Skip to content
Latchkey LogoLatchkey home

Docker workflow (argoproj/argo-rollouts)

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

Source: argoproj/argo-rollouts.github/workflows/docker-publish.ymlLicense Apache-2.0View source
B
CI health grade
72/100
Health score
3
Jobs per trigger
2
Fixes in the optimized version

In short

  1. CI health: B (good)
  2. The optimized version below points runs-on at Latchkey managed runners and adds job timeouts.

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

workflow (.yml)
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 }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

workflow (.yml), optimized
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:
    timeout-minutes: 30
    permissions:
      contents: read
    runs-on: ubuntu-latest
    runs-on: latchkey-small
    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:
    timeout-minutes: 30
    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:
    timeout-minutes: 30
    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 }}

What changed

  1. Run on Latchkey managed runners with one line (runs-on), which apply the fixes below automatically and self-heal transient failures. Each Linux x64 job moves to the Latchkey size matching its vCPU count, latchkey-small for a standard 2 vCPU runner; macOS, Windows and arm64 jobs stay as written.
  2. Add a job timeout so a hung step cannot burn hours of runner time.

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 3 jobs per trigger. 1 of the 3 runs on a standard GitHub-hosted Linux x64 runner, which in a private repository bills $0.006 a minute against $0.0025 on latchkey-small, 58% lower; in a public repository like this one it is free. Estimate the monthly difference with your own run counts.

Actions used in this workflow

  • docker/metadata-action

Frequently asked questions

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.

References