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

Migrate build system to gradle #1592

Merged

Conversation

rs-eliatra
Copy link
Contributor

@rs-eliatra rs-eliatra commented Jan 31, 2022

Description

[Describe what this change achieves]
1. Category
Maintenance

2. Github Issue
#1121

3. Description of changes

  • gradle script configured to cover whole build
  • configuration around gradle plugins

4. Why these changes are required?
OpenSearch use Gradle to build and package OpenSearch, and also to orchestrate tests and another tasks.

Currently there is a mix inside OpenSearch Security Plugin:

  • build / tests by maven
  • Gradle is used to build .rpn and .deb packages
  • CD script uses both: maven & gradle

5. What is the old behavior before changes and new behavior after changes?

Testing

  • Unit Tests
    • ./gradlew test
  • Manual Testing:
    • ./gradlew clean build testsJar --no-daemon -Dbuild.snapshot=false -x test

      The artifacts generated in build:
      * opensearch-security-1.3.0.0.jar
      * opensearch-security-1.3.0.0.jar

      The artifacts generated in build/distributions:
      * opensearch-security-1.3.0.0.zip
      * opensearch-security-1.3.0.0.zip.sha512
      * opensearch-security-1.3.1.0-securityadmin-standalone.tar.gz
      * opensearch-security-1.3.1.0-securityadmin-standalone.zip

    • Installed security plugin generated by Gradle on OpenSearch.

    • The artifacts generated by gradle were compared with artifacts generated by Maven

/comparing$ diff -q -r maven-opensearch-security-1.3.0.0-SNAPSHOT-jar gradle-opensearch-security-1.3.0.0-SNAPSHOT-jar
Files maven-opensearch-security-1.3.0.0-SNAPSHOT-jar/git.properties and gradle-opensearch-security-1.3.0.0-SNAPSHOT-jar/git.properties differ
Files maven-opensearch-security-1.3.0.0-SNAPSHOT-jar/META-INF/MANIFEST.MF and gradle-opensearch-security-1.3.0.0-SNAPSHOT-jar/META-INF/MANIFEST.MF differ
Only in maven-opensearch-security-1.3.0.0-SNAPSHOT-jar/META-INF: maven
comparing$ diff -q -r gradle-opensearch-security-1.3.0.0-SNAPSHOT-tests maven-opensearch-security-1.3.0.0-SNAPSHOT-tests
Files gradle-opensearch-security-1.3.0.0-SNAPSHOT-tests/META-INF/MANIFEST.MF and maven-opensearch-security-1.3.0.0-SNAPSHOT-tests/META-INF/MANIFEST.MF differ
Only in maven-opensearch-security-1.3.0.0-SNAPSHOT-tests/META-INF: maven

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@rs-eliatra rs-eliatra requested a review from a team January 31, 2022 14:56
@rs-eliatra rs-eliatra changed the title automatic conversion using 'gradle init' Migrate build system to gradle Jan 31, 2022
@rs-eliatra rs-eliatra force-pushed the migrate-build-system-to-gradle#1533 branch 2 times, most recently from 1d78eee to b774290 Compare January 31, 2022 16:57
@rs-eliatra rs-eliatra force-pushed the migrate-build-system-to-gradle#1533 branch from 01e4783 to d8ce201 Compare January 31, 2022 18:37
@davidlago
Copy link

Linking #1505 as this PR also moves to Gradle 7

@rs-eliatra rs-eliatra force-pushed the migrate-build-system-to-gradle#1533 branch 12 times, most recently from 4e94fad to b635789 Compare February 3, 2022 17:35
davidlago
davidlago previously approved these changes Feb 8, 2022
@peternied peternied self-requested a review February 9, 2022 19:46
dblock
dblock previously approved these changes Feb 10, 2022
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

👍

.github/workflows/ci.yml Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
peternied
peternied previously approved these changes Feb 10, 2022
@davidlago
Copy link

@rs-eliatra please address the merge conflicts and the questions in the PR and we are good to go. Thanks for the help!

@rs-eliatra rs-eliatra dismissed stale reviews from peternied, dblock, and davidlago via 37c7ba6 February 11, 2022 17:59
@rs-eliatra rs-eliatra force-pushed the migrate-build-system-to-gradle#1533 branch 2 times, most recently from 37c7ba6 to 7314442 Compare February 11, 2022 18:04
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
…ndencies

Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
…ndencies fix

Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
…ndError

Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
@rs-eliatra rs-eliatra force-pushed the migrate-build-system-to-gradle#1533 branch from cd3720b to 891c2a5 Compare February 14, 2022 22:18
@peternied
Copy link
Member

@rs-eliatra I've retriggered the CI, it looks like there is a CVE on one of the dependencies

Path to vulnerable library: /home/wss-scanner/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.3.13/d2a6c3372dd337e08144f9f49f386b8ec7a8080d/spring-core-5.3.13.jar

Suggested fix

Upgrade to version: org.springframework:spring-core:5.2.19, 5.3.14

Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
@rs-eliatra rs-eliatra force-pushed the migrate-build-system-to-gradle#1533 branch from 4d7b453 to 9eed836 Compare February 15, 2022 07:02
Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
@davidlago
Copy link

@rs-eliatra guava 0.29 is still being brought in transiently:

image

Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Great work!

@davidlago davidlago merged commit 21dd8ce into opensearch-project:main Feb 15, 2022
@DarshitChanpura
Copy link
Member

Code Coverage report seems to have not been printed...we should look into it

@rs-eliatra rs-eliatra deleted the migrate-build-system-to-gradle#1533 branch April 13, 2022 08:56
wuychn pushed a commit to ochprince/security that referenced this pull request Mar 16, 2023
Conversion to Gradle

Signed-off-by: rs-eliatra <rafal.stobiecki@eliatra.com>
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.

5 participants