Test CNI workflow (rancher/rke)
The Test CNI workflow from rancher/rke, explained and optimized by Latchkey.
A
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the Test CNI workflow from the rancher/rke 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: Test CNI
on:
pull_request:
branches:
- '**'
paths-ignore:
- '**.md'
- 'CODEOWNERS'
- 'LICENSE'
- 'docs/**'
jobs:
integration-cni-tests:
permissions:
contents: read
id-token: write
runs-on: runs-on,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
timeout-minutes: 60
strategy:
matrix:
cni: [flannel, calico, weave]
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version-file: 'go.mod'
- name: Retrieve Stage Registry Credentials from Vault
uses: rancher-eio/read-vault-secrets@0da85151ad1f19ed7986c41587e45aac1ace74b6 # v3
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/stage-registry/rancher/rke-extended-life/credentials endpoint | STAGE_REGISTRY_ENDPOINT ;
secret/data/github/repo/${{ github.repository }}/stage-registry/rancher/rke-extended-life/credentials username | STAGE_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/stage-registry/rancher/rke-extended-life/credentials password | STAGE_REGISTRY_PASSWORD
- name: Run ${{ matrix.cni }} check
run: |
./scripts/build
./scripts/integration ${{ matrix.cni }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Test CNI on: pull_request: branches: - '**' paths-ignore: - '**.md' - 'CODEOWNERS' - 'LICENSE' - 'docs/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: integration-cni-tests: permissions: contents: read id-token: write runs-on: runs-on,runner=4cpu-linux-x64,run-id=${{ github.run_id }} timeout-minutes: 60 strategy: matrix: cni: [flannel, calico, weave] steps: - name: Checkout code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Setup Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: go-version-file: 'go.mod' - name: Retrieve Stage Registry Credentials from Vault uses: rancher-eio/read-vault-secrets@0da85151ad1f19ed7986c41587e45aac1ace74b6 # v3 with: secrets: | secret/data/github/repo/${{ github.repository }}/stage-registry/rancher/rke-extended-life/credentials endpoint | STAGE_REGISTRY_ENDPOINT ; secret/data/github/repo/${{ github.repository }}/stage-registry/rancher/rke-extended-life/credentials username | STAGE_REGISTRY_USERNAME ; secret/data/github/repo/${{ github.repository }}/stage-registry/rancher/rke-extended-life/credentials password | STAGE_REGISTRY_PASSWORD - name: Run ${{ matrix.cni }} check run: | ./scripts/build ./scripts/integration ${{ matrix.cni }}
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
This workflow runs 1 job (3 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.