-
Notifications
You must be signed in to change notification settings - Fork 24
165 lines (145 loc) · 5.1 KB
/
Copy pathbuild.yaml
File metadata and controls
165 lines (145 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build
on:
pull_request:
branches: ['main']
push:
branches: [main]
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: image/git-init
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: "image/git-init/go.mod"
cache-dependency-path: "image/git-init/go.sum"
- run: go build ./...
- run: go vet ./...
- run: go test ./...
- name: Verify StepAction is in sync
working-directory: .
run: |
./hack/generate-stepaction.sh
if ! git diff --exit-code stepaction/; then
echo "StepAction is out of sync with Task. Run: ./hack/generate-stepaction.sh"
exit 1
fi
e2e:
name: E2E (${{ matrix.pipeline-version }})
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# All supported Tekton Pipelines LTS versions
# Update quarterly when new LTS is released
pipeline-version:
- v1.12.0 # LTS, EOL 2027-05-04
- v1.9.3 # LTS, EOL 2027-01-30
- v1.6.2 # LTS, EOL 2026-10-31
- v1.3.4 # LTS, EOL 2026-08-04
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: "image/git-init/go.mod"
cache-dependency-path: "image/git-init/go.sum"
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
- name: Create Kind cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
cluster_name: kind
wait: 120s
- name: Build base image
run: |
docker build -t ghcr.io/${{ github.repository }}/base:latest image/base/
docker tag ghcr.io/${{ github.repository }}/base:latest ko.local/git-clone-base:latest
- name: Build and load image into Kind
env:
KO_DOCKER_REPO: kind.local
KO_DEFAULTBASEIMAGE: ko.local/git-clone-base:latest
run: |
cd image/git-init
ko build --sbom=none -B -t e2e .
echo "GIT_INIT_IMAGE=kind.local/git-init:e2e" >> "$GITHUB_ENV"
- name: Run e2e tests
env:
PIPELINE_VERSION: ${{ matrix.pipeline-version }}
TIMEOUT: 180s
run: ./test/e2e-tests.sh
e2e-bundle:
name: E2E Bundle
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: "image/git-init/go.mod"
cache-dependency-path: "image/git-init/go.sum"
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
- uses: tektoncd/actions/setup-tektoncd-cli@dd92514472167b361de1c95fd31fc2ef83c282ec # main
- name: Create Kind cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
cluster_name: kind
wait: 120s
- name: Build base image
run: |
docker build -t ghcr.io/${{ github.repository }}/base:latest image/base/
docker tag ghcr.io/${{ github.repository }}/base:latest ko.local/git-clone-base:latest
- name: Build and load image into Kind
env:
KO_DOCKER_REPO: kind.local
KO_DEFAULTBASEIMAGE: ko.local/git-clone-base:latest
run: |
cd image/git-init
ko build --sbom=none -B -t e2e .
echo "GIT_INIT_IMAGE=kind.local/git-init:e2e" >> "$GITHUB_ENV"
- name: Run bundle e2e test
env:
PIPELINE_VERSION: v1.12.0
TIMEOUT: 180s
run: ./test/e2e-bundle-test.sh
ci-summary:
name: CI summary
needs: [build, e2e, e2e-bundle]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check CI results
run: |
results=(
"build=${NEEDS_BUILD_RESULT}"
"e2e=${NEEDS_E2E_RESULT}"
"e2e-bundle=${NEEDS_E2E_BUNDLE_RESULT}"
)
failed=0
for r in "${results[@]}"; do
name="${r%%=*}"
result="${r#*=}"
echo "${name}: ${result}"
if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then
failed=1
fi
done
if [ "$failed" -eq 1 ]; then
echo ""
echo "Some CI jobs failed or were cancelled"
exit 1
fi
echo ""
echo "All CI checks passed"
env:
NEEDS_BUILD_RESULT: ${{ needs.build.result }}
NEEDS_E2E_RESULT: ${{ needs.e2e.result }}
NEEDS_E2E_BUNDLE_RESULT: ${{ needs.e2e-bundle.result }}