Skip to content

Commit

Permalink
fix neglected push triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreylimnardy committed Oct 17, 2024
1 parent 00aba42 commit f7fed5e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/template/prepare-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
run: "./hack/await_image.sh"
env:
GITHUB_TOKEN: "${{ inputs.github-token }}"
COMMIT_SHA: "${{ github.event.pull_request.head.sha }}"
TRIGGER: "${{ github.event.pull_request.head.sha }}"
QUERY_INTERVAL: 30
IMAGE_REPO: "europe-docker.pkg.dev/kyma-project/dev/telemetry-manager"

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/branch-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ jobs:

# wait for the build to succeed so that the manager image is available
- name: Wait for the image to be available in the registry
run: "./hack/await_image.sh ${{ github.ref_name }}"
run: "./hack/await_image.sh"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
IMAGE_REPO: "europe-docker.pkg.dev/kyma-project/prod/telemetry-manager"
TRIGGER: "${{ github.ref_name }}"
QUERY_INTERVAL: 30

# save gardener kubeconfig to a temp file in order to pass it to the command
- name: Save serviceaccount to file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-lifecycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: "./hack/await_image.sh"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
COMMIT_SHA: "${{ github.event.pull_request.head.sha }}"
TRIGGER: "${{ github.event.pull_request.head.sha }}"
QUERY_INTERVAL: 30
IMAGE_REPO: "europe-docker.pkg.dev/kyma-project/dev/telemetry-manager"

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:

# wait for the build to succeed so that the manager image is available
- name: Wait for the image to be available in the registry
run: "./hack/await_image.sh ${{ github.ref_name }}"
run: "./hack/await_image.sh"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
IMAGE_REPO: "europe-docker.pkg.dev/kyma-project/prod/telemetry-manager"
TRIGGER: "${{ github.ref_name }}"
QUERY_INTERVAL: 30

- name: Install tools
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions hack/await_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -o pipefail # prevents errors in a pipeline from being masked
# Expected variables:
# IMAGE_REPO - binary image repository
# GITHUB_TOKEN - github token
# COMMIT_SHA - commit SHA which triggered the workflow
# TRIGGER - event which triggered the workflow, for PRs it is the commit SHA, for push events it is the GITHUB_REF
# QUERY_INTERVAL - time to wait between queries in seconds

PROTOCOL=docker://
Expand All @@ -18,14 +18,14 @@ PROTOCOL=docker://
TIMEOUT=900
START_TIME=$SECONDS

until $(skopeo list-tags ${PROTOCOL}${IMAGE_REPO} | jq '.Tags|any(. == env.COMMIT_SHA)'); do
until $(skopeo list-tags ${PROTOCOL}${IMAGE_REPO} | jq '.Tags|any(. == env.TRIGGER)'); do
if (( SECONDS - START_TIME > TIMEOUT )); then
echo "Timeout reached: ${IMAGE_REPO}:${COMMIT_SHA} not found within $(( TIMEOUT/60 )) minutes"
exit 1
fi
echo "Waiting for binary image: ${IMAGE_REPO}:${COMMIT_SHA}"
echo "Commit SHA: $COMMIT_SHA"
echo "Waiting for binary image: ${IMAGE_REPO}:${TRIGGER}"
echo "Trigger: $TRIGGER"
sleep "$QUERY_INTERVAL"
done

echo "Binary image: ${IMAGE_REPO}:${COMMIT_SHA} available"
echo "Binary image: ${IMAGE_REPO}:${TRIGGER} available"

0 comments on commit f7fed5e

Please sign in to comment.