Op donderdag 14 mei 2020 22:40:32 UTC+2 schreef Megan Marsh:
>
> This is where that bracket issue you found on another thread comes into
> play.
>
> Instead of
>
> "post-processors": [
>> {
>> "type": "shell-local",
>> "script": "create-cloudbox.sh"
>> },
>> {
>> "output": "{{ user `build_directory` }}/{{user
>> `box_basename`}}.{{.Provider}}.box",
>> "type": "vagrant"
>> },
>> {
>> "type": "vagrant-cloud",
>> "box_tag": "username/nameofmybox",
>> "access_token": "{{user `cloud_token`}}",
>> "version": "{{user `version`}}"
>> }
>> ],
>
>
> You need
>
> "post-processors": [[
>> {
>> "type": "shell-local",
>> "script": "create-cloudbox.sh"
>> },
>> {
>> "output": "{{ user `build_directory` }}/{{user
>> `box_basename`}}.{{.Provider}}.box",
>> "type": "vagrant"
>> },
>> {
>> "type": "vagrant-cloud",
>> "box_tag": "username/nameofmybox",
>> "access_token": "{{user `cloud_token`}}",
>> "version": "{{user `version`}}"
>> }
>> ]],
>
>
> Any post-processors only wrapped in the first set of brackets will get the
> build artifact as its input.
>
> Any post-processors inside the second set of brackets will run in order,
> with the output artifact from one post-processor becoming the input
> artifact to the next.
>
> Why?
>
> The double-bracketing doesn't make intuitive sense in a single-flow
> context like yours, but it allows users to create multiple output artifacts
> using different postprocessor flows from the same build artifact.
>
> So, for example, you could take the same vmware artifact and both create a
> vagrant box that you upload to vagrant cloud in one flow like you're doing
> here, but then, and in another flow upload it to vsphere, and the
> postprocessors wouldn't get in each other's ways.
>
> For a little more detail on sequencing, you can see the docs at
> https://www.packer.io/docs/templates/post-processors/#post-processor-definition
>
> Hope this helps!
>
Executing local shell command [/bin/sh -c PACKER_BUILDER_TYPE='vmware-iso'
PACKER_BUILD_NAME='vmware-iso' ./create-cloudbox.sh]
==> vmware-iso (shell-local): % Total % Received % Xferd Average
Speed Time Time Time Current
==> vmware-iso (shell-local): Dload
Upload Total Spent Left Speed
==> vmware-iso (shell-local): 100 643 0 402 100 241 300
179 0:00:01 0:00:01 --:--:-- 479
vmware-iso (shell-local):
{"tag":"cool-base-nl/testmenow16","username":"myusername","name":"mybox","private":false,"downloads":0,"created_at":"2020-05-15T00:44:24.812+02:00","updated_at":"2020-05-15T00:44:24.812+02:00","short_description":"My
dev box11","description_markdown":"Testbox11 to include Ansible
scripts","description_html":"<p>Testbox11 to include Ansible
scripts</p>\n","current_version":null,"versions":[]}
2020/05/15 00:44:25 [INFO] (telemetry) ending shell-local
==> vmware-iso: Running post-processor: vagrant
2020/05/15 00:44:25 Flagging to keep original artifact from post-processor
'shell-local'
2020/05/15 00:44:25 [INFO] (telemetry) Starting post-processor vagrant
2020/05/15 00:44:25 [INFO] (telemetry) ending vagrant
Build 'vmware-iso' errored: 1 error(s) occurred:
* Post-processor failed: Unknown artifact type, can't build box:
* Post-processor failed: Unknown artifact type, can't build box:
2020/05/15 00:44:25 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
==> Some builds didn't complete successfully and had errors:
2020/05/15 00:44:25 machine readable: vmware-iso,error []string{"1 error(s)
occurred:\n\n* Post-processor failed: Unknown artifact type, can't build
box: "}
--> vmware-iso: 1 error(s) occurred:
* Post-processor failed: Unknown artifact type, can't build box:
==> Builds finished but no artifacts were created.
* Post-processor failed: Unknown artifact type, can't build box:
==> Builds finished but no artifacts were created.
2020/05/15 00:44:25 [INFO] (telemetry) Finalizing.
2020/05/15 00:44:26 waiting for all plugin processes to complete...
2020/05/15 00:44:26 [ERR] Error decoding response stream 12: EOF
2020/05/15 00:44:26 [ERR] Error decoding response stream 7: EOF
2020/05/15 00:44:26 [ERR] Error decoding response stream 8: EOF
2020/05/15 00:44:26 [ERR] Error decoding response stream 9: EOF
2020/05/15 00:44:26 [ERR] Error decoding response stream 10: EOF
2020/05/15 00:44:26 [ERR] Error decoding response stream 11: EOF
2020/05/15 00:44:26 /usr/local/bin/packer: plugin process exited
2020/05/15 00:44:26 /usr/local/bin/packer: plugin process exited
2020/05/15 00:44:26 /usr/local/bin/packer: plugin process exited
2020/05/15 00:44:26 /usr/local/bin/packer: plugin process exited
2020/05/15 00:44:26 /usr/local/bin/packer: plugin process exited
"post-processors": [[
{
"type": "shell-local",
"script": "./create-cloudbox.sh"
},
{
"output": "{{ user `build_directory` }}/{{user
`box_basename`}}.{{.Provider}}.box",
"type": "vagrant"
},
{
"type": "vagrant-cloud",
"box_tag": "myusername/mybox",
"access_token": "{{user `cloud_token`}}",
"version": "{{user `version`}}"
}
]],
You need
"post-processors": [[
> {
> "type": "shell-local",
> "script": "create-cloudbox.sh"
> },
> {
> "output": "{{ user `build_directory` }}/{{user
> `box_basename`}}.{{.Provider}}.box",
> "type": "vagrant"
> },
> {
> "type": "vagrant-cloud",
> "box_tag": "username/nameofmybox",
> "access_token": "{{user `cloud_token`}}",
> "version": "{{user `version`}}"
> }
> ]],
Mybe first the vagrant and than the output ?
"type": "vagrant",
"output": "{{ user `build_directory` }}/{{user
`box_basename`}}.{{.Provider}}.box"
will give it a try.
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/eaa60e84-96a4-40cd-9064-d5095685b655%40googlegroups.com.