Skip to content

Instantly share code, notes, and snippets.

@alventech
Last active May 30, 2021 09:44
Show Gist options
  • Save alventech/f3e657427f3a87dba4f9afc7a498acd7 to your computer and use it in GitHub Desktop.
Save alventech/f3e657427f3a87dba4f9afc7a498acd7 to your computer and use it in GitHub Desktop.
packer_azure_devops_pipeline
# Variable Group 'wvd-packer-vars' was defined in the Variables tab
# Variable Group 'wvd-kv' was defined in the Variables tab
resources:
repositories:
- repository: self
type: git
ref: main
jobs:
- job: Job_1
displayName: Agent job 1
pool:
vmImage: ubuntu-18.04
steps:
- checkout: self
- task: AzureCLI@2
displayName: Azure CLI Packer Validate
inputs:
connectedServiceNameARM: 00000000-0000000-000000000-00000
scriptType: bash
scriptLocation: inlineScript
scriptPath: packer/packer_w10_20h2_sig.json
inlineScript: >-
packer --version
export subscriptionid=$(subscriptionid)
export clientAPPID=$(clientAPPID)
export clientSecret=$(clientSecret)
export tenantid=$(tenantid)
echo $subscriptionid
echo $clientSecret
echo $clientAPPID
echo $tenantid
image_version=$(date +%Y.%H%M.%S)
echo $image_version
packer validate \
-var clientAPPIDd=$clientAPPID \
-var clientSecret=$clientSecret \
-var tenantid=$tenantid \
-var subscriptionid=$subscriptionid \
-var image_version=$image_version \
packer_w10_20h2_sig.json
addSpnToEnvironment: true
cwd: packer
- task: AzureCLI@2
displayName: Azure CLI Packer build
inputs:
connectedServiceNameARM: 00000000-0000000-000000000-00000
scriptType: bash
scriptLocation: inlineScript
scriptPath: packer/packer_w10_20h2_sig.json
inlineScript: >-
packer --version
export subscriptionid=$(subscriptionid)
export clientAPPID=$(clientAPPID)
export clientSecret=$(clientSecret)
export tenantid=$(tenantid)
echo $subscriptionid
echo $clientSecret
echo $clientAPPID
echo $tenantid
image_version=$(date +%Y.%H%M.%S)
echo $image_version
packer build \
-var clientAPPID=$clientAppID \
-var clientSecret=$clientSecret \
-var tenantid=$tenantid \
-var subscriptionid=$subscriptionid \
-var image_version=$image_version \
packer_w10_20h2_sig.json
addSpnToEnvironment: true
cwd: packer
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment