-
Notifications
You must be signed in to change notification settings - Fork 12
223 lines (198 loc) · 10.1 KB
/
trigger-9.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
---
name: RHEL 9 compose trigger
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * *'
- cron: '0 16 * * *'
env:
COMPOSE_URL_94: "http://${{ secrets.DOWNLOAD_NODE }}/rhel-9/nightly/updates/RHEL-9"
COMPOSE_URL_95: "http://${{ secrets.DOWNLOAD_NODE }}/rhel-9/nightly/RHEL-9"
jobs:
check-compose:
# Do not run this job on any fork repos
if: github.repository == 'virt-s1/rhel-edge'
runs-on: container-runner
container: quay.io/fedora/fedora:38-x86_64
steps:
- uses: actions/checkout@v3
- run: sudo dnf install -y gh
- name: Check RHEL 9.4 compose
id: check_compose_id_94
run: |
curl -s ${COMPOSE_URL_94}/latest-RHEL-9.4.0/STATUS --output STATUS_94
STATUS_94=$(cat STATUS_94)
if [[ "$STATUS_94" == "FINISHED" ]]; then
curl -s ${COMPOSE_URL_94}/latest-RHEL-9.4.0/COMPOSE_ID --output COMPOSE_ID_94
COMPOSE_ID_94=$(cat COMPOSE_ID_94)
TESTED_COMPOSE_94=( $( cat compose/compose.94 ) )
if [[ " ${TESTED_COMPOSE_94[*]} " =~ "$COMPOSE_ID_94" ]]; then
COMPOSE_ID_94="false"
fi
else
COMPOSE_ID_94="false"
fi
if [[ "$COMPOSE_ID_94" != "false" ]]; then
gh pr list -R virt-s1/rhel-edge --state open --json title --jq '.[].title' > PR_LIST_94
PR_LIST_94=$(cat PR_LIST_94)
if [[ $PR_LIST_94 == *"$COMPOSE_ID_94"* ]]; then
echo "pr_running_94=true" >> $GITHUB_OUTPUT
else
echo "pr_running_94=false" >> $GITHUB_OUTPUT
fi
OSBUILD_VERSION_94=$(curl -s "${COMPOSE_URL_94}/${COMPOSE_ID_94}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">osbuild-[0-9].*<" | tr -d "><")
OSBUILD_COMPOSER_VERSION_94=$(curl -s "${COMPOSE_URL_94}/${COMPOSE_ID_94}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">osbuild-composer-[0-9].*<" | tr -d "><")
COMPOSER_CLI_VERSION_94=$(curl -s "${COMPOSE_URL_94}/${COMPOSE_ID_94}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">weldr-client-[0-9].*<" | tr -d "><")
echo "osbuild_version_94=$OSBUILD_VERSION_94" >> $GITHUB_OUTPUT
echo "osbuild_composer_version_94=$OSBUILD_COMPOSER_VERSION_94" >> $GITHUB_OUTPUT
echo "composer_cli_version_94=$COMPOSER_CLI_VERSION_94" >> $GITHUB_OUTPUT
else
echo "osbuild_version_94=Null" >> $GITHUB_OUTPUT
echo "osbuild_composer_version_94=Null" >> $GITHUB_OUTPUT
echo "composer_cli_version_94=Null" >> $GITHUB_OUTPUT
fi
echo "rhel94_compose=$COMPOSE_ID_94" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check RHEL 9.5 compose
id: check_compose_id_95
run: |
curl -s ${COMPOSE_URL_95}/latest-RHEL-9.5.0/STATUS --output STATUS_95
STATUS_95=$(cat STATUS_95)
if [[ "$STATUS_95" == "FINISHED" ]]; then
curl -s ${COMPOSE_URL_95}/latest-RHEL-9.5.0/COMPOSE_ID --output COMPOSE_ID_95
COMPOSE_ID_95=$(cat COMPOSE_ID_95)
TESTED_COMPOSE_95=( $( cat compose/compose.95 ) )
if [[ " ${TESTED_COMPOSE_95[*]} " =~ "$COMPOSE_ID_95" ]]; then
COMPOSE_ID_95="false"
fi
else
COMPOSE_ID_95="false"
fi
if [[ "$COMPOSE_ID_95" != "false" ]]; then
gh pr list -R virt-s1/rhel-edge --state open --json title --jq '.[].title' > PR_LIST_95
PR_LIST_95=$(cat PR_LIST_95)
if [[ $PR_LIST_95 == *"$COMPOSE_ID_95"* ]]; then
echo "pr_running_95=true" >> $GITHUB_OUTPUT
else
echo "pr_running_95=false" >> $GITHUB_OUTPUT
fi
OSBUILD_VERSION_95=$(curl -s "${COMPOSE_URL_95}/${COMPOSE_ID_95}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">osbuild-[0-9].*<" | tr -d "><")
OSBUILD_COMPOSER_VERSION_95=$(curl -s "${COMPOSE_URL_95}/${COMPOSE_ID_95}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">osbuild-composer-[0-9].*<" | tr -d "><")
COMPOSER_CLI_VERSION_95=$(curl -s "${COMPOSE_URL_95}/${COMPOSE_ID_95}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">weldr-client-[0-9].*<" | tr -d "><")
echo "osbuild_version_95=$OSBUILD_VERSION_95" >> $GITHUB_OUTPUT
echo "osbuild_composer_version_95=$OSBUILD_COMPOSER_VERSION_95" >> $GITHUB_OUTPUT
echo "composer_cli_version_95=$COMPOSER_CLI_VERSION_95" >> $GITHUB_OUTPUT
else
echo "osbuild_version_95=Null" >> $GITHUB_OUTPUT
echo "osbuild_composer_version_95=Null" >> $GITHUB_OUTPUT
echo "composer_cli_version_95=Null" >> $GITHUB_OUTPUT
fi
echo "rhel95_compose=$COMPOSE_ID_95" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
rhel94_compose: ${{ steps.check_compose_id_94.outputs.rhel94_compose }}
rhel95_compose: ${{ steps.check_compose_id_95.outputs.rhel95_compose }}
osbuild_version_94: ${{ steps.check_compose_id_94.outputs.osbuild_version_94 }}
osbuild_composer_version_94: ${{ steps.check_compose_id_94.outputs.osbuild_composer_version_94 }}
composer_cli_version_94: ${{ steps.check_compose_id_94.outputs.composer_cli_version_94 }}
osbuild_version_95: ${{ steps.check_compose_id_95.outputs.osbuild_version_95 }}
osbuild_composer_version_95: ${{ steps.check_compose_id_95.outputs.osbuild_composer_version_95 }}
composer_cli_version_95: ${{ steps.check_compose_id_95.outputs.composer_cli_version_95 }}
pr_running_94: ${{ steps.check_compose_id_94.outputs.pr_running_94 }}
pr_running_95: ${{ steps.check_compose_id_95.outputs.pr_running_95 }}
rhel-9-4:
needs: check-compose
if: ${{ needs.check-compose.outputs.rhel94_compose != 'false' && needs.check-compose.outputs.pr_running_94 == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Add new compose id in compose.94
run: |
compose_id="${{ needs.check-compose.outputs.rhel94_compose }}"
echo $compose_id >> compose/compose.94
cat compose/compose.94
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "${{ needs.check-compose.outputs.rhel94_compose }} - ${{ steps.date.outputs.date }}"
committer: cloudkitebot <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: cpr
branch-suffix: random
delete-branch: true
title: "${{ needs.check-compose.outputs.rhel94_compose }} - ${{ steps.date.outputs.date }}"
labels: auto-merge,RHEL-9.4.0
body: |
RHEL 9.4 compose ${{ needs.check-compose.outputs.rhel94_compose }}
- Date: ${{ steps.date.outputs.date }}
- Packages:
- ${{ needs.check-compose.outputs.osbuild_version_94 }}
- ${{ needs.check-compose.outputs.osbuild_composer_version_94 }}
- ${{ needs.check-compose.outputs.composer_cli_version_94 }}
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: rebase
- name: Add a comment to trigger test workflow
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.PAT }}
issue-number: ${{ steps.cpr.outputs.pull-request-number }}
body: /test-rhel-9-4
rhel-9-5:
needs: check-compose
if: ${{ needs.check-compose.outputs.rhel95_compose != 'false' && needs.check-compose.outputs.pr_running_95 == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Add new compose id in compose.95
run: |
compose_id="${{ needs.check-compose.outputs.rhel95_compose }}"
echo $compose_id >> compose/compose.95
cat compose/compose.95
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "${{ needs.check-compose.outputs.rhel95_compose }} - ${{ steps.date.outputs.date }}"
committer: cloudkitebot <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: cpr
branch-suffix: random
delete-branch: true
title: "${{ needs.check-compose.outputs.rhel95_compose }} - ${{ steps.date.outputs.date }}"
labels: auto-merge,RHEL-9.5.0
body: |
RHEL 9.5 compose ${{ needs.check-compose.outputs.rhel95_compose }}
- Date: ${{ steps.date.outputs.date }}
- Packages:
- ${{ needs.check-compose.outputs.osbuild_version_95 }}
- ${{ needs.check-compose.outputs.osbuild_composer_version_95 }}
- ${{ needs.check-compose.outputs.composer_cli_version_95 }}
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: rebase
- name: Add a comment to trigger test workflow
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.PAT }}
issue-number: ${{ steps.cpr.outputs.pull-request-number }}
body: /test-rhel-9-5