-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #38 from Luap99/image-ref
Patch the image ref in the VM to point to the right container image and post image urls in PR comments
Showing
3 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
|
||
# Use the latest published version of the cirrus-ci_retrospective container | ||
# to determine the execution context of _this_ workflow run. If it is a | ||
# pull request, post the artifact URLs so it is easy to download and test. | ||
|
||
on: | ||
check_suite: # ALWAYS triggered from the default branch | ||
# Ref: https://help.github.com/en/actions/reference/events-that-trigger-workflows#check-suite-event-check_suite | ||
types: | ||
- completed | ||
|
||
jobs: | ||
comment_image_id: | ||
# Do not execute for other github applications, only works with cirrus-ci | ||
if: github.event.check_suite.app.name == 'Cirrus CI' | ||
runs-on: ubuntu-latest | ||
env: | ||
# This is the last component of the gist URL | ||
# i.e. https://gist.github.com/<user>/<id> | ||
built_images_gist_id: f505b6fb78db279855862e035629f8aa | ||
steps: | ||
- name: Execute latest upstream cirrus-ci_retrospective | ||
uses: docker://quay.io/libpod/cirrus-ci_retrospective:latest | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Writes $GITHUB_WORKSPACE/cirrus-ci_retrospective.json | ||
|
||
- name: Debug cirrus-ci_retrospective JSON | ||
run: jq --indent 4 --color-output . $GITHUB_WORKSPACE/cirrus-ci_retrospective.json | ||
|
||
- name: Load JSON into github workflow output variables | ||
id: retro | ||
run: | | ||
ccirjson=$GITHUB_WORKSPACE/cirrus-ci_retrospective.json | ||
prn=$(jq --raw-output \ | ||
'.[] | select(.name == "'success'") | .build.pullRequest' \ | ||
"$ccirjson") | ||
bid=$(jq --raw-output \ | ||
'.[] | select(.name == "'success'") | .build.id' \ | ||
"$ccirjson") | ||
status=$(jq --raw-output \ | ||
'.[] | select(.name == "'success'") | .status' \ | ||
"$ccirjson") | ||
if [[ -n "$prn" ]] && \ | ||
[[ "$prn" != "null" ]] && \ | ||
[[ $prn -gt 0 ]] && \ | ||
[[ "$status" == "COMPLETED" ]] | ||
then | ||
printf "prn=%s\n" "$prn" >> $GITHUB_OUTPUT | ||
printf "bid=%s\n" "$bid" >> $GITHUB_OUTPUT | ||
printf "is_pr=%s\n" "true" >> $GITHUB_OUTPUT | ||
else | ||
printf "prn=%s\n" "0" >> $GITHUB_OUTPUT | ||
printf "bid=%s\n" "0" >> $GITHUB_OUTPUT | ||
printf "is_pr=%s\n" "false" >> $GITHUB_OUTPUT | ||
fi | ||
- if: steps.retro.outputs.is_pr == 'true' | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- if: steps.retro.outputs.is_pr == 'true' | ||
name: Print Artifacts output | ||
id: artifact_output | ||
run: ./contrib/cirrus/print-artifacts-urls.sh "${{ steps.retro.outputs.bid }}" | ||
|
||
- if: steps.retro.outputs.is_pr == 'true' | ||
name: Count the number of manifest.json files downloaded | ||
uses: thollander/actions-comment-pull-request@v3 | ||
with: | ||
pr-number: ${{ steps.retro.outputs.prn }} | ||
# the tag causes it to replace the comment | ||
comment-tag: artifacts | ||
mode: recreate | ||
message: ${{ steps.artifact_output.outputs.stdout }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
CIRRUS_BUILD_ID=$1 | ||
|
||
if [[ -z "$CIRRUS_BUILD_ID" ]]; then | ||
echo "Requires cirrus build as first argument" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
echo "Image Downloads for id ${CIRRUS_BUILD_ID}:" | ||
echo | ||
echo "| Name | URL |" | ||
echo "| --- | --- |" | ||
|
||
for arch in x86_64 aarch64; do | ||
for end in applehv.raw.zst hyperv.vhdx.zst qemu.qcow2.zst tar; do | ||
name="podman-machine.$arch.$end" | ||
echo "| $name | https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/image_build/image/$name |" | ||
done | ||
done | ||
|
||
echo "| Everything zip | https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/image.zip |" |