Skip to content

Commit

Permalink
Minor CI lint/notice steps improvement (#3089)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
artem-shelkovnikov and elasticmachine authored Jan 9, 2025
1 parent 02fa274 commit c664243
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
1 change: 1 addition & 0 deletions .buildkite/run_linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if is_pr; then
echo "Nothing to be fixed by autoformat"
exit 0
else
git --no-pager diff
echo "linting errors are fixed, pushing the diff"
export GH_TOKEN="$VAULT_GITHUB_TOKEN"

Expand Down
1 change: 1 addition & 0 deletions .buildkite/run_notice_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ make notice
if [ -z "$(git status --porcelain | grep NOTICE.txt)" ]; then
exit 0
else
git --no-pager diff
if is_pr; then
export GH_TOKEN="$VAULT_GITHUB_TOKEN"

Expand Down
28 changes: 5 additions & 23 deletions .buildkite/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,9 @@ retry() {
}

is_pr() {
[[ "${BUILDKITE_PULL_REQUEST-}" ]] && return
false
}

retry() {
local retries=$1; shift
local delay=$1; shift
local attempts=1

until "$@"; do
retry_exit_status=$?
echo "Exited with $retry_exit_status" >&2
if (( retries == "0" )); then
return $retry_exit_status
elif (( attempts == retries )); then
echo "Failed $attempts retries" >&2
return $retry_exit_status
else
echo "Retrying $((retries - attempts)) more times..." >&2
attempts=$((attempts + 1))
sleep "$delay"
fi
done
if [ -z "$BUILDKITE_PULL_REQUEST" ] || [ "$BUILDKITE_PULL_REQUEST" = "false"]; then
return 1 # false
else
return 0 # true
fi
}

0 comments on commit c664243

Please sign in to comment.