REMOVE LATER: lowercase changes #166
This file contains hidden or 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 | ||
| - "dev/**" | ||
| merge_group: | ||
| types: [checks_requested] | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| get-tag: | ||
| name: Get Image Tag | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| outputs: | ||
| tag: ${{ steps.get_tag.outputs.tag }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - name: Get tag | ||
| id: get_tag | ||
| run: echo "tag=$(make version)" >> $GITHUB_OUTPUT | ||
| retina-images: | ||
| name: Build Agent Images - Linux | ||
| runs-on: ${{ matrix.runner }} | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| matrix: | ||
| platform: ["linux"] | ||
| arch: ["amd64", "arm64"] | ||
| include: | ||
| - arch: amd64 | ||
| runner: ubuntu-latest | ||
| - arch: arm64 | ||
| runner: ubuntu-24.04-arm | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| - run: go version | ||
| - name: Set lowercase repo name | ||
| shell: bash | ||
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
| - name: Az CLI login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | ||
| IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | ||
| APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_KEY }} \ | ||
| BUILDX_ACTION=--push | ||
| else | ||
| make retina-image \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} | ||
| fi | ||
| env: | ||
| SHOULD_PUSH_IMAGE: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| build-windows-binaries: | ||
| name: Build Windows Binaries | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| - run: go version | ||
| - name: Build Windows Binaries | ||
| shell: bash | ||
| run: | | ||
| TAG=$(make version) | ||
| echo "TAG=$TAG" >> $GITHUB_ENV | ||
| make build-windows-binaries \ | ||
| GOOS=windows \ | ||
| GOARCH=amd64 \ | ||
| TAG=$TAG \ | ||
| APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_KEY }} | ||
| env: | ||
| APP_INSIGHTS_ID: ${{ secrets.AZURE_APP_INSIGHTS_KEY }} | ||
| - name: Upload Windows Binaries | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: windows-binaries | ||
| path: output/windows_amd64/ | ||
| retention-days: 1 | ||
| retina-image-win: | ||
| name: Build Agent Image - Windows ${{ matrix.year }} | ||
| needs: build-windows-binaries | ||
| runs-on: windows-${{ matrix.year }} | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| matrix: | ||
| year: ["2022"] | ||
| platform: ["windows"] | ||
| arch: ["amd64"] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - name: Download Windows Binaries | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: windows-binaries | ||
| path: output/windows_amd64/ | ||
| - name: Ensure Docker daemon is running | ||
| shell: pwsh | ||
| run: | | ||
| $timeout = 120 | ||
| $timer = [Diagnostics.Stopwatch]::StartNew() | ||
| while ($timer.Elapsed.TotalSeconds -lt $timeout) { | ||
| $svc = Get-Service docker -ErrorAction SilentlyContinue | ||
| if ($svc -and $svc.Status -ne 'Running') { | ||
| Start-Service docker -ErrorAction SilentlyContinue | ||
| } | ||
| $result = docker info 2>&1 | ||
| if ($LASTEXITCODE -eq 0) { | ||
| Write-Host "Docker daemon is ready" | ||
| return | ||
| } | ||
| Write-Host "Waiting for Docker daemon to start..." | ||
| Start-Sleep -Seconds 5 | ||
| } | ||
| throw "Docker daemon failed to start within $timeout seconds" | ||
| - name: Set lowercase repo name | ||
| shell: bash | ||
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
| - name: Az CLI login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| if: ${{ github.event_name == 'merge_group' }} || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| 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 | ||
| TAG=$(make version) | ||
| echo "TAG=$TAG" >> "$GITHUB_ENV" | ||
| if [ "$SHOULD_PUSH_IMAGE" == "true" ]; then | ||
| az acr login -n ${{ vars.ACR_NAME }} | ||
| make retina-image-win \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | ||
| WINDOWS_YEARS=${{ matrix.year }} \ | ||
| IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | ||
| APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_KEY }} \ | ||
| BINARIES_PATH=output/windows_${{ matrix.arch }} \ | ||
| REPO_PATH=. | ||
| docker push ${{ vars.ACR_NAME }}/${{ github.repository }}/retina-agent:${TAG}-windows-ltsc${{ matrix.year }}-${{ matrix.arch }} | ||
| else | ||
| make retina-image-win \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | ||
| WINDOWS_YEARS=${{ matrix.year }} \ | ||
| BINARIES_PATH=output/windows_${{ matrix.arch }} \ | ||
| REPO_PATH=. | ||
| fi | ||
| env: | ||
| SHOULD_PUSH_IMAGE: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| operator-images: | ||
| name: Build Operator Images | ||
| runs-on: ${{ matrix.runner }} | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| matrix: | ||
| platform: ["linux"] | ||
| arch: ["amd64", "arm64"] | ||
| include: | ||
| - arch: amd64 | ||
| runner: ubuntu-latest | ||
| - arch: arm64 | ||
| runner: ubuntu-24.04-arm | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| - run: go version | ||
| - name: Set lowercase repo name | ||
| shell: bash | ||
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
| - name: Az CLI login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| if: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| 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 | ||
| if [ "$SHOULD_PUSH_IMAGE" == "true" ]; then | ||
| az acr login -n ${{ vars.ACR_NAME }} | ||
| make retina-operator-image \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | ||
| IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | ||
| APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_KEY }} \ | ||
| BUILDX_ACTION=--push | ||
| else | ||
| make retina-operator-image \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} | ||
| fi | ||
| env: | ||
| SHOULD_PUSH_IMAGE: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| retina-shell-images: | ||
| name: Build Retina Shell Images (${{ matrix.platform }}, ${{ matrix.arch }}) | ||
| runs-on: ${{ matrix.runner }} | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - platform: linux | ||
| arch: amd64 | ||
| runner: ubuntu-latest | ||
| - platform: linux | ||
| arch: arm64 | ||
| runner: ubuntu-24.04-arm | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| - run: go version | ||
| - name: Set lowercase repo name | ||
| shell: bash | ||
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
| - name: Az CLI login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| if: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| 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 | ||
| if [ "$SHOULD_PUSH_IMAGE" == "true" ]; then | ||
| az acr login -n ${{ vars.ACR_NAME }} | ||
| make retina-shell-image \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | ||
| IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | ||
| BUILDX_ACTION=--push | ||
| else | ||
| make retina-shell-image \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} | ||
| fi | ||
| env: | ||
| SHOULD_PUSH_IMAGE: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| kubectl-retina-images: | ||
| name: Build Kubectl Retina Images | ||
| runs-on: ${{ matrix.runner }} | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| matrix: | ||
| platform: ["linux"] | ||
| arch: ["amd64", "arm64"] | ||
| include: | ||
| - arch: amd64 | ||
| runner: ubuntu-latest | ||
| - arch: arm64 | ||
| runner: ubuntu-24.04-arm | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| - run: go version | ||
| - name: Set lowercase repo name | ||
| shell: bash | ||
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
| - name: Az CLI login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| if: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| 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 | ||
| if [ "$SHOULD_PUSH_IMAGE" == "true" ]; then | ||
| az acr login -n ${{ vars.ACR_NAME }} | ||
| make kubectl-retina-image \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \ | ||
| IMAGE_REGISTRY=${{ vars.ACR_NAME }} \ | ||
| BUILDX_ACTION=--push | ||
| else | ||
| make kubectl-retina-image \ | ||
| IMAGE_NAMESPACE=${{ env.REPO }} \ | ||
| PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} | ||
| fi | ||
| env: | ||
| SHOULD_PUSH_IMAGE: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| manifests: | ||
| name: Generate Manifests | ||
| if: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| needs: | ||
| [ | ||
| retina-images, | ||
| retina-image-win, | ||
| operator-images, | ||
| retina-shell-images, | ||
| kubectl-retina-images, | ||
| ] | ||
| strategy: | ||
| matrix: | ||
| components: ["retina", "operator", "shell", "kubectl-retina"] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - name: Setup QEMU | ||
| uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 | ||
| - name: Azure CLI login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| 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: | ||
| name: Run E2E Tests | ||
| if: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| needs: [manifests] | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 90 | ||
| env: | ||
| CLUSTER_NAME: retina-e2e-${{ github.run_id }}-${{ github.run_attempt }} | ||
| steps: | ||
| - name: Set lowercase repo name | ||
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - name: Setup go | ||
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| - run: go version | ||
| - name: Az CLI login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| if: ${{ (github.event_name == 'merge_group') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev/v0.0.33-windows' && github.repository == 'microsoft/retina') }} | ||
| 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 }} | ||
| AZURE_AGENT_LINUX_SKU: ${{ vars.AZURE_AGENT_LINUX_SKU }} | ||
| AZURE_AGENT_WINDOWS_SKU: ${{ vars.AZURE_AGENT_WINDOWS_SKU }} | ||
| AZURE_AGENT_LINUX_ARM_SKU: ${{ vars.AZURE_AGENT_LINUX_ARM_SKU }} | ||
| 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=${{ env.REPO }} | ||
| - name: Cleanup resource group | ||
| if: always() | ||
| shell: bash | ||
| run: | | ||
| if az group exists --name "$CLUSTER_NAME" 2>/dev/null | grep -q true; then | ||
| echo "Deleting resource group $CLUSTER_NAME..." | ||
| az group delete --name "$CLUSTER_NAME" --yes --no-wait || true | ||
| fi | ||
| perf-test-basic: | ||
| if: ${{ github.event_name == 'merge_group'}} | ||
| needs: [manifests, get-tag, e2e] | ||
| uses: ./.github/workflows/perf-template.yaml | ||
| with: | ||
| image-registry: ${{ vars.ACR_NAME }} | ||
| tag: ${{ needs.get-tag.outputs.tag }} | ||
| image-namespace: ${{ github.repository }} | ||
| retina-mode: basic | ||
| azure-location: ${{ vars.AZURE_LOCATION }} | ||
| azure-agent-linux-sku: ${{ vars.AZURE_AGENT_LINUX_SKU }} | ||
| azure-agent-windows-sku: ${{ vars.AZURE_AGENT_WINDOWS_SKU }} | ||
| azure-agent-linux-arm-sku: ${{ vars.AZURE_AGENT_LINUX_ARM_SKU }} | ||
| secrets: | ||
| azure-subscription: ${{ secrets.AZURE_SUBSCRIPTION }} | ||
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
| azure-app-insights-key: ${{ secrets.AZURE_APP_INSIGHTS_KEY }} | ||
| perf-test-advanced: | ||
| if: ${{ github.event_name == 'merge_group'}} | ||
| needs: [manifests, get-tag, e2e] | ||
| uses: ./.github/workflows/perf-template.yaml | ||
| with: | ||
| image-registry: ${{ vars.ACR_NAME }} | ||
| tag: ${{ needs.get-tag.outputs.tag }} | ||
| image-namespace: ${{ github.repository }} | ||
| retina-mode: advanced | ||
| azure-location: ${{ vars.AZURE_LOCATION }} | ||
| azure-agent-linux-sku: ${{ vars.AZURE_AGENT_LINUX_SKU }} | ||
| azure-agent-windows-sku: ${{ vars.AZURE_AGENT_WINDOWS_SKU }} | ||
| azure-agent-linux-arm-sku: ${{ vars.AZURE_AGENT_LINUX_ARM_SKU }} | ||
| secrets: | ||
| azure-subscription: ${{ secrets.AZURE_SUBSCRIPTION }} | ||
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
| azure-app-insights-key: ${{ secrets.AZURE_APP_INSIGHTS_KEY }} | ||