From 2e22ecbb2978841e666e1df4a08b34215142726d Mon Sep 17 00:00:00 2001 From: Roberto Oliveira Date: Tue, 10 Oct 2023 13:28:50 -0300 Subject: [PATCH] Revert "kie-issues#574 Initial ASF Jenkins CI Setup (#1703)" This reverts commit 9ad98ac7ca0f6bebb5b573b5497fffb316f0ae27. --- .ci/jenkins/Jenkinsfile | 22 ++++- .ci/jenkins/Jenkinsfile.build-image | 22 ++++- .ci/jenkins/Jenkinsfile.deploy | 13 ++- .ci/jenkins/Jenkinsfile.promote | 17 ++-- .ci/jenkins/Jenkinsfile.setup-branch | 21 +++- .ci/jenkins/Jenkinsfile.update-prod-version | 103 ++++++++++++++++++++ .ci/jenkins/dsl/jobs.groovy | 71 ++++++++++---- .ci/jenkins/dsl/test.sh | 2 +- .github/workflows/jenkins-tests-PR.yml | 4 +- 9 files changed, 226 insertions(+), 49 deletions(-) create mode 100644 .ci/jenkins/Jenkinsfile.update-prod-version diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile index 693fa00c2..9111c2a74 100644 --- a/.ci/jenkins/Jenkinsfile +++ b/.ci/jenkins/Jenkinsfile @@ -2,7 +2,11 @@ pipeline { agent { - label 'ubuntu' + label 'rhel8 && !built-in' + } + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { timeout(time: 120, unit: 'MINUTES') @@ -15,7 +19,7 @@ pipeline { sh 'printenv' - githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getChangeTarget(), true) + githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'kiegroup', getChangeTarget(), true) } } } @@ -52,7 +56,7 @@ pipeline { } unsuccessful { script { - pullrequest.postComment(util.getMarkdownTestSummary('PR', "${BUILD_URL}", 'GITHUB')) + pullrequest.postComment(util.getMarkdownTestSummary(isProdCI() ? 'Prod' : 'PR', '', "${BUILD_URL}", 'GITHUB')) } } } @@ -73,7 +77,7 @@ Closure createBuildAndTestStageClosure(String image) { buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) - githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getGitAuthorCredentialsId()) + githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'kiegroup', getGitAuthorCredentialsId()) githubscm.updateGithubCommitStatus(image, 'PENDING', 'Queued', getRepoName()) // Keep executing so we can cancel all if needed @@ -93,7 +97,15 @@ String[] getImages() { if (env.IMAGES_LIST) { return env.IMAGES_LIST.split(',') } - return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',') + String listCmd = 'make list' + if (isProdCI()) { + listCmd += ' arg=--prod' + } + return util.runWithPythonVirtualEnv("${listCmd} | tr '\\n' ','", 'cekit', true).trim().split(',') +} + +boolean isProdCI() { + return env.PROD_CI ? env.PROD_CI.toBoolean() : false } String getChangeAuthor() { diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image index f13a64043..2d5d323fc 100644 --- a/.ci/jenkins/Jenkinsfile.build-image +++ b/.ci/jenkins/Jenkinsfile.build-image @@ -4,15 +4,18 @@ QUAY_REGISTRY = 'quay.io' pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } + label 'kie-rhel8 && docker && !built-in' + } + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { timeout(time: 120, unit: 'MINUTES') } environment { + CI = true + // Linked to node label // Use docker due to multiplatform build CONTAINER_ENGINE = 'docker' @@ -46,6 +49,11 @@ pipeline { } updateGithubCommitStatus('PENDING', 'Started') + if (isProdCI()) { + // Prod fix to be able to build the image as a community one + sh "echo '' > content_sets.yaml" + } + // Login to final registry if deploy is needed if (shouldDeployImage()) { if (isDeployImageInOpenshiftRegistry()) { @@ -245,7 +253,7 @@ String getBuiltImageTag(String imageTag = '') { } void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } //////////////////////////////////////////////////////////////////////// @@ -356,6 +364,10 @@ String getMavenArtifactRepository() { return params.MAVEN_ARTIFACTS_REPOSITORY } +boolean isProdCI() { + return env.PROD_CI ? Boolean.parseBoolean(env.PROD_CI) : false +} + String getQuarkusPlatformURL() { return params.QUARKUS_PLATFORM_URL } diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 83697af7a..9f694a471 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -10,10 +10,13 @@ TEST_FAILED_IMAGES = [] pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } + label 'rhel8 && !built-in' + } + + // Needed for local build + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { @@ -418,7 +421,7 @@ String[] getImages() { } void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } String getQuarkusPlatformVersion() { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 9bf8b4994..5604453da 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -5,21 +5,24 @@ deployProperties = [:] pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } + label 'rhel8 && podman && !built-in' } options { timeout(time: 120, 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}") - CONTAINER_ENGINE = 'docker' - CONTAINER_ENGINE_TLS_OPTIONS = '' + // Linked to node label + CONTAINER_ENGINE = 'podman' + CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false' OPENSHIFT_API = credentials('OPENSHIFT_API') OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') @@ -356,5 +359,5 @@ String[] getImages() { } void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 182689cb0..9e0e4459c 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -3,18 +3,29 @@ import org.jenkinsci.plugins.workflow.libs.Library pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } + label 'rhel8 && podman && !built-in' + } + + // Needed for local build + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { timeout(time: 120, 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}") + + JAVA_HOME = "${GRAALVM_HOME}" } stages { @@ -171,5 +182,5 @@ String getCleanedReleaseNotes() { } void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } \ No newline at end of file diff --git a/.ci/jenkins/Jenkinsfile.update-prod-version b/.ci/jenkins/Jenkinsfile.update-prod-version new file mode 100644 index 000000000..3d4bb28a0 --- /dev/null +++ b/.ci/jenkins/Jenkinsfile.update-prod-version @@ -0,0 +1,103 @@ +@Library('jenkins-pipeline-shared-libraries')_ + +pipeline { + agent { + label 'rhel8 && podman && !built-in' + } + + options { + timeout(time: 30, unit: 'MINUTES') + } + + // parameters { + // For parameters, check into ./dsl/jobs.groovy file + // } + + environment { + // Static env is defined into ./dsl/jobs.groovy file + + PR_BRANCH_HASH = "${util.generateHash(10)}" + } + + stages { + stage('Initialization') { + steps { + script { + assert getProdProjectVersion() + assert getJiraNumber() + + currentBuild.displayName = getProdProjectVersion() + + deleteDir() + checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false)) + } + } + } + stage('Prepare for PR') { + steps { + script { + githubscm.createBranch(getPRBranch()) + } + } + } + stage('Update prod version') { + when { + expression { return getProdProjectVersion() != '' } + } + steps { + script { + sh "python3 scripts/manage-kogito-version.py --bump-to ${getProdProjectVersion()} --confirm --prod" + } + } + } + stage('Create PR') { + steps { + script { + String commitMsg = "[${getJiraNumber()}] Update product version to ${getProdProjectVersion()}" + if (githubscm.isThereAnyChanges()) { + githubscm.commitChanges(commitMsg) + } else { + error 'No update version can be done' + } + githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID()) + String prLink = githubscm.createPR(commitMsg, 'Please review and merge', getBuildBranch(), getGitAuthorCredsID()) + + echo "Created PR ${prLink}" + } + } + } + } + post { + cleanup { + cleanWs() + } + } +} + +String getRepoName() { + return "${REPO_NAME}" +} + +String getBuildBranch() { + return "${BUILD_BRANCH_NAME}" +} + +String getGitAuthor() { + return "${GIT_AUTHOR}" +} + +String getGitAuthorCredsID() { + return env.AUTHOR_CREDS_ID +} + +String getPRBranch() { + return "${getProdProjectVersion() ?: getBuildBranch()}-${env.PR_BRANCH_HASH}" +} + +String getProdProjectVersion() { + return "${PROD_PROJECT_VERSION}" +} + +String getJiraNumber() { + return "${JIRA_NUMBER}" +} \ No newline at end of file diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index fb18ed05f..cb073f2ac 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/apache/incubator-kie-kogito-pipelines repository. +* The main part of Jenkins job generation is defined into the https://github.com/kiegroup/kogito-pipelines repository. * * This file is making use of shared libraries defined in -* https://github.com/apache/incubator-kie-kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl. +* https://github.com/kiegroup/kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl. */ import org.kie.jenkins.jobdsl.model.JobType @@ -17,7 +17,7 @@ import org.kie.jenkins.jobdsl.Utils jenkins_path = '.ci/jenkins' // PR checks -Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile") +setupPrJob() // Init branch createSetupBranchJob() @@ -30,6 +30,12 @@ KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'quarkus-lts') setupDeployJob(JobType.RELEASE) setupPromoteJob(JobType.RELEASE) +if (Utils.isProductizedBranch(this)) { + setupPrJob(true) // Prod CI job + setupProdUpdateVersionJob() + setupQuarkusUpdateJob(true) // Prod CI job +} + // Update quarkus on community setupQuarkusUpdateJob() @@ -37,11 +43,11 @@ setupQuarkusUpdateJob() // Methods ///////////////////////////////////////////////////////////////// -void setupPrJob() { - setupBuildImageJob(JobType.PULL_REQUEST) +void setupPrJob(boolean isProdCI = false) { + setupBuildImageJob(JobType.PULL_REQUEST, isProdCI) - def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images PR check") - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images${isProdCI ? ' Prod' : ''} PR check") + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.pr.putAll([ run_only_for_branches: [ "${GIT_BRANCH}" ], disable_status_message_error: true, @@ -49,7 +55,13 @@ void setupPrJob() { commitContext: 'Retrieve and Launch Image Checks', contextShowtestResults: false, ]) - if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { + if (isProdCI) { + jobParams.job.name += '.prod' + jobParams.pr.trigger_phrase = '.*[j|J]enkins,?.*(rerun|run) [prod|Prod|PROD].*' + jobParams.pr.trigger_phrase_only = true + jobParams.pr.commitContext = '(Prod) Retrieve and Launch Image Checks' + jobParams.env.put('PROD_CI', true) + } else if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES')) } jobParams.env.putAll([ @@ -60,8 +72,9 @@ void setupPrJob() { void createSetupBranchJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Images Init Branch') - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.env.putAll([ + REPO_NAME: 'kogito-images', GIT_AUTHOR: "${GIT_AUTHOR_NAME}", JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", @@ -89,7 +102,7 @@ void setupDeployJob(JobType jobType) { setupBuildImageJob(jobType) def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-deploy', jobType, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Images Deploy') - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.env.putAll([ PROPERTIES_FILE_NAME: 'deployment.properties', @@ -125,7 +138,7 @@ void setupDeployJob(JobType jobType) { // Deploy information booleanParam('IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') - stringParam('IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') + stringParam('IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') stringParam('IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') stringParam('IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') stringParam('IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') @@ -145,15 +158,16 @@ void setupDeployJob(JobType jobType) { } } -void setupBuildImageJob(JobType jobType) { +void setupBuildImageJob(JobType jobType, boolean prodCI = false) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images.build-image', jobType, "${jenkins_path}/Jenkinsfile.build-image", 'Kogito Images Build single image') // Use jenkinsfile from the build branch jobParams.git.author = '${SOURCE_AUTHOR}' jobParams.git.branch = '${SOURCE_BRANCH}' - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.env.putAll([ MAX_REGISTRY_RETRIES: 3, TARGET_AUTHOR: Utils.getGitAuthor(this), // In case of a PR to merge with target branch + PROD_CI: prodCI, AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", @@ -185,7 +199,7 @@ void setupBuildImageJob(JobType jobType) { // Deploy information booleanParam('DEPLOY_IMAGE', false, 'Should we deploy image to given deploy registry ?') booleanParam('DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') - stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') + stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') stringParam('DEPLOY_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') stringParam('DEPLOY_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') stringParam('DEPLOY_IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') @@ -197,8 +211,8 @@ void setupBuildImageJob(JobType jobType) { void setupPromoteJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Images Promote') - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ + REPO_NAME: 'kogito-images', PROPERTIES_FILE_NAME: 'deployment.properties', MAX_REGISTRY_RETRIES: 3, @@ -227,7 +241,7 @@ void setupPromoteJob(JobType jobType) { // Base images information which can override `deployment.properties` booleanParam('BASE_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Override `deployment.properties`. Set to true if base image should be retrieved from Openshift registry.In this case, BASE_IMAGE_REGISTRY_CREDENTIALS, BASE_IMAGE_REGISTRY and BASE_IMAGE_NAMESPACE parameters will be ignored') - stringParam('BASE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Override `deployment.properties`. Base Image registry credentials to use to deploy images. Will be ignored if no BASE_IMAGE_REGISTRY is given') + stringParam('BASE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Override `deployment.properties`. Base Image registry credentials to use to deploy images. Will be ignored if no BASE_IMAGE_REGISTRY is given') stringParam('BASE_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Override `deployment.properties`. Base image registry') stringParam('BASE_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Override `deployment.properties`. Base image namespace') stringParam('BASE_IMAGE_NAMES', '', 'Override `deployment.properties`. Comma separated list of images') @@ -236,7 +250,7 @@ void setupPromoteJob(JobType jobType) { // Promote images information booleanParam('PROMOTE_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if base image should be deployed in Openshift registry.In this case, PROMOTE_IMAGE_REGISTRY_CREDENTIALS, PROMOTE_IMAGE_REGISTRY and PROMOTE_IMAGE_NAMESPACE parameters will be ignored') - stringParam('PROMOTE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Promote Image registry credentials to use to deploy images. Will be ignored if no PROMOTE_IMAGE_REGISTRY is given') + stringParam('PROMOTE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Promote Image registry credentials to use to deploy images. Will be ignored if no PROMOTE_IMAGE_REGISTRY is given') stringParam('PROMOTE_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Promote image registry') stringParam('PROMOTE_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Promote image namespace') stringParam('PROMOTE_IMAGE_NAME_SUFFIX', '', 'Promote image name suffix') @@ -254,8 +268,27 @@ void setupPromoteJob(JobType jobType) { } } -void setupQuarkusUpdateJob() { +void setupProdUpdateVersionJob() { + def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-update-prod-version', JobType.TOOLS, "${jenkins_path}/Jenkinsfile.update-prod-version", 'Update prod version for Kogito Images') + jobParams.env.putAll([ + REPO_NAME: 'kogito-images', + + BUILD_BRANCH_NAME: "${GIT_BRANCH}", + GIT_AUTHOR: "${GIT_AUTHOR_NAME}", + AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", + ]) + KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { + parameters { + stringParam('JIRA_NUMBER', '', 'KIECLOUD-XXX or RHPAM-YYYY or else. This will be added to the commit and PR.') + stringParam('PROD_PROJECT_VERSION', '', 'Which version to set ?') + } + } +} + +void setupQuarkusUpdateJob(boolean isProdCI = false) { + def prodFlag = isProdCI ? '--prod' : '' KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-images', [:], [:], [], [ - "source ~/virtenvs/cekit/bin/activate && python3 scripts/update-repository.py --quarkus-platform-version %new_version%" + "source ~/virtenvs/cekit/bin/activate && python3 scripts/update-repository.py --quarkus-platform-version %new_version% ${prodFlag}" ]) } diff --git a/.ci/jenkins/dsl/test.sh b/.ci/jenkins/dsl/test.sh index 2d518eb9f..ad8af34ac 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/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/seed_test.sh +curl -o ${file} https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/seed_test.sh chmod u+x ${file} ${file} $@ \ No newline at end of file diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml index 324a2deb1..bf3815cbc 100644 --- a/.github/workflows/jenkins-tests-PR.yml +++ b/.github/workflows/jenkins-tests-PR.yml @@ -17,6 +17,6 @@ jobs: - name: DSL tests uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main with: - main-config-file-repo: apache/incubator-kie-kogito-pipelines + main-config-file-repo: kiegroup/kogito-pipelines main-config-file-path: .ci/jenkins/config/main.yaml - branch-config-file-repo: apache/incubator-kie-kogito-pipelines + branch-config-file-repo: kiegroup/kogito-pipelines