-
Notifications
You must be signed in to change notification settings - Fork 39
Add post-release Maven Central resolution check #1435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vikrantpuppala
wants to merge
1
commit into
main
Choose a base branch
from
feat/post-publish-resolution-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| name: Post-release resolution check | ||
|
|
||
| # Resolves the just-released artifacts from Maven Central with a fresh | ||
| # Maven cache, exactly as a downstream consumer would. Catches the class | ||
| # of bug that hit 3.3.2 (#1431) where the published POM was structurally | ||
| # valid (Sonatype accepted it) but referenced an unpublished coordinate, | ||
| # making the artifact unusable for any consumer. | ||
| # | ||
| # Runs on a public GitHub-hosted runner because protected runners cannot | ||
| # reach repo1.maven.org. No secrets needed — the test only reads from | ||
| # Maven Central. | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Version to check (e.g. 3.3.3). Defaults to the GitHub release tag minus the 'v' prefix." | ||
| required: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| resolve-from-central: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Determine version | ||
| id: v | ||
| env: | ||
| INPUT_VERSION: ${{ inputs.version }} | ||
| RELEASE_TAG: ${{ github.event.release.tag_name }} | ||
| run: | | ||
| if [[ -n "${INPUT_VERSION:-}" ]]; then | ||
| VERSION="${INPUT_VERSION#v}" | ||
| else | ||
| VERSION="${RELEASE_TAG#v}" | ||
| fi | ||
| if [[ -z "$VERSION" ]]; then | ||
| echo "::error::No version supplied via input or release tag." | ||
| exit 1 | ||
| fi | ||
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Set up JDK | ||
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | ||
| with: | ||
| java-version: 11 | ||
| distribution: temurin | ||
|
|
||
| # Maven Central's sync from the upload-accepted state to | ||
| # repo1.maven.org availability is typically a few minutes but can | ||
| # take up to ~1 hour. Poll the index until both coordinates are | ||
| # visible before running resolution. | ||
| - name: Wait for Maven Central availability | ||
| env: | ||
| VERSION: ${{ steps.v.outputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
| UBER_URL="https://repo1.maven.org/maven2/com/databricks/databricks-jdbc/${VERSION}/databricks-jdbc-${VERSION}.pom" | ||
| THIN_URL="https://repo1.maven.org/maven2/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}.pom" | ||
|
|
||
| for url in "$UBER_URL" "$THIN_URL"; do | ||
| for i in $(seq 1 60); do | ||
| code=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 30 "$url" || echo "000") | ||
| if [[ "$code" == "200" ]]; then | ||
| echo "Visible on Central: $url" | ||
| break | ||
| fi | ||
| if [[ "$i" == "60" ]]; then | ||
| echo "::error::Timed out waiting for $url (last HTTP=$code after 60 minutes)." | ||
| exit 1 | ||
| fi | ||
| echo " attempt $i: HTTP $code (sleeping 60s)" | ||
| sleep 60 | ||
| done | ||
| done | ||
|
|
||
| - name: Resolve from Central with a fresh cache | ||
| env: | ||
| VERSION: ${{ steps.v.outputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
| PROBE_DIR=$(mktemp -d) | ||
| mkdir -p "${PROBE_DIR}/probe/src/main/java/probe" | ||
|
|
||
| cat > "${PROBE_DIR}/probe/pom.xml" <<EOF | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>probe</groupId> | ||
| <artifactId>probe</artifactId> | ||
| <version>1.0</version> | ||
| <packaging>jar</packaging> | ||
| <properties> | ||
| <maven.compiler.source>11</maven.compiler.source> | ||
| <maven.compiler.target>11</maven.compiler.target> | ||
| </properties> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.databricks</groupId> | ||
| <artifactId>databricks-jdbc</artifactId> | ||
| <version>${VERSION}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.databricks</groupId> | ||
| <artifactId>databricks-jdbc-thin</artifactId> | ||
| <version>${VERSION}</version> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> | ||
| EOF | ||
|
|
||
| cat > "${PROBE_DIR}/probe/src/main/java/probe/Probe.java" <<'EOF' | ||
| package probe; | ||
| public class Probe { | ||
| public static void main(String[] args) throws Exception { | ||
| Class.forName("com.databricks.client.jdbc.Driver"); | ||
| System.out.println("Probe OK: driver class loaded from " + | ||
| Class.forName("com.databricks.client.jdbc.Driver") | ||
| .getProtectionDomain().getCodeSource().getLocation()); | ||
| } | ||
| } | ||
| EOF | ||
|
|
||
| cd "${PROBE_DIR}/probe" | ||
| # -Dmaven.repo.local=fresh forces resolution from the network. | ||
| # Default ~/.m2/settings.xml on ubuntu-latest is empty — Maven | ||
| # goes straight to Central. | ||
| mvn -B -Dmaven.repo.local="${PROBE_DIR}/m2" dependency:resolve compile | ||
| mvn -B -Dmaven.repo.local="${PROBE_DIR}/m2" -q exec:java -Dexec.mainClass=probe.Probe | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will there be no issue accessing this Url from our runners?