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

Plugins installed via packer plugins install are not loaded without a required_plugins block #11697

Closed
nywilken opened this issue Apr 6, 2022 · 1 comment · Fixed by #11712
Assignees
Labels
command/plugins Issues related to the plugins management commands hcl2

Comments

@nywilken
Copy link
Contributor

nywilken commented Apr 6, 2022

Plugins installed via packer plugins install are not loaded without a required_plugins block

Upon installing a plugin via packer plugins install it was found that the plugin is usable for HCL2 template builds only if the required plugins block is specified in the HCL build template.Since the plugins command can be used for installing external plugins I would expect the plugin to be found regardless of the build template type.

Reproduction Steps

  1. Run packer plugins install github.com/sylviamoss/comment
  2. Run packer build source.json

Build Template: source.json.pkr.hcl

source "null" "autogenerated_1" {
  communicator = "none"
}

build {
  sources = ["source.null.autogenerated_1"]

  provisioner "comment" {
    bubble_text = true
    comment     = "Begin"
    ui          = true
  }

  provisioner "shell-local" {
    inline = ["echo \"This is a shell script\""]
  }

  provisioner "comment" {
    comment = "In the middle of Provisioning run"
    ui      = true
  }

  provisioner "shell-local" {
    inline = ["echo \"This is another shell script\""]
  }

  provisioner "comment" {
    comment = "this comment is invisible and won't go to the UI"
  }

  provisioner "comment" {
    bubble_text = true
    comment     = "End"
    ui          = true
  }

}

Expected Results

~>  packer build source.json.pkr.hcl
null: output will be in this color.

==> null:   ____                   _
==> null:  | __ )    ___    __ _  (_)  _ __
==> null:  |  _ \   / _ \  / _` | | | | '_ \
==> null:  | |_) | |  __/ | (_| | | | | | | |
==> null:  |____/   \___|  \__, | |_| |_| |_|
==> null:                  |___/
==> null:
==> null: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell1166603649
    null: This is a shell script
==> null: In the middle of Provisioning run
==> null: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell4281157345
    null: This is another shell script
==> null:   _____               _
==> null:  | ____|  _ __     __| |
==> null:  |  _|   | '_ \   / _` |
==> null:  | |___  | | | | | (_| |
==> null:  |_____| |_| |_|  \__,_|
==> null:
Build 'null' finished after 201 milliseconds 504 microseconds.

==> Wait completed after 201 milliseconds 551 microseconds

==> Builds finished. The artifacts of successful builds are:
--> null: Did not export anything. This is the null builder

Actual Results

Error: Unknown provisioner type "comment"

  on source.json.pkr.hcl line 8:
  (source code not available)

known provisioners: [azure-dtlartifact windows-restart chef-client shell
puppet-masterless converge puppet-server salt-masterless windows-shell sleep
ansible chef-solo powershell inspec ansible-local breakpoint file shell-local]

Error: Unknown provisioner type "comment"

  on source.json.pkr.hcl line 18:
  (source code not available)

known provisioners: [inspec sleep ansible chef-solo powershell ansible-local
breakpoint file shell-local puppet-masterless converge puppet-server
azure-dtlartifact windows-restart chef-client shell salt-masterless
windows-shell]

Error: Unknown provisioner type "comment"

  on source.json.pkr.hcl line 27:
  (source code not available)

known provisioners: [salt-masterless windows-shell sleep ansible chef-solo
powershell inspec ansible-local breakpoint file shell-local azure-dtlartifact
windows-restart chef-client shell puppet-masterless converge puppet-server]

Error: Unknown provisioner type "comment"

  on source.json.pkr.hcl line 31:
  (source code not available)

known provisioners: [ansible-local breakpoint file shell-local puppet-masterless
converge puppet-server azure-dtlartifact windows-restart chef-client shell
salt-masterless windows-shell inspec sleep ansible chef-solo powershell]

Adding a required plugin block for the comment provisioner fixes issue.

packer  {
  required_plugins {
    comment = {
      source = "github.com/sylviamoss/comment"
      version = ">= 0.2.24"
    }
  }
}

source "null" "autogenerated_1" {
  communicator = "none"
}

build {
  sources = ["source.null.autogenerated_1"]

  provisioner "comment" {
    bubble_text = true
    comment     = "Begin"
    ui          = true
  }

  provisioner "shell-local" {
    inline = ["echo \"This is a shell script\""]
  }

  provisioner "comment" {
    comment = "In the middle of Provisioning run"
    ui      = true
  }

  provisioner "shell-local" {
    inline = ["echo \"This is another shell script\""]
  }

  provisioner "comment" {
    comment = "this comment is invisible and won't go to the UI"
  }

  provisioner "comment" {
    bubble_text = true
    comment     = "End"
    ui          = true
  }

}
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
command/plugins Issues related to the plugins management commands hcl2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants