Skip to content

Add disk and config support#398

Open
zliang-akamai wants to merge 15 commits intodevfrom
zhiwei/config-disk
Open

Add disk and config support#398
zliang-akamai wants to merge 15 commits intodevfrom
zhiwei/config-disk

Conversation

@zliang-akamai
Copy link
Member

@zliang-akamai zliang-akamai commented Feb 6, 2026

📝 Description

Resolve #222

Add support for custom disks and configuration profiles in the Linode builder, enabling advanced provisioning with custom disk layouts, multiple filesystems, and configuration profiles instead of pre-built images.

Changes

  • New Config Structs: Added Disk, InstanceConfig, InstanceConfigDevices, InstanceConfigDevice, and InstanceConfigHelpers structs with full HCL2 support
  • Build Step: Implemented step_create_disk_config.go for custom disk creation, label resolution, and configuration profile management
  • Validation: Enhanced Prepare() method with comprehensive checks preventing incompatible configurations
  • Documentation: Updated builder docs with examples and field references
  • Tests: Added 12 unit tests and 3 acceptance tests covering all scenarios
  • Architecture: Two-mode support (standard vs custom) with backwards compatibility

✔️ How to Test

Auto Testing

make unit-test
make int-test

Manual Testing

Save this into a file maybe named as test.pkr.hcl. Then checkout this branch and make dev to install it. Run packer build . to test it.

locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }

source "linode" "example" {
  image_description = "My Private Image"
  image_label       = "private-image-${local.timestamp}"
  instance_label    = "temporary-linode-${local.timestamp}"
  instance_type     = "g6-nanode-1"
  region            = "us-mia"
  ssh_username      = "root"
  interface_generation = "linode"

  linode_interface {
    public {
      ipv4 {
        address {
          address = "auto"
          primary = true
        }
      }
    }
  }

  config {
    label       = "my-config"
    comments    = "Boot config"
    kernel      = "linode/latest-64bit"
    root_device = "/dev/sda"
    run_level   = "default"
    
    devices {
      sda { disk_label = "boot" }
    }
    
    helpers {
      updatedb_disabled   = true
      distro              = true
      modules_dep         = true
      network             = true
      devtmpfs_automount  = true
    }
  }

  disk {
    label           = "boot"
    size            = 25000
    image           = "linode/ubuntu24.04"
  }
}

build {
  sources = ["source.linode.example"]
}

@zliang-akamai zliang-akamai requested a review from a team as a code owner February 6, 2026 22:25
@zliang-akamai zliang-akamai requested review from Copilot, jriddle-linode and lgarber-akamai and removed request for a team February 6, 2026 22:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for advanced Linode provisioning by allowing custom disk layouts and configuration profiles (instead of relying solely on a pre-built image).

Changes:

  • Introduces new disk and config configuration blocks (HCL2 support + validation updates).
  • Adds a new build step to create disks/config profiles and boot via a selected config.
  • Updates docs/examples and expands unit/acceptance tests around the new configuration mode.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
go.mod Updates Go language version used by the module.
builder/linode/config.go Adds new configuration structs and updates validation to support custom disk/config mode.
builder/linode/config.hcl2spec.go Adds generated HCL2 spec support for new disk and config blocks.
builder/linode/step_create_linode.go Adjusts instance creation to omit image/boot when provisioning disks/configs explicitly.
builder/linode/step_create_disk_config.go Implements custom disk creation, config profile creation, and manual boot.
builder/linode/builder.go Inserts the new disk/config creation step into the build pipeline.
builder/linode/builder_test.go Adds unit tests for new validation and parsing behavior.
builder/linode/builder_acc_test.go Adds acceptance tests for custom disks/configs and interface combinations.
docs/builders/linode.mdx Documents custom disk/config usage and adds full examples.
.web-docs/components/builder/linode/README.md Mirrors docs updates in generated web docs.
example/* Updates example templates (regions/images) to newer defaults.
builder/linode/artifact_test.go Updates expected source image metadata in tests.
AGENTS.md Adds repository guidelines for AI coding agents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zliang-akamai zliang-akamai marked this pull request as draft February 6, 2026 23:12
@zliang-akamai zliang-akamai requested a review from Copilot February 6, 2026 23:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zliang-akamai zliang-akamai requested a review from Copilot February 7, 2026 01:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zliang-akamai zliang-akamai requested a review from Copilot February 7, 2026 01:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zliang-akamai zliang-akamai requested a review from Copilot February 7, 2026 01:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zliang-akamai zliang-akamai requested a review from Copilot February 7, 2026 03:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zliang-akamai zliang-akamai marked this pull request as ready for review February 7, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add support to set instance config during creation.

1 participant