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

[DEVOPS-1751] Pipeline for publishing java sdk to gradle #740

Merged

Conversation

michalchecinski
Copy link
Contributor

Type of change

- [ ] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [x] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Code changes

  • .github/workflows/build-java.yml: Run build on rc and hotfix-rc and on PR. Change Publish task to package.
  • .github/workflows/publish-java.yml Add Publish workflow
  • .github/workflows/version-bump.yml Add Java SDK to version bump workflow
  • languages/java/build.gradle Change name of the package to sdk-secrets. Add https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ as repository to publish.

Before you submit

  • Please add unit tests where it makes sense to do so

@michalchecinski michalchecinski requested a review from a team as a code owner April 26, 2024 10:59
Copy link
Contributor

github-actions bot commented Apr 26, 2024

Logo
Checkmarx One – Scan Summary & Detailsce1aa135-8a69-4008-8ca8-ed4226f20709

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 54 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /publish-java.yml: 60 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 53

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.69%. Comparing base (37dc5d3) to head (9116ee0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #740   +/-   ##
=======================================
  Coverage   58.69%   58.69%           
=======================================
  Files         177      177           
  Lines       11501    11501           
=======================================
  Hits         6751     6751           
  Misses       4750     4750           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mzieniukbw mzieniukbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the intention was to make this Java sdk to be Secrets Manager specific.
See below for my other comments

uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0
with:
arguments: publish
arguments: package
build-root-directory: languages/java
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we need the token here anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! Good catch.

uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0
with:
arguments: publish
arguments: package
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably unsupported by this action, since it's more for setup of gradle, rather than execution.
You need a separate step like: (also there is no "package" in gradle, but there is "build"

    - name: Build Maven
      run: ./gradlew build

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 😃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should publish with java docs (and optionally source code), maybe add:

java {
    withJavadocJar()
    withSourcesJar()
}

java.sourceCompatibility = JavaVersion.VERSION_1_8

publishing {
publications {
maven(MavenPublication) {
groupId = 'com.bitwarden'
artifactId = 'sdk'
artifactId = 'sdk-secrets'
Copy link
Contributor

@mzieniukbw mzieniukbw Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i though this sdk repo is not specific to secrets manager, but it's for everyone ?
I did not know the Bitwarden SDK / this repo is just for secrets manager, so this change make sense now.

Copy link
Contributor

@mimartin12 mimartin12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing from my side that @mzieniukbw hasn't already by brought up 👍

Copy link
Contributor

@mzieniukbw mzieniukbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@michalchecinski michalchecinski enabled auto-merge (squash) May 8, 2024 09:31
mzieniukbw
mzieniukbw previously approved these changes May 10, 2024
@michalchecinski michalchecinski merged commit f01c270 into main May 10, 2024
93 checks passed
@michalchecinski michalchecinski deleted the DEVOPS-1751-Pipeline-for-publishing-Java-SDK-to-Gradle branch May 10, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants