Skip to content

Commit ede9003

Browse files
feat: download logs
1 parent 50208a2 commit ede9003

2 files changed

Lines changed: 47 additions & 59 deletions

File tree

.github/workflows/copr-ci-post.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/copr-ci.yml

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
description: 'Job timeout in minutes.'
2828
required: false
2929
type: number
30-
default: 60
30+
default: 90
3131
secrets:
3232
COPR_BETA_WEBHOOK_TOKEN:
3333
description: 'Copr beta webhook token. This should be a secret.'
@@ -136,15 +136,27 @@ jobs:
136136
needs: package-init
137137
if: github.repository_owner == inputs.github_org_owner
138138
runs-on: ubuntu-latest
139+
container: fedora:latest
139140
timeout-minutes: ${{ inputs.job_timeout }}
140141
outputs:
141142
BUILD_ID: ${{ steps.build.outputs.BUILD_ID }}
142143
BUILD_CANCEL: ${{ steps.build.outcome == 'cancelled' }}
143144
BUILD_SUCCESS: ${{ steps.build.outcome == 'success' }}
144145
steps:
146+
- name: Install dependencies
147+
run: |
148+
dnf install -y \
149+
copr-cli \
150+
git \
151+
nodejs \
152+
zip
153+
145154
- name: Checkout
146155
uses: actions/checkout@v4
147156

157+
- name: Set git safe directory
158+
run: git config --global --add safe.directory '*'
159+
148160
- name: Get properties
149161
env:
150162
COPR_PR_WH_TOKEN: ${{ inputs.copr_pr_webhook_token }}
@@ -156,17 +168,22 @@ jobs:
156168
# release and released type
157169
if [ "${{ github.event_name }}" = "release" ]; then
158170
if [ "${{ github.event.action }}" = "prereleased" ]; then
159-
COPR_PUSH_WEBHOOK="${copr_base}/beta/${{ secrets.COPR_BETA_WEBHOOK_TOKEN }}/${package}/"
171+
BUILD_CHANNEL="beta"
172+
COPR_PUSH_WEBHOOK="${copr_base}/${BUILD_CHANNEL}/${{ secrets.COPR_BETA_WEBHOOK_TOKEN }}/${package}/"
160173
elif [ "${{ github.event.action }}" = "released" ]; then
161-
COPR_PUSH_WEBHOOK="${copr_base}/stable/${{ secrets.COPR_STABLE_WEBHOOK_TOKEN }}/${package}/"
174+
BUILD_CHANNEL="stable"
175+
COPR_PUSH_WEBHOOK="${copr_base}/${BUILD_CHANNEL}/${{ secrets.COPR_STABLE_WEBHOOK_TOKEN }}/${package}/"
162176
fi
163177
elif [ "${{ github.event_name }}" = "pull_request" ]; then
164-
COPR_PR_WEBHOOK="${copr_base}/pulls:pr:${{ github.event.number }}/${{ env.COPR_PR_WH_TOKEN }}/${package}/"
178+
BUILD_CHANNEL="pulls:pr:${{ github.event.number }}"
179+
COPR_PR_WEBHOOK="${copr_base}/${BUILD_CHANNEL}/${{ env.COPR_PR_WH_TOKEN }}/${package}/"
165180
fi
166181
182+
echo "BUILD_CHANNEL=${BUILD_CHANNEL}" >> $GITHUB_ENV
167183
echo "COPR_PUSH_WEBHOOK=${COPR_PUSH_WEBHOOK}" >> $GITHUB_ENV
168184
echo "COPR_PR_WEBHOOK=${COPR_PR_WEBHOOK}" >> $GITHUB_ENV
169185
186+
echo "BUILD_CHANNEL=${BUILD_CHANNEL}"
170187
echo "COPR_PUSH_WEBHOOK=${COPR_PUSH_WEBHOOK}"
171188
echo "COPR_PR_WEBHOOK=${COPR_PR_WEBHOOK}"
172189
@@ -179,61 +196,50 @@ jobs:
179196
# if a PR number is added the script will use the PR webhook, otherwise it will use the push webhook
180197
bash submit ${{ github.event.pull_request.number }}
181198
182-
cancel-build:
183-
name: Cancel build
184-
needs: build
185-
if: |
186-
always() &&
187-
needs.build.outputs.BUILD_CANCEL == 'true'
188-
runs-on: ubuntu-latest
189-
container: fedora:latest
190-
steps:
191-
- name: Install dependencies
192-
run: |
193-
dnf install -y \
194-
copr-cli
195-
196199
- name: Cancel Copr build
200+
if: >-
201+
always() &&
202+
steps.build.outcome == 'cancelled' &&
203+
github.secret_source
197204
run: |
198-
if [ -n "${{ secrets.COPR_CLI_CONFIG }}" ]; then
199-
mkdir -p ~/.config
200-
echo "${{ secrets.COPR_CLI_CONFIG }}" > ~/.config/copr
205+
mkdir -p ~/.config
206+
echo "${{ secrets.COPR_CLI_CONFIG }}" > ~/.config/copr
201207
202-
copr-cli \
203-
cancel \
204-
${{ needs.build.outputs.BUILD_ID }}
205-
else
206-
echo "Cannot cancel Copr build. No Copr CLI configuration file found. This is likely a PR from a fork."
207-
exit 1
208-
fi
208+
copr-cli \
209+
cancel \
210+
${{ steps.build.outputs.BUILD_ID }}
209211
210-
download-build:
211-
name: Download build
212-
if: needs.build.outputs.BUILD_SUCCESS == 'true'
213-
needs: build
214-
runs-on: ubuntu-latest
215-
container: fedora:latest
216-
steps:
217-
- name: Install dependencies
212+
- name: Download logs
213+
# if: steps.build.outcome == 'failure'
218214
run: |
219-
dnf install -y \
220-
copr-cli \
221-
nodejs \
222-
zip
215+
# get the active chroots of the project
216+
package=${{ github.event.repository.name }}
217+
copr-cli \
218+
get \
219+
${{ inputs.copr_ownername }}/${package}
220+
221+
# https://download.copr.fedorainfracloud.org/results/lizardbyte/pulls:pr:4116/fedora-41-aarch64/09346409-Sunshine/builder-live.log.gz
222+
download_base="https://download.copr.fedorainfracloud.org/results/${{ inputs.copr_ownername }}"
223+
url="${download_base}/${BUILD_CHANNEL}"
223224
224225
- name: Download build
226+
id: download-build
227+
if: steps.build.outcome == 'success'
225228
run: |
226229
mkdir -p artifacts
227230
copr-cli \
228231
download-build \
229232
--dest . \
230233
--rpms \
231-
${{ needs.build.outputs.BUILD_ID }}
234+
${{ steps.build.outputs.BUILD_ID }}
232235
233236
- name: Setup gh actions artifact client
237+
id: download-build-client
238+
if: steps.download-build.outcome == 'success'
234239
uses: lhotari/gh-actions-artifact-client@v2
235240

236241
- name: Upload artifacts
242+
if: steps.download-build-client.outcome == 'success'
237243
run: |
238244
find . -type f -name "*.rpm" ! -name "*.src.rpm" | while read -r file; do
239245
name=build-$(basename "$file")

0 commit comments

Comments
 (0)