Skip to content

Commit f56a1ea

Browse files
Route Maven through Moderne Artifactory cache to avoid HTTP 429 (#1096)
* Route Maven through Moderne Artifactory cache to avoid HTTP 429 Maven Central has started rate-limiting parallel test resolution (HTTP 429), failing CI across recipe repos. Inline the same mirror configuration used by moderneinc/rewrite-java-security: route `mirrorOf: "*"` through artifactory.moderne.ninja's moderne-cache-3 via s4u/maven-settings-action, and set REWRITE_GRADLE_MIRROR_* on the build/publish steps so Gradle resolution goes through the cache too. This replaces the call into openrewrite/gh-automation's reusable ci-gradle.yml / publish-gradle.yml workflows with their composite actions called inline, which is the bypass pattern the reusable workflow explicitly recommends for consumers that need a mirror. * Pin jspecify version in MigrateFromJavaxAnnotationApi recipe The five other JSpecify recipes in this file pin to 1.0.0; this one used `latest.release`, which now resolves to `1.0.0.redhat-00001` through the Moderne Artifactory cache mirror, breaking JSpecifyBestPracticesTest. --------- Co-authored-by: Tim te Beek <tim@moderne.io>
1 parent d5db0d7 commit f56a1ea

3 files changed

Lines changed: 93 additions & 24 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,41 @@ concurrency:
2020

2121
jobs:
2222
build:
23-
uses: openrewrite/gh-automation/.github/workflows/ci-gradle.yml@main
24-
with:
25-
java_version: |
26-
25
27-
21
28-
secrets:
29-
gradle_enterprise_access_key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
30-
sonatype_username: ${{ secrets.SONATYPE_USERNAME }}
31-
sonatype_token: ${{ secrets.SONATYPE_TOKEN}}
32-
ossrh_signing_key: ${{ secrets.OSSRH_SIGNING_KEY }}
33-
ossrh_signing_password: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
34-
OPS_GITHUB_ACTIONS_WEBHOOK: ${{ secrets.OPS_GITHUB_ACTIONS_WEBHOOK }}
23+
runs-on: ubuntu-latest
24+
if: github.event_name != 'schedule' || github.repository_owner == 'openrewrite' || github.repository_owner == 'moderneinc'
25+
steps:
26+
- uses: openrewrite/gh-automation/.github/actions/setup@main
27+
with:
28+
java_version: |
29+
25
30+
21
31+
develocity_access_key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
32+
33+
# Route Maven resolution through Moderne's Artifactory cache to avoid
34+
# Maven Central rate-limiting (HTTP 429) under parallel test load.
35+
- uses: s4u/maven-settings-action@v4.0.0
36+
with:
37+
mirrors: '[{"id": "moderne-cache", "name": "Moderne Artifactory Cache", "mirrorOf": "*", "url": "https://artifactory.moderne.ninja/artifactory/moderne-cache-3/"}]'
38+
servers: ${{ secrets.ARTIFACTORY_USERNAME != '' && format('[{{"id":"moderne-cache","username":"{0}","password":"{1}"}}]', secrets.ARTIFACTORY_USERNAME, secrets.ARTIFACTORY_PASSWORD) || '[]' }}
39+
40+
- uses: openrewrite/gh-automation/.github/actions/build@main
41+
env:
42+
REWRITE_GRADLE_MIRROR_URL: https://artifactory.moderne.ninja/artifactory/moderne-cache-3/
43+
REWRITE_GRADLE_MIRROR_USERNAME: ${{ secrets.AST_PUBLISH_USERNAME }}
44+
REWRITE_GRADLE_MIRROR_PASSWORD: ${{ secrets.AST_PUBLISH_PASSWORD }}
45+
46+
- if: failure() && github.event_name == 'schedule' && (github.repository_owner == 'openrewrite' || github.repository_owner == 'moderneinc')
47+
uses: openrewrite/gh-automation/.github/actions/slack-failure@main
48+
with:
49+
webhook: ${{ secrets.OPS_GITHUB_ACTIONS_WEBHOOK }}
50+
51+
- if: >
52+
github.event_name != 'pull_request' &&
53+
github.ref == 'refs/heads/main' &&
54+
(github.repository_owner == 'openrewrite' || github.repository_owner == 'moderneinc')
55+
uses: openrewrite/gh-automation/.github/actions/publish-snapshots@main
56+
with:
57+
sonatype_username: ${{ secrets.SONATYPE_USERNAME }}
58+
sonatype_token: ${{ secrets.SONATYPE_TOKEN }}
59+
ossrh_signing_key: ${{ secrets.OSSRH_SIGNING_KEY }}
60+
ossrh_signing_password: ${{ secrets.OSSRH_SIGNING_PASSWORD }}

.github/workflows/publish.yml

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,59 @@ concurrency:
1111
group: publish-${{ github.ref }}
1212
cancel-in-progress: false
1313

14+
env:
15+
GRADLE_SWITCHES: --console=plain --info --stacktrace --warning-mode=all --no-daemon
16+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
17+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_TOKEN }}
18+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_SIGNING_KEY }}
19+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
20+
1421
jobs:
1522
release:
16-
uses: openrewrite/gh-automation/.github/workflows/publish-gradle.yml@main
17-
with:
18-
java_version: |
19-
25
20-
21
21-
secrets:
22-
gradle_enterprise_access_key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
23-
sonatype_username: ${{ secrets.SONATYPE_USERNAME }}
24-
sonatype_token: ${{ secrets.SONATYPE_TOKEN}}
25-
ossrh_signing_key: ${{ secrets.OSSRH_SIGNING_KEY }}
26-
ossrh_signing_password: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: openrewrite/gh-automation/.github/actions/setup@main
26+
with:
27+
java_version: |
28+
25
29+
21
30+
develocity_access_key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
31+
32+
# Route Maven resolution through Moderne's Artifactory cache to avoid
33+
# Maven Central rate-limiting (HTTP 429) under parallel test load.
34+
- uses: s4u/maven-settings-action@v4.0.0
35+
with:
36+
mirrors: '[{"id": "moderne-cache", "name": "Moderne Artifactory Cache", "mirrorOf": "*", "url": "https://artifactory.moderne.ninja/artifactory/moderne-cache-3/"}]'
37+
servers: ${{ secrets.ARTIFACTORY_USERNAME != '' && format('[{{"id":"moderne-cache","username":"{0}","password":"{1}"}}]', secrets.ARTIFACTORY_USERNAME, secrets.ARTIFACTORY_PASSWORD) || '[]' }}
38+
39+
- name: publish-candidate
40+
if: contains(github.ref, '-rc.')
41+
env:
42+
REWRITE_GRADLE_MIRROR_URL: https://artifactory.moderne.ninja/artifactory/moderne-cache-3/
43+
REWRITE_GRADLE_MIRROR_USERNAME: ${{ secrets.AST_PUBLISH_USERNAME }}
44+
REWRITE_GRADLE_MIRROR_PASSWORD: ${{ secrets.AST_PUBLISH_PASSWORD }}
45+
run: |
46+
./gradlew \
47+
${{ env.GRADLE_SWITCHES }} \
48+
-Preleasing \
49+
-Prelease.disableGitChecks=true \
50+
-Prelease.useLastTag=true \
51+
candidate \
52+
publish \
53+
closeAndReleaseSonatypeStagingRepository
54+
55+
- name: publish-release
56+
if: (!contains(github.ref, '-rc.'))
57+
env:
58+
REWRITE_GRADLE_MIRROR_URL: https://artifactory.moderne.ninja/artifactory/moderne-cache-3/
59+
REWRITE_GRADLE_MIRROR_USERNAME: ${{ secrets.AST_PUBLISH_USERNAME }}
60+
REWRITE_GRADLE_MIRROR_PASSWORD: ${{ secrets.AST_PUBLISH_PASSWORD }}
61+
run: |
62+
./gradlew \
63+
${{ env.GRADLE_SWITCHES }} \
64+
-Preleasing \
65+
-Prelease.disableGitChecks=true \
66+
-Prelease.useLastTag=true \
67+
final \
68+
publish \
69+
closeAndReleaseSonatypeStagingRepository

src/main/resources/META-INF/rewrite/jspecify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ recipeList:
6262
- org.openrewrite.java.dependencies.AddDependency:
6363
groupId: org.jspecify
6464
artifactId: jspecify
65-
version: latest.release
65+
version: 1.0.0
6666
onlyIfUsing: javax.annotation.*ull*
6767
acceptTransitive: true
6868
- org.openrewrite.java.migrate.jspecify.MoveAnnotationToArrayType:

0 commit comments

Comments
 (0)