diff --git a/.ci/environments/common/update_quarkus.sh b/.ci/environments/common/update_quarkus.sh index 00b98ae80a..8bb8716136 100755 --- a/.ci/environments/common/update_quarkus.sh +++ b/.ci/environments/common/update_quarkus.sh @@ -3,7 +3,7 @@ set -euo pipefail mvn_cmd="mvn ${BUILD_MVN_OPTS:-} ${BUILD_MVN_OPTS_QUARKUS_UPDATE:-}" -source <(curl -s https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/install_quarkus.sh) +source <(curl -s https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/install_quarkus.sh) echo "Update project with Quarkus version ${QUARKUS_VERSION}" diff --git a/.ci/environments/update.sh b/.ci/environments/update.sh index 80abdd7110..5c8416d881 100755 --- a/.ci/environments/update.sh +++ b/.ci/environments/update.sh @@ -44,4 +44,4 @@ if [ -f "${env_path}/after.sh" ]; then fi # Download `setup_integration_branch` script and execute -curl -s https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/setup_integration_branch.sh | bash \ No newline at end of file +curl -s https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/setup_integration_branch.sh | bash \ No newline at end of file diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile new file mode 100644 index 0000000000..f021522c8f --- /dev/null +++ b/.ci/jenkins/Jenkinsfile @@ -0,0 +1,40 @@ +@Library('jenkins-pipeline-shared-libraries')_ + +pr_check_script = null + +pipeline { + agent { + label 'ubuntu' + } + options { + timestamps() + timeout(time: 360, unit: 'MINUTES') + } + environment { + BUILDCHAIN_PROJECT = 'apache/incubator-kie-kogito-examples' + + KOGITO_EXAMPLES_BUILD_MVN_OPTS = '-Dvalidate-formatting' + } + stages { + stage('Initialize') { + steps { + script { + // load `pr_check.groovy` file from kogito-pipelines:main + dir('kogito-pipelines') { + checkout(githubscm.resolveRepository('incubator-kie-kogito-pipelines', 'apache', 'main', false, 'ASF_Cloudbees_Jenkins_ci-builds')) + 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 1ca5c5d20c..172a081721 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -10,12 +10,10 @@ examplesHelper = null pipeline { agent { - label 'kie-rhel8 && docker && kie-mem16g && !built-in' - } - - 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 - KOGITO_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 { @@ -132,7 +121,7 @@ pipeline { if (params.SKIP_TESTS) { mvnCmd.skipTests() // Conflict somehow with Python testing. If `skipTests={anyvalue}` is set, then exec plugin is not executed ... } - util.runWithPythonVirtualEnv(mvnCmd.getFullRunCommand('clean install'), 'swf') + mvnCmd.run('clean install') } } } @@ -259,7 +248,7 @@ void commitAndCreatePR() { prBody += '\nPlease review and merge.' } // Not using githubscm.commitChanges() because globbing won't work. - // See: https://github.com/kiegroup/kogito-runtimes/pull/570#discussion_r449268738 + // See: https://github.com/apache/incubator-kie-kogito-runtimes/pull/570#discussion_r449268738 addNotIgnoredPoms() sh "git commit -m '${commitMsg}'" githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID()) @@ -275,7 +264,7 @@ boolean shouldStageArtifacts() { } boolean shouldDeployToRepository() { - return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID && getGitAuthor() == 'kiegroup' + return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID && getGitAuthor() == 'apache' } boolean isRelease() { @@ -347,7 +336,7 @@ void runMavenDeploy(boolean localDeployment = false) { mvnCmd.skipTests(true).run('clean deploy') - util.runWithPythonVirtualEnv(mvnCmd.skipTests(true).getFullRunCommand('clean deploy'), 'swf') + mvnCmd.skipTests(true).run('clean deploy') } void runMavenStage() { diff --git a/.ci/jenkins/Jenkinsfile.post-release b/.ci/jenkins/Jenkinsfile.post-release index afcfebd3bf..e183f4593a 100644 --- a/.ci/jenkins/Jenkinsfile.post-release +++ b/.ci/jenkins/Jenkinsfile.post-release @@ -3,12 +3,10 @@ import org.jenkinsci.plugins.workflow.libs.Library pipeline { agent { - label 'kie-rhel8 && !built-in' - } - - 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 { @@ -19,7 +17,6 @@ pipeline { environment { CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - GITHUB_CLI_VERSION = '0.11.1' } stages { @@ -34,10 +31,7 @@ pipeline { // Verify version is set and if on right release branch assert getProjectVersion() - assert getBuildBranch() == util.getReleaseBranchFromVersion(getProjectVersion()) - - installGithubCLI() } } } @@ -112,15 +106,6 @@ void checkoutTag(String repo, String tagName, String localBranchName = tagName) sh "git checkout tags/${tagName} -b ${localBranchName}" } -void installGithubCLI() { - sh """ - wget https://github.com/cli/cli/releases/download/v${env.GITHUB_CLI_VERSION}/gh_${env.GITHUB_CLI_VERSION}_linux_amd64.tar.gz - tar xzf gh_${env.GITHUB_CLI_VERSION}_linux_amd64.tar.gz - mv gh_${env.GITHUB_CLI_VERSION}_linux_amd64/bin/gh . - rm -r gh_${env.GITHUB_CLI_VERSION}_linux_amd64* - """ -} - void setDefaultBranch(String defaultBranch) { withCredentials([string(credentialsId: env.GITHUB_TOKEN_CREDS_ID, variable: 'GITHUB_TOKEN')]) { // gh command from https://github.com/cli/cli/issues/929#issuecomment-629253585 diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 541473a129..6ce2d3a6b2 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -8,7 +8,10 @@ examplesHelper = null pipeline { agent { - label 'rhel8 && !built-in' + 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 d194a76d3c..d794139f26 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr @@ -8,11 +8,10 @@ changeTarget = env.ghprbTargetBranch ?: CHANGE_TARGET pipeline { agent { - label 'kie-rhel8 && docker && kie-mem16g && !built-in' - } - 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() @@ -38,9 +37,9 @@ pipeline { stage('Build upstream projects') { steps { script { - [ 'drools', 'kogito-runtimes', 'kogito-apps' ].each { project -> + [ 'incubator-kie-drools', 'incubator-kie-kogito-runtimes', 'incubator-kie-kogito-apps' ].each { project -> dir(project) { - githubscm.checkoutIfExists(project, changeAuthor, changeBranch, 'kiegroup', changeTarget, true) + githubscm.checkoutIfExists(project, changeAuthor, changeBranch, 'apache', changeTarget, true) sh '.ci/environments/update.sh quarkus-3' getMavenCommand().withProperty('quickly').run('clean install') } @@ -56,7 +55,7 @@ pipeline { env.BUILD_MVN_OPTS = "${env.BUILD_MVN_OPTS ?: ''} -s ${MAVEN_SETTINGS_FILE} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.test.failure.ignore=true" echo "BUILD_MVN_OPTS = ${BUILD_MVN_OPTS}" - util.runWithPythonVirtualEnv('.ci/environments/quarkus-3/before.sh rewrite', 'swf') + sh '.ci/environments/quarkus-3/before.sh rewrite' } } } diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone index 4a038baac7..81bfac2629 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 'kie-rhel8 && docker && kie-mem16g && !built-in' - } - - 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 { @@ -57,7 +55,7 @@ pipeline { stage('Build upstream projects') { steps { script { - [ 'drools', 'kogito-runtimes', 'kogito-apps' ].each { project -> + [ 'incubator-kie-drools', 'incubator-kie-kogito-runtimes', 'incubator-kie-kogito-apps' ].each { project -> dir(project) { githubscm.checkoutIfExists(project, getGitAuthor(), getBuildBranch(), getBaseAuthor(), getBaseBranch(), true) sh '.ci/environments/update.sh quarkus-3' @@ -75,7 +73,7 @@ pipeline { env.BUILD_MVN_OPTS = "${env.BUILD_MVN_OPTS ?: ''} -s ${MAVEN_SETTINGS_FILE} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.test.failure.ignore=true" echo "BUILD_MVN_OPTS = ${BUILD_MVN_OPTS}" - util.runWithPythonVirtualEnv('.ci/environments/quarkus-3/before.sh rewrite', 'swf') + sh '.ci/environments/quarkus-3/before.sh rewrite' } } } diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 43004d809d..7d22ace90f 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -5,18 +5,16 @@ import org.kie.jenkins.MavenCommand examplesHelper = null -droolsRepo = 'drools' -kogitoRuntimesRepo = 'kogito-runtimes' -kogitoAppsRepo = 'kogito-apps' +droolsRepo = 'incubator-kie-drools' +kogitoRuntimesRepo = 'incubator-kie-kogito-runtimes' +kogitoAppsRepo = 'incubator-kie-kogito-apps' pipeline { agent { - label 'kie-rhel8 && !built-in' - } - - 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 { @@ -24,17 +22,8 @@ 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 - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - - // Keep here for visitibility - MAVEN_OPTS = '-Xms1024m -Xmx4g' } stages { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 826ae91b40..edcad9cfed 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -2,10 +2,10 @@ * This file is describing all the Jenkins jobs in the DSL format (see https://plugins.jenkins.io/job-dsl/) * needed by the Kogito pipelines. * -* The main part of Jenkins job generation is defined into the https://github.com/kiegroup/kogito-pipelines repository. +* The main part of Jenkins job generation is defined into the https://github.com/apache/incubator-kie-kogito-pipelines repository. * * This file is making use of shared libraries defined in -* https://github.com/kiegroup/kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl. +* https://github.com/apache/incubator-kie-kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl. */ import org.kie.jenkins.jobdsl.model.JenkinsFolder @@ -67,7 +67,7 @@ List getExamplesBuildMvnOptions(JenkinsFolder jobFolder) { } // PR checks -KogitoJobUtils.createAllEnvironmentsPerRepoPRJobs(this) { jobFolder -> getMultijobPRConfig(jobFolder) } +Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile") // Init branch createSetupBranchJob() @@ -98,7 +98,9 @@ if (isMainStream()) { // Quarkus 3 if (EnvUtils.isEnvironmentEnabled(this, 'quarkus-3')) { - setupPrQuarkus3RewriteJob() + // Deactivated due to ghprb not available on Apache Jenkins + // TODO create PR job with branch source plugin + // setupPrQuarkus3RewriteJob() setupStandaloneQuarkus3RewriteJob() } } @@ -117,7 +119,7 @@ void setupSpecificBuildChainNightlyJob(String envName, Closure defaultJobParamsG void createSetupBranchJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Examples Init branch') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", @@ -144,7 +146,7 @@ void createSetupBranchJob() { void setupReleaseDeployJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-deploy', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Examples Deploy') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ PROPERTIES_FILE_NAME: 'deployment.properties', @@ -186,7 +188,7 @@ void setupReleaseDeployJob() { void setupReleasePromoteJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-promote', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Examples Promote') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ PROPERTIES_FILE_NAME: 'deployment.properties', @@ -222,7 +224,7 @@ void setupReleasePromoteJob() { void setupPostReleaseJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-post-release', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.post-release", 'Kogito Examples Post Release') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", @@ -246,7 +248,7 @@ void setupPostReleaseJob() { void setupPrQuarkus3RewriteJob() { def jobParams = JobParamsUtils.getBasicJobParamsWithEnv(this, 'kogito-examples.rewrite', JobType.PULL_REQUEST, 'quarkus-3', "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.pr", 'Kogito Examples 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}" ], @@ -266,7 +268,7 @@ void setupPrQuarkus3RewriteJob() { void setupStandaloneQuarkus3RewriteJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples.quarkus-3.rewrite', JobType.TOOLS, "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.standalone", 'Kogito Examples Quarkus 3 rewrite patch regeneration') jobParams.env.putAll(EnvUtils.getEnvironmentEnvVars(this, 'quarkus-3')) - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", diff --git a/.ci/jenkins/dsl/test.sh b/.ci/jenkins/dsl/test.sh index ad8af34ac2..2d518eb9f9 100755 --- a/.ci/jenkins/dsl/test.sh +++ b/.ci/jenkins/dsl/test.sh @@ -1,6 +1,6 @@ #!/bin/bash -e file=$(mktemp) # For more usage of the script, use ./test.sh -h -curl -o ${file} https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/seed_test.sh +curl -o ${file} https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/seed_test.sh chmod u+x ${file} ${file} $@ \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f9ff7a1801..e3ac70c34d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,7 +4,7 @@ Please make sure that your PR meets the following requirements: **WARNING! Please make sure you are opening your PR against `main` branch!** -- [ ] You have read the [contributors guide](https://github.com/kiegroup/kogito-runtimes#contributing-to-kogito) +- [ ] You have read the [contributors guide](https://github.com/apache/incubator-kie-kogito-runtimes#contributing-to-kogito) - [ ] Pull Request title is properly formatted: `KOGITO-XYZ Subject` - [ ] Pull Request title contains the target branch if not targeting main: `[0.9.x] KOGITO-XYZ Subject` - [ ] Pull Request contains link to the JIRA issue diff --git a/.github/workflows/pr-jenkins.yml b/.github/workflows/pr-jenkins.yml index f0ca27557a..591c1d79a2 100644 --- a/.github/workflows/pr-jenkins.yml +++ b/.github/workflows/pr-jenkins.yml @@ -18,6 +18,6 @@ jobs: - name: DSL tests uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main with: - main-config-file-repo: kiegroup/kogito-pipelines + main-config-file-repo: apache/incubator-kie-kogito-pipelines main-config-file-path: .ci/jenkins/config/main.yaml - branch-config-file-repo: kiegroup/kogito-pipelines + branch-config-file-repo: apache/incubator-kie-kogito-pipelines diff --git a/.github/workflows/pr-kogito-examples.yml b/.github/workflows/pr-kogito-examples.yml index 1c19c8f5dd..a896e662d3 100644 --- a/.github/workflows/pr-kogito-examples.yml +++ b/.github/workflows/pr-kogito-examples.yml @@ -26,13 +26,13 @@ jobs: maven-version: ['3.8.7'] include: - job_name: kogito-quarkus-examples - repository: kogito-examples + repository: incubator-kie-kogito-examples env_KOGITO_EXAMPLES_SUBFOLDER_POM: kogito-quarkus-examples/ - job_name: kogito-springboot-examples - repository: kogito-examples + repository: incubator-kie-kogito-examples env_KOGITO_EXAMPLES_SUBFOLDER_POM: kogito-springboot-examples/ - job_name: serverless-workflow-examples - repository: kogito-examples + repository: incubator-kie-kogito-examples env_KOGITO_EXAMPLES_SUBFOLDER_POM: serverless-workflow-examples/ fail-fast: false runs-on: ${{ matrix.os }} @@ -57,7 +57,7 @@ jobs: with: annotations-prefix: ${{ runner.os }}-${{ matrix.java-version }}/${{ matrix.maven-version }} github-token: "${{ secrets.GITHUB_TOKEN }}" - definition-file: https://raw.githubusercontent.com/${GROUP:kiegroup}/kogito-pipelines/${BRANCH:main}/.ci/pull-request-config.yaml + definition-file: https://raw.githubusercontent.com/${GROUP:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/pull-request-config.yaml - name: Surefire Report uses: kiegroup/kie-ci/.ci/actions/surefire-report@main if: ${{ always() }}