Skip to content

Commit b4cb539

Browse files
committed
Switch to GHA for e2e tests
Adapt the setup-kind script from the pipeline repo. Created a GHA workflow that can use the above script to setup a k8s cluster and run the e2e script on top as is done today on a prow cluster. The GHA workflow also includes a matrix which will test modified resources against the four supported LTS versions. The list of required jobs needs to be updated in the plumbing repository to match the new job name. This PR also deprecates a number of tasks that should have been deprecated before, as newer versions took precedence. Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
1 parent c9818f3 commit b4cb539

86 files changed

Lines changed: 597 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# The _chatops_retest workflow reruns failed GHA for a PR
2+
#
3+
# This workflow is triggered by leaving a "/retest" comment on
4+
# a pull request. If the required preconditions are met, it will
5+
# rerun failed GitHub actions checks on that PR
6+
#
7+
# Condition for the "/retest" command are:
8+
# - either the issuer is a maintainer
9+
# - or the issuer is the owner the PR
10+
11+
name: Rerun Failed Actions
12+
on:
13+
repository_dispatch:
14+
types: [retest-command]
15+
16+
jobs:
17+
retest:
18+
name: Rerun Failed Actions
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Show Environment Variables
22+
run: env
23+
- name: Show Github Object
24+
run: |
25+
cat <<'EOF'
26+
${{ toJson(github) }}
27+
EOF
28+
- name: Show Github Event Path Json
29+
run: 'cat $GITHUB_EVENT_PATH || true'
30+
- name: Rerun Failed Actions
31+
run: |
32+
echo '::group:: Get the PR commit sha'
33+
# Get the sha of the HEAD commit in the PR
34+
GITHUB_COMMIT_SHA=$(gh api $(echo ${GITHUB_PULL_URL#https://api.github.com/}) | \
35+
jq -r .head.sha)
36+
echo GITHUB_COMMIT_SHA=${GITHUB_COMMIT_SHA}
37+
echo '::endgroup::'
38+
39+
echo '::group:: Get the list of run IDs'
40+
# Get a list of run IDs
41+
RUN_IDS=$(gh api repos/${GITHUB_REPO}/commits/${GITHUB_COMMIT_SHA}/check-runs | \
42+
jq -r '.check_runs[] | select(.name != "Rerun Failed Actions") | .html_url | capture("/runs/(?<number>[0-9]+)/job") | .number' | \
43+
sort -u)
44+
echo RUN_IDS=${RUN_IDS}
45+
echo '::endgroup::'
46+
47+
echo '::group:: Rerun failed runs'
48+
# For each run, retrigger faild jobs
49+
for runid in ${RUN_IDS}; do
50+
echo Restarting run ${runid} for commit ${GITHUB_COMMIT_SHA}
51+
gh run \
52+
--repo ${GITHUB_REPO} \
53+
rerun ${runid} \
54+
--failed || true
55+
done
56+
echo '::endgroup::'
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.CHATOPS_TOKEN }}
59+
GITHUB_REPO: ${{ github.event.client_payload.github.payload.repository.full_name }}
60+
GITHUB_PULL_URL: ${{ github.event.client_payload.github.payload.issue.pull_request.url }}
61+
62+
- name: Create comment
63+
if: ${{ failure() && steps.landStack.outcome == 'failure' }}
64+
uses: peter-evans/create-or-update-comment@v4
65+
with:
66+
token: ${{ secrets.CHATOPS_TOKEN }}
67+
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
68+
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
69+
body: |
70+
Something went wrong with your `/${{ github.event.client_payload.slash_command.command }}` command: [please check the logs][1].
71+
72+
[1]: ${{ steps.vars.outputs.run-url }}
73+
74+
- name: Add reaction
75+
if: ${{ success() }}
76+
uses: peter-evans/create-or-update-comment@v4
77+
with:
78+
token: ${{ secrets.CHATOPS_TOKEN }}
79+
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
80+
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
81+
reactions: hooray

.github/workflows/ci.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: ci
2+
3+
on: [pull_request] # yamllint disable-line rule:truthy
4+
5+
defaults:
6+
run:
7+
shell: bash
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
e2e-tests:
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ matrix.tekton-version }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
name: e2e tests
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false # Keep running if one leg fails.
21+
matrix:
22+
tekton-version:
23+
- lts-latest
24+
- lts-latest-minus-one
25+
- lts-latest-minus-two
26+
- lts-latest-minus-three
27+
28+
include:
29+
- tekton-version: lts-latest
30+
pipeline-version: v1.0.0
31+
- tekton-version: lts-latest-minus-one
32+
pipeline-version: v0.68.1
33+
- tekton-version: lts-latest-minus-two
34+
pipeline-version: v0.65.6
35+
- tekton-version: lts-latest-minus-three
36+
pipeline-version: v0.62.8
37+
38+
env:
39+
KO_DOCKER_REPO: registry.local:5000/tekton
40+
CLUSTER_DOMAIN: c${{ github.run_id }}.local
41+
ARTIFACTS: ${{ github.workspace }}/artifacts
42+
43+
steps:
44+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
46+
with:
47+
go-version-file: "go.mod"
48+
- uses: ko-build/setup-ko@v0.9
49+
50+
- name: Install Dependencies
51+
working-directory: ./
52+
run: |
53+
echo '::group:: install go-junit-report'
54+
go install github.com/jstemmer/go-junit-report@v0.9.1
55+
echo '::endgroup::'
56+
57+
echo '::group:: created required folders'
58+
mkdir -p "${ARTIFACTS}"
59+
echo '::endgroup::'
60+
61+
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
62+
63+
- name: Run tests
64+
run: |
65+
./hack/setup-kind.sh \
66+
--registry-url $(echo ${KO_DOCKER_REPO} | cut -d'/' -f 1) \
67+
--cluster-suffix c${{ github.run_id }}.local \
68+
--nodes 3 \
69+
--pipeline-version ${{ matrix.pipeline-version }} \
70+
--e2e-script ./test/e2e-tests.sh \
71+
--e2e-env ./test/e2e-tests-kind-gha.env
72+
73+
- name: Upload test results
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: ${{ matrix.pipeline-version }}
77+
path: ${{ env.ARTIFACTS }}
78+
79+
- uses: chainguard-dev/actions/kind-diag@main
80+
if: ${{ failure() }}
81+
with:
82+
artifact-name: ${{ matrix.pipeline-version }}-logs
83+
84+
- name: Dump Artifacts
85+
if: ${{ failure() }}
86+
run: |
87+
if [[ -d ${{ env.ARTIFACTS }} ]]; then
88+
cd ${{ env.ARTIFACTS }}
89+
for x in $(find . -type f); do
90+
echo "::group:: artifact $x"
91+
cat $x
92+
echo '::endgroup::'
93+
done
94+
fi

.github/workflows/slash.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# The slash workflow handles slash commands
2+
#
3+
# Slash commands are given through comments on pull requests
4+
# and may be used only by individuals with "write" access to
5+
# the repository (i.e. maintainers).
6+
#
7+
# Slash commands must be placed at the very beginning of the
8+
# first line of a comment. More details are available in the
9+
# action docs: https://github.com/peter-evans/slash-command-dispatch/tree/main?tab=readme-ov-file#how-comments-are-parsed-for-slash-commands
10+
#
11+
# The workflow looks for and dispatches to another workflow
12+
# named <command>-command which must exist in the repository.
13+
#
14+
# Supported commands:
15+
# - /land: invokes the land-command workflow, to land (merge) PRs
16+
# stacked through ghstack
17+
#
18+
# When a command is recognised, the rocket and eyes emojis are added
19+
20+
name: Slash Command Routing
21+
on:
22+
issue_comment:
23+
types: [created]
24+
25+
jobs:
26+
check_comments:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: route-land
30+
uses: peter-evans/slash-command-dispatch@v4
31+
with:
32+
token: ${{ secrets.CHATOPS_TOKEN }}
33+
config: >
34+
[
35+
{
36+
"command": "retest",
37+
"permission": "write",
38+
"issue_type": "pull-request",
39+
"repository": "tektoncd/catalog"
40+
}
41+
]

0 commit comments

Comments
 (0)