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.
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
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.