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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a0f68e2
automatic conversion using 'gradle init'
rs-eliatra Jan 15, 2022
5fd84a3
configure gradle plugins and resources after automatic migration to g…
rs-eliatra Jan 21, 2022
682aec9
configure git plugin to contains only needed fields and exclude KEYS …
rs-eliatra Jan 21, 2022
3bdb508
configure dependencies and configure build to prepare artifacts
rs-eliatra Jan 24, 2022
f9703ed
provide more replacement for maven plugins and configure jar and test…
rs-eliatra Jan 24, 2022
3ac0577
configure 'test' plugin
rs-eliatra Jan 24, 2022
eab5ac8
configure build to package correct dependencies into seucirty admin s…
rs-eliatra Jan 25, 2022
b163a25
set java version in gradle script to 1.8 as it was for maven
rs-eliatra Jan 25, 2022
130b7b8
customize manifest
rs-eliatra Jan 29, 2022
1da3a7a
configure checkstyle gradle plugin
rs-eliatra Jan 29, 2022
41a25a1
add 'taskinfo' plugin to give possibility of printing gradle task graph
rs-eliatra Jan 29, 2022
786eb74
configure build to generate 'rpm' and 'deb' artifacts
rs-eliatra Jan 29, 2022
9e38638
change README.md and DEVELOPER_GUIDE.md after migration to gradle
rs-eliatra Jan 29, 2022
56fbb26
rename checkstyle.xml to original name: sun_checks.xml
rs-eliatra Jan 29, 2022
a0d0179
fixup! automatic conversion using 'gradle init'
rs-eliatra Jan 29, 2022
9c04bbc
update dependencies in gradle script according to latest pom dependen…
rs-eliatra Jan 29, 2022
374f5e6
migrate CI/CD scripts to use: 'gradle'
rs-eliatra Jan 29, 2022
54233ce
remove '--no-daemon' from commands
rs-eliatra Jan 31, 2022
01691cb
add kafka clients test dependency
rs-eliatra Jan 31, 2022
c6695f6
build fix test
rs-eliatra Feb 1, 2022
713c3fa
add something to build.gradle to check if hash is changing
rs-eliatra Feb 2, 2022
f8feca5
Add missing plugin: com.google.osdetector and use it's output in depe…
rs-eliatra Feb 2, 2022
d3cadda
Add missing plugin: com.google.osdetector and use it's output in depe…
rs-eliatra Feb 2, 2022
714ba4e
Set OPENDISTRO_SECURITY_TEST_OPENSSL_OPT in CI script
rs-eliatra Feb 2, 2022
5eab5e6
change CI job logging
rs-eliatra Feb 2, 2022
c44165c
force to use scala-library as testImplementation to fix NoClassDefFou…
rs-eliatra Feb 3, 2022
368965f
configure test to retry for CI job
rs-eliatra Feb 3, 2022
f5b2b54
setup gradle cache (CI)
rs-eliatra Feb 5, 2022
46c4eec
resolve conflicts and address review feedback
rs-eliatra Feb 11, 2022
891c2a5
resolve conflicts and address review feedback v2
rs-eliatra Feb 11, 2022
9eed836
fix dependencies after conflict
rs-eliatra Feb 15, 2022
64528b9
upgrade spring-core to 5.3.14
rs-eliatra Feb 15, 2022
e59a7c6
configure guava to use 30.0-jre also in buildscript (checkstyle plugin)
rs-eliatra Feb 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '*'

env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
GRADLE_OPTS: -Dhttp.keepAlive=false

jobs:
build:
Expand All @@ -22,22 +22,25 @@ jobs:
- name: Checkout security
uses: actions/checkout@v2

- name: Cache Maven packages
uses: actions/cache@v1
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build
run: |
mvn -B clean package -Padvanced -DskipTests
artifact_zip=`ls $(pwd)/target/releases/opensearch-security-*.zip | grep -v admin-standalone`
./gradlew build buildDeb buildRpm --no-daemon -ParchivePath=$artifact_zip -Dbuild.snapshot=false
./gradlew clean build -Dbuild.snapshot=false -x test
artifact_zip=`ls $(pwd)/build/distributions/opensearch-security-*.zip | grep -v admin-standalone`
./gradlew build buildDeb buildRpm -ParchivePath=$artifact_zip -Dbuild.snapshot=false -x test
mkdir artifacts
cp $artifact_zip artifacts/
cp gradle-build/distributions/*.deb artifacts/
cp gradle-build/distributions/*.rpm artifacts/
cp build/distributions/*.deb artifacts/
cp build/distributions/*.rpm artifacts/
zip -r artifacts.zip artifacts
echo "TAG_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- opendistro-*

env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
GRADLE_OPTS: -Dhttp.keepAlive=false

jobs:
build:
Expand All @@ -36,24 +36,28 @@ jobs:
with:
languages: java

- name: Cache Maven packages
uses: actions/cache@v1
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-


- name: Checkstyle
run: mvn -B checkstyle:checkstyle
run: ./gradlew clean checkstyleMain checkstyleTest

- name: Package
run: mvn -B clean package -Padvanced -DskipTests
run: ./gradlew clean build -Dbuild.snapshot=false -x test

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

- name: Test
run: OPENDISTRO_SECURITY_TEST_OPENSSL_OPT=true mvn -B test
run: OPENDISTRO_SECURITY_TEST_OPENSSL_OPT=true ./gradlew test

- name: Coverage
uses: codecov/codecov-action@v1
Expand All @@ -64,4 +68,4 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: artifacts
path: target/releases/
path: build/distributions/
6 changes: 3 additions & 3 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ The `curl localhost:9200` call from before should also succeed now. Kill the ser
First create a fork of this repo and clone it locally. Changing into the directory of the newly cloned repository, run the following to build the project:

```bash
mvn -B package -Padvanced -DskipTests
./gradlew clean assemble
peternied marked this conversation as resolved.
Show resolved Hide resolved
```

Install the built plugin into the OpenSearch server:

```bash
export OPENSEARCH_SECURITY_HOME=$OPENSEARCH_HOME/plugins/opensearch-security
cp target/releases/opensearch-security-1.3.0.0-SNAPSHOT.zip $OPENSEARCH_SECURITY_HOME
cp build/distributions/opensearch-security-1.3.0.0-SNAPSHOT.zip $OPENSEARCH_SECURITY_HOME
cd $OPENSEARCH_SECURITY_HOME
unzip opensearch-security-1.3.0.0-SNAPSHOT.zip
rm opensearch-security-1.3.0.0-SNAPSHOT.zip
Expand Down Expand Up @@ -115,7 +115,7 @@ curl -XGET https://localhost:9200/_plugins/_security/authinfo -u 'admin:admin' -

## Using IntelliJ IDEA

Launch IntelliJ IDEA, choose **Import Project**, and select the `pom.xml` file in the root of this package.
Launch IntelliJ IDEA, choose **Project from Existing Sources**, and select directory with Gradle build script (`build.gradle`).

## Submitting Changes

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ You can also see the [developer guide](https://github.com/opensearch-project/sec

Run all tests:
```bash
mvn clean test
./gradlew clean test
```

Build artifacts (zip, deb, rpm):
```bash
mvn clean package -Padvanced -DskipTests
artifact_zip=`ls $(pwd)/target/releases/opensearch-security-*.zip | grep -v admin-standalone`
./gradlew build buildDeb buildRpm --no-daemon -ParchivePath=$artifact_zip -Dbuild.snapshot=false
./gradlew clean assemble
artifact_zip=`ls $(pwd)/build/distributions/opensearch-security-*.zip | grep -v admin-standalone`
./gradlew buildDeb buildRpm -ParchivePath=$artifact_zip
```

This produces:

```
target/releases/opensearch-security-<VERSION>.zip
gradle-build/distributions/opensearch-security-<VERSION>.deb
gradle-build/distributions/opensearch-security-<VERSION>.rpm
build/releases/opensearch-security-<VERSION>.zip
build/distributions/opensearch-security-<VERSION>.deb
build/distributions/opensearch-security-<VERSION>.rpm
```

## Config hot reloading
Expand Down
Loading