diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 00e3d1d9576..e64df2cb05c 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -26,7 +26,7 @@ Map getMultijobPRConfig(Folder jobFolder) { env : [ // Sonarcloud analysis only on main branch // As we have only Community edition - DISABLE_SONARCLOUD: !Utils.isMainBranch(this), + ENABLE_SONARCLOUD: Utils.isMainBranch(this), ] ], [ id: 'kogito-apps', @@ -49,12 +49,7 @@ KogitoJobUtils.createAllEnvsPerRepoPRJobs(this) { jobFolder -> getMultijobPRConf setupDeployJob(Folder.PULLREQUEST_RUNTIMES_BDD) // Nightly jobs -setupSonarCloudJob() -setupDeployJob(Folder.NIGHTLY) -setupNativeJob() -setupQuarkusJob(Folder.NIGHTLY_QUARKUS_MAIN) -setupQuarkusJob(Folder.NIGHTLY_QUARKUS_BRANCH) -setupMandrelJob() +KogitoJobUtils.createAllJobsForArtifactsRepository(this, ['drools', 'kogito']) // Release jobs setupDeployJob(Folder.RELEASE) @@ -71,66 +66,6 @@ KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-runtimes', [ // Methods ///////////////////////////////////////////////////////////////// -void setupQuarkusJob(Folder quarkusFolder) { - def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-ecosystem', quarkusFolder, "${jenkins_path}/Jenkinsfile.quarkus", 'Kogito Runtimes Quarkus Snapshot') - jobParams.triggers = [ cron : 'H 4 * * *' ] - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - NOTIFICATION_JOB_NAME: "${quarkusFolder.environment.toName()} check" - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout') - stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout') - } - } -} - -void setupSonarCloudJob() { - def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes', Folder.NIGHTLY_SONARCLOUD, "${jenkins_path}/Jenkinsfile.sonarcloud", 'Kogito Runtimes Daily Sonar') - jobParams.triggers = [ cron : 'H 20 * * 1-5' ] - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - NOTIFICATION_JOB_NAME: 'Sonarcloud check' - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout') - stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout') - } - } -} - -void setupNativeJob() { - def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes', Folder.NIGHTLY_NATIVE, "${jenkins_path}/Jenkinsfile.native", 'Kogito Runtimes Native Testing') - jobParams.triggers = [ cron : 'H 6 * * *' ] - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - NOTIFICATION_JOB_NAME: 'Native check' - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout') - stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout') - } - } -} - -void setupMandrelJob() { - def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes', Folder.NIGHTLY_MANDREL, "${jenkins_path}/Jenkinsfile.native", 'Kogito Runtimes Mandrel Testing') - jobParams.triggers = [ cron : 'H 8 * * *' ] - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - NOTIFICATION_JOB_NAME: 'Mandrel check' - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout') - stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout') - } - } -} - void setupDeployJob(Folder jobFolder) { def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes-deploy', jobFolder, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Runtimes Deploy') if (jobFolder.isPullRequest()) { diff --git a/.ci/jenkins/scripts/update-version/git_stage_files.groovy b/.ci/jenkins/scripts/update-version/git_stage_files.groovy new file mode 100644 index 00000000000..11e870ff3d9 --- /dev/null +++ b/.ci/jenkins/scripts/update-version/git_stage_files.groovy @@ -0,0 +1,6 @@ +void execute(def pipelinesCommon) { + echo 'Hello from Git Stage Files script' + githubscm.findAndStageNotIgnoredFiles('pom.xml') +} + +return this diff --git a/.ci/jenkins/scripts/update-version/init.groovy b/.ci/jenkins/scripts/update-version/init.groovy new file mode 100644 index 00000000000..88cdeb80c2e --- /dev/null +++ b/.ci/jenkins/scripts/update-version/init.groovy @@ -0,0 +1,14 @@ +void execute(def pipelinesCommon) { + echo 'Hello from init script' + if (pipelinesCommon.isRelease() || pipelinesCommon.isCreatePR()) { + // Verify version is set + assert pipelinesCommon.getKogitoVersion() + + if (pipelinesCommon.isRelease()) { + // Verify if on right release branch + assert pipelinesCommon.getGitBranch() == util.getReleaseBranchFromVersion(pipelinesCommon.getKogitoVersion()) + } + } +} + +return this diff --git a/.ci/jenkins/scripts/update-version/main.groovy b/.ci/jenkins/scripts/update-version/main.groovy new file mode 100644 index 00000000000..67292269a78 --- /dev/null +++ b/.ci/jenkins/scripts/update-version/main.groovy @@ -0,0 +1,6 @@ +void execute(def pipelinesCommon) { + maven.mvnVersionsSet(pipelinesCommon.getDefaultMavenCommand(), pipelinesCommon.getKogitoVersion(), !pipelinesCommon.isRelease()) + maven.mvnSetVersionProperty(pipelinesCommon.getDefaultMavenCommand(), 'version.org.kie', pipelinesCommon.getDroolsVersion()) +} + +return this diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml index 4f982d42d4b..9b8a30ca771 100644 --- a/.github/workflows/jenkins-tests-PR.yml +++ b/.github/workflows/jenkins-tests-PR.yml @@ -48,4 +48,4 @@ jobs: java-version: 11 - name: Test DSL - run: .ci/jenkins/dsl/test.sh -h ${{ github.head_ref }} -r ${{ github.event.pull_request.head.repo.full_name }} -b ${{ github.base_ref }} -t ${{ github.event.pull_request.base.repo.full_name }} .ci/jenkins/dsl \ No newline at end of file + run: .ci/jenkins/dsl/test.sh -h ${{ github.head_ref }} -r ${{ github.event.pull_request.head.repo.full_name }} -b ${{ github.base_ref }} -t ${{ github.event.pull_request.base.repo.full_name }} .ci/jenkins/dsl