Skip to content

Commit

Permalink
github/workflows : fail test_suite_pr if PR images are not pushed yet
Browse files Browse the repository at this point in the history
Signed-off-by: Shahriyar Jalayeri <[email protected]>
  • Loading branch information
shjala authored and eriknordmark committed Nov 15, 2023
1 parent bcce66b commit f0f05b0
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/eden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f0f05b0

Please sign in to comment.