hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.06k stars 3.32k forks source link

The copied image does not have name if error occurs #13100

Closed EugenKon closed 2 months ago

EugenKon commented 2 months ago

Overview of the Issue

image

The copied image does not have name if this error occurs: https://github.com/hashicorp/packer/issues/13099 The image is not tagged also.

Reproduction Steps

See config at the linked issue.

Expected behaviour

The name and Tags should be assigned as possible as image was created. Otherwise it is not clear what this image is. It could be created a lot of images with empty names and this is ambiguous.

Here image is ready and must be named/tagged: image

Actual behaviour

But it is tagged a far later: image

Relevant log messages

==> amazon-ebs.nomad_ami: Stopping the source instance...
    amazon-ebs.nomad_ami: Stopping instance
==> amazon-ebs.nomad_ami: Waiting for the instance to stop...
==> amazon-ebs.nomad_ami: Creating AMI -nomad-20240704171233 from instance i-0e4XX
    amazon-ebs.nomad_ami: AMI: ami-06365XX
==> amazon-ebs.nomad_ami: Waiting for AMI to become ready...
==> amazon-ebs.nomad_ami: Copying/Encrypting AMI (ami-063658XX) to other regions...
    amazon-ebs.nomad_ami: Copying to: ca-central-1
    amazon-ebs.nomad_ami: Copying to: us-east-1
    amazon-ebs.nomad_ami: Copying to: us-east-2
    amazon-ebs.nomad_ami: Copying to: us-west-1
    amazon-ebs.nomad_ami: Waiting for all copies to complete...
==> amazon-ebs.nomad_ami: Skipping Enable AMI deprecation...
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-0383XX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-00015eXXX
==> amazon-ebs.nomad_ami: Creating AMI tags
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
    amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
    amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18eXX"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Creating snapshot tags
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-06dc8XX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-06481XX
==> amazon-ebs.nomad_ami: Creating AMI tags
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18XX"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
    amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
    amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
==> amazon-ebs.nomad_ami: Creating snapshot tags
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-0636XX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-00d7XX
==> amazon-ebs.nomad_ami: Creating AMI tags
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
    amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
    amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18XX"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Creating snapshot tags
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-03fbXXX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-0838XX
==> amazon-ebs.nomad_ami: Creating AMI tags
    amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
    amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18eXX"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Creating snapshot tags
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-03fcXX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-06077XX
==> amazon-ebs.nomad_ami: Creating AMI tags
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
    amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
    amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff1XX"
    amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
==> amazon-ebs.nomad_ami: Creating snapshot tags
    amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
    amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Terminating the source AWS instance...
==> amazon-ebs.nomad_ami: Cleaning up any extra volumes...
==> amazon-ebs.nomad_ami: No volumes to clean up, skipping
==> amazon-ebs.nomad_ami: Deleting temporary security group...
==> amazon-ebs.nomad_ami: Deleting temporary keypair...
Build 'amazon-ebs.nomad_ami' finished after 11 minutes 26 seconds.

==> Wait completed after 11 minutes 26 seconds

==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs.nomad_ami: AMIs were created:
ca-central-1: ami-06dc8XX
us-east-1: ami-03fb6XX
us-east-2: ami-03fcdXX
us-west-1: ami-0383a2XX
us-west-2: ami-06365XX

Packer version

v1.9.4

github-actions[bot] commented 2 months ago

This issue has been migrated to https://github.com/hashicorp/packer-plugin-amazon/issues/491 due to the Packer Plugin split.

Please follow the new issue for updates.

github-actions[bot] commented 1 month ago

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.