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

feat(bakery/Azure): Changes to extract shared-image-gallery image name from logs #561

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

harikumarks
Copy link

@harikumarks harikumarks commented Mar 17, 2020

This PR is for resolving spinnaker/spinnaker#5448.
When using Azure provider if we have a custom packer template which creates shared gallery image , the "Image" output variable still reference the managed image which also gets created as a part of the shared image gallery version. It is possible to create shared image gallery images by adding extension attributes in bake stage json as it is passed on to the packer template as variables. However the rosco azure bake handler only scraps Managed image id which is also created in the due process. But if one were to create shared gallery image, then the idea is that we don't need managed image id reference anymore. So the output could reference the shared image gallery id and this could be in turn used for deploy. This PR is for that.
Samples changes to packer json and extended attributes in bake stage are as below
Packer changes to include shared image gallery

                          "shared_image_gallery": {
				"subscription": "{{user `azure_sig_src_subscription`}}",
				"resource_group": "{{user `azure_sig_src_resource_group`}}",
				"gallery_name": "{{user `azure_sig_src_gallery_name`}}",
				"image_name": "{{user `azure_sig_src_image_name`}}",
				"image_version": "{{user `azure_sig_src_image_version`}}"
			},

			"shared_image_gallery_destination": {
				"resource_group":"{{user `azure_sig_dst_resource_group`}}",
				"gallery_name": "{{user `azure_sig_dst_gallery_name`}}",
				"image_name": "{{user `azure_sig_dst_image_name`}}",
				"image_version": "{{user `azure_sig_dst_image_version`}}",
				"replication_regions": "{{user `azure_sig_replication_regions`}}"
			},

			"managed_image_name": "{{user `azure_sig_dst_image_name`}}-{{user `azure_sig_dst_image_version`}}",
			"managed_image_resource_group_name":"{{user `azure_sig_dst_resource_group`}}",

Bake stage additional attributes could be added to extended attribute as below

     "extendedAttributes": {
          "azure_sig_dst_gallery_name": "${trigger.parameters.azure_sig_dst_gallery_name}",
          "azure_sig_dst_image_name": "${trigger.parameters.azure_sig_dst_image_name}",
          "azure_sig_dst_image_version": "${trigger.parameters.azure_sig_dst_image_version}",
          "azure_sig_dst_resource_group": "${trigger.parameters.azure_sig_dst_resource_group}",
          "azure_sig_dst_packer_resource_group" : "${trigger.parameters.azure_sig_dst_packer_resource_group}",
          "azure_sig_replication_regions": "${trigger.parameters.azure_sig_replication_regions}",
          "azure_sig_src_gallery_name": "${trigger.parameters.azure_sig_src_gallery_name}",
          "azure_sig_src_image_name": "${trigger.parameters.azure_sig_src_image_name}",
          "azure_sig_src_image_version": "${trigger.parameters.azure_sig_src_image_version}",
          "azure_sig_src_resource_group": "${trigger.parameters.azure_sig_src_resource_group}",
          "azure_sig_src_subscription": "${trigger.parameters.azure_sig_src_subscription}",
          "azure_sig_vm_size": "${trigger.parameters.azure_sig_vm_size}"
        },

@spinnakerbot
Copy link
Contributor

The following commits need their title changed:

  • 0be04a6: Adding changes to scrape sharedimage gallery name from logs

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

@harikumarks harikumarks changed the title Adding changes to scrape sharedimage gallery name from logs enhancement(Azure): Adding changes to scrape sharedimage gallery name from logs Mar 17, 2020
@harikumarks harikumarks changed the title enhancement(Azure): Adding changes to scrape sharedimage gallery name from logs feat(bakery/Azure): Adding changes to scrape sharedimage gallery name from logs Mar 17, 2020
@harikumarks harikumarks changed the title feat(bakery/Azure): Adding changes to scrape sharedimage gallery name from logs feat(bakery/Azure): Changes to extract shared-image-gallery image name from logs Mar 17, 2020
Copy link
Author

@harikumarks harikumarks left a comment

Choose a reason for hiding this comment

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

LGTM

@ajordens
Copy link
Contributor

Talked with @neil-yechenwei offline and this PR has passed their integration tests, will merge.

@ajordens ajordens merged commit 0a782e9 into spinnaker:master Feb 10, 2021
@EasyAsABC123
Copy link

@ajordens @neil-yechenwei thanks!

@EasyAsABC123
Copy link

EasyAsABC123 commented Feb 10, 2021

resolves spinnaker/spinnaker#5448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants