Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Linode Image Data Source #209

Merged

Conversation

zliang-akamai
Copy link
Member

@zliang-akamai zliang-akamai commented Mar 20, 2024

📝 Description

Built on top of #208. If we can merge #208 before this PR and then rebase this branch, the number of changed lines in this PR may be reduced.

TODO:

  • Needs next linodego release containing linode/linodego@73f38b5 done
  • Unit/integration test implementation is in progress done

✔️ How to Test

Automated Test

make test

Manual Test

Build packer plugin locally.

go build

Place this content below into a file call test.pkr.hcl.

data "linode-image" "latest_ubuntu" {
    id_regex = "linode/ubuntu.*"
    latest = true
}

source "linode" "example" {
  image             = data.linode-image.latest_ubuntu.id
  image_description = "My Private Image"
  image_label       = "my-packaer-private-linode-image-test"
  instance_label    = "temporary-linode-image"
  instance_type     = "g6-nanode-1"
  region            = "us-mia"
  ssh_username      = "root"
}

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

data "linode-image" "latest_ubuntu_lts" {
    label_regex = "Ubuntu [0-9]+\\.[0-9]+ LTS"
    latest = true
}

data "linode-image" "ubuntu22_lts" {
    id = "linode/ubuntu22.04"
}

Run build command

packer build .

Verify the config on the test Linode is called My Ubuntu 23.10, meaning the latest Ubuntu was selected.

image

You can also switch image output from other 2 data sources and verify the config name accordingly.

@zliang-akamai zliang-akamai requested a review from a team as a code owner March 20, 2024 05:51
@zliang-akamai zliang-akamai requested review from jriddle-linode and yec-akamai and removed request for a team March 20, 2024 05:51
@zliang-akamai zliang-akamai changed the title Zhiwei/linode image data source Implement Linode Image Data Source Mar 20, 2024
@zliang-akamai zliang-akamai marked this pull request as draft March 20, 2024 05:55
@zliang-akamai zliang-akamai force-pushed the zhiwei/linode-image-data-source branch 2 times, most recently from 2e7e971 to 3dcd769 Compare March 20, 2024 06:47
@zliang-akamai zliang-akamai force-pushed the zhiwei/linode-image-data-source branch from 3dcd769 to 5f53cf9 Compare March 20, 2024 06:51
@zliang-akamai zliang-akamai marked this pull request as ready for review March 22, 2024 04:06
Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Tests are all passing locally and everything seems to be working well in my local testing (dx-devenv), excellent work!

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Works well on my end. Nice work!

@zliang-akamai zliang-akamai merged commit 1320847 into linode:dev Mar 28, 2024
10 checks passed
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.

3 participants