Skip to content

Commit

Permalink
publish snapshots with a backoff and retry to avoid spurious failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Mar 16, 2024
1 parent 50584be commit b9a4474
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 12 deletions.
20 changes: 19 additions & 1 deletion .github/actions/run-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ inputs:
token:
required: false
description: 'A Github PAT'
attempt-limit:
default: '1'
required: false
description: Number of attempts
attempt-delay:
default: '0'
required: false
description: A delay between attempts in seconds
runs:
using: composite
steps:
Expand Down Expand Up @@ -85,4 +93,14 @@ runs:
JAVA_HOME: ${{ steps.setup-gradle-jdk.outputs.path }}
ORG_GRADLE_PROJECT_org.gradle.java.installations.auto-download: 'false'
shell: bash
run: ./gradlew ${{ inputs.arguments }}
run: |
for ((i=1; i<=${{ inputs.attempt-limit }}; i++)); do
./gradlew $(echo "${{ inputs.arguments }}" | tr -d '\n') && break
if [ $i -lt ${{ inputs.attempt-limit }} ]; then
echo "Attempt $i failed. Retrying in ${{ inputs.attempt-delay }} seconds..."
sleep ${{ inputs.attempt-delay }}
else
echo "All attempts failed."
exit 1
fi
done
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
egress-policy: block
allowed-endpoints: ${{ env.ALLOWED_ENDPOINTS }}
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Prepare GraalVM
if: env.JAVA_VERSION == 'GraalVM'
shell: bash
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
egress-policy: block
allowed-endpoints: ${{ env.ALLOWED_ENDPOINTS }}
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run tests (${{ env.JAVA_VERSION }})
uses: ./.github/actions/run-gradle
with:
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
storage.googleapis.com:443
uploader.codecov.io:443
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Download Tests Results
Expand Down Expand Up @@ -340,7 +340,7 @@ jobs:
errorprone.info:443
lightbend.github.io:443
guava.dev:443
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Publish Snapshot
uses: ./.github/actions/run-gradle
env:
Expand All @@ -350,6 +350,8 @@ jobs:
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
with:
attempt-limit: 3
attempt-delay: 2
java: ${{ env.PUBLISH_JDK }}
token: ${{ secrets.GITHUB_TOKEN }}
arguments: publishToSonatype --no-configuration-cache
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: Wandalen/wretry.action@1a10d4835a1506f513ad8e7488aeb474ab20055c # v1.4.10
timeout-minutes: 5
with:
action: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
action: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with: |
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-submission-pr-submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: Wandalen/wretry.action@1a10d4835a1506f513ad8e7488aeb474ab20055c # v1.4.10
timeout-minutes: 5
with:
action: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
action: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with: |
cache: gradle
distribution: temurin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: Wandalen/wretry.action@1a10d4835a1506f513ad8e7488aeb474ab20055c # v1.4.10
timeout-minutes: 5
with:
action: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
action: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with: |
cache: gradle
distribution: temurin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: Wandalen/wretry.action@1a10d4835a1506f513ad8e7488aeb474ab20055c # v1.4.10
timeout-minutes: 5
with:
action: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
action: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with: |
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
asm = "9.6"
auto-value = "1.10.4"
awaitility = "4.2.0"
awaitility = "4.2.1"
bcel = "6.8.2"
bnd = "7.0.0"
bouncycastle-jdk15on = "1.70"
Expand All @@ -25,7 +25,7 @@ eclipse-collections = "12.0.0.M3"
ehcache3 = "3.10.8"
errorprone-core = "2.26.1"
errorprone-plugin = "3.1.0"
errorprone-support = "0.16.0"
errorprone-support = "0.16.1"
expiring-map = "0.5.11"
fast-filter = "1.0.2"
fastutil = "8.5.13"
Expand All @@ -41,7 +41,7 @@ h2 = "2.2.224"
hamcrest = "2.2"
hazelcast = "5.3.6"
httpclient = "4.5.14"
idea = "1.1.7"
idea = "1.1.8"
jackrabbit = "1.60.0"
jackson = "2.17.0"
jacoco = "0.8.11"
Expand Down

0 comments on commit b9a4474

Please sign in to comment.