Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
92 changes: 80 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,102 @@ permissions:
checks: write # Used to annotate code in the PR

jobs:
changes:
name: categorize changes
runs-on: ubuntu-latest
outputs:
non-docs: ${{ steps.detect.outputs.non-docs }}
yaml: ${{ steps.detect.outputs.yaml }}
steps:
- name: Get base depth
id: base-depth
run: echo "base-depth=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_OUTPUT
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ steps.base-depth.outputs.base-depth }}
- name: detect
id: detect
run: |
git fetch origin ${{ github.base_ref }}

# Store git diff command for reuse
GIT_DIFF_CMD="git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}"

# Disable pipefail to avoid SIGPIPE (exit 141) when commands like head/grep exit early
# SIGPIPE occurs when git diff tries to write but the reading end of the pipe has closed
set +o pipefail

# Show changed files for debugging (limit to first 50 for readability)
echo "Changed files (first 50):"
$GIT_DIFF_CMD | head -50
FILE_COUNT=$($GIT_DIFF_CMD | wc -l)
echo "Total files changed: $FILE_COUNT"

# If no files are changed at all, skip detection
# Use git diff output directly to avoid bash variable size limits with large PRs
if [[ $FILE_COUNT -gt 0 ]]; then
# We only care about grep's exit status (did it find matches?), not the pipe status
NON_DOCS=$($GIT_DIFF_CMD | grep -Ev '\.md$' > /dev/null && echo 'true' || echo 'false')
YAML=$($GIT_DIFF_CMD | grep -E '\.ya?ml$' > /dev/null && echo 'true' || echo 'false')
echo "non-docs=${NON_DOCS}" | tee -a $GITHUB_OUTPUT
echo "yaml=${YAML}" | tee -a $GITHUB_OUTPUT
fi

# Re-enable pipefail for subsequent commands
set -o pipefail

build:
name: build
needs: [changes]
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.non-docs == 'true' }}
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
check-latest: true
env:
GOTOOLCHAIN: auto
- name: build
run: |
go build -v ./...
linting:
needs: [build]
needs: [changes]
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
check-latest: true
env:
GOTOOLCHAIN: auto
- name: gofmt
if: ${{ needs.changes.outputs.non-docs == 'true' }}
run: |
gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*'))
if [[ -n "$gofmt_out" ]]; then
failed=1
fi
echo "$gofmt_out"
- name: golangci-lint
uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0
if: ${{ needs.changes.outputs.non-docs == 'true' }}
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v2.1.0
only-new-issues: true
args: --timeout=10m
version: v2.7.2
args: --new-from-merge-base=origin/${{ github.base_ref }} --timeout=10m
- name: yamllint
if: ${{ needs.changes.outputs.yaml == 'true' }}
run: |
apt update && apt install -y yamllint
yamllint -c .yamllint $(find . -path ./vendor -prune -o -type f -regex ".*y[a]ml" -print | tr '\n' ' ')
- name: check-license
if: ${{ needs.changes.outputs.non-docs == 'true' }}
run: |
go install github.com/google/go-licenses@v1.0.0
go-licenses check ./...
Expand All @@ -65,10 +123,13 @@ jobs:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
check-latest: true
env:
GOTOOLCHAIN: auto
- name: build
run: |
make test-unit-verbose-and-race
Expand All @@ -77,10 +138,13 @@ jobs:
name: Check generated code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
check-latest: true
env:
GOTOOLCHAIN: auto
- name: generated
run: |
./hack/verify-codegen.sh
Expand All @@ -89,10 +153,13 @@ jobs:
name: Multi-arch build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
check-latest: true
env:
GOTOOLCHAIN: auto
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
- name: ko-resolve
run: |
Expand All @@ -104,8 +171,9 @@ jobs:
github.com/tektoncd/operator/cmd/openshift/proxy-webhook: registry.access.redhat.com/ubi9/ubi-minimal
EOF

KO_DOCKER_REPO=example.com make TARGET=kubernetes resolve
KO_DOCKER_REPO=example.com make TARGET=openshift resolve
# Use ko from setup-ko action to avoid Go version mismatch
KO_BIN=$(which ko) KO_DOCKER_REPO=example.com make TARGET=kubernetes resolve
KO_BIN=$(which ko) KO_DOCKER_REPO=example.com make TARGET=openshift resolve
e2e-tests:
needs: [build]
uses: ./.github/workflows/e2e-matrix.yml
18 changes: 11 additions & 7 deletions .github/workflows/e2e-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Tekton Integration
# Adapted from https://github.com/mattmoor/mink/blob/master/.github/workflows/minkind.yaml

on: [workflow_call] # yamllint disable-line rule:truthy
on:
- workflow_call

defaults:
run:
Expand All @@ -19,23 +20,26 @@ jobs:
matrix:
k8s-name:
- k8s-oldest
- k8s-plus-one
- k8s-latest

include:
- k8s-name: k8s-oldest
k8s-version: v1.28.x
- k8s-name: k8s-plus-one
k8s-version: v1.29.x
- k8s-name: k8s-latest
k8s-version: v1.34.x
env:
KO_DOCKER_REPO: registry.local:5000/tekton
CLUSTER_DOMAIN: c${{ github.run_id }}.local
ARTIFACTS: ${{ github.workspace }}/artifacts

steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
check-latest: true
env:
GOTOOLCHAIN: auto
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9

- name: Install Dependencies
Expand All @@ -62,12 +66,12 @@ jobs:
--e2e-env ./test/e2e-tests-kind.env

- name: Upload test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ matrix.k8s-version }}-${{ matrix.feature-flags }}
path: ${{ env.ARTIFACTS }}

- uses: chainguard-dev/actions/kind-diag@3e8a2a226fad9e1ecbf2d359b8a7697554a4ac6d # v1.5.10
- uses: chainguard-dev/actions/kind-diag@7d647f470c4d3692286221bd17ca78206976a61c # v1.5.11
if: ${{ failure() }}
with:
artifact-name: ${{ matrix.k8s-version }}-${{ matrix.feature-flags }}-logs
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ permissions:
contents: read
checks: write # Used to annotate code in the PR

env:
GOTOOLCHAIN: auto

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version: "1.23.x"
go-version-file: "go.mod"
check-latest: true
env:
GOTOOLCHAIN: auto
- name: golangci-lint
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v6.2.0
with:
version: v2.0.1
args: --timeout=10m
version: v2.7.2
args: --timeout=10m --new-from-merge-base=origin/${{ github.base_ref }}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Q = $(if $(filter 1,$V),,@)
M = $(shell printf "\033[34;1m🐱\033[0m")

export GO111MODULE=on
# Force GOTOOLCHAIN to auto to allow downloading Go 1.25+
export GOTOOLCHAIN = auto

$(BIN):
@mkdir -p $@
Expand Down
Loading
Loading