Merge pull request #390 from gadget-inc/sc/split-child-cleanup-stranding #165
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 Dev Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| push: | |
| description: "Push image to registry" | |
| required: false | |
| default: true | |
| type: boolean | |
| jobs: | |
| build-docker-dev: | |
| name: Build and push Docker dev image (${{ matrix.platform }}) | |
| strategy: | |
| matrix: | |
| platform: [amd64, arm64] | |
| include: | |
| - platform: amd64 | |
| runner: ubuntu-latest-l | |
| nix_system: x86_64-linux | |
| - platform: arm64 | |
| runner: blacksmith-2vcpu-ubuntu-2404-arm | |
| nix_system: aarch64-linux | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up environment | |
| uses: ./.github/actions/setup-test-env | |
| with: | |
| cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
| - name: Build Docker dev image with Nix | |
| run: | | |
| nix build .#packages.${{ matrix.nix_system }}.silo-docker-dev -L | |
| docker load < result | |
| - name: Authenticate gcloud | |
| if: ${{ github.event_name == 'push' || inputs.push }} | |
| id: auth | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| token_format: access_token | |
| workload_identity_provider: ${{ vars.GCLOUD_WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ vars.GCLOUD_SERVICE_ACCOUNT_EMAIL }} | |
| - name: Login to Google Artifact Registry | |
| if: ${{ github.event_name == 'push' || inputs.push }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: us-central1-docker.pkg.dev | |
| username: oauth2accesstoken | |
| password: ${{ steps.auth.outputs.access_token }} | |
| - name: Tag and push image | |
| if: ${{ github.event_name == 'push' || inputs.push }} | |
| run: | | |
| sha=$(git rev-parse --short HEAD) | |
| registry="us-central1-docker.pkg.dev/gadget-core-production/core-production/silo" | |
| image_tag="${registry}/silo-dev:sha-${sha}-${{ matrix.platform }}" | |
| docker tag silo-dev:latest "${image_tag}" | |
| docker push "${image_tag}" | |
| echo "✅ Pushed: ${image_tag}" | |
| merge-docker-dev-manifests: | |
| name: Merge Docker dev manifests | |
| needs: build-docker-dev | |
| if: ${{ github.event_name == 'push' || inputs.push }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| steps: | |
| - name: Authenticate gcloud | |
| id: auth | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| token_format: access_token | |
| workload_identity_provider: ${{ vars.GCLOUD_WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ vars.GCLOUD_SERVICE_ACCOUNT_EMAIL }} | |
| - name: Login to Google Artifact Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: us-central1-docker.pkg.dev | |
| username: oauth2accesstoken | |
| password: ${{ steps.auth.outputs.access_token }} | |
| - name: Merge images into multi-architecture manifest | |
| run: | | |
| sha="${{ github.sha }}" | |
| sha="${sha:0:7}" | |
| registry="us-central1-docker.pkg.dev/gadget-core-production/core-production/silo" | |
| docker manifest create "${registry}/silo-dev:sha-${sha}" \ | |
| "${registry}/silo-dev:sha-${sha}-amd64" \ | |
| "${registry}/silo-dev:sha-${sha}-arm64" | |
| docker manifest push "${registry}/silo-dev:sha-${sha}" | |
| docker manifest create "${registry}/silo-dev:latest" \ | |
| "${registry}/silo-dev:sha-${sha}-amd64" \ | |
| "${registry}/silo-dev:sha-${sha}-arm64" | |
| docker manifest push "${registry}/silo-dev:latest" | |
| echo "" | |
| echo "✅ Successfully pushed multi-architecture Docker dev images:" | |
| echo " - ${registry}/silo-dev:sha-${sha}" | |
| echo " - ${registry}/silo-dev:latest" |