-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github/workflows : fail test_suite_pr if PR images are not pushed yet
Signed-off-by: Shahriyar Jalayeri <[email protected]>
- Loading branch information
1 parent
bcce66b
commit f0f05b0
Showing
1 changed file
with
41 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -22,7 +22,48 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
check_pr_publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install curl and jq | ||
run: sudo apt-get update && sudo apt-get install -y curl jq | ||
|
||
- name: Check PR images are published on Docker Hub | ||
run: | | ||
DOCKER_HUB_PATH="evebuild/danger" | ||
# currently we only test amd64 (kvms and xen) with Eden | ||
IMAGE_AMD64_XEN="pr${{ github.event.pull_request.number }}-xen" | ||
IMAGE_AMD64_KVM="pr${{ github.event.pull_request.number }}-kvm" | ||
amd64_xen_res=$(curl -s "https://hub.docker.com/v2/repositories/${DOCKER_HUB_PATH}/tags/${IMAGE_AMD64_XEN}") | ||
amd64_kvm_res=$(curl -s "https://hub.docker.com/v2/repositories/${DOCKER_HUB_PATH}/tags/${IMAGE_AMD64_KVM}") | ||
if [[ "$(echo "$amd64_xen_res" | jq -r '.name')" == "${IMAGE_AMD64_XEN}" && "$(echo "$amd64_kvm_res" | jq -r '.name')" == "${IMAGE_AMD64_KVM}" ]]; then | ||
echo "Docker image ${DOCKER_HUB_PATH}:${IMAGE_AMD64_XEN} and ${DOCKER_HUB_PATH}:${IMAGE_AMD64_KVM} are available on Docker Hub." | ||
exit 0 | ||
else | ||
echo "Docker image ${DOCKER_HUB_PATH}:${IMAGE_AMD64_XEN} and ${DOCKER_HUB_PATH}:${IMAGE_AMD64_KVM} are not available on Docker Hub." | ||
exit 1 | ||
fi | ||
report_pr_publish: | ||
runs-on: ubuntu-latest | ||
needs: check_pr_publish | ||
if: failure() | ||
permissions: | ||
issues: write | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: '⚠️ Docker image is not available on Docker Hub to run Eden PR tests. Please wait for the image to be built and published.' | ||
}) | ||
test_suite_pr: | ||
needs: check_pr_publish | ||
if: github.event.review.state == 'approved' | ||
uses: lf-edge/eden/.github/workflows/[email protected] | ||
with: | ||
|