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