Skip to content

Commit 69f4bcc

Browse files
committed
workflows: Trigger anaconda test on bridge/storaged changes
We want to make sure to not break the Web UI with changes which affect it, i.e. API changes. Add a workflow which runs if the PR affects Anaconda (changes to pyanaconda), polls the packit COPR until it has the current PR version available, and then test-triggers a "anaconda PR" scenario.
1 parent 7d6d52a commit 69f4bcc

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/trigger-webui.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Anaconda's tests are "special" (require booting boot.iso, can't run in
2+
# tmt/Testing Farm), so we need to run them in Cockpit's CI. But we still want
3+
# to re-use the packit COPR, which is much easier to consume by Anaconda's
4+
# tests than building cockpit in Anaconda.
5+
# This workflow checks if the PR affects Anaconda (changes to the bridge or
6+
# Storage page), polls the packit COPR until it has the current PR version
7+
# available, and then test-triggers a "cockpit PR" scenario.
8+
9+
name: anaconda
10+
on:
11+
pull_request_target:
12+
# only API changes might affect the Web UI
13+
paths:
14+
- pyanaconda/**
15+
paths-ignore:
16+
- pyanaconda/ui/**
17+
jobs:
18+
trigger:
19+
runs-on: ubuntu-22.04
20+
# the default workflow token cannot read our org membership, for deciding who is allowed to trigger tests
21+
environment: gh-cockpituous
22+
container: registry.fedoraproject.org/fedora:rawhide
23+
# this polls for a COPR build, which can take long
24+
timeout-minutes: 120
25+
26+
steps:
27+
- name: Install dependencies
28+
run: |
29+
dnf install -y git-core dnf-plugins-core || {
30+
sleep 60
31+
dnf install -y git-core dnf-plugins-core
32+
}
33+
34+
# Naively this should wait for github.event.pull_request.head.sha, but
35+
# that breaks on non-current branches, which packit merges to main with
36+
# an unpredictable SHA; so instead, wait until COPR has a build which is
37+
# newer than the PR push time. This assumes that this workflow always runs earlier
38+
# than the COPR srpm build finishes.
39+
- name: Wait for packit COPR build
40+
run: |
41+
set -ex
42+
PUSH_TIME=$(date --utc +%Y%m%d%H%M%S -d '${{ github.event.pull_request.head.repo.pushed_at }}')
43+
COPR_NAME="${{ github.event.pull_request.base.user.login }}-${{ github.event.pull_request.base.repo.name }}-${{ github.event.number }}"
44+
for _ in $(seq 60); do
45+
sleep 60;
46+
if dnf copr enable -y packit/$COPR_NAME &&
47+
out=$(dnf info --refresh --repo='copr:*anaconda*' anaconda) &&
48+
stamp=$(echo "$out" | awk '/^Release/ { split($3, v, "."); print substr(v[2], 0, 14)}') &&
49+
[ "$stamp" -gt "$PUSH_TIME" ]; then
50+
exit 0
51+
fi
52+
done
53+
exit 1
54+
55+
- name: Trigger anaconda run
56+
run: |
57+
git clone --depth=1 https://github.com/cockpit-project/bots
58+
mkdir -p ~/.config/cockpit-dev
59+
echo '${{ secrets.COCKPITUOUS_TOKEN }}' > ~/.config/cockpit-dev/github-token
60+
bots/tests-trigger --repo ${{ github.repository }} ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui

0 commit comments

Comments
 (0)