Skip to content
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

[release]: Publish opensearch-sdk-java SNAPSHOTs to Maven #3011

Closed
saratvemulapalli opened this issue Dec 15, 2022 · 14 comments · Fixed by opensearch-project/opensearch-sdk-java#312
Assignees
Labels
release v2.5.0 'Issues and PRs related to version v2.5.0'

Comments

@saratvemulapalli
Copy link
Member

saratvemulapalli commented Dec 15, 2022

What is the name of your component?

opensearch-sdk-java

What is the link to your GitHub repo?

https://github.com/opensearch-project/opensearch-sdk-java

Targeted release date

Q1 2023

Where should we publish this component?

Maven

What type of artifact(s) will be generated for this component?

Jars, and XML config.

Have you completed the required reviews including security reviews, UX reviews?

No, we'd like to publish SNAPSHOTs and we'll take go through the review process when we are ready to release.

Have you on-boarded automated security scanning for the GitHub repo associated with this component?

Yes: Mend Renovate
opensearch-project/opensearch-sdk-java#256

Additional context

What are we looking for?
We'd like the SNAPSHOTS to be published nightly.

Here is how the artifacts look like:

%> ls
maven-metadata-local.xml			opensearch-sdk-java-1.0.0-SNAPSHOT.module
opensearch-sdk-java-1.0.0-SNAPSHOT.jar		opensearch-sdk-java-1.0.0-SNAPSHOT.pom
vemsarat@3c22fb88f11c 1.0.0-SNAPSHOT % 

cc: @rishabh6788

@dblock
Copy link
Member

dblock commented Dec 15, 2022

Reading #1182 (comment) it seems like we no longer need to do anything in opensearch-build to enable that?

@gaiksaya
Copy link
Member

Reading #1182 (comment) it seems like we no longer need to do anything in opensearch-build to enable that?

I believe we still will need to give that repo access to the required creds once the infrastructure is in place. Need approval from @bbarani on that GHA approach for publishing snapshots.

@gaiksaya gaiksaya removed the untriaged Issues that have not yet been triaged label Dec 20, 2022
@saratvemulapalli saratvemulapalli added the v2.5.0 'Issues and PRs related to version v2.5.0' label Jan 3, 2023
@bbarani
Copy link
Member

bbarani commented Jan 3, 2023

@gaiksaya I am good with using GHA to publish snapshots.

@gaiksaya
Copy link
Member

gaiksaya commented Jan 5, 2023

I am working on setting up the infra for this process.
Update is same as here #1182 (comment)

@saratvemulapalli Can you or someone confirm that the mentioned gradle task ./gradlew publishAllPublicationsToSnapshotsRepository will take care of publishing snapshots to maven? More details in the issue description mentioned above.
Thanks!

@gaiksaya
Copy link
Member

gaiksaya commented Jan 6, 2023

Hi @saratvemulapalli ,

I also do not see any task to publish snapshots on maven under sdk-java project:

Publishing tasks
----------------
generateMetadataFileForMavenJavaPublication - Generates the Gradle metadata file for publication 'mavenJava'.
generatePomFileForMavenJavaPublication - Generates the Maven POM file for publication 'mavenJava'.
publish - Publishes all publications produced by this project.
publishMavenJavaPublicationToMavenLocal - Publishes Maven publication 'mavenJava' to the local Maven repository.
publishToMavenLocal - Publishes all Maven publications produced by this project to the local Maven cache.

Let me know what command needs to be used. Thanks!

@gaiksaya gaiksaya self-assigned this Jan 6, 2023
@saratvemulapalli
Copy link
Member Author

Thanks @gaiksaya. Looks like publish snapshot task is not available. Let me PR the change.

@gaiksaya
Copy link
Member

gaiksaya commented Jan 7, 2023

The infrastructure set up is merged and ready to publish snapshots. Please update this issue once the gradle task is ready.
Thanks!

@saratvemulapalli
Copy link
Member Author

@gaiksaya the PR[1] is up. You can use publishAllPublicationsToSnapshotsRepository task to publish to snapshots repo. I've put in sonatype creds as system variables. If you expect it differently let me know.

[1] opensearch-project/opensearch-sdk-java#311

@gaiksaya
Copy link
Member

gaiksaya commented Jan 9, 2023

@saratvemulapalli Thanks for the update!

I tried running the above task and as expected it failed due to lack of creds in my local. Question about the group id

I see that it is trying to put the contents under org.opensearch.opensearch-sdk-java. Can you confirm if that is right? Or should it be something like org.opensearch.sdk?

./gradlew publishMavenJavaPublicationToSnapshotsRepository

> Task :compileJava
Note: /Users/gaiksaya/opensearch-project/sarat/src/main/java/org/opensearch/sdk/SDKClient.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :publishMavenJavaPublicationToSnapshotsRepository FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':publishMavenJavaPublicationToSnapshotsRepository'.
> Failed to publish publication 'mavenJava' to repository 'Snapshots'
   > Could not PUT 'https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/opensearch-sdk-java/1.0.0-SNAPSHOT/maven-metadata.xml'. Received status code 401 from server: Unauthorized

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Thanks!

@saratvemulapalli
Copy link
Member Author

saratvemulapalli commented Jan 9, 2023

@gaiksaya thats a good question. I like org.opensearch.sdk as we would have more sdks coming along.
I'll update the group id to be org.opensearch.sdk and it should publish to https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/sdk/opensearch-sdk-java/

@gaiksaya
Copy link
Member

gaiksaya commented Jan 9, 2023

Can you also tell me what should be the trigger for publishing the snapshots? Will add a workflow accordingly.
Thanks!

@saratvemulapalli
Copy link
Member Author

Lets do a cron, twice everyday?

@gaiksaya
Copy link
Member

Sounds good. PR[1] raised for the same.
Thanks!

[1] opensearch-project/opensearch-sdk-java#312

@gaiksaya
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release v2.5.0 'Issues and PRs related to version v2.5.0'
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants