Skip to content

Commit

Permalink
wip: use the classic subscription for the gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
smerle33 committed Dec 21, 2023
1 parent 497ed56 commit 0cb8433
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Jenkinsfile_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ pipeline {
// Defines the following environment variables: AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID
// Ref. https://plugins.jenkins.io/azure-credentials/#plugin-content-declarative-pipeline
AZURE = credentials('packer-azure-serviceprincipal-sponsorship')
AZURE_GALLERY = credentials('packer-azure-serviceprincipal')
// // Split packer plugins/configuration for each matrix cell - ref. https://www.packer.io/docs/configure
// PACKER_PLUGIN_PATH = "${env.WORKSPACE}/plugins"
// Define Packer Input variables through environment variables prefixed with 'PKR_VAR_'
Expand All @@ -185,6 +186,7 @@ pipeline {
PKR_VAR_agent_os_version = "${env.agent_type.split('-')[1]}"
PKR_VAR_architecture = "${env.cpu_architecture}"
PKR_VAR_image_type = "${env.compute_type}"
PKR_VAR_azure_gallery_subscription_id = "${env.AZURE_GALLERY_SUBSCRIPTION_ID}"
PATH = "${WORKSPACE}/.bin:${env.PATH}" // Required if packer needs to be installed
}
stages {
Expand Down
2 changes: 1 addition & 1 deletion sources.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ source "azure-arm" "base" {

# Where to export the image
shared_image_gallery_destination {
subscription = var.azure_subscription_id
subscription = var.azure_gallery_subscription_id
resource_group = local.azure_destination_resource_group
gallery_name = "${var.build_type}_packer_images"
# Not unique name defined in https://github.com/jenkins-infra/azure/blob/bfe56cb4f843b0c8029413090c383f7ac38dde2a/locals.tf#L4-L41
Expand Down
4 changes: 4 additions & 0 deletions variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ variable "azure_subscription_id" {
type = string
default = env("AZURE_SUBSCRIPTION_ID")
}
variable "azure_gallery_subscription_id" {
type = string
default = env("AZURE_SUBSCRIPTION_ID") # allow to specify distinct subscription
}
variable "image_version" {
type = string
default = "0.0.1" # Default is a valid version to not fail azure validation
Expand Down

0 comments on commit 0cb8433

Please sign in to comment.