← Files Testkube SkillsARCHIVED FILE

skills/testworkflow-author/examples/go-build-lint.yaml

1.49 KB · Oct 5, 2026 · 18:30 UTC

↓ Download file

# Example: Go Build and Lint (CI)
# Patterns: multi-step, different images per step, run with shell
# What this demonstrates: A CI-style workflow with multiple steps using
#                       different container images — lint with one image,
#                       build with another. Each step has full isolation.

apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
  name: go-build-lint
  labels:
    category: ci
spec:
  content:
    git:
      uri: https://github.com/kubeshop/testkube
      revision: main

  container:
    workingDir: /data/repo
    resources:
      requests:
        cpu: 1500m
        memory: 2Gi

  steps:
  # Step 1: Lint with golangci-lint.
  # Uses `run` to specify a different image — a Go toolchain image.
  # The shell command downloads and runs golangci-lint.
  - name: Lint
    run:
      image: golang:1.26-bookworm
      shell: |
        set -euo pipefail
        curl -L \
          https://github.com/golangci/golangci-lint/releases/download/v2.12.2/golangci-lint-2.12.2-linux-amd64.tar.gz \
          -o golangci.tar.gz
        tar -xzf golangci.tar.gz
        mv golangci-lint-2.12.2-linux-amd64/golangci-lint /usr/local/bin/
        golangci-lint run --timeout=10m ./cmd/api-server/...

  # Step 2: Build — completely separate container from lint step.
  # If lint fails, this step won't run (default condition: "passed").
  - name: Build
    run:
      image: golang:1.26-bookworm
      shell: |
        set -euo pipefail
        go build ./cmd/api-server

SHA-256: 8296bd68d45999cc678aca850a18af90a536e21bb8916571e5e3cd35f0fec6d2