diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile new file mode 100644 index 00000000000..3a1196057d1 --- /dev/null +++ b/.ci/jenkins/Jenkinsfile @@ -0,0 +1,43 @@ +@Library('jenkins-pipeline-shared-libraries')_ + +pr_check_script = null + +pipeline { + agent { + label 'ubuntu' + } + options { + timestamps() + timeout(time: '720', unit: 'MINUTES') + } + environment { + BUILDCHAIN_PROJECT = 'kiegroup/drools' + BUILDCHAIN_CONFIG_REPO = 'drools' + BUILDCHAIN_CONFIG_FILE_PATH = '.ci/buildchain-config.yaml' + + ENABLE_SONARCLOUD = 'true' + DROOLS_BUILD_MVN_OPTS = '-Prun-code-coverage' + } + stages { + stage('Initialize') { + steps { + script { + // load `pr_check.groovy` file from kogito-pipelines:main + dir('kogito-pipelines') { + checkout(githubscm.resolveRepository('kogito-pipelines', 'kiegroup', 'apache_migration', false, 'kie-ci')) // TODO to change back to kiegroup:main + pr_check_script = load 'dsl/scripts/pr_check.groovy' + } + } + } + } + stage('PR check') { + steps { + script { + dir('kogito-pipelines') { + pr_check_script.launch() + } + } + } + } + } +} diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index f0135cb9e24..713eb876bc6 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -10,12 +10,10 @@ droolsRepository = 'drools' pipeline { agent { - label 'ubuntu' - } - - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { @@ -23,20 +21,11 @@ pipeline { timeout(time: 180, unit: 'MINUTES') } - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - environment { - // Static env is defined into ./dsl/jobs.groovy file - DROOLS_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - // Keep here for visitibility - MAVEN_OPTS = '-Xms1024m -Xmx4g' - PR_BRANCH_HASH = "${util.generateHash(10)}" - MAVEN_DEPLOY_LOCAL_DIR = "${WORKSPACE}/maven_deploy_dir" + MAVEN_DEPLOY_LOCAL_DIR = "/tmp/maven_deploy_dir" } stages { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 5221120344b..2c7d058c750 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -8,12 +8,10 @@ pipelineProperties = [:] pipeline { agent { - label 'ubuntu' - } - - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr index e92ceaf3d9a..5a4b689871c 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr @@ -7,11 +7,10 @@ changeBranch = env.ghprbSourceBranch ?: CHANGE_BRANCH pipeline { agent { - label 'ubuntu' - } - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { timestamps() diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone index b5b67433f16..4e2c7cf7ee9 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone @@ -7,12 +7,10 @@ previousHash = '' pipeline { agent { - label 'ubuntu' - } - - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index afc7f009031..95b74cfcbe6 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -5,12 +5,10 @@ import org.kie.jenkins.MavenCommand pipeline { agent { - label 'ubuntu' - } - - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { @@ -18,18 +16,9 @@ pipeline { timeout(time: 60, unit: 'MINUTES') } - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - environment { - // Static env is defined into ./dsl/jobs.groovy file - DROOLS_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - // Keep here for visitibility - MAVEN_OPTS = '-Xms1024m -Xmx4g' - BRANCH_HASH = "${util.generateHash(10)}" } diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index e74db85ad53..f5d0aa78811 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -106,7 +106,7 @@ void setupProjectReleaseJob() { void setupProjectPostReleaseJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'drools-post-release', JobType.RELEASE, "${jenkins_path_project}/Jenkinsfile.post-release", 'Drools Post Release') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", @@ -148,9 +148,6 @@ Map getMultijobPRConfig(JenkinsFolder jobFolder) { ], [ id: 'kogito-apps', repository: 'kogito-apps', - env : [ - NODE_OPTIONS: '--max_old_space_size=4096', - ] ], [ id: 'kogito-quarkus-examples', repository: 'kogito-examples', @@ -242,7 +239,7 @@ void setupSpecificBuildChainNightlyJob(String envName, Closure defaultJobParamsG void createSetupBranchJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'drools', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Drools Setup branch') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ REPO_NAME: 'drools', JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", @@ -270,7 +267,7 @@ void createSetupBranchJob() { void setupDeployJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'drools-deploy', jobType, "${jenkins_path}/Jenkinsfile.deploy", 'Drools Deploy') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ REPO_NAME: 'drools', PROPERTIES_FILE_NAME: 'deployment.properties', @@ -314,7 +311,7 @@ void setupDeployJob(JobType jobType) { void setupPromoteJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'drools-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Drools Promote') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ REPO_NAME: 'drools', PROPERTIES_FILE_NAME: 'deployment.properties', @@ -346,7 +343,7 @@ void setupPromoteJob(JobType jobType) { void setupPrQuarkus3RewriteJob() { def jobParams = JobParamsUtils.getBasicJobParamsWithEnv(this, 'drools.rewrite', JobType.PULL_REQUEST, 'quarkus-3', "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.pr", 'Drools Quarkus 3 rewrite patch regeneration') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.jenkinsfile = "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.pr" jobParams.pr.putAll([ run_only_for_branches: [ "${GIT_BRANCH}" ], @@ -365,7 +362,7 @@ void setupPrQuarkus3RewriteJob() { void setupStandaloneQuarkus3RewriteJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'drools.quarkus-3.rewrite', JobType.TOOLS, "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.standalone", 'Drools Quarkus 3 rewrite patch regeneration') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll(EnvUtils.getEnvironmentEnvVars(this, 'quarkus-3')) jobParams.env.putAll([ AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", diff --git a/.ci/jenkins/project/Jenkinsfile.post-release b/.ci/jenkins/project/Jenkinsfile.post-release index cc4a8dc2718..6627c4cab3c 100644 --- a/.ci/jenkins/project/Jenkinsfile.post-release +++ b/.ci/jenkins/project/Jenkinsfile.post-release @@ -7,12 +7,10 @@ import org.kie.jenkins.MavenCommand pipeline { agent { - label 'ubuntu' - } - - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { @@ -21,13 +19,7 @@ pipeline { disableConcurrentBuilds(abortPrevious: true) } - // parameters { - // For parameters, check into .jenkins/dsl/jobs.groovy file - // } - environment { - // Some generated env is also defined into .jenkins/dsl/jobs.groovy file - DROOLS_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") PR_BRANCH_HASH = "${util.generateHash(10)}" diff --git a/.ci/jenkins/project/Jenkinsfile.release b/.ci/jenkins/project/Jenkinsfile.release index 26f0c77b4b0..0848703bbf8 100644 --- a/.ci/jenkins/project/Jenkinsfile.release +++ b/.ci/jenkins/project/Jenkinsfile.release @@ -21,13 +21,7 @@ pipeline { label 'ubuntu' } - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - environment { - // Some generated env is also defined into ./dsl/jobs.groovy file - DROOLS_CI_EMAIL = credentials("${JENKINS_EMAIL_CREDS_ID}") } diff --git a/.ci/jenkins/project/Jenkinsfile.setup-branch b/.ci/jenkins/project/Jenkinsfile.setup-branch index f2bba114317..736ef8455d9 100644 --- a/.ci/jenkins/project/Jenkinsfile.setup-branch +++ b/.ci/jenkins/project/Jenkinsfile.setup-branch @@ -10,7 +10,6 @@ JOBS = [:] FAILED_STAGES = [:] UNSTABLE_STAGES = [:] -// Should be multibranch pipeline pipeline { agent { label 'ubuntu' @@ -20,13 +19,7 @@ pipeline { timeout(time: 360, unit: 'MINUTES') } - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - environment { - // Some generated env is also defined into ./dsl/jobs.groovy file - DROOLS_CI_EMAIL = credentials("${JENKINS_EMAIL_CREDS_ID}") // Use branch name in nightly tag as we may have parallel main and release branch builds