diff --git a/README.md b/README.md index 6b2638a067..1c73fe5a95 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ OpenSearch Java Client - [Project Resources](#project-resources) - [Code of Conduct](#code-of-conduct) - [User Guide](#user-guide) +- [Snapshot Builds](#snapshot-builds) - [Compatibility with OpenSearch](#compatibility-with-opensearch) - [Security](#security) - [License](#license) @@ -35,7 +36,7 @@ Please see the [USER_GUIDE](USER_GUIDE.md) for code snippets. * [Documentation](https://opensearch.org/docs/latest/clients/java/) * [JavaDoc](https://www.javadoc.io/doc/org.opensearch.client/opensearch-java/latest/index.html) * [Maven Central](https://search.maven.org/artifact/org.opensearch.client/opensearch-java) -* [Snapshot Builds](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/client/opensearch-java/) +* [Snapshot Builds](#snapshot-builds) * Need help? Try [Forums](https://discuss.opendistrocommunity.dev/) * [Project Principles](https://opensearch.org/#principles) * [Contributing to OpenSearch](CONTRIBUTING.md) @@ -52,6 +53,9 @@ This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUC See [User Guide](USER_GUIDE.md). +## Snapshot Builds +The [snapshots builds](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/client/opensearch-java/) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. + ## Compatibility with OpenSearch See [Compatibility](COMPATIBILITY.md). diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 7f482efd60..463e7b0f18 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -260,8 +260,11 @@ publishing { repositories{ if (version.toString().endsWith("SNAPSHOT")) { maven("https://aws.oss.sonatype.org/content/repositories/snapshots/") { - name = "snapshotRepo" - credentials(PasswordCredentials::class) + name = "Snapshots" + credentials { + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_PASSWORD") + } } } maven("${rootProject.buildDir}/repository") { diff --git a/jenkins/publish-snapshot.jenkinsfile b/jenkins/publish-snapshot.jenkinsfile deleted file mode 100644 index 73ffdce604..0000000000 --- a/jenkins/publish-snapshot.jenkinsfile +++ /dev/null @@ -1,50 +0,0 @@ -pipeline { - options { - timeout(time: 30, unit: 'MINUTES') - throttleJobProperty( - categories: [], - limitOneJobWithMatchingParams: false, - maxConcurrentPerNode: 0, - maxConcurrentTotal: 1, - paramsToUseForLimit: '', - throttleEnabled: true, - throttleOption: 'project', - ) - } - agent { - docker { - label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' - image 'opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2' - args '-e JAVA_HOME=/opt/java/openjdk-11' - alwaysPull true - } - } - triggers { - GenericTrigger( - genericVariables: [ - [key: 'ref', value: '$.ref'], - ], - tokenCredentialId: 'jenkins-opensearch-java-generic-webhook-token', - causeString: 'A commit was pushed on opensearch-project/opensearch-java repository main branch causing this workflow to run', - printContributedVariables: false, - printPostContent: false, - regexpFilterText: '$ref', - regexpFilterExpression: '^(refs/heads/main)$' - ) - } - stages { - stage('Publish to Sonatype Snapshots Repo') { - steps { - git url: 'https://github.com/opensearch-project/opensearch-java.git', branch: 'main' - withCredentials([usernamePassword(credentialsId: 'jenkins-sonatype-creds', usernameVariable: 'ORG_GRADLE_PROJECT_snapshotRepoUsername', passwordVariable: 'ORG_GRADLE_PROJECT_snapshotRepoPassword')]) { - sh './gradlew --no-daemon publishPublishMavenPublicationToSnapshotRepoRepository' - } - } - post { - always { - cleanWs disableDeferredWipeout: true, deleteDirs: true - } - } - } - } -}