# Docker workflow (argoproj/argo-rollouts)

> The Docker workflow from argoproj/argo-rollouts, explained and optimized by Latchkey.

Source: https://latchkey.dev/workflows/argoproj-argo-rollouts-docker-publish  
Upstream: [argoproj/argo-rollouts](https://github.com/argoproj/argo-rollouts/blob/master/.github/workflows/docker-publish.yml) (.github/workflows/docker-publish.yml), licence Apache-2.0

## What it does

This is the Docker workflow from the argoproj/argo-rollouts repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

## The workflow

```yaml
name: Docker

on:
  push:
    branches:
      - master
      - release-*
    paths-ignore:
      - '**/*.md'
      - 'docs/**'    

  # Run tests for any PRs.
  pull_request:
    paths-ignore:
      - '**/*.md'
      - 'docs/**'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions: {}

env:
  # Registry namespace - defaults to 'argoproj', override via GitHub vars
  REGISTRY_NAMESPACE: ${{ vars.REGISTRY_NAMESPACE || 'argoproj' }}

jobs:
  set-vars:
    permissions:
      contents: read
    runs-on: ubuntu-latest
    outputs:
      controller-meta-tags: ${{ steps.controller-meta.outputs.tags }}
      plugin-meta-tags: ${{ steps.plugin-meta.outputs.tags }}
      platforms: ${{ steps.platform-matrix.outputs.platform-matrix }}

    steps:
      - name: Docker meta (controller)
        id: controller-meta
        uses: docker/metadata-action@v5
        with:
          images: |
            quay.io/${{ env.REGISTRY_NAMESPACE }}/argo-rollouts
          tags: |
            type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master'}}
            type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}

      - name: Docker meta (plugin)
        id: plugin-meta
        uses: docker/metadata-action@v5
        with:
          images: |
            quay.io/${{ env.REGISTRY_NAMESPACE }}/kubectl-argo-rollouts
          tags: |
            type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master'}}
            type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}

      # avoid building linux/arm64 for PRs since it takes so long
      - name: Set Platform Matrix
        id: platform-matrix
        run: |
          PLATFORM_MATRIX=linux/amd64
          if [[ "${{ github.event_name }}" == "push" || "${{ contains(github.event.pull_request.labels.*.name, 'test-arm-image') }}" == "true" ]]
          then
            PLATFORM_MATRIX=$PLATFORM_MATRIX,linux/arm64
          fi
          echo "platform-matrix=$PLATFORM_MATRIX" >> $GITHUB_OUTPUT

  build-and-push-controller-image:
    needs: [set-vars]
    permissions:
      contents: read
      packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
      id-token: write # for creating OIDC tokens for signing.
    uses: ./.github/workflows/image-reuse.yaml
    with:
      quay_image_name: ${{ needs.set-vars.outputs.controller-meta-tags }}
      # Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
      go-version: '1.26'
      platforms: ${{ needs.set-vars.outputs.platforms }}
      push: ${{ github.event_name != 'pull_request' }}
    secrets:
      quay_username: ${{ secrets.QUAY_USERNAME }}
      quay_password: ${{ secrets.QUAY_ROBOT_TOKEN }}

  build-and-push-plugin-image:
    needs: [set-vars]
    permissions:
      contents: read
      packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
      id-token: write # for creating OIDC tokens for signing.
    uses: ./.github/workflows/image-reuse.yaml
    with:
      quay_image_name: ${{ needs.set-vars.outputs.plugin-meta-tags }}
      # Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
      go-version: '1.26'
      platforms: ${{ needs.set-vars.outputs.platforms }}
      push: ${{ github.event_name != 'pull_request' }}
      target: kubectl-argo-rollouts
    secrets:
      quay_username: ${{ secrets.QUAY_USERNAME }}
      quay_password: ${{ secrets.QUAY_ROBOT_TOKEN }}
```

## FAQ

### What does the Docker workflow (argoproj/argo-rollouts) workflow do?

This is the Docker workflow from the argoproj/argo-rollouts repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

### What CI health grade does this workflow get?

This Docker workflow grades B. Paste your own workflow into the Latchkey grader to see its grade and the exact fixes.

### How can I improve this Docker workflow?

Add job timeouts. Latchkey applies these automatically on managed runners when you point runs-on at Latchkey.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
