Code Monkey home page Code Monkey logo

packer-plugin-linode's Issues

Packer 1.12.0-alpha1 testing

Hi, your friend Packer maintainer here!

I am opening this issue as a follow-up to the github.com/zclconf/go-cty breaking change issue we opened on Packer Plugin SDK last year. With this upcoming release, we are starting to tackle phase 2 of this issue, with some changes compared to the original plan.

We are not going to migrate to go-plugin now, and instead introduced a way for Packer to toggle between the use of Gob or Protobuf/msgpack for all its over-the-wire communication. This change does not apply to communicators, which will continue to use gob for over-the-wire communication.

With the alpha we released last week, Packer now behaves like the following:

  1. During plugin discovery, it will look for a new "protocol_version":"v2" attribute in the returned describe output for a plugin binary.
  2. If the "protocol_version":"v2" attribute is not present, Packer will fallback into compatibility mode and use Gob for communication between Packer and plugins.
  3. Assuming all the plugins discovered support "protocol_version":"v2", Protobuf/msgpack will be used for communication between Packer and plugins.

This behavior can be disabled with a PACKER_FORCE_GOB environment variable, allowing for an escape hatch if a build is blocked because of a bug in that new code that handles protobuf/msgpack serialization.

What it means for plugins

This change should be as transparent as possible for you as plugin developers, and for our users. There will however be one change to make in the plugin's code, namely updating the SDK to the upcoming 0.6.0 release. The release date of 0.6.0 has not yet been determined.

Right now, the code that manages this protobuf/msgpack logic is stored in a grpc_base branch. Apologies for the name, it is not representative of the objective anymore.

Before we can consider releasing this version of Packer, and a version of the SDK, we'd love to get help from you.

Our requests

As we move to support both protocols, we need you to perform a couple tests with your plugin to ensure we maintain compatibility for your supported configurations.

We've prepared a series of steps that we'd like you to run on your code, alongside Packer 1.12.0-alpha1, which you can get from our releases page.

Once you have Packer 1.12.0-alpha1 setup, we'd ask that try the following scenarios on templates of your choice.

Ideally, these tests should be run in a plugin directory that is not your normal one, to avoid Packer discovering plugins that force it to go into compatibility (i.e. Gob) mode.

Scenario 1 - Packer 1.12.0-alpha1 + plugin latest released version

In this scenario, you should expect Packer to use Gob for serialization, as the latest plugin is not (by our assumption) compatible with protobuf/msgpack yet. This is the baseline test, to ensure Packer 1.12.0 still works with your plugin.

If you do not have one, this will also help you get a base working template that relies solely on your plugin and, maybe, Packer's embedded components.

Note: this point is crucial as none of the existing plugin releases support both serialization formats, and so will mandate Packer to run in compatibility mode.

Scenario 2 - Packer 1.12.0-alpha1 + plugin custom build with protobuf/msgpack support

This scenario will require you to bump your dependency on the packer-plugin-sdk to use grpc_base instead of a current release.

You can do this with the following commands for example:

$ go get -v github.com/hashicorp/packer-plugin-sdk@grpc_base && go mod tidy

When this is done, you can compile the plugin, and install it in your test plugin directory.

$ PACKER_PLUGIN_PATH=<test-plugin directory> packer plugins install --path compiled-plugin-binary github.com/org/name

This will need to be the highest compatible version with your plugin in order for Packer to prioritize it, and use protobuf/msgpack for communication.

In order to know for sure if Packer used protobuf for communication, you can take a peek at the verbose logs, where you should encounter a log that points to this.

$ PACKER_PLUGIN_PATH=<test-plugin directory> PACKER_LOG=1 packer build <template> 2>&1 | grep 'Using protobuf for communication with plugins'

This sample command should highlight that Packer uses the expected protocol for communicating. If the build uses Gob, this means that the logic failed, and we may need to do some troubleshooting to understand what happened. In this case please let us know by responding to this issue, and we'll be in contact to sort this out.

Scenario 3 - Packer 1.12.0-alpha1 + plugin custom build with protobuf/msgpack support, with PACKER_FORCE_GOB=1.

As a follow-up to scenario 2, we want to ensure that the code handling the logic for switching protocols works if a fallback is requested by a user.

The overall process is similar, the only difference you can expect is that the grep returns nothing instead of the line in the logs that reports protobuf being used.

$ PACKER_PLUGIN_PATH=<test-plugin directory> PACKER_FORCE_GOB=1 PACKER_LOG=1 packer build <template> 2>&1 | grep 'Using protobuf for communication with plugins'

Scenario 4 - Packer 1.11.2 (latest release) with protobuf compatible plugin

This one is more of a sanity test that ensures your plugin remains compatible with older versions of Packer. If you haven't already please download the latest official Packer 1.11.2 release from the releases page. We expect this one to succeed at all times, but we'd like to be as sure as we can before we release ๐Ÿ˜ƒ

Conclusion

This is overall a small update to Packer core, and hopefully a small enough change that it will be easy to roll into your codebase, which paves the way for us to later remove our dependency on @nywilken's go-cty fork down the road.

We are aiming to release this in the coming months, and we're hoping we can squash as many bugs as we can before then so this doesn't impact real-life user workflows.

Thank you for your continued support!

[Bug]: Equal (=) sign is not being accepted as a tag value

Packer Version

v1.10.2

Packer Plugin Linode Version

v1.4.1

Expected Behavior

Tag which contains an equal sign are not being accepted as a valid character. Adding it via the API or web interface works without any issues.

Looks like the limitation comes from this regex -

tagRe := regexp.MustCompile("^[[:alnum:]:_-]{1,255}$")

source "linode" "example" {
  image             = "linode/ubuntu22.04"
  image_description = "This image was created using Packer."
  image_label       = "test-image-${local.timestamp}"
  instance_label    = "temp-packer-debian-10"
  instance_type     = "g6-nanode-1"
  linode_token      = "${var.linode_api_token}"
  region            = "nl-ams"
  ssh_username      = "root"
  instance_tags     = ["foo=bar"]
}

Actual Behavior

Error returned

Steps to Reproduce

Add a tag which contains = sign

source "linode" "example" {
  image             = "linode/ubuntu22.04"
  image_description = "This image was created using Packer."
  image_label       = "test-image-${local.timestamp}"
  instance_label    = "temp-packer-debian-10"
  instance_type     = "g6-nanode-1"
  linode_token      = "${var.linode_api_token}"
  region            = "nl-ams"
  ssh_username      = "root"
  instance_tags     = ["foo=bar"]
}

Error Output

Error: 1 error(s) occurred:

* invalid tag: foo=bar

  on linode.pkr.hcl line 1:
  (source code not available)

Setting ssh_private_key_file fails with linode error

Overview of the Issue

I tried to set the ssh_private_key_file to make sure I can use the same SSH key after setting up a Linode with NixOS. First I tried using https://www.packer.io/docs/datasources/sshkey, then I tried using my own private key but they both fail.

Build 'linode.example' errored after 838 milliseconds 558 microseconds: Error creating Linode: [400] [authorized_keys] SSH Key 1 key-type must be ssh-dss, ssh-rsa, ecdsa-sha2-nistp, or ssh-ed25519.

Reproduction Steps

Use the linode example config, this still works:

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

source "linode" "example" {
  image             = "linode/debian9"
  image_description = "My Private Image"
  image_label       = "private-image-${local.timestamp}"
  instance_label    = "temporary-linode-${local.timestamp}"
  instance_type     = "g6-nanode-1"
  linode_token      = "YOUR API TOKEN"
  region            = "us-east"
  ssh_username      = "root"
}

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

Now add any private key using the ssh_private_key_file option, as stated in the docs. Provisioning now fails.

Plugin and Packer version

Packer v1.7.3

packer-plugin-linode_v1.0.0_x5.0_darwin_amd64

Simplified Packer Buildfile

Reproducable build file
packer {
  required_plugins {
    linode = {
      version = ">= 0.0.1"
      source  = "github.com/hashicorp/linode"
    }
    sshkey = {
      version = ">= 0.1.0"
      source  = "github.com/ivoronin/sshkey"
    }
  }
}

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


variable "linode_token" {
  type      = string
  sensitive = true
}

source "linode" "example" {
  image                = "linode/debian9"
  image_description    = "NixOS"
  image_label          = "nixos-${local.timestamp}"
  instance_label       = "packer-build-${local.timestamp}"
  instance_type        = "g6-standard-2"
  linode_token         = var.linode_token
  region               = "us-east"
  ssh_username         = "root"
  ssh_private_key_file = data.sshkey.install.private_key_path
}

data "sshkey" "install" {}

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

Operating system and Environment details

running from MacOS (but via nix), trying to install NixOS with NIXOS_LUSTRATE on a debian 9 base.

Log Fragments and crash.log files

Full logs
2021/07/20 18:03:20 [INFO] Packer version: 1.7.3 [go1.16.6 darwin amd64]
2021/07/20 18:03:20 [TRACE] discovering plugins in /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin
2021/07/20 18:03:20 [TRACE] discovering plugins in /Users/jelle/.packer.d/plugins
2021/07/20 18:03:20 [TRACE] discovering plugins in .
2021/07/20 18:03:20 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/07/20 18:03:20 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/jelle/.packerconfig
2021/07/20 18:03:20 [WARN] Config file doesn't exist: /Users/jelle/.packerconfig
2021/07/20 18:03:20 [INFO] Setting cache directory: /Users/jelle/dev/projects/peertube-saas/nixos-packer/packer_cache
2021/07/20 18:03:20 [TRACE] init: plugingetter.ListInstallationsOptions{FromFolders:[]string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", ".", "/Users/jelle/.packer.d/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000086480)}}}}
2021/07/20 18:03:20 [TRACE] listing potential installations for "github.com/hashicorp/linode" that match ">= 0.0.1". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", ".", "/Users/jelle/.packer.d/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000086480)}}}}
2021/07/20 18:03:20 [TRACE] for plugin github.com/hashicorp/linode found 1 matching installation(s)
2021/07/20 18:03:20 [TRACE] listing potential installations for "github.com/ivoronin/sshkey" that match ">= 0.1.0". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", ".", "/Users/jelle/.packer.d/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000086480)}}}}
2021/07/20 18:03:20 [TRACE] for plugin github.com/ivoronin/sshkey found 1 matching installation(s)
2021/07/20 18:03:20 [INFO] (telemetry) Finalizing.
2021/07/20 18:03:20 waiting for all plugin processes to complete...
2021/07/20 18:03:21 [INFO] Packer version: 1.7.3 [go1.16.6 darwin amd64]
2021/07/20 18:03:21 [TRACE] discovering plugins in /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin
2021/07/20 18:03:21 [TRACE] discovering plugins in /Users/jelle/.packer.d/plugins
2021/07/20 18:03:21 [TRACE] discovering plugins in .
2021/07/20 18:03:21 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/07/20 18:03:21 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/jelle/.packerconfig
2021/07/20 18:03:21 [WARN] Config file doesn't exist: /Users/jelle/.packerconfig
2021/07/20 18:03:21 [INFO] Setting cache directory: /Users/jelle/.cache/packer
2021/07/20 18:03:21 [TRACE] listing potential installations for "github.com/hashicorp/linode" that match ">= 0.0.1". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", ".", "/Users/jelle/.packer.d/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000086600)}}}}
2021/07/20 18:03:21 [TRACE] Found the following "github.com/hashicorp/linode" installations: [{/Users/jelle/.packer.d/plugins/github.com/hashicorp/linode/packer-plugin-linode_v1.0.0_x5.0_darwin_amd64 v1.0.0}]
2021/07/20 18:03:21 [INFO] found external [-packer-default-plugin-name-] builders from linode plugin
2021/07/20 18:03:21 [TRACE] listing potential installations for "github.com/ivoronin/sshkey" that match ">= 0.1.0". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", ".", "/Users/jelle/.packer.d/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000086600)}}}}
2021/07/20 18:03:21 [TRACE] Found the following "github.com/ivoronin/sshkey" installations: [{/Users/jelle/.packer.d/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64 v0.1.0}]
2021/07/20 18:03:21 found external [-packer-default-plugin-name-] datasource from sshkey plugin
2021/07/20 18:03:21 [TRACE] validateValue: not active for linode_token, so skipping
2021/07/20 18:03:21 [TRACE] validateValue: not active for nixos_version, so skipping
2021/07/20 18:03:21 [TRACE] Starting external plugin /Users/jelle/.packer.d/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64 start datasource -packer-default-plugin-name-
2021/07/20 18:03:21 Starting plugin: /Users/jelle/.packer.d/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64 []string{"/Users/jelle/.packer.d/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64", "start", "datasource", "-packer-default-plugin-name-"}
2021/07/20 18:03:21 Waiting for RPC address for: /Users/jelle/.packer.d/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64
2021/07/20 18:03:21 packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 Plugin address: unix /tmp/packer-plugin602722078
2021/07/20 18:03:21 packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 Waiting for connection...
2021/07/20 18:03:21 Received unix RPC address for /Users/jelle/.packer.d/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64: addr is /tmp/packer-plugin602722078
2021/07/20 18:03:21 packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 Serving a plugin connection...
2021/07/20 18:03:21 packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 [TRACE] starting datasource -packer-default-plugin-name-
2021/07/20 18:03:21 [TRACE] Starting external plugin /Users/jelle/.packer.d/plugins/github.com/hashicorp/linode/packer-plugin-linode_v1.0.0_x5.0_darwin_amd64 start builder -packer-default-plugin-name-
2021/07/20 18:03:21 Starting plugin: /Users/jelle/.packer.d/plugins/github.com/hashicorp/linode/packer-plugin-linode_v1.0.0_x5.0_darwin_amd64 []string{"/Users/jelle/.packer.d/plugins/github.com/hashicorp/linode/packer-plugin-linode_v1.0.0_x5.0_darwin_amd64", "start", "builder", "-packer-default-plugin-name-"}
2021/07/20 18:03:21 Waiting for RPC address for: /Users/jelle/.packer.d/plugins/github.com/hashicorp/linode/packer-plugin-linode_v1.0.0_x5.0_darwin_amd64
2021/07/20 18:03:21 packer-plugin-linode_v1.0.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 Plugin address: unix /tmp/packer-plugin264359411
2021/07/20 18:03:21 Received unix RPC address for /Users/jelle/.packer.d/plugins/github.com/hashicorp/linode/packer-plugin-linode_v1.0.0_x5.0_darwin_amd64: addr is /tmp/packer-plugin264359411
2021/07/20 18:03:21 packer-plugin-linode_v1.0.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 Waiting for connection...
2021/07/20 18:03:21 packer-plugin-linode_v1.0.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 Serving a plugin connection...
2021/07/20 18:03:21 packer-plugin-linode_v1.0.0_x5.0_darwin_amd64 plugin: 2021/07/20 18:03:21 [TRACE] starting builder -packer-default-plugin-name-
2021/07/20 18:03:21 [TRACE] Starting internal plugin packer-provisioner-file
2021/07/20 18:03:21 Starting plugin: /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer []string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", "plugin", "packer-provisioner-file"}
2021/07/20 18:03:21 Waiting for RPC address for: /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer
2021/07/20 18:03:21 packer-provisioner-file plugin: [INFO] Packer version: 1.7.3 [go1.16.6 darwin amd64]
2021/07/20 18:03:21 packer-provisioner-file plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/07/20 18:03:21 packer-provisioner-file plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/jelle/.packerconfig
2021/07/20 18:03:21 packer-provisioner-file plugin: [WARN] Config file doesn't exist: /Users/jelle/.packerconfig
2021/07/20 18:03:21 packer-provisioner-file plugin: [INFO] Setting cache directory: /Users/jelle/.cache/packer
2021/07/20 18:03:21 packer-provisioner-file plugin: args: []string{"packer-provisioner-file"}
2021/07/20 18:03:21 Received unix RPC address for /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer: addr is /tmp/packer-plugin479551696
2021/07/20 18:03:21 packer-provisioner-file plugin: Plugin address: unix /tmp/packer-plugin479551696
2021/07/20 18:03:21 packer-provisioner-file plugin: Waiting for connection...
2021/07/20 18:03:21 packer-provisioner-file plugin: Serving a plugin connection...
2021/07/20 18:03:21 [TRACE] Starting internal plugin packer-provisioner-shell
2021/07/20 18:03:21 Starting plugin: /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer []string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", "plugin", "packer-provisioner-shell"}
2021/07/20 18:03:21 Waiting for RPC address for: /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] Packer version: 1.7.3 [go1.16.6 darwin amd64]
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/jelle/.packerconfig
2021/07/20 18:03:22 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/jelle/.packerconfig
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] Setting cache directory: /Users/jelle/.cache/packer
2021/07/20 18:03:22 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2021/07/20 18:03:22 Received unix RPC address for /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer: addr is /tmp/packer-plugin202666409
2021/07/20 18:03:22 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin202666409
2021/07/20 18:03:22 packer-provisioner-shell plugin: Waiting for connection...
2021/07/20 18:03:22 packer-provisioner-shell plugin: Serving a plugin connection...
2021/07/20 18:03:22 [TRACE] Starting internal plugin packer-provisioner-shell
2021/07/20 18:03:22 Starting plugin: /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer []string{"/nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer", "plugin", "packer-provisioner-shell"}
2021/07/20 18:03:22 Waiting for RPC address for: /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] Packer version: 1.7.3 [go1.16.6 darwin amd64]
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/jelle/.packerconfig
2021/07/20 18:03:22 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/jelle/.packerconfig
2021/07/20 18:03:22 packer-provisioner-shell plugin: [INFO] Setting cache directory: /Users/jelle/.cache/packer
2021/07/20 18:03:22 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2021/07/20 18:03:22 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin507125290
2021/07/20 18:03:22 packer-provisioner-shell plugin: Waiting for connection...
2021/07/20 18:03:22 Received unix RPC address for /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer: addr is /tmp/packer-plugin507125290
2021/07/20 18:03:22 packer-provisioner-shell plugin: Serving a plugin connection...
2021/07/20 18:03:22 Build debug mode: false
2021/07/20 18:03:22 Force build: false
2021/07/20 18:03:22 On error:
linode.example: output will be in this color.

2021/07/20 18:03:22 Waiting on builds to complete...
2021/07/20 18:03:22 Starting build run: linode.example
2021/07/20 18:03:22 Running builder:
2021/07/20 18:03:22 [INFO] (telemetry) Starting builder
==> linode.example: Running builder ...
==> linode.example: Using existing SSH private key
==> linode.example: Creating Linode...
==> linode.example: Error creating Linode: [400] [authorized_keys] SSH Key 1 key-type must be ssh-dss, ssh-rsa, ecdsa-sha2-nistp, or ssh-ed25519.
2021/07/20 18:03:23 [INFO] (telemetry) ending
==> Wait completed after 840 milliseconds 984 microseconds
2021/07/20 18:03:23 machine readable: error-count []string{"1"}
Build 'linode.example' errored after 838 milliseconds 558 microseconds: Error creating Linode: [400] [authorized_keys] SSH Key 1 key-type must be ssh-dss, ssh-rsa, ecdsa-sha2-nistp, or ssh-ed25519.
==> Some builds didn't complete successfully and had errors:

2021/07/20 18:03:23 machine readable: linode.example,error []string{"Error creating Linode: [400] [authorized_keys] SSH Key 1 key-type must be ssh-dss, ssh-rsa, ecdsa-sha2-nistp, or ssh-ed25519."}
==> Builds finished but no artifacts were created.
==> Wait completed after 840 milliseconds 984 microseconds

==> Some builds didn't complete successfully and had errors:
--> linode.example: Error creating Linode: [400] [authorized_keys] SSH Key 1 key-type must be ssh-dss, ssh-rsa, ecdsa-sha2-nistp, or ssh-ed25519.

2021/07/20 18:03:23 [INFO] (telemetry) Finalizing.
==> Builds finished but no artifacts were created.
2021/07/20 18:03:23 waiting for all plugin processes to complete...
2021/07/20 18:03:23 /Users/jelle/.packer.d/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64: plugin process exited
2021/07/20 18:03:23 /Users/jelle/.packer.d/plugins/github.com/hashicorp/linode/packer-plugin-linode_v1.0.0_x5.0_darwin_amd64: plugin process exited
2021/07/20 18:03:23 /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer: plugin process exited
2021/07/20 18:03:23 /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer: plugin process exited
2021/07/20 18:03:23 /nix/store/qn5pnsn5dchqbsy20ajzjpaqqk9hwzlc-packer-1.7.3/bin/packer: plugin process exited

[Bug]: Tags are not applied when building using Packer

tags

Packer Version

v1.10.2

Packer Plugin Linode Version

v1.4.1

Expected Behavior

VM tags are not applied to the VM when building using Packer.

source "linode" "example" {
  image             = "linode/ubuntu22.04"
  image_description = "This image was created using Packer."
  image_label       = "test-image-${local.timestamp}"
  instance_label    = "temp-packer-debian-10"
  instance_type     = "g6-nanode-1"
  linode_token      = "${var.linode_api_token}"
  region            = "nl-ams"
  ssh_username      = "root"
  instance_tags     = ["foo"]
 
}

Actual Behavior

Command output:

packer build .
linode.example: output will be in this color.

==> linode.example: Running builder ...
==> linode.example: Creating temporary SSH key for instance...
==> linode.example: Creating Linode...
==> linode.example: Using SSH communicator to connect: 172.233.51.105
==> linode.example: Waiting for SSH to become available...
==> linode.example: Connected to SSH!
==> linode.example: Provisioning with shell script: /tmp/packer-shell3435650164
    linode.example: Adding file to Docker Container
==> linode.example: Shutting down Linode...
==> linode.example: Creating image...

Build is done successfully, but tags are not being applied to the VM (screenshot attached)

Steps to Reproduce

Specify VM tags using "instance_tags"

source "linode" "example" {
  image             = "linode/ubuntu22.04"
  image_description = "This image was created using Packer."
  image_label       = "test-image-${local.timestamp}"
  instance_label    = "temp-packer-debian-10"
  instance_type     = "g6-nanode-1"
  linode_token      = "${var.linode_api_token}"
  region            = "nl-ams"
  ssh_username      = "root"
  instance_tags     = ["foo"]
 
}

Error Output

No error output. Tags are not being applied.

Support for private ips

Description

I'm using private ips for the Linodes that I launch with Terraform, and it would be nice to be able to configure that for the Linode that Packer sets up.

Use Case(s)

I am building Consul servers with Packer, and I am using the private IPs for communication, this works fine for Linodes that have private_ip = true (through Terraform), but Consul throws errors if there is no private IP attached.

During my Packer build of my Consul images I run a sanity check: /usr/local/bin/consul validate /etc/consul.d/consul.json however this fails with this error:

==> linode: Config validation failed: No private IPv4 address found

If I could configure the linode to have private networking enabled I could catch configuration mistakes early.

linodego version

Overview of the Issue

It appears the linode/linodego had an accidental v1.0.0 release which was picked up by this project. See: linode/linodego@fb6add3

I think because of this, we won't see any of the updates in v0.26.1 or newer and latest is currently v0.28.1.

[Bug]: OAuth error with plugin versions > 1.0.5

Packer Version

v1.9.4

Packer Plugin Linode Version

v1.1.3

Expected Behavior

When building an image using plugin greater than 1.0.5 its failing using an existing token created a few years ago, i would expect the image to build successfully.

I am setting linode_token with a valid token that works in v1.0.5 if I go > than this version it fails

Actual Behavior

The behaviour I'm seeing is as follows

==> linode.test-game-server: Failed to create event poller: failed to run pretask: failed to list events: [401] Your OAuth token is not authorized to use this endpoint.
==> linode.test-game-server: Provisioning step had errors: Running the cleanup provisioner, if present...
Build 'linode.test-game-server' errored after 4 minutes 16 seconds: Failed to create event poller: failed to run pretask: failed to list events: [401] Your OAuth token is not authorized to use this endpoint.

Steps to Reproduce

Create an old api token on linode interface

Error Output

==> linode.test-game-server: Failed to create event poller: failed to run pretask: failed to list events: [401] Your OAuth token is not authorized to use this endpoint.
==> linode.test-game-server: Provisioning step had errors: Running the cleanup provisioner, if present...
Build 'linode.test-game-server' errored after 4 minutes 16 seconds: Failed to create event poller: failed to run pretask: failed to list events: [401] Your OAuth token is not authorized to use this endpoint.

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

Hi Guys,

I can't see a template for a feature / enhancement (I think it's broken according to github). So I'm sorry it's not following your expected format.

Description:

Please can we add the ability to set the instance config during packer initalization. When we are building packer images we are wanting to use GRUB2 as we would like to boot with your kernels during imaging, rather than Linode's. However, the Linode Packer integration does not allow you to set config specific variables.

As a result, we have to have a shell provisioner which runs before ansible, shuts down the instance and then reboots it. Instead, it would be much cleaner if we can get some (or all) of the linode config so that once it's booted we can get straight to work.

Use Case:

We build images, and run them, using the OS Kernel, not Linode's. This allows us to set it from boot instead of it being a post step. This is our last discrepency between Linode and AWS Image Building, which allows us to ensure that all image building works with both systems!

Thoughts:

I'm not sure if it would be best to make the config option a dictionary / object and just pass it straight through to the Linode API so it's always up to date, or if it's best to have specific config keys you would want to pass through.

You would need to launch the machine with it being powered off, change the config, and then power it on. Rather than trying to change the config once it had booted.

Many Thanks,
Tom Franklin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.