Skip to content

Commit 70b6154

Browse files
committed
Add GitHub Actions workflow for E2E tests
Run tests for read-only and read-write mode in parallel across multiple Kubernetes versions. Upload artifacts (logs, screen recordings) in case of failure. Changes to the test script are backwards compatible so existing use such as the nightly s390x / ppc64le tests on dogfooding continue to work as expected.
1 parent c8038ff commit 70b6154

File tree

4 files changed

+129
-2
lines changed

4 files changed

+129
-2
lines changed

.github/workflows/e2e.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: E2E
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: ["main"]
10+
pull_request:
11+
# The branches below must be a subset of the branches above
12+
branches: ["main"]
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
jobs:
19+
e2e-tests:
20+
name: E2E tests
21+
runs-on: ubuntu-latest
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
k8s-name:
26+
- k8s-oldest
27+
- k8s-plus-one
28+
29+
dashboard-mode:
30+
- read-only
31+
- read-write
32+
33+
# k8s-name above is used to give stable naming of the checks for branch
34+
# protection config. Map name to corresponding version for use in steps
35+
include:
36+
- k8s-name: k8s-oldest
37+
k8s-version: v1.29.x
38+
- k8s-name: k8s-plus-one
39+
k8s-version: v1.30.x
40+
41+
env:
42+
GOPATH: ${{ github.workspace }}
43+
GO111MODULE: on
44+
KO_DOCKER_REPO: registry.local:5000/tekton
45+
CLUSTER_DOMAIN: c${{ github.run_id }}.local
46+
ARTIFACTS: ${{ github.workspace }}/artifacts
47+
48+
steps:
49+
- name: Harden runner
50+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
51+
with:
52+
egress-policy: audit
53+
54+
- name: Checkout
55+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
56+
with:
57+
path: ${{ github.workspace }}/src/github.com/tektoncd/dashboard
58+
59+
- name: Checkout setup-kind.sh
60+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
61+
with:
62+
repository: tektoncd/pipeline
63+
ref: d306d649df2dbd2badaba6a90459efd05c753d2f
64+
path: scripts
65+
sparse-checkout: |
66+
hack/setup-kind.sh
67+
sparse-checkout-cone-mode: false
68+
69+
- name: Set up Go 1.22
70+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
71+
with:
72+
go-version: 1.22.5
73+
74+
- name: Install dependencies
75+
working-directory: ./
76+
run: |
77+
echo '::group::install ko'
78+
curl -L https://github.com/ko-build/ko/releases/download/v0.15.4/ko_0.15.4_Linux_x86_64.tar.gz | tar xzf - ko
79+
chmod +x ./ko
80+
sudo mv ko /usr/local/bin
81+
echo '::endgroup::'
82+
83+
echo '::group::create required folders'
84+
mkdir -p "${ARTIFACTS}"
85+
echo '::endgroup::'
86+
87+
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
88+
89+
- name: Run tests
90+
working-directory: ${{ github.workspace }}/src/github.com/tektoncd/dashboard
91+
run: |
92+
${{ github.workspace }}/scripts/hack/setup-kind.sh \
93+
--registry-url $(echo ${KO_DOCKER_REPO} | cut -d'/' -f 1) \
94+
--cluster-suffix c${{ github.run_id }}.local \
95+
--nodes 3 \
96+
--k8s-version ${{ matrix.k8s-version }} \
97+
--e2e-script ./test/e2e-tests-prow.sh \
98+
--e2e-env ./test/e2e-tests-kind-${{ matrix.dashboard-mode }}.env
99+
100+
- name: Upload test results
101+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
102+
with:
103+
name: ${{ matrix.k8s-version }}-${{ matrix.dashboard-mode }}
104+
path: ${{ env.ARTIFACTS }}
105+
106+
- name: Collect resources from cluster
107+
uses: chainguard-dev/actions/kind-diag@94389dc7faf4ef9040df90498419535e1bdcb60e # main
108+
if: ${{ failure() }}
109+
with:
110+
artifact-name: ${{ matrix.k8s-version }}-${{ matrix.dashboard-mode }}-logs
111+
namespace-resources: pods,taskruns,pipelineruns

test/e2e-tests-kind-read-only.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
KO_DOCKER_REPO=registry.local:5000
2+
SKIP_INITIALIZE=true
3+
DASHBOARD_MODE=read-only

test/e2e-tests-kind-read-write.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
KO_DOCKER_REPO=registry.local:5000
2+
SKIP_INITIALIZE=true
3+
DASHBOARD_MODE=read-write

test/e2e-tests.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,18 @@ header "Test Dashboard default namespace"
131131
export DASHBOARD_NAMESPACE=tekton-pipelines
132132
export TENANT_NAMESPACE=""
133133

134-
test_dashboard ${PLATFORM} --read-write
135-
test_dashboard ${PLATFORM}
134+
if [ -z "$DASHBOARD_MODE" ]; then
135+
echo "Running tests for both install modes"
136+
test_dashboard ${PLATFORM} --read-write
137+
test_dashboard ${PLATFORM}
138+
fi
139+
140+
if [ "$DASHBOARD_MODE" = "read-write" ]; then
141+
test_dashboard ${PLATFORM} --read-write
142+
fi
143+
if [ "$DASHBOARD_MODE" = "read-only" ]; then
144+
test_dashboard ${PLATFORM}
145+
fi
136146

137147
header "Test Dashboard custom namespace"
138148
if [ -z "$TEST_CUSTOM_INSTALL_NAMESPACE" ]; then

0 commit comments

Comments
 (0)