Skip to content

Commit bf5cd85

Browse files
fix: ci action for release branch
Signed-off-by: Anitha Natarajan <anataraj@redhat.com>
1 parent ab93ad4 commit bf5cd85

20 files changed

Lines changed: 449 additions & 165 deletions

.github/workflows/ci.yaml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: ci
2+
3+
'on':
4+
pull_request: {}
5+
merge_group: {}
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
changes:
20+
name: categorize changes
21+
runs-on: ubuntu-latest
22+
outputs:
23+
non-docs: ${{ steps.detect.outputs.non-docs }}
24+
yaml: ${{ steps.detect.outputs.yaml }}
25+
steps:
26+
- name: Get base depth
27+
id: base-depth
28+
run: echo "base-depth=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_OUTPUT
29+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30+
with:
31+
ref: ${{ github.event.pull_request.head.sha }}
32+
fetch-depth: ${{ steps.base-depth.outputs.base-depth }}
33+
persist-credentials: false
34+
- name: detect
35+
id: detect
36+
run: |
37+
git fetch origin ${GITHUB_BASE_REF}
38+
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} | tr ' ' '\n')
39+
40+
echo -e "Changed files:\n${CHANGED_FILES}"
41+
42+
# If no files are changed at all, then `grep -v` will match even though no change outputs
43+
# should be true. Skipping output on an empty set of changes eliminates the false positive
44+
if [[ -n "${CHANGED_FILES}" ]]; then
45+
NON_DOCS=$(echo "${CHANGED_FILES}" | grep -Eqv '\.md$' && echo 'true' || echo 'false')
46+
YAML=$(echo "${CHANGED_FILES}" | grep -Eq '\.ya?ml$' && echo 'true' || echo 'false')
47+
echo "non-docs=${NON_DOCS}" | tee -a $GITHUB_OUTPUT
48+
echo "yaml=${YAML}" | tee -a $GITHUB_OUTPUT
49+
fi
50+
51+
build:
52+
name: build
53+
runs-on: ubuntu-latest
54+
needs: [changes]
55+
if: ${{ needs.changes.outputs.non-docs == 'true' }}
56+
steps:
57+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
58+
with:
59+
persist-credentials: false
60+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
61+
with:
62+
go-version-file: "go.mod"
63+
- name: build
64+
run: |
65+
go build -v ./...
66+
linting:
67+
name: lint
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: read
71+
checks: write # Used by golangci-lint to annotate code in the PR
72+
needs: [changes]
73+
steps:
74+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
75+
with:
76+
fetch-depth: 0
77+
persist-credentials: false
78+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
79+
with:
80+
go-version-file: "go.mod"
81+
- name: gofmt
82+
if: ${{ needs.changes.outputs.non-docs == 'true' }}
83+
run: |
84+
gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*'))
85+
if [[ -n "$gofmt_out" ]]; then
86+
failed=1
87+
fi
88+
echo "$gofmt_out"
89+
- name: golangci-lint
90+
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
91+
if: ${{ needs.changes.outputs.non-docs == 'true' }}
92+
with:
93+
version: v2.7.2
94+
args: --new-from-merge-base=origin/${{ github.base_ref }} --timeout=10m
95+
- name: yamllint
96+
if: ${{ needs.changes.outputs.yaml == 'true' }}
97+
run: |
98+
apt-get update && apt-get install -y yamllint
99+
make yamllint
100+
- name: check-license
101+
if: ${{ needs.changes.outputs.non-docs == 'true' }}
102+
run: |
103+
go install github.com/google/go-licenses@v1.0.0
104+
go-licenses check ./...
105+
tests:
106+
needs: [build]
107+
name: test
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
111+
with:
112+
persist-credentials: false
113+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
114+
with:
115+
go-version-file: "go.mod"
116+
- name: unit-test
117+
run: |
118+
make test-unit-verbose-and-race
119+
e2e-tests:
120+
needs: [build]
121+
uses: ./.github/workflows/kind-e2e.yaml
122+
123+
ci-summary:
124+
name: CI summary
125+
needs: [build, linting, tests, e2e-tests]
126+
runs-on: ubuntu-latest
127+
if: always()
128+
steps:
129+
- name: Check CI results
130+
run: |
131+
results=(
132+
"build=${NEEDS_BUILD_RESULT}"
133+
"linting=${NEEDS_LINTING_RESULT}"
134+
"tests=${NEEDS_TESTS_RESULT}"
135+
"e2e-tests=${NEEDS_E2E_TESTS_RESULT}"
136+
)
137+
failed=0
138+
for r in "${results[@]}"; do
139+
name="${r%%=*}"
140+
result="${r#*=}"
141+
echo "${name}: ${result}"
142+
if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then
143+
failed=1
144+
fi
145+
done
146+
if [ "$failed" -eq 1 ]; then
147+
echo ""
148+
echo "Some CI jobs failed or were cancelled"
149+
exit 1
150+
fi
151+
echo ""
152+
echo "All CI checks passed"
153+
env:
154+
NEEDS_BUILD_RESULT: ${{ needs.build.result }}
155+
NEEDS_LINTING_RESULT: ${{ needs.linting.result }}
156+
NEEDS_TESTS_RESULT: ${{ needs.tests.result }}
157+
NEEDS_E2E_TESTS_RESULT: ${{ needs.e2e-tests.result }}

.github/workflows/codeql.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4444

4545
# Initializes the CodeQL tools for scanning.
4646
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@v3
47+
uses: github/codeql-action/init@a8d1ac45b9a34d11fe398d5503176af0d06b303e # v3.30.7
4848
with:
4949
languages: ${{ matrix.language }}
5050
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -58,7 +58,7 @@ jobs:
5858
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
5959
# If this step fails, then you should remove it and run the build manually (see below)
6060
- name: Autobuild
61-
uses: github/codeql-action/autobuild@v3
61+
uses: github/codeql-action/autobuild@a8d1ac45b9a34d11fe398d5503176af0d06b303e # v3.30.7
6262

6363
# ℹ️ Command-line programs to run using the OS shell.
6464
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -71,6 +71,6 @@ jobs:
7171
# ./location_of_script_within_repo/buildscript.sh
7272

7373
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@v3
74+
uses: github/codeql-action/analyze@a8d1ac45b9a34d11fe398d5503176af0d06b303e # v3.30.7
7575
with:
76-
category: "/language:${{matrix.language}}"
76+
category: "/language:${{matrix.language}}"

.github/workflows/kind-e2e.yaml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,49 @@
11
name: Chains kind E2E Tests
22

3-
on:
4-
pull_request:
5-
branches:
6-
- main
7-
- release-*
3+
'on':
4+
workflow_call: {}
5+
# on:
6+
# pull_request:
7+
# branches:
8+
# - main
9+
# - release-*
810

911
defaults:
1012
run:
1113
shell: bash
12-
working-directory: ./
1314

1415
jobs:
1516
k8s:
17+
permissions:
18+
contents: read
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ matrix.k8s-version }}-${{ github.event.pull_request.number || github.ref }}
21+
cancel-in-progress: true
1622
strategy:
1723
fail-fast: false # Keep running if one leg fails.
1824
matrix:
1925
# Keep in sync with the list of supported releases: https://kubernetes.io/releases/
20-
# TODO: add 1.31.x once it is added in https://github.com/sigstore/scaffolding/releases
26+
# Add latest k8s-version once it is added in https://github.com/sigstore/scaffolding/releases
2127
k8s-version:
22-
- v1.28.x
23-
- v1.29.x
24-
- v1.30.x
28+
- v1.31.x
29+
- v1.32.x
30+
- v1.33.x
2531
uses: ./.github/workflows/reusable-e2e.yaml
2632
with:
2733
k8s-version: ${{ matrix.k8s-version }}
28-
pipelines-release: v0.50.1
34+
pipelines-release: v1.2.0 # Latest version
2935
pipelines-lts:
3036
strategy:
3137
fail-fast: false # Keep running if one leg fails.
3238
matrix:
3339
pipelines-release:
34-
# This should follow the list of versions from https://github.com/tektoncd/pipeline/blob/main/releases.md#release
35-
- v0.53.5 # LTS
36-
- v0.56.3 # LTS
37-
- v0.59.2 # LTS
38-
- v0.62.0
40+
# This should follow the list of versions from
41+
# https://github.com/tektoncd/pipeline/blob/main/releases.md#release
42+
- v0.62.9 # LTS
43+
- v0.65.7 # LTS
44+
- v0.68.1 # LTS
45+
- v1.0.0 # LTS
3946
uses: ./.github/workflows/reusable-e2e.yaml
4047
with:
41-
k8s-version: v1.28.x
48+
k8s-version: v1.30.x # intersection of the latest version and scaffolding
4249
pipelines-release: ${{ matrix.pipelines-release }}

.github/workflows/lint.yaml

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)