Skip to content

Publish Test Container #10

Publish Test Container

Publish Test Container #10

on:
workflow_dispatch:
inputs:
promote:
description: Promote this build to the latest stable image for this extension version
type: boolean
required: true
default: false
name: Publish Integration Test Container Image
run-name: Publish Test Container${{ inputs.promote && ' [stable]' || '' }}
permissions:
# required for OpenID federation
contents: 'read'
id-token: 'write'
jobs:
int-test:
uses: ./.github/workflows/int_test.yml
with:
resource-group: ops-cli-int-test-rg
use-container: true
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AIO_SP_APP_ID: ${{ secrets.AIO_SP_APP_ID }}
AIO_SP_OBJECT_ID: ${{ secrets.AIO_SP_OBJECT_ID }}
AIO_SP_SECRET: ${{ secrets.AIO_SP_SECRET }}
build-and-deploy:
needs: int-test
environment: container_registry
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@main
- name: "Az CLI login"
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Login to ACR via OIDC
run: |
az acr login --name aziotops
- name: Determine version from constants
run: |
echo VERSION=$(sed -n -e 's/^VERSION = "\(.*\)"/\1/p' ./azext_edge/constants.py) >> $GITHUB_ENV
- name: Build, tag, and push container image to registry
run: |
base="aziotops/cli-extension-tests"
datetag=$(date +%Y%m%d)
az acr build -t $base:${{ github.sha }} -t $base:${{ env.VERSION }}${{ !inputs.promote && '-$datetag' || '' }} -r aziotops .