Skip to content

Commit c057f26

Browse files
zakisktheakshaypant
authored andcommitted
test: split github_ghe job into 3 parallel chunks
Split the single github_ghe CI matrix entry into github_ghe_1, github_ghe_2, and github_ghe_3 to run GHE E2E tests in parallel, matching the existing gitea chunking pattern. The old github_ghe target is kept as a backward compat alias. Signed-off-by: Zaki Shaikh <zashaikh@redhat.com> Assisted-by: Claude Opus 4.6 (via Claude Code)
1 parent d4b5b97 commit c057f26

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

.github/workflows/e2e.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ jobs:
4444
provider:
4545
[
4646
github_public,
47-
github_ghe,
47+
github_ghe_1,
48+
github_ghe_2,
49+
github_ghe_3,
4850
gitlab_bitbucket,
4951
gitea_1,
5052
gitea_2,
@@ -319,7 +321,7 @@ jobs:
319321
nohup gosmee client --saveDir /tmp/gosmee-replay "${TEST_GITEA_SMEEURL}" "https://${CONTROLLER_DOMAIN_URL}" >> /tmp/gosmee-main.log 2>&1 &
320322
321323
- name: Run gosmee for second controller (GHE)
322-
if: matrix.provider == 'github_ghe' || matrix.provider == 'concurrency'
324+
if: startsWith(matrix.provider, 'github_ghe') || matrix.provider == 'concurrency'
323325
run: |
324326
nohup gosmee client --saveDir /tmp/gosmee-replay-ghe ${{ secrets.TEST_GITHUB_SECOND_SMEE_URL }} "https://ghe.paac-127-0-0-1.nip.io" > /tmp/gosmee-ghe.log 2>&1 &
325327

hack/gh-workflow-ci.sh

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ get_tests() {
8585
gitea_tests=("${filtered_tests[@]}")
8686
fi
8787

88+
local -a ghe_tests=()
89+
if [[ "${target}" == github_ghe* ]]; then
90+
mapfile -t ghe_tests < <(echo "${all_tests}" | grep -iP 'GithubGHE' 2>/dev/null | grep -ivP 'Concurrency' 2>/dev/null | sort 2>/dev/null)
91+
fi
92+
8893
local -a github_tests=()
89-
if [[ "${target}" == *"github"* ]] && [[ "${target}" != "github_ghe" ]] && [[ "${target}" != "github_second_controller" ]]; then
94+
if [[ "${target}" == *"github"* ]] && [[ "${target}" != github_ghe* ]] && [[ "${target}" != "github_second_controller" ]]; then
9095
mapfile -t github_tests < <(echo "${all_tests}" | grep -iP '^TestGithub' 2>/dev/null | grep -ivP 'Concurrency|GithubGHE' 2>/dev/null | sort 2>/dev/null)
9196
fi
9297

@@ -97,6 +102,13 @@ get_tests() {
97102
remainder=$((${#gitea_tests[@]} % 3))
98103
fi
99104

105+
# Calculate chunk sizes for splitting GHE tests into 3 parts
106+
local ghe_chunk_size ghe_remainder
107+
if [[ ${#ghe_tests[@]} -gt 0 ]]; then
108+
ghe_chunk_size=$((${#ghe_tests[@]} / 3))
109+
ghe_remainder=$((${#ghe_tests[@]} % 3))
110+
fi
111+
100112
# TODO: revert once the new workflow matrix lands on main.
101113
# Backward compat: github_1/github_2 chunking for pull_request_target
102114
# which runs the workflow YAML from main (old target names).
@@ -135,11 +147,28 @@ get_tests() {
135147
printf '%s\n' "${github_tests[@]:$((github_chunk_size + github_remainder))}"
136148
fi
137149
;;
138-
github_second_controller)
150+
# TODO: revert - remove github_second_controller, github_ghe aliases
151+
# once the new workflow matrix lands on main. These exist because
152+
# pull_request_target runs the workflow YAML from main which still sends old
153+
# target names.
154+
github_second_controller | github_ghe)
139155
printf '%s\n' "${all_tests}" | grep -iP 'GithubGHE' | grep -ivP 'Concurrency'
140156
;;
141-
github_ghe)
142-
printf '%s\n' "${all_tests}" | grep -iP 'GithubGHE' | grep -ivP 'Concurrency'
157+
github_ghe_1)
158+
if [[ ${#ghe_tests[@]} -gt 0 ]]; then
159+
printf '%s\n' "${ghe_tests[@]:0:${ghe_chunk_size}}"
160+
fi
161+
;;
162+
github_ghe_2)
163+
if [[ ${#ghe_tests[@]} -gt 0 ]]; then
164+
printf '%s\n' "${ghe_tests[@]:${ghe_chunk_size}:${ghe_chunk_size}}"
165+
fi
166+
;;
167+
github_ghe_3)
168+
if [[ ${#ghe_tests[@]} -gt 0 ]]; then
169+
local start_idx=$((ghe_chunk_size * 2))
170+
printf '%s\n' "${ghe_tests[@]:${start_idx}:$((ghe_chunk_size + ghe_remainder))}"
171+
fi
143172
;;
144173
gitlab_bitbucket)
145174
printf '%s\n' "${all_tests}" | grep -iP 'Gitlab|Bitbucket' | grep -ivP 'Concurrency'
@@ -162,8 +191,8 @@ get_tests() {
162191
;;
163192
*)
164193
echo "Invalid target: ${target}"
165-
echo "supported targets: github_public, github_ghe, gitlab_bitbucket, gitea_1, gitea_2, gitea_3, concurrency, flaky"
166-
echo "backward compat aliases: github_1, github_2, github_second_controller"
194+
echo "supported targets: github_public, github_ghe_1, github_ghe_2, github_ghe_3, gitlab_bitbucket, gitea_1, gitea_2, gitea_3, concurrency, flaky"
195+
echo "backward compat aliases: github_1, github_2, github_second_controller, github_ghe"
167196
;;
168197
esac
169198
}
@@ -308,7 +337,7 @@ output_logs)
308337
;;
309338
print_tests)
310339
set +x
311-
for target in github_public github_ghe gitlab_bitbucket gitea_1 gitea_2 gitea_3 concurrency flaky; do
340+
for target in github_public github_ghe_1 github_ghe_2 github_ghe_3 gitlab_bitbucket gitea_1 gitea_2 gitea_3 concurrency flaky; do
312341
mapfile -t tests < <(get_tests "${target}")
313342
echo "Tests for target: ${target} Total: ${#tests[@]}"
314343
printf '%s\n' "${tests[@]}"

0 commit comments

Comments
 (0)