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

Removed Shared Image Gallery values from generated_data #182

Merged
merged 2 commits into from
Feb 8, 2022

Conversation

nywilken
Copy link
Contributor

@nywilken nywilken commented Feb 7, 2022

This change removes the duplicated shared image gallery data used in the Artifact, and now relies on the state data that gets set during the publish to SIG destination step.

The changes use the provided constants to ensure the correct data is being read from state. In addition to the constants a new method was added to the builder for ensuring that the SIG Artifact is generated consistently at the end of a build.

Closes #168

Validated fix for #168 using the following template
variable "resource_group_name" {
  type    = string
  default = ""
}

variable "subscription_id" {
  type    = string
  default = ""
}

source "azure-arm" "autogenerated_1" {
  azure_tags = {
    dept = "Engineering"
    task = "Image deployment"
  }
  image_offer                       = "UbuntuServer"
  image_publisher                   = "Canonical"
  image_sku                         = "16.04-LTS"
  location                          = "East US"
  managed_image_name                = "PackerImage-6"
  managed_image_resource_group_name = "${var.resource_group_name}"
  os_type                           = "Linux"
  shared_image_gallery_destination {
    gallery_name        = "PackerTestGallery"
    image_name          = "packer-test"
    image_version       = "0.0.6"
    replication_regions = ["South Central US"]
    resource_group      = "${var.resource_group_name}"
  }
  subscription_id = "${var.subscription_id}"
  vm_size         = "Standard_DS2_v2"
}

build {
  sources = ["source.azure-arm.autogenerated_1"]

  provisioner "shell-local" {
    inline = [
    "echo ${build.SourceImageName}",
    ]
  }

  post-processor "manifest" {
  }
}

Results of build

==> Wait completed after 11 minutes 27 seconds

==> Builds finished. The artifacts of successful builds are:
--> azure-arm.autogenerated_1: Azure.ResourceManagement.VMImage:

OSType: Linux
ManagedImageResourceGroupName: ....
ManagedImageName: PackerImage-6
ManagedImageId: /subscriptions/...../resourceGroups/...../providers/Microsoft.Compute/images/PackerImage-6
ManagedImageLocation: East US
ManagedImageSharedImageGalleryId: /subscriptions/...../resourceGroups/..../providers/Microsoft.Compute/galleries/PackerTestGallery/images/packer-test/versions/0.0.6

This change removes the duplicated shared image gallery data used in the
Artifact, and now relies on the state data that gets set during the
publish to SIG destination step.

The changes use the provided constants to ensure the correct data is
being read from state. In addition to the constants a new method was
added to the builder for ensuring that the SIG Artifact is generated
consistently at the end of a build.

Closes #168
@nywilken nywilken requested a review from a team as a code owner February 7, 2022 18:39
@nywilken nywilken added the bug label Feb 7, 2022
Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

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

LGTM !

@azr azr merged commit 3ad8165 into main Feb 8, 2022
@azr azr deleted the wilken/fix_shared_gallery_generated_data branch February 8, 2022 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

post-processor failed: unhandled buildvar type []interface {}
2 participants