Skip to content

publish-mcr-image

publish-mcr-image #1

name: Push image to MCR
on:
repository_dispatch:
types: [ publish-mcr-image ]
permissions:
contents: write
packages: write
env:
GO_VERSION: '1.20'
IMAGE_NAME: 'workspace'
jobs:
build-publish-mcr-image:
runs-on:
labels: [ "self-hosted", "1ES.Pool=1es-aks-kaito-agent-pool-ubuntu" ]
environment: publish-mcr
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Set Image tag
run: |
ver=${{ github.event.client_payload.tag }}
echo "IMG_TAG=${ver#"v"}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
ref: ${{ github.event.client_payload.tag }}
- name: Authenticate to ACR
run: |
az login --identity
az acr login -n ${{ secrets.KAITO_MCR_REGISTRY }}
- name: 'Build and Publish to MCR'
id: Publish
run: |
OUTPUT_TYPE=type=registry make docker-build-kaito
env:
VERSION: ${{ needs.get-tag.outputs.release-tag }}
REGISTRY: ${{ secrets.KAITO_MCR_REGISTRY }}/public/aks/kaito
run-e2e-mcr:
permissions:
contents: read
id-token: write
statuses: write
needs: [ build-publish-mcr-image ]
uses: ./.github/workflows/e2e-workflow.yml
with:
git_sha: ${{ github.sha }}
isRelease: true
registry: "mcr.microsoft.com/aks/kaito"
tag: ${{ github.event.client_payload.tag }}
secrets:
E2E_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
E2E_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
E2E_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
E2E_AMRT_SECRET_NAME: ${{ secrets.AMRT_SECRET_NAME }}
E2E_ACR_AMRT_USERNAME: ${{ secrets.ACR_AMRT_USERNAME }}
E2E_ACR_AMRT_PASSWORD: ${{ secrets.ACR_AMRT_PASSWORD }}
create-release:
runs-on: ubuntu-latest
environment: publish-mcr
needs: [ run-e2e-mcr ]
steps:
- name: 'Dispatch release tag'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: create-release
client-payload: '{"tag": "${{ github.event.client_payload.tag }}"}'