Skip to content
Latchkey

Golang Test Images workflow (gardener/gardener)

The Golang Test Images workflow from gardener/gardener, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: gardener/gardener.github/workflows/golang-test-images.yamlLicense Apache-2.0View source

What it does

This is the Golang Test Images workflow from the gardener/gardener 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: Golang Test Images

on:
  workflow_call:
    outputs:
      matrix:
        description: "Matrix configuration for golang-test images"
        value: ${{ jobs.generate-matrix.outputs.matrix }}

jobs:
  generate-matrix:
    name: Generate Matrix
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    permissions:
      contents: read
    steps:
      - name: Set matrix
        id: set-matrix
        run: |
          cat <<'EOF' >> $GITHUB_OUTPUT
          matrix<<MATRIX_EOF
          {
            "images": [
              {
                "version": "1.25",
                "image": "golang:1.25.12-bookworm"
              },
              {
                "version": "1.26",
                "image": "golang:1.26.5-bookworm"
              }
            ]
          }
          MATRIX_EOF
          EOF

The same workflow, on Latchkey

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

name: Golang Test Images
 
on:
  workflow_call:
    outputs:
      matrix:
        description: "Matrix configuration for golang-test images"
        value: ${{ jobs.generate-matrix.outputs.matrix }}
 
jobs:
  generate-matrix:
    timeout-minutes: 30
    name: Generate Matrix
    runs-on: latchkey-small
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    permissions:
      contents: read
    steps:
      - name: Set matrix
        id: set-matrix
        run: |
          cat <<'EOF' >> $GITHUB_OUTPUT
          matrix<<MATRIX_EOF
          {
            "images": [
              {
                "version": "1.25",
                "image": "golang:1.25.12-bookworm"
              },
              {
                "version": "1.26",
                "image": "golang:1.26.5-bookworm"
              }
            ]
          }
          MATRIX_EOF
          EOF
 

What changed

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.