Build Images #76
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
name: Build Images | |
on: | |
pull_request: | |
branches: [main] | |
merge_group: | |
types: [checks_requested] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
retina-images: | |
name: Build Agent Images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["linux"] | |
arch: ["amd64", "arm64"] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
- run: go version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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 }} | |
- name: Build Images | |
shell: bash | |
run: | | |
set -euo pipefail | |
echo "TAG=$(make version)" >> $GITHUB_ENV | |
az acr login -n ${{ vars.ACR_NAME }} | |
make retina-image \ | |
IMAGE_NAMESPACE=${{ github.repository }} \ | |
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | |
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | |
APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_KEY }} \ | |
BUILDX_ACTION=--push | |
env: | |
IS_MERGE_GROUP: ${{ github.event_name == 'merge_group' }} | |
retina-win-images: | |
name: Build Agent Windows Images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["windows"] | |
arch: ["amd64"] | |
year: ["2019", "2022"] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
- run: go version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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 }} | |
- name: Build Images | |
shell: bash | |
run: | | |
set -euo pipefail | |
echo "TAG=$(make version)" >> $GITHUB_ENV | |
az acr login -n ${{ vars.ACR_NAME }} | |
make retina-image-win \ | |
IMAGE_NAMESPACE=${{ github.repository }} \ | |
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | |
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | |
APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_KEY }} \ | |
WINDOWS_YEARS=${{ matrix.year }} \ | |
BUILDX_ACTION=--push | |
env: | |
IS_MERGE_GROUP: ${{ github.event_name == 'merge_group' }} | |
operator-images: | |
name: Build Operator Images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["linux"] | |
arch: ["amd64"] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
- run: go version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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 }} | |
- name: Build Images | |
shell: bash | |
run: | | |
set -euo pipefail | |
echo "TAG=$(make version)" >> $GITHUB_ENV | |
az acr login -n ${{ vars.ACR_NAME }} | |
make retina-operator-image \ | |
IMAGE_NAMESPACE=${{ github.repository }} \ | |
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | |
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | |
APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_KEY }} \ | |
BUILDX_ACTION=--push | |
env: | |
IS_MERGE_GROUP: ${{ github.event_name == 'merge_group' }} | |
retina-shell-images: | |
name: Build Retina Shell Images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["linux"] | |
arch: ["amd64", "arm64"] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
- run: go version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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 }} | |
- name: Build Images | |
shell: bash | |
run: | | |
set -euo pipefail | |
echo "TAG=$(make version)" >> $GITHUB_ENV | |
az acr login -n ${{ vars.ACR_NAME }} | |
make retina-shell-image \ | |
IMAGE_NAMESPACE=${{ github.repository }} \ | |
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | |
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | |
BUILDX_ACTION=--push | |
env: | |
IS_MERGE_GROUP: ${{ github.event_name == 'merge_group' }} | |
kubectl-retina-images: | |
name: Build Kubectl Retina Images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["linux"] | |
arch: ["amd64", "arm64"] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
- run: go version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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 }} | |
- name: Build Images | |
shell: bash | |
run: | | |
set -euo pipefail | |
echo "TAG=$(make version)" >> $GITHUB_ENV | |
az acr login -n ${{ vars.ACR_NAME }} | |
make kubectl-retina-image \ | |
IMAGE_NAMESPACE=${{ github.repository }} \ | |
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | |
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | |
BUILDX_ACTION=--push | |
env: | |
IS_MERGE_GROUP: ${{ github.event_name == 'merge_group' }} | |
manifests: | |
if: ${{ success('retina-images') && success('retina-win-images') && success('operator-images') && success('retina-shell-images') && success('kubectl-retina-images') }} | |
name: Generate Manifests | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
retina-images, | |
retina-win-images, | |
operator-images, | |
retina-shell-images, | |
kubectl-retina-images, | |
] | |
strategy: | |
matrix: | |
components: ["retina", "operator", "shell", "kubectl-retina"] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Azure CLI login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }} | |
- name: Generate Manifests | |
shell: bash | |
run: | | |
set -euo pipefail | |
az acr login -n ${{ vars.ACR_NAME }} | |
make manifest COMPONENT=${{ matrix.components }} \ | |
IMAGE_REGISTRY=${{ vars.ACR_NAME }} | |
e2e: | |
if: ${{ success('manifests') }} | |
name: Run E2E Tests | |
runs-on: ubuntu-latest | |
needs: [manifests] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup go | |
uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
- run: go version | |
- 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 }} | |
- name: Run E2E Tests | |
env: | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }} | |
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | |
shell: bash | |
run: | | |
set -euo pipefail | |
go test -v ./test/e2e/. -timeout 60m -tags=e2e -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository}} |