diff --git a/jenkins/gradle/gradle-check.jenkinsfile b/jenkins/gradle/gradle-check.jenkinsfile
index 939c7c61cc..f0872e202e 100644
--- a/jenkins/gradle/gradle-check.jenkinsfile
+++ b/jenkins/gradle/gradle-check.jenkinsfile
@@ -4,6 +4,7 @@ lib = library(identifier: 'jenkins@1.0.4', retriever: modernSCM([
]))
pipeline {
+ agent none
options {
timeout(time: 2, unit: 'HOURS')
throttleJobProperty(
@@ -16,16 +17,6 @@ pipeline {
throttleOption: 'project',
)
}
- // gradle check have a lot of issues running on containers
- // Therefore, we directly run it on the agent node
- agent {
- node {
- // Must use Ubuntu agent with 1 executor or gradle check will show a lot of java-related errors
- // The c524xlarge is the instance type that has the least amount of errors during gradle check
- // https://github.com/opensearch-project/OpenSearch/issues/1975
- label 'Jenkins-Agent-Ubuntu2004-X64-C524xlarge-Single-Host'
- }
- }
parameters {
string(
name: 'GIT_REPO_URL',
@@ -39,6 +30,14 @@ pipeline {
defaultValue: 'main',
trim: true
)
+ // Must use agent with 1 executor or gradle check will show a lot of java-related errors
+ // The c524xlarge is the instance type that has the least amount of errors during gradle check
+ // https://github.com/opensearch-project/OpenSearch/issues/1975
+ choice(
+ name: 'AGENT_LABEL',
+ description: 'Choose which jenkins agent to run gradle check on',
+ choices: ['Jenkins-Agent-Ubuntu2004-X64-C524xlarge-Single-Host', 'Jenkins-Agent-Windows2019-X64-C524xlarge-Single-Host'],
+ )
}
triggers {
GenericTrigger(
@@ -65,93 +64,117 @@ pipeline {
TIMER_BUILD_CAUSE = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')
}
stages {
- stage('Install openjdk-8') {
- tools {
- jdk 'openjdk-8'
- }
- steps {
- echo "Install openjdk-8"
- sh("ls ${JAVA8_HOME}/.. | grep openjdk-8")
- }
- }
- stage('Install openjdk-11') {
- tools {
- jdk 'openjdk-11'
- }
- steps {
- echo "Install openjdk-11"
- sh("ls ${JAVA11_HOME}/.. | grep openjdk-11")
- }
- }
- stage('Install openjdk-14') {
- tools {
- jdk 'openjdk-14'
- }
- steps {
- echo "Install openjdk-14"
- sh("ls ${JAVA14_HOME}/.. | grep openjdk-14")
- }
- }
- stage('Install openjdk-17') {
- tools {
- jdk 'openjdk-17'
- }
- steps {
- echo "Install openjdk-17"
- sh("ls ${JAVA17_HOME}/.. | grep openjdk-17")
+ stage('verify-parameters') {
+ agent {
+ docker {
+ label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host'
+ image 'alpine:3'
+ alwaysPull true
+ }
}
- }
- stage('Install openjdk-19') {
- tools {
- jdk 'openjdk-19'
- }
steps {
- echo "Install openjdk-19"
- sh("ls ${JAVA19_HOME}/.. | grep openjdk-19")
+ script {
+ if (AGENT_LABEL == '') {
+ currentBuild.result = 'ABORTED'
+ error("Gradle Check (Jenkins) failed to start. Missing parameter: AGENT_LABEL.")
+ }
+ }
}
}
- stage('Run Gradle Check') {
- steps {
- script {
- sh("ls /var/jenkins/tools/hudson.model.JDK/")
- if (env.USER_BUILD_CAUSE.equals('[]') && env.TIMER_BUILD_CAUSE.equals('[]')) {
- def pr_url = "${pr_to_clone_url}".replace(".git", "/pull/${pr_number}")
- println("Triggered by GitHub: ${pr_to_clone_url}")
- if ("$pr_number" == "Null") {
- currentBuild.description = """Others: ${pr_title}"""
- }
- else {
- currentBuild.description = """PR #${pr_number}: ${pr_title}"""
- }
-
- runGradleCheck(
- gitRepoUrl: "${pr_from_clone_url}",
- gitReference: "${pr_from_sha}"
- )
+ stage('Gradle Check') {
+ // gradle check have a lot of issues running on containers
+ // Therefore, we directly run it on the agent node
+ agent { label AGENT_LABEL }
+ stages {
+ stage('Install openjdk-8') {
+ tools {
+ jdk 'openjdk-8'
}
- else {
- println("Triggered by User or Triggered by Timer")
- def repo_url = "${GIT_REPO_URL}".replace(".git", "/commit")
- currentBuild.description = """git: ${GIT_REPO_URL}
ref: ${GIT_REFERENCE}"""
-
- runGradleCheck(
- gitRepoUrl: "${GIT_REPO_URL}",
- gitReference: "${GIT_REFERENCE}"
- )
+ steps {
+ echo "Install openjdk-8"
+ sh("ls ${JAVA8_HOME}/.. | grep openjdk-8")
}
}
- }
- post() {
- failure {
- archiveArtifacts artifacts: '**/build/heapdump/*.hprof', allowEmptyArchive: true
+ stage('Install openjdk-11') {
+ tools {
+ jdk 'openjdk-11'
+ }
+ steps {
+ echo "Install openjdk-11"
+ sh("ls ${JAVA11_HOME}/.. | grep openjdk-11")
+ }
}
- always {
- sh ("cp -v `find search/build/reports/jacoco/ -name '*.xml' | head -n 1` codeCoverage.xml || echo")
- junit allowEmptyResults: true, testResults: '**/build/test-results/**/*.xml'
- archiveArtifacts artifacts: 'codeCoverage.xml', onlyIfSuccessful: true
- script {
- sh("rm -rf *")
- postCleanup()
+ stage('Install openjdk-14') {
+ tools {
+ jdk 'openjdk-14'
+ }
+ steps {
+ echo "Install openjdk-14"
+ sh("ls ${JAVA14_HOME}/.. | grep openjdk-14")
+ }
+ }
+ stage('Install openjdk-17') {
+ tools {
+ jdk 'openjdk-17'
+ }
+ steps {
+ echo "Install openjdk-17"
+ sh("ls ${JAVA17_HOME}/.. | grep openjdk-17")
+ }
+ }
+ stage('Install openjdk-19') {
+ tools {
+ jdk 'openjdk-19'
+ }
+ steps {
+ echo "Install openjdk-19"
+ sh("ls ${JAVA19_HOME}/.. | grep openjdk-19")
+ }
+ }
+ stage('Run Gradle Check') {
+ steps {
+ script {
+ sh("ls /var/jenkins/tools/hudson.model.JDK/")
+ if (env.USER_BUILD_CAUSE.equals('[]') && env.TIMER_BUILD_CAUSE.equals('[]')) {
+ def pr_url = "${pr_to_clone_url}".replace(".git", "/pull/${pr_number}")
+ println("Triggered by GitHub: ${pr_to_clone_url}")
+ if ("$pr_number" == "Null") {
+ currentBuild.description = """Others: ${pr_title}"""
+ }
+ else {
+ currentBuild.description = """PR #${pr_number}: ${pr_title}"""
+ }
+
+ runGradleCheck(
+ gitRepoUrl: "${pr_from_clone_url}",
+ gitReference: "${pr_from_sha}"
+ )
+ }
+ else {
+ println("Triggered by User or Triggered by Timer")
+ def repo_url = "${GIT_REPO_URL}".replace(".git", "/commit")
+ currentBuild.description = """git: ${GIT_REPO_URL}
ref: ${GIT_REFERENCE}"""
+
+ runGradleCheck(
+ gitRepoUrl: "${GIT_REPO_URL}",
+ gitReference: "${GIT_REFERENCE}"
+ )
+ }
+ }
+ }
+ post() {
+ failure {
+ archiveArtifacts artifacts: '**/build/heapdump/*.hprof', allowEmptyArchive: true
+ }
+ always {
+ sh ("cp -v `find search/build/reports/jacoco/ -name '*.xml' | head -n 1` codeCoverage.xml || echo")
+ junit allowEmptyResults: true, testResults: '**/build/test-results/**/*.xml'
+ archiveArtifacts artifacts: 'codeCoverage.xml', onlyIfSuccessful: true
+ script {
+ sh("rm -rf *")
+ postCleanup()
+ }
+ }
}
}
}
diff --git a/jenkins/opensearch/.distribution-build.jenkinsfile.swp b/jenkins/opensearch/.distribution-build.jenkinsfile.swp
new file mode 100644
index 0000000000..306c544f0c
Binary files /dev/null and b/jenkins/opensearch/.distribution-build.jenkinsfile.swp differ