-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: image factory docker workflow (#12)
Merge after: #9 - Test image factory container build workflow added - Customer tests are still missing - Workflow call from customer repo: https://github.com/comsysto/wp10-image-factory-user/actions/runs/10980125334 REMARK: Runners are running in my development VM in public subnet. It can be moved to air-gapped env as soon as we enable access to ACR. --------- Co-authored-by: Silvija Tovernic <[email protected]> Co-authored-by: Marko Paulic <[email protected]>
- Loading branch information
1 parent
e90ca3d
commit 8a2875c
Showing
3 changed files
with
126 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Reusable workflow - build packer VM | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image-name: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
packer-build: | ||
runs-on: self-hosted | ||
|
||
env: | ||
AZ_CLI_VERSION: 2.64.0 | ||
PACKER_VERSION: 1.9.4 | ||
|
||
# AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | ||
# AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }} | ||
# AZURE_ACG: ${{ vars.AZURE_ACG }} | ||
# AZURE_CREDENTIALS: | | ||
# { | ||
# "clientId": "${{ secrets.AZURE_CLIENT_ID }}", | ||
# "clientSecret": "${{ secrets.AZURE_CLIENT_SECRET }}", | ||
# "subscriptionId": "${{ secrets.AZURE_SUBSCRIPTION_ID }}", | ||
# "tenantId": "${{ secrets.AZURE_TENANT_ID }}" | ||
# } | ||
|
||
# IMAGE_PUBLISHER: "wp10-image-factory" | ||
# IMAGE_OFFER: "wp10-image-factory-vm" | ||
# IMAGE_SKU: "v1" | ||
# IMAGE_OS_TYPE: "linux" | ||
# IMAGE_VERSION: "${{ github.run_number }}" | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
# - name: Azure Login | ||
# uses: azure/login@v2 | ||
# with: | ||
# creds: ${{ env.AZURE_CREDENTIALS }} | ||
|
||
# - name: Create Azure Image Definition | ||
# uses: azure/cli@v2 | ||
# with: | ||
# azcliversion: ${{ env.AZ_CLI_VERSION }} | ||
# inlineScript: | | ||
# set +e | ||
# az sig image-definition show \ | ||
# --resource-group "$AZURE_RESOURCE_GROUP" \ | ||
# --gallery-name "$AZURE_ACG" \ | ||
# --gallery-image-definition "{{ inputs.image-name }}" \ | ||
# --query "name" -o tsv | ||
# az_exit_code=$? | ||
# set -e | ||
# if [ $az_exit_code -eq 3 ]; then | ||
# echo "Image definition does not exist. Creating it..." | ||
# az sig image-definition create \ | ||
# --resource-group "$AZURE_RESOURCE_GROUP" \ | ||
# --gallery-name "$AZURE_ACG" \ | ||
# --gallery-image-definition "{{ inputs.image-name }} \ | ||
# --publisher "$IMAGE_PUBLISHER" \ | ||
# --offer "$IMAGE_OFFER" \ | ||
# --sku "$IMAGE_SKU" \ | ||
# --os-type "$IMAGE_OS_TYPE" | ||
# else | ||
# echo "Image definition '{{ inputs.image-name }}' already exists." | ||
# fi | ||
|
||
# - name: Template Packer vars file | ||
# uses: cuchi/[email protected] | ||
# with: | ||
# template: images/packer/image-factory-vm/values.auto.pkrvars.hcl.j2 | ||
# output_file: images/packer/image-factory-vm/values.auto.pkrvars.hcl | ||
|
||
# - name: Setup Packer | ||
# uses: hashicorp/setup-packer@main | ||
# with: | ||
# version: ${{ env.PACKER_VERSION }} | ||
|
||
# - name: Packer Init | ||
# run: packer init images/packer/image-factory-vm | ||
|
||
# - name: Packer Build | ||
# run: | | ||
# packer build \ | ||
# -var "client_id=${{ secrets.AZURE_CLIENT_ID }}" \ | ||
# -var "client_secret=${{ secrets.AZURE_CLIENT_SECRET }}" \ | ||
# -var "tenant_id=${{ secrets.AZURE_TENANT_ID }}" \ | ||
# -var "subscription_id=${{ secrets.AZURE_SUBSCRIPTION_ID }}" \ | ||
# images/packer/image-factory-vm | ||
|