-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 6.x] Add bwc.checkout.align parameter support in gradle-che…
…ck (#452) Signed-off-by: Rishabh Singh <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
168a549
commit 0af56a7
Showing
8 changed files
with
159 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
pipeline { | ||
agent none | ||
stages { | ||
stage('gradle-check') { | ||
steps { | ||
script { | ||
runGradleCheck( | ||
gitRepoUrl: "https://github.com/opensearch-project/OpenSearch", | ||
gitReference: "main", | ||
bwcCheckoutAlign: "true" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
RunGradleCheckBwcAlign_Jenkinsfile.run() | ||
RunGradleCheckBwcAlign_Jenkinsfile.pipeline(groovy.lang.Closure) | ||
RunGradleCheckBwcAlign_Jenkinsfile.echo(Executing on agent [label:none]) | ||
RunGradleCheckBwcAlign_Jenkinsfile.stage(gradle-check, groovy.lang.Closure) | ||
RunGradleCheckBwcAlign_Jenkinsfile.script(groovy.lang.Closure) | ||
RunGradleCheckBwcAlign_Jenkinsfile.runGradleCheck({gitRepoUrl=https://github.com/opensearch-project/OpenSearch, gitReference=main, bwcCheckoutAlign=true}) | ||
runGradleCheck.legacySCM(groovy.lang.Closure) | ||
runGradleCheck.library({[email protected], retriever=null}) | ||
runGradleCheck.usernamePassword({credentialsId=jenkins-gradle-check-s3-aws-credentials, usernameVariable=amazon_s3_access_key, passwordVariable=amazon_s3_secret_key}) | ||
runGradleCheck.usernamePassword({credentialsId=jenkins-gradle-check-s3-aws-resources, usernameVariable=amazon_s3_base_path, passwordVariable=amazon_s3_bucket}) | ||
runGradleCheck.withCredentials([[amazon_s3_access_key, amazon_s3_secret_key], [amazon_s3_base_path, amazon_s3_bucket]], groovy.lang.Closure) | ||
runGradleCheck.sh( | ||
#!/bin/bash | ||
|
||
set -e | ||
set +x | ||
|
||
echo "Git clone: https://github.com/opensearch-project/OpenSearch with ref: main" | ||
rm -rf search | ||
git clone https://github.com/opensearch-project/OpenSearch search | ||
cd search/ | ||
git checkout -f main | ||
git rev-parse HEAD | ||
|
||
echo "Get Major Version" | ||
OS_VERSION=`cat buildSrc/version.properties | grep opensearch | cut -d= -f2 | grep -oE '[0-9.]+'` | ||
JDK_MAJOR_VERSION=`cat buildSrc/version.properties | grep "bundled_jdk" | cut -d= -f2 | grep -oE '[0-9]+' | head -n 1` | ||
OS_MAJOR_VERSION=`echo $OS_VERSION | grep -oE '[0-9]+' | head -n 1` | ||
echo "Version: $OS_VERSION, Major Version: $OS_MAJOR_VERSION" | ||
|
||
echo "Using JAVA $JDK_MAJOR_VERSION" | ||
eval export JAVA_HOME='$JAVA'$JDK_MAJOR_VERSION'_HOME' | ||
|
||
env | grep JAVA | grep HOME | ||
|
||
echo "Gradle clean cache and stop existing gradledaemon" | ||
./gradlew --stop | ||
rm -rf ~/.gradle | ||
|
||
if command -v docker > /dev/null; then | ||
echo "Check existing dockercontainer" | ||
docker ps -a | ||
docker stop `docker ps -qa` > /dev/null 2>&1 || echo | ||
docker rm --force `docker ps -qa` > /dev/null 2>&1 || echo | ||
echo "Stop existing dockercontainer" | ||
docker ps -a | ||
|
||
echo "Check docker-compose version" | ||
docker-compose version | ||
fi | ||
|
||
echo "Check existing processes" | ||
ps -ef | grep [o]pensearch | wc -l | ||
echo "Cleanup existing processes" | ||
kill -9 `ps -ef | grep [o]pensearch | awk '{print $2}'` > /dev/null 2>&1 || echo | ||
ps -ef | grep [o]pensearch | wc -l | ||
|
||
echo "Start gradlecheck" | ||
GRADLE_CHECK_STATUS=0 | ||
./gradlew clean && ./gradlew check -Dtests.coverage=true -Dbwc.checkout.align=true --no-daemon --no-scan || GRADLE_CHECK_STATUS=1 | ||
|
||
if [ "$GRADLE_CHECK_STATUS" != 0 ]; then | ||
echo Gradle Check Failed! | ||
exit 1 | ||
fi | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
RunGradleCheck_Jenkinsfile.echo(Executing on agent [label:none]) | ||
RunGradleCheck_Jenkinsfile.stage(gradle-check, groovy.lang.Closure) | ||
RunGradleCheck_Jenkinsfile.script(groovy.lang.Closure) | ||
RunGradleCheck_Jenkinsfile.runGradleCheck({gitRepoUrl=https://github.com/opensearch-project/OpenSearch, gitReference=main}) | ||
RunGradleCheck_Jenkinsfile.runGradleCheck({gitRepoUrl=https://github.com/opensearch-project/OpenSearch, gitReference=main, bwcCheckoutAlign=false}) | ||
runGradleCheck.legacySCM(groovy.lang.Closure) | ||
runGradleCheck.library({[email protected], retriever=null}) | ||
runGradleCheck.usernamePassword({credentialsId=jenkins-gradle-check-s3-aws-credentials, usernameVariable=amazon_s3_access_key, passwordVariable=amazon_s3_secret_key}) | ||
|
@@ -57,7 +57,7 @@ | |
|
||
echo "Start gradlecheck" | ||
GRADLE_CHECK_STATUS=0 | ||
./gradlew clean && ./gradlew check -Dtests.coverage=true --no-daemon --no-scan || GRADLE_CHECK_STATUS=1 | ||
./gradlew clean && ./gradlew check -Dtests.coverage=true --no-daemon --no-scan || GRADLE_CHECK_STATUS=1 | ||
|
||
if [ "$GRADLE_CHECK_STATUS" != 0 ]; then | ||
echo Gradle Check Failed! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,16 @@ void call(Map args = [:]) { | |
def lib = library(identifier: '[email protected]', retriever: legacySCM(scm)) | ||
def git_repo_url = args.gitRepoUrl ?: 'null' | ||
def git_reference = args.gitReference ?: 'null' | ||
def bwc_checkout_align = args.bwcCheckoutAlign ?: 'false' | ||
def bwc_checkout_align_param = '' | ||
|
||
println("Git Repo: ${git_repo_url}") | ||
println("Git Reference: ${git_reference}") | ||
println("Bwc Checkout Align: ${bwc_checkout_align}") | ||
|
||
if (Boolean.parseBoolean(bwc_checkout_align)) { | ||
bwc_checkout_align_param = '-Dbwc.checkout.align=true' | ||
} | ||
|
||
if (git_repo_url.equals('null') || git_reference.equals('null')) { | ||
println("No git repo url or git reference to checkout the commit, exit 1") | ||
|
@@ -71,7 +78,7 @@ void call(Map args = [:]) { | |
echo "Start gradlecheck" | ||
GRADLE_CHECK_STATUS=0 | ||
./gradlew clean && ./gradlew check -Dtests.coverage=true --no-daemon --no-scan || GRADLE_CHECK_STATUS=1 | ||
./gradlew clean && ./gradlew check -Dtests.coverage=true ${bwc_checkout_align_param} --no-daemon --no-scan || GRADLE_CHECK_STATUS=1 | ||
if [ "\$GRADLE_CHECK_STATUS" != 0 ]; then | ||
echo Gradle Check Failed! | ||
|