Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit 629744d

Browse files
authored
Add Manually Triggerable E2E Workflow (#564)
1 parent 51ee64a commit 629744d

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

.github/workflows/e2e-dispatch.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Run Single E2E
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
distro:
6+
description: 'Distro to run test'
7+
required: true
8+
default: "ubuntu"
9+
test-name:
10+
description: 'Name of test to run'
11+
required: true
12+
cluster-wide:
13+
description: 'Whether or not the test is cluster wide'
14+
required: true
15+
default: "false"
16+
17+
jobs:
18+
setup:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- pipeline-argument: operator-ubi
25+
- pipeline-argument: version-post-start-hook-init
26+
- pipeline-argument: readiness-probe-init
27+
- pipeline-argument: agent-ubi
28+
- pipeline-argument: agent-ubuntu
29+
- pipeline-argument: e2e
30+
steps:
31+
- name: Checkout Code
32+
uses: actions/checkout@v2
33+
- name: Setup Python
34+
uses: actions/setup-python@v2
35+
with:
36+
python-version: '3.8'
37+
38+
- uses: actions/cache@v2
39+
with:
40+
path: ~/.cache/pip
41+
key: ${{ hashFiles('requirements.txt') }}
42+
43+
- name: Install Python Dependencies
44+
run: pip install -r requirements.txt
45+
46+
- name: Login to Quay.io
47+
uses: docker/login-action@v1
48+
with:
49+
registry: quay.io
50+
username: ${{ secrets.QUAY_USERNAME }}
51+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
52+
53+
- name: Build and Push Images
54+
run: python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false
55+
env:
56+
MONGODB_COMMUNITY_CONFIG: "${{ github.workspace }}/scripts/ci/config.json"
57+
version_id: "${{ github.run_id }}"
58+
59+
tests:
60+
runs-on: ubuntu-latest
61+
needs: [setup]
62+
63+
steps:
64+
- name: Checkout Code
65+
uses: actions/checkout@v2
66+
67+
- name: Setup Python
68+
uses: actions/setup-python@v2
69+
with:
70+
python-version: '3.8'
71+
72+
- name: Cache Dependencies
73+
uses: actions/cache@v2
74+
with:
75+
path: ~/.cache/pip
76+
key: ${{ hashFiles('requirements.txt') }}
77+
78+
- name: Install Python Dependencies
79+
run: pip install -r requirements.txt
80+
81+
- name: Setup Kind Cluster
82+
uses: engineerd/[email protected]
83+
with:
84+
version: "v0.8.1"
85+
86+
- name: Install CRD
87+
run: kubectl apply -f config/crd/bases/mongodbcommunity.mongodb.com_mongodbcommunity.yaml
88+
89+
- name: Run Test
90+
run: python3 ./scripts/dev/e2e.py --test ${{ github.event.inputs.test-name }} --tag ${{ github.run_id }} --config_file ./scripts/ci/config.json --distro ${{ github.event.inputs.distro }} --cluster-wide ${{ github.event.inputs.cluster-wide }}
91+
92+
- name: Dump Diagnostics
93+
if: always()
94+
continue-on-error: true
95+
run: scripts/ci/dump_diagnostics.sh default # default since kind is running in the default namespace
96+
97+
- name: Upload Diagnostics
98+
if: always()
99+
uses: actions/upload-artifact@v2
100+
continue-on-error: true
101+
with:
102+
name: "${{ github.event.inputs.test-name }}-${{ github.event.inputs.distro }}-diagnostics"
103+
path: "${{ github.workspace }}/diagnostics"

.github/workflows/e2e.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ jobs:
2020
- pipeline-argument: agent-ubuntu
2121
- pipeline-argument: e2e
2222
steps:
23+
- name: Cancel Previous Runs
24+
uses: styfle/[email protected]
25+
with:
26+
access_token: ${{ github.token }}
27+
2328
- name: Checkout Code
2429
uses: actions/checkout@v2
2530
- name: Setup Python
@@ -125,6 +130,11 @@ jobs:
125130

126131

127132
steps:
133+
- name: Cancel Previous Runs
134+
uses: styfle/[email protected]
135+
with:
136+
access_token: ${{ github.token }}
137+
128138
- name: Checkout Code
129139
uses: actions/checkout@v2
130140

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ e2e: install
8383
eval $$(scripts/dev/get_e2e_env_vars.py $(cleanup)); \
8484
go test -v -short -timeout=30m -failfast ./test/e2e/$(test)
8585

86+
# Trigger a Github Action of the given test
87+
e2e-gh:
88+
scripts/dev/run_e2e_gh.sh $(test)
89+
8690
# Generate code
8791
generate: controller-gen
8892
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

scripts/dev/run_e2e_gh.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -Eeou pipefail
3+
4+
test_name="${1}"
5+
current_branch="$(git branch --show-current)"
6+
7+
gh workflow run e2e-dispatch.yml -f "test-name=${test_name}" --ref "${current_branch}"
8+
9+
run_id="$(gh run list --workflow=e2e-dispatch.yml | grep workflow_dispatch | grep -Eo "[0-9]+" | head -n 1)"
10+
11+
gh run view "${run_id}" --web

0 commit comments

Comments
 (0)