From f1c5748e850c447c4bae7a59d1a639718eed24ff Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 21 Dec 2023 11:15:36 +0100 Subject: [PATCH] ci: support no secrets for dependabot (#3473) --- .ci/scripts/jboss-pull.sh | 20 +++++++++++++++++++- .github/workflows/main.yml | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.ci/scripts/jboss-pull.sh b/.ci/scripts/jboss-pull.sh index 60ef187f62..b867d4d387 100755 --- a/.ci/scripts/jboss-pull.sh +++ b/.ci/scripts/jboss-pull.sh @@ -3,6 +3,24 @@ # Bash strict mode set -eo pipefail +# Retry the given command for the given times. +retry() { + local retries=$1 + shift + local count=0 + until "$@"; do + exit=$? + wait=$((2 ** count)) + count=$((count + 1)) + if [ $count -lt "$retries" ]; then + sleep $wait + else + return $exit + fi + done + return 0 +} + ## This script is used by the CI to be able to re-tag the docker images ## to use the official docker namespace. ## Or by an Elastic employee to configure the docker images as needed. @@ -10,7 +28,7 @@ while read -r i ; do [[ -z $i ]] && continue name="${i##*/}" echo "::group::$name" - docker pull docker.elastic.co/observability-ci/$name --platform linux/amd64 + retry 3 docker pull --platform linux/amd64 docker.elastic.co/observability-ci/$name docker tag docker.elastic.co/observability-ci/$name $i echo "::endgroup::" done < .ci/scripts/jboss-docker-images.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7d6f8b245b..0d17a91dbc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -325,7 +325,8 @@ jobs: name: JBoss integration tests runs-on: ubuntu-latest needs: build - if: github.event_name != 'pull_request' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false + # If no PR event or if a PR event that's caused by a non-fork and non dependabot actor + if: github.event_name != 'pull_request' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' ) steps: - uses: actions/checkout@v4 - uses: elastic/apm-pipeline-library/.github/actions/docker-login@current