diff --git a/.ci/jenkins/Jenkinsfile.nightly b/.ci/jenkins/Jenkinsfile.nightly index 0692d65ea..c54d1ee54 100644 --- a/.ci/jenkins/Jenkinsfile.nightly +++ b/.ci/jenkins/Jenkinsfile.nightly @@ -134,19 +134,6 @@ pipeline { } } } - - stage('Start Cloud nightly') { - when { - expression { !params.SKIP_CLOUD_NIGHTLY } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addSkipTestsParam(buildParams) - build(job: './0-kogito-nightly-cloud', wait: false, parameters: buildParams, propagate: false) - } - } - } } post { unsuccessful { diff --git a/.ci/jenkins/Jenkinsfile.nightly.cloud b/.ci/jenkins/Jenkinsfile.nightly.cloud deleted file mode 100644 index ae1e41789..000000000 --- a/.ci/jenkins/Jenkinsfile.nightly.cloud +++ /dev/null @@ -1,248 +0,0 @@ -import org.jenkinsci.plugins.workflow.libs.Library - -@Library('jenkins-pipeline-shared-libraries')_ - -// Deploy jobs -IMAGES_DEPLOY = 'kogito-images-deploy' -SEVERLESS_OPERATOR_DEPLOY = 'kogito-serverless-operator-deploy' - -// Map of executed jobs -// See https://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html -// for more options on built job entity -JOBS = [:] - -FAILED_STAGES = [:] -UNSTABLE_STAGES = [:] - -defaultImageParamsPrefix = 'IMAGE' - -// Should be multibranch pipeline -pipeline { - agent { - label util.avoidFaultyNodes('ubuntu') - } - - options { - timeout(time: 1380, unit: 'MINUTES') - } - - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - - environment { - // Some generated env is also defined into ./dsl/jobs.groovy file - - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - - IMAGE_NAME_NIGHTLY_SUFFIX = '' - - // Use branch name in nightly tag as we may have parallel main and release branch builds - NIGHTLY_TAG = getBuildBranch() - } - - stages { - stage('Initialize') { - steps { - script { - echo "nightly tag is ${env.NIGHTLY_TAG}" - - currentBuild.displayName = env.NIGHTLY_TAG - } - } - } - - stage('Build & Deploy Images') { - when { - expression { return isImagesDeploy() } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addImageBuildParams(buildParams, env.NIGHTLY_TAG) - addDeployImageWithLatestTagParam(buildParams) - - // For building - addAppsParam(buildParams) - - // For testing - addSkipTestsParam(buildParams) - - // Ask to create the PR with changes occuring in this - addBooleanParam(buildParams, 'CREATE_PR', true) - - buildJob(IMAGES_DEPLOY, buildParams) - } - } - post { - failure { - addFailedStage(IMAGES_DEPLOY) - } - } - } - - stage('Build & Deploy Serverless Operator') { - when { - expression { return isOperatorDeploy() } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addSkipTestsParam(buildParams) - addImageBuildParams(buildParams, env.NIGHTLY_TAG) - addDeployImageWithLatestTagParam(buildParams) - - buildJob(SEVERLESS_OPERATOR_DEPLOY, buildParams) - } - } - post { - failure { - addFailedStage(SEVERLESS_OPERATOR_DEPLOY) - } - } - } - } - post { - unsuccessful { - sendPipelineErrorNotification() - } - } -} - -def buildJob(String jobName, List buildParams, String jobKey = jobName) { - echo "[${jobKey}] Build ${jobName} with params ${buildParams}" - - def job = build(job: "${jobName}", wait: true, parameters: buildParams, propagate: false) - JOBS[jobKey] = job - - // Set Unstable if job did not succeed - if (!isJobSucceeded(jobKey)) { - addUnstableStage(jobKey) - unstable("Job ${jobName} finished with result ${job.result}") - } - return job -} - -def getJob(String jobKey) { - return JOBS[jobKey] -} - -String getJobUrl(String jobKey) { - echo "getJobUrl for ${jobKey}" - return getJob(jobKey)?.absoluteUrl ?: '' -} - -boolean isJobSucceeded(String jobKey) { - return getJob(jobKey)?.result == 'SUCCESS' -} - -boolean isJobUnstable(String jobKey) { - return getJob(jobKey)?.result == 'UNSTABLE' -} - -void addFailedStage(String jobKey = '') { - FAILED_STAGES.put("${env.STAGE_NAME}", jobKey) -} -void addUnstableStage(String jobKey = '') { - UNSTABLE_STAGES.put("${env.STAGE_NAME}", jobKey) -} - -void sendPipelineErrorNotification() { - String bodyMsg = "Kogito Cloud nightly job #${env.BUILD_NUMBER} was: ${currentBuild.currentResult}" - - paramsStr = '' - if (params.SKIP_TESTS) { - paramsStr += '\n- Tests skipped' - } - if (params.SKIP_IMAGES) { - paramsStr += '\n- Images skipped' - } - if (params.SKIP_OPERATOR) { - paramsStr += '\n- Operator skipped' - } - bodyMsg += paramsStr ? "\n\nConfiguration:${paramsStr}" : '\n' - - if (FAILED_STAGES.size() > 0) { - bodyMsg += '\nFailed stages: \n- ' - bodyMsg += FAILED_STAGES.collect { "${it.key} => ${getJobUrl(it.value)}" }.join('\n- ') - } - bodyMsg += '\n' - if (UNSTABLE_STAGES.size() > 0) { - bodyMsg += '\nUnstable stages: \n- ' - bodyMsg += UNSTABLE_STAGES.collect { "${it.key} => ${getJobUrl(it.value)}" }.join('\n- ') - } - bodyMsg += '\n' - bodyMsg += "\nPlease look here: ${env.BUILD_URL}" - emailext body: bodyMsg, subject: "[${getBuildBranch()}][d] Full Pipeline", - to: env.KOGITO_CI_EMAIL_TO -} - -List getDefaultBuildParams(String buildBranchName = '', String key = '') { - buildBranchName = buildBranchName ?: getBuildBranch() - List params = [] - addStringParam(params, 'DISPLAY_NAME', "${key ? "${key}-" : ''}${env.NIGHTLY_TAG}") - addBooleanParam(params, 'SEND_NOTIFICATION', true) - - return params -} - -void addSkipTestsParam(buildParams) { - addBooleanParam(buildParams, 'SKIP_TESTS', params.SKIP_TESTS) -} - -void addSkipIntegrationTestsParam(buildParams) { - addBooleanParam(buildParams, 'SKIP_INTEGRATION_TESTS', params.SKIP_TESTS) -} - -void addAppsParam(buildParams) { - addStringParam(buildParams, 'APPS_REF', "${getBuildBranch()}") - addStringParam(buildParams, 'APPS_URI', "https://github.com/${getGitAuthor()}/incubator-kie-kogito-apps") -} - -void addImageBuildParams(List buildParams, String tag, String paramsPrefix = defaultImageParamsPrefix, String extraSuffix = '') { - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY_USER_CREDENTIALS_ID'), env.IMAGE_REGISTRY_USER_CREDENTIALS_ID) - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY_TOKEN_CREDENTIALS_ID'), env.IMAGE_REGISTRY_TOKEN_CREDENTIALS_ID) - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY'), env.IMAGE_REGISTRY) - addStringParam(buildParams, constructKey(paramsPrefix, 'NAMESPACE'), env.IMAGE_NAMESPACE) - addStringParam(buildParams, constructKey(paramsPrefix, 'TAG'), tag) -} - -void addDeployImageWithLatestTagParam(buildParams) { - addBooleanParam(buildParams, 'DEPLOY_WITH_LATEST_TAG', isDeployImagesLatestTag()) -} - -void addStringParam(List params, String key, String value) { - params.add(string(name: key, value: value)) -} - -void addBooleanParam(List params, String key, boolean value) { - params.add(booleanParam(name: key, value: value)) -} - -String constructKey(String prefix, String paramId) { - return prefix ? "${prefix}_${paramId}" : paramId -} - -String getBuildBranch() { - return env.GIT_BRANCH_NAME -} - -String getGitAuthor() { - return env.GIT_AUTHOR -} - -String getGitAuthorCredsId() { - return env.GIT_AUTHOR_CREDS_ID -} - -boolean isDeployImagesLatestTag() { - return false -} - -boolean isImagesDeploy() { - return !params.SKIP_IMAGES -} - -boolean isOperatorDeploy() { - return !params.SKIP_OPERATOR -} diff --git a/.ci/jenkins/Jenkinsfile.nightly.quarkus-platform b/.ci/jenkins/Jenkinsfile.nightly.quarkus-platform deleted file mode 100644 index f248de855..000000000 --- a/.ci/jenkins/Jenkinsfile.nightly.quarkus-platform +++ /dev/null @@ -1,226 +0,0 @@ -import org.jenkinsci.plugins.workflow.libs.Library -@Library('jenkins-pipeline-shared-libraries')_ - -import org.kie.jenkins.MavenCommand -import org.kie.jenkins.MavenSettingsUtils - -pipeline { - agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - label util.avoidFaultyNodes() - } - } - - options { - timestamps() - timeout(time: 240, unit: 'MINUTES') - } - - environment { - // Static env is defined into .jenkins/dsl/jobs.groovy file - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - - SETTINGS_FILE = "${WORKSPACE}/quarkus-platform/.github/mvn-settings.xml" - } - - stages { - stage('Initialize') { - steps { - script { - cleanWs(disableDeferredWipeout: true) - sh 'printenv' - - if (params.DISPLAY_NAME) { - currentBuild.displayName = params.DISPLAY_NAME - } - } - } - } - stage('Checkout artifacts\'s repositories') { - steps { - script { - dir('drools') { - deleteDir() - checkout(githubscm.resolveRepository('incubator-kie-drools', getGitAuthor(), getTargetBranch(7), false)) - } - dir('kogito-runtimes') { - deleteDir() - checkout(githubscm.resolveRepository('incubator-kie-kogito-runtimes', getGitAuthor(), getGitBranch(), false)) - } - dir('kogito-apps') { - deleteDir() - checkout(githubscm.resolveRepository('incubator-kie-kogito-apps', getGitAuthor(), getGitBranch(), false)) - } - dir('optaplanner') { - deleteDir() - // Get current corresponding branch and if not working, latest tag - String opBranch = getTargetBranch(7) - try { - checkout(githubscm.resolveRepository('incubator-kie-optaplanner', getGitAuthor(), opBranch, false)) - } catch(err) { - echo "Error checking out ${opBranch}. Fallback to latest tag." - String latestTag = githubscm.getLatestTag("${opBranch.split("\\.")[0]}\\.") - echo "Got latest tag = ${latestTag}" - checkout(githubscm.resolveRepository('incubator-kie-optaplanner', getGitAuthor(), latestTag, false)) - } - } - } - } - } - stage('Retrieve versions') { - steps { - script { - dir('drools') { - env.DROOLS_VERSION = sh(script: 'mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -pl :drools-parent -Dexpression=project.version -q -DforceStdout', returnStdout: true).trim() - assert env.DROOLS_VERSION : 'Cannot find the Drools version.' - } - dir('kogito-runtimes') { - env.KOGITO_VERSION = sh(script: 'mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -pl :kogito-runtimes -Dexpression=project.version -q -DforceStdout', returnStdout: true).trim() - env.QUARKUS_VERSION = sh(script: 'mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -pl :kogito-dependencies-bom -Dexpression=version.io.quarkus -q -DforceStdout', returnStdout: true).trim() - assert env.KOGITO_VERSION : 'Cannot find the Kogito version.' - assert env.QUARKUS_VERSION : 'Cannot find the Quarkus version.' - } - dir('optaplanner') { - env.OPTAPLANNER_VERSION = sh(script: 'mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -pl :optaplanner-parent -Dexpression=project.version -q -DforceStdout', returnStdout: true).trim() - assert env.OPTAPLANNER_VERSION : 'Cannot find the OptaPlanner version.' - } - - echo "Configured Drools version ${env.DROOLS_VERSION}" - echo "Configured Kogito version ${env.KOGITO_VERSION}" - echo "Configured Quarkus version ${env.QUARKUS_VERSION}" - echo "Configured OptaPlanner version ${env.OPTAPLANNER_VERSION}" - } - } - } - stage('Prepare quarkus-platform') { - steps { - script { - dir('quarkus-platform') { - deleteDir() - - String quarkusBranch = env.QUARKUS_VERSION.split("\\.")[0] + '.' + env.QUARKUS_VERSION.split("\\.")[1] - echo "Use quarkus branch ${quarkusBranch}" - checkout(githubscm.resolveRepository('quarkus-platform', 'quarkusio', quarkusBranch, false)) - - // Update platform mvn settings file - // We use platform settings file to be sure to get all needed artifacts - MavenSettingsUtils.setRepositoryInSettings(this, env.SETTINGS_FILE, 'kogito-staging', 'https://repository.apache.org/service/local/staging/deploy/maven2/') - MavenSettingsUtils.setRepositoryInSettings(this, env.SETTINGS_FILE, 'kogito-public', 'https://repository.apache.org/content/groups/public/') - - String localQuarkusPlatformVersion = sh(script: 'mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout', returnStdout: true).trim() - echo "Platform Quarkus version ${localQuarkusPlatformVersion}" - - // Set Drools/OP & Kogito versions - maven.mvnSetVersionProperty('kogito-quarkus.version', env.KOGITO_VERSION) - maven.mvnSetVersionProperty('drools-quarkus.version', env.DROOLS_VERSION) - maven.mvnSetVersionProperty('optaplanner-quarkus.version', env.OPTAPLANNER_VERSION) - maven.mvnSetVersionProperty('quarkus.version', env.QUARKUS_VERSION) - - // Update platform version - localQuarkusPlatformVersion = "kogito-${env.KOGITO_VERSION}" - echo "Set quarkus platform version ${localQuarkusPlatformVersion}" - maven.mvnVersionsSet(localQuarkusPlatformVersion, true) - } - } - } - } - stage('Install local artifacts') { - steps { - script { - [ 'drools', 'kogito-runtimes', 'kogito-apps', 'optaplanner'].each { directory -> - echo "Install ${directory} artifacts" - dir(directory) { - new MavenCommand(this, ['-fae', '-ntp']) - .withSettingsXmlFile(env.SETTINGS_FILE) - .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : []) - .withOptions(env.BUILD_MVN_OPTS_UPSTREAM ? [ env.BUILD_MVN_OPTS_UPSTREAM ] : []) - .withProperty('quickly') - .run('install') - } - } - } - } - } - stage('Deploy quarkus-platform') { - steps { - script { - dir('quarkus-platform') { - new MavenCommand(this, ['-fae', '-ntp']) - .withSettingsXmlFile(env.SETTINGS_FILE) - .withProperty('altDeploymentRepository', "local::default::file://${getMavenDeployLocalDir()}") - .withProperty('enforcer.skip', true) - .withProperty('maven.test.failure.ignore', true) - .run('deploy') - - // Upload to specific repository with credentials - // Removed deployment to reposiory as no repository defined for now ... - // String mavenDeployRepositoryZipUrl = "${QUARKUS_PLATFORM_NEXUS_URL.replaceAll('/content/', '/service/local/').replaceFirst('/*$', '')}/content-compressed" - // maven.uploadLocalArtifacts("${QUARKUS_PLATFORM_NEXUS_CREDS}", getMavenDeployLocalDir(), mavenDeployRepositoryZipUrl) - } - } - } - post { - always { - junit(testResults: '**/target/surefire-reports/**/*.xml, **/target/failsafe-reports/**/*.xml, **/target/invoker-reports/**/*.xml', allowEmptyResults: true) - } - unsuccessful { - script { - util.archiveConsoleLog('', 300) - } - } - } - } - - // Tests of platform should be done in a separate job - } - post { - cleanup { - cleanWs() - } - unsuccessful { - sendErrorNotification() - } - } -} - -void checkoutRepo(String repo, String gitAuthor, String branch, String gitAuthorCredsId) { - checkout(githubscm.resolveRepository(repo, gitAuthor, branch, false, gitAuthorCredsId)) - // need to manually checkout branch since on a detached branch after checkout command - sh "git checkout ${branch}" -} - -String getGitBranch() { - return env.GIT_BRANCH_NAME -} - -String getGitAuthor() { - return env.GIT_AUTHOR -} - -void sendNotification(String body) { - emailext body: "${body}", - subject: "[${getGitBranch()}] Kogito Quarkus Platform", - to: env.KOGITO_CI_EMAIL_TO -} - -void sendErrorNotification() { - sendNotification("Job #${BUILD_NUMBER} was: **${currentBuild.currentResult}**\nPlease look here: ${BUILD_URL}") -} - -String getMavenDeployLocalDir() { - return "${WORKSPACE}/maven_deploy_dir" -} - -String getTargetBranch(Integer addToMajor) { - String targetBranch = getGitBranch() - List versionSplit = targetBranch.split("\\.") as List - - if (versionSplit[0].isNumber()) { - targetBranch = "${Integer.parseInt(versionSplit[0]) + addToMajor}.${versionSplit.tail().join('.')}" - } else { - echo "Cannot parse targetBranch as release branch so going further with current value: ${targetBranch}" - } - return targetBranch -} diff --git a/.ci/jenkins/Jenkinsfile.release b/.ci/jenkins/Jenkinsfile.release index 9dfaa04ba..5f0d3ab77 100644 --- a/.ci/jenkins/Jenkinsfile.release +++ b/.ci/jenkins/Jenkinsfile.release @@ -86,20 +86,6 @@ pipeline { } } } - - stage('Start Cloud release') { - when { - expression { isCloudRelease() } - } - steps { - script { - def buildParams = getDefaultBuildParams(getReleaseVersion()) - addStringParam(buildParams, 'RELEASE_VERSION', getReleaseVersion()) - addSkipTestsParam(buildParams) - build(job: './0-kogito-release-cloud', wait: false, parameters: buildParams, propagate: false) - } - } - } } post { always { @@ -322,10 +308,6 @@ String getGitAuthor() { return env.GIT_AUTHOR } -boolean isCloudRelease() { - return !params.SKIP_CLOUD_RELEASE -} - void setReleasePropertyIfneeded(String key, def value) { if (value) { releaseProperties[key] = value diff --git a/.ci/jenkins/Jenkinsfile.release.cloud b/.ci/jenkins/Jenkinsfile.release.cloud deleted file mode 100644 index 31509fb4e..000000000 --- a/.ci/jenkins/Jenkinsfile.release.cloud +++ /dev/null @@ -1,346 +0,0 @@ -import org.jenkinsci.plugins.workflow.libs.Library - -@Library('jenkins-pipeline-shared-libraries')_ - -kogitoImagesRepo = 'kogito-images' - -JOB_PROPERTY_PREFIX = 'build' -JOB_RESULT_PROPERTY_KEY = 'result' -JOB_URL_PROPERTY_KEY = 'absoluteUrl' -JOB_DECISION_PROPERTY_KEY = 'decision' -JOB_DECISION_MESSAGE_PROPERTY_KEY = 'decisionMessage' - -releaseProperties = [:] - -defaultImageParamsPrefix = 'IMAGE' -baseImageParamsPrefix = 'BASE_IMAGE' - -pipeline { - agent { - label util.avoidFaultyNodes('ubuntu') - } - - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - - environment { - // Some generated env is also defined into ./dsl/jobs.groovy file - - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - } - - stages { - stage('Initialize') { - steps { - script { - // Restore config from previous run - if (params.RESTORE_FROM_PREVIOUS_JOB) { - releaseProperties = readPropertiesFromUrl(params.RESTORE_FROM_PREVIOUS_JOB, 'release.properties') - echo "Release properties imported from previous job: ${releaseProperties}" - } - - assert getReleaseVersion() - - currentBuild.displayName = getDisplayName() - - sendNotification("Cloud Release Pipeline has started...\nKogito version = ${getReleaseVersion()}\n=> ${env.BUILD_URL}") - } - } - post { - always { - setReleasePropertyIfneeded('release.version', getReleaseVersion()) - setReleasePropertyIfneeded('git.tag.name', getGitTagName()) - } - } - } - - stage('Setup configuration for testing') { - steps { - script { - env.APPS_URI = params.APPS_URI ?: (getReleaseProperty('apps.uri') ?: "https://github.com/${getGitAuthor()}/incubator-kie-kogito-apps") - env.APPS_REF = params.APPS_REF ?: (getReleaseProperty('apps.ref') ?: getGitTagName()) - - echo "Got apps uri ${env.APPS_URI}" - echo "Got apps ref ${env.APPS_REF}" - - setReleasePropertyIfneeded('apps.uri', env.APPS_URI) - setReleasePropertyIfneeded('apps.ref', env.APPS_REF) - } - } - } - - stage('Build & Deploy Kogito Images') { - when { - expression { return isImagesRelease() } - } - steps { - script { - def buildParams = getDefaultBuildParams(getReleaseVersion()) - addImageBuildParams(buildParams, getReleaseVersion()) - addAppsParam(buildParams) - addSkipTestsParam(buildParams) - - buildJob(getDeployJobName(kogitoImagesRepo), buildParams) - } - } - } - } - post { - always { - script { - saveReleaseProperties() - } - } - cleanup { - cleanWs() - } - success { - script { - sendSuccessfulReleaseNotification() - } - } - unsuccessful { - sendErrorNotification() - } - } -} - -def buildJob(String jobName, List buildParams) { - if (!hasJob(jobName) || (getJobResult(jobName) != 'SUCCESS' && getJobDecision(jobName) == 'retry')) { - sendStageNotification() - echo "Build ${jobName} with params ${buildParams}" - def job = build(job: "./${jobName}", wait: true, parameters: buildParams, propagate: false) - removeJobDecision(jobName) - registerJobExecution(jobName, job.result, job.absoluteUrl) - } else { - echo 'Job was already executed. Retrieving information...' - } - - saveReleaseProperties() - - def jobResult = getJobResult(jobName) - def jobUrl = getJobUrl(jobName) - def jobDecision = getJobDecision(jobName) - if (jobResult != 'SUCCESS') { - if (jobDecision != 'continue' && jobDecision != 'skip') { - echo "Sending a notification about an unsuccessful job build ${jobName}." - sendNotification("`${jobName}` finished with status `${jobResult}`.\nSee: ${jobUrl}\n\nPlease provide which action should be done (retry ? continue ? skip ? abort ?): ${env.BUILD_URL}input") - - // abort is handled automatically by the pipeline in the input - def result = input message: "Job `${jobName}` is in status ${jobResult}. What do you want to do ?\nBeware that skipping a deploy job will not launch the promote part.", parameters: [choice(name: 'ACTION', choices: ['retry', 'continue', 'skip'].join('\n')), string(name: 'MESSAGE', description: 'If you want to add information to your action...')] - def inputDecision = result['ACTION'] - def inputMessage = result['MESSAGE'] - registerJobDecision(jobName, inputDecision, inputMessage) - - String resultStr = "`${jobName}` failure => Decision was made to ${inputDecision}." - if (inputMessage) { - resultStr += "Additional Information: `${inputMessage}`" - } - sendNotification(resultStr) - - if (inputDecision == 'retry') { - // If retry, remove job and build again - return buildJob(jobName, buildParams) - } - } else { - echo "Job decision was '${jobDecision}'" - } - } else { - echo 'Job succeeded' - } -} - -String getDeployJobName(String repository) { - return "${repository}-deploy" -} - -String getJobPropertySuffix(String jobName) { - return "${JOB_PROPERTY_PREFIX}.${jobName}" -} - -String getJobPropertyKey(String jobName, String key) { - return "${getJobPropertySuffix(jobName)}.${key}" -} - -def registerJobExecution(String jobName, String result, String absoluteUrl) { - setReleasePropertyIfneeded(getJobPropertyKey(jobName, JOB_RESULT_PROPERTY_KEY), result) - setReleasePropertyIfneeded(getJobPropertyKey(jobName, JOB_URL_PROPERTY_KEY), absoluteUrl) -} - -def registerJobDecision(String jobName, String decision, String message = '') { - setReleasePropertyIfneeded(getJobPropertyKey(jobName, JOB_DECISION_PROPERTY_KEY), decision) - setReleasePropertyIfneeded(getJobPropertyKey(jobName, JOB_DECISION_MESSAGE_PROPERTY_KEY), message) -} - -def removeJobDecision(String jobName) { - removeReleaseProperty(getJobPropertyKey(jobName, JOB_DECISION_PROPERTY_KEY)) - removeReleaseProperty(getJobPropertyKey(jobName, JOB_DECISION_MESSAGE_PROPERTY_KEY)) -} - -List getAllJobNames() { - return releaseProperties.findAll { it.key.startsWith(JOB_PROPERTY_PREFIX) }.collect { it.key.split('\\.')[1] }.unique() -} - -boolean hasJob(String jobName) { - return releaseProperties.any { it.key.startsWith(getJobPropertySuffix(jobName)) } -} - -String getJobUrl(String jobName) { - echo "getJobUrl for ${jobName}" - return getReleaseProperty(getJobPropertyKey(jobName, JOB_URL_PROPERTY_KEY)) ?: '' -} - -String getJobResult(String jobName) { - echo "getJobResult for ${jobName}" - return getReleaseProperty(getJobPropertyKey(jobName, JOB_RESULT_PROPERTY_KEY)) ?: '' -} - -String getJobDecision(String jobName) { - echo "getJobDecision for ${jobName}" - return getReleaseProperty(getJobPropertyKey(jobName, JOB_DECISION_PROPERTY_KEY)) ?: '' -} - -boolean isJobConsideredOk(String jobName) { - String result = getJobResult(jobName) - String decision = getJobDecision(jobName) - return result == 'SUCCESS' || (result == 'UNSTABLE' && decision == 'continue') -} - -void saveReleaseProperties() { - def propertiesStr = releaseProperties.collect { entry -> "${entry.key}=${entry.value}" }.join('\n') - writeFile( file : 'release.properties' , text : propertiesStr) - archiveArtifacts artifacts: 'release.properties' -} - -void sendSuccessfulReleaseNotification() { - String bodyMsg = 'Cloud release is successful with those jobs:\n' - getAllJobNames().findAll { isJobConsideredOk(it) }.each { - bodyMsg += "- ${it}\n" - } - bodyMsg += "\nPlease look here: ${BUILD_URL} for more information" - sendNotification(bodyMsg) -} - -void sendErrorNotification() { - sendNotification("Cloud release job #${BUILD_NUMBER} was: ${currentBuild.currentResult}\nPlease look here: ${BUILD_URL}") -} - -void sendStageNotification() { - sendNotification("${env.STAGE_NAME}") -} - -void sendNotification(String body) { - echo 'Send Notification' - echo body - emailext body: body, subject: "[${env.GIT_BRANCH_NAME}] Release Pipeline", - to: env.KOGITO_CI_EMAIL_TO -} - -def readPropertiesFromUrl(String url, String propsFilename) { - if (!url.endsWith('/')) { - url += '/' - } - sh "wget ${url}artifact/${propsFilename} -O ${propsFilename}" - def props = readProperties file: propsFilename - echo props.collect { entry -> "${entry.key}=${entry.value}" }.join('\n') - return props -} - -List getDefaultBuildParams(String version) { - List buildParams = [] - addDisplayNameParam(buildParams, getDisplayName(version)) - addStringParam(buildParams, 'PROJECT_VERSION', version) - addStringParam(buildParams, 'KOGITO_PR_BRANCH', params.KOGITO_PR_BRANCH ?: "kogito-${version}") - addStringParam(buildParams, 'GIT_TAG_NAME', getGitTagName()) - return buildParams -} - -void addDisplayNameParam(buildParams, name = '') { - name = name ?: getDisplayName() - addStringParam(buildParams, 'DISPLAY_NAME', name) -} - -void addDeployBuildUrlParam(buildParams, jobName) { - addDeployBuildUrlParamOrClosure(buildParams, jobName) -} - -void addDeployBuildUrlParamOrClosure(buildParams, jobName, closure = null) { - String url = getJobUrl(jobName) - if (url) { - addStringParam(buildParams, 'DEPLOY_BUILD_URL', getJobUrl(jobName)) - } else if (closure) { - closure() - } -} - -void addSkipTestsParam(buildParams) { - addBooleanParam(buildParams, 'SKIP_TESTS', params.SKIP_TESTS) -} - -void addAppsParam(buildParams) { - addStringParam(buildParams, 'APPS_URI', env.APPS_URI) - addStringParam(buildParams, 'APPS_REF', env.APPS_REF) -} - -void addImageBuildParams(List buildParams, String tag, boolean isFinalImage = false, String paramsPrefix = defaultImageParamsPrefix) { - addBooleanParam(buildParams, constructKey(paramsPrefix, 'USE_OPENSHIFT_REGISTRY'), false) - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY_USER_CREDENTIALS_ID'), '') - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY_TOKEN_CREDENTIALS_ID'), '') - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY'), env.IMAGE_REGISTRY) - addStringParam(buildParams, constructKey(paramsPrefix, 'NAMESPACE'), env.IMAGE_NAMESPACE) - addStringParam(buildParams, constructKey(paramsPrefix, 'TAG'), tag) -} - -void addStringParam(List buildParams, String key, String value) { - buildParams.add(string(name: key, value: value)) -} - -void addBooleanParam(List buildParams, String key, boolean value) { - buildParams.add(booleanParam(name: key, value: value)) -} - -String constructKey(String prefix, String paramId) { - return prefix ? "${prefix}_${paramId}" : paramId -} - -String getDisplayName(version = '') { - version = version ?: getReleaseVersion() - return "Release ${version}" -} - -String getReleaseVersion() { - return params.RELEASE_VERSION ?: getReleaseProperty('release.version') -} - -String getGitAuthor() { - return env.GIT_AUTHOR -} - -boolean isImagesRelease() { - return !params.SKIP_IMAGES_RELEASE -} - -String getGitTagName() { - return params.GIT_TAG_NAME ?: getReleaseProperty('git.tag.name') -} - -void setReleasePropertyIfneeded(String key, def value) { - if (value) { - releaseProperties[key] = value - } -} - -void removeReleaseProperty(String key) { - if (hasReleaseProperty(key)) { - releaseProperties.remove(key) - } -} - -boolean hasReleaseProperty(String key) { - return releaseProperties.containsKey(key) -} - -def getReleaseProperty(String key) { - return hasReleaseProperty(key) ? releaseProperties[key] : '' -} diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 97d7d54aa..ee514aca4 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -116,27 +116,11 @@ pipeline { script { def buildParams = getDefaultBuildParams() addBooleanParam(buildParams, 'SKIP_TESTS', true) - addBooleanParam(buildParams, 'SKIP_CLOUD_NIGHTLY', true) build(job: '../nightly/0-kogito-nightly', wait: false, parameters: buildParams, propagate: false) } } } - // Launch the nightly to deploy all artifacts from the branch - stage('Launch cloud setup branch') { - when { - expression { return !params.SKIP_CLOUD_SETUP_BRANCH } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addKogitoVersionParam(buildParams) - addBooleanParam(buildParams, 'DEPLOY', params.DEPLOY) - build(job: './0-setup-branch-cloud', wait: false, parameters: buildParams, propagate: false) - } - } - } - // Launch the weekly to deploy all artifacts from the branch stage('Launch the weekly') { when { @@ -146,7 +130,6 @@ pipeline { script { def buildParams = getDefaultBuildParams() addBooleanParam(buildParams, 'SKIP_TESTS', true) - addBooleanParam(buildParams, 'SKIP_CLOUD_NIGHTLY', true) build(job: '../other/0-kogito-weekly', wait: false, parameters: buildParams, propagate: false) } } diff --git a/.ci/jenkins/Jenkinsfile.setup-branch.cloud b/.ci/jenkins/Jenkinsfile.setup-branch.cloud deleted file mode 100644 index 2022b9c5f..000000000 --- a/.ci/jenkins/Jenkinsfile.setup-branch.cloud +++ /dev/null @@ -1,199 +0,0 @@ -import org.jenkinsci.plugins.workflow.libs.Library - -@Library('jenkins-pipeline-shared-libraries')_ - -// Map of executed jobs -// See https://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html -// for more options on built job entity -JOBS = [:] - -FAILED_STAGES = [:] -UNSTABLE_STAGES = [:] - -pipeline { - agent { - label util.avoidFaultyNodes('ubuntu') - } - - options { - timeout(time: 360, unit: 'MINUTES') - } - - environment { - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") -} - - stages { - stage('Initialize') { - steps { - script { - currentBuild.displayName = getKogitoVersion() - } - } - } - - stage('Init Images') { - steps { - script { - def buildParams = getDefaultBuildParams() - addStringParam(buildParams, 'KOGITO_VERSION', getKogitoVersion()) - addStringParam(buildParams, 'KOGITO_ARTIFACTS_VERSION', getKogitoVersion()) - buildJob('kogito-images', buildParams) - } - } - post { - failure { - addFailedStage('kogito-images') - } - } - } - - stage('Init Serverless Operator') { - steps { - script { - def buildParams = getDefaultBuildParams() - addStringParam(buildParams, 'PROJECT_VERSION', getKogitoVersion().toLowerCase()) - buildJob('kogito-serverless-operator', buildParams) - } - } - post { - failure { - addFailedStage('kogito-serverless-operator') - } - } - } - - // Launch the nightly to deploy all artifacts from the branch - stage('Launch the nightly') { - when { - expression { return params.DEPLOY } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addBooleanParam(buildParams, 'SKIP_TESTS', true) - build(job: '../nightly/0-kogito-nightly-cloud', wait: false, parameters: buildParams, propagate: false) - } - } - } - - // Launch the weekly to deploy all artifacts from the branch - stage('Launch the weekly') { - when { - expression { return params.DEPLOY } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addBooleanParam(buildParams, 'SKIP_TESTS', true) - build(job: '../other/0-kogito-weekly-cloud', wait: false, parameters: buildParams, propagate: false) - } - } - } - } - post { - unsuccessful { - sendPipelineErrorNotification() - } - } -} - -def buildJob(String jobName, List buildParams, String jobKey = jobName, boolean waitForJob = true) { - echo "[${jobKey}] Build ${jobName} with params ${buildParams}" - - def job = build(job: "${jobName}", wait: waitForJob, parameters: buildParams, propagate: false) - JOBS[jobKey] = job - - // Set Unstable if job did not succeed - if (waitForJob && !isJobSucceeded(jobKey)) { - addUnstableStage(jobKey) - unstable("Job ${jobName} finished with result ${job.result}") - } - return job -} - -def getJob(String jobKey) { - return JOBS[jobKey] -} - -String getJobUrl(String jobKey) { - echo "getJobUrl for ${jobKey}" - return getJob(jobKey)?.absoluteUrl ?: '' -} - -boolean isJobSucceeded(String jobKey) { - return getJob(jobKey)?.result == 'SUCCESS' -} - -boolean isJobUnstable(String jobKey) { - return getJob(jobKey)?.result == 'UNSTABLE' -} - -void addFailedStage(String jobKey = '') { - FAILED_STAGES.put("${STAGE_NAME}", jobKey) -} -void addUnstableStage(String jobKey = '') { - UNSTABLE_STAGES.put("${STAGE_NAME}", jobKey) -} - -void sendPipelineErrorNotification() { - String bodyMsg = "Kogito setup branch job #${BUILD_NUMBER} was: ${currentBuild.currentResult}" - - if (FAILED_STAGES.size()) { - bodyMsg += '\nFailed stages: \n- ' - bodyMsg += FAILED_STAGES.collect { "${it.key} => ${getJobUrl(it.value)}" }.join('\n- ') - } - bodyMsg += '\n' - if (UNSTABLE_STAGES.size()) { - bodyMsg += '\nUnstable stages: \n- ' - bodyMsg += UNSTABLE_STAGES.collect { "${it.key} => ${getJobUrl(it.value)}" }.join('\n- ') - } - bodyMsg += '\n' - bodyMsg += "\nPlease look here: ${BUILD_URL}" - emailext body: bodyMsg, subject: "[${getBuildBranch()}][d] Setup branch", - to: env.KOGITO_CI_EMAIL_TO -} - -List getDefaultBuildParams() { - List buildParams = [] - addStringParam(buildParams, 'DISPLAY_NAME', getKogitoVersion()) - addBooleanParam(buildParams, 'SEND_NOTIFICATION', true) - - return buildParams -} - -void addStringParam(List params, String key, String value) { - params.add(string(name: key, value: value)) -} - -void addBooleanParam(List params, String key, boolean value) { - params.add(booleanParam(name: key, value: value)) -} - -String getBuildBranch() { - return env.GIT_BRANCH_NAME -} - -String getGitAuthor() { - return env.GIT_AUTHOR -} - -String getGitAuthorCredsId() { - return env.GIT_AUTHOR_CREDS_ID -} - -String getKogitoVersion() { - return params.KOGITO_VERSION ?: getVersionFromReleaseBranch(getBuildBranch()) -} - -String getVersionFromReleaseBranch(String releaseBranch, int microVersion = 999, String suffix = 'SNAPSHOT') { - String [] versionSplit = releaseBranch.split("\\.") - if (versionSplit.length == 3 - && versionSplit[0].isNumber() - && versionSplit[1].isNumber() - && versionSplit[2] == 'x') { - return "${versionSplit[0]}.${versionSplit[1]}.${microVersion}${suffix ? '-' + suffix : ''}" - } else { - error 'Cannot parse given branch as a release branch, aka [M].[m].x ...' - } -} diff --git a/.ci/jenkins/Jenkinsfile.weekly.cloud b/.ci/jenkins/Jenkinsfile.weekly.cloud deleted file mode 100644 index 5fa76b3c6..000000000 --- a/.ci/jenkins/Jenkinsfile.weekly.cloud +++ /dev/null @@ -1,249 +0,0 @@ -import org.jenkinsci.plugins.workflow.libs.Library - -@Library('jenkins-pipeline-shared-libraries')_ - -// Deploy jobs -IMAGES_DEPLOY = 'kogito-images.weekly-deploy' -SEVERLESS_OPERATOR_DEPLOY = 'kogito-serverless-operator.weekly-deploy' - -// Map of executed jobs -// See https://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html -// for more options on built job entity -JOBS = [:] - -FAILED_STAGES = [:] -UNSTABLE_STAGES = [:] - -defaultImageParamsPrefix = 'IMAGE' - -// Should be multibranch pipeline -pipeline { - agent { - label util.avoidFaultyNodes('ubuntu') - } - - options { - timeout(time: 1380, unit: 'MINUTES') - } - - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - - environment { - // Some generated env is also defined into ./dsl/jobs.groovy file - - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - - // Use branch name in weekly tag as we may have parallel main and release branch builds - WEEKLY_TAG = """${getBuildBranch()}-${getCurrentDate()}""" - } - - stages { - stage('Initialize') { - steps { - script { - echo "weekly tag is ${env.WEEKLY_TAG}" - - currentBuild.displayName = env.WEEKLY_TAG - } - } - } - - stage('Build & Deploy Images') { - when { - expression { return isImagesDeploy() } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addImageBuildParams(buildParams, env.WEEKLY_TAG) - - // For building - addAppsParam(buildParams) - - // For testing - addSkipTestsParam(buildParams) - addExamplesParam(buildParams) - - buildJob(IMAGES_DEPLOY, buildParams) - } - } - post { - failure { - addFailedStage(IMAGES_DEPLOY) - } - } - } - - stage('Build & Deploy Serverless Operator') { - when { - expression { return isOperatorDeploy() } - } - steps { - script { - def buildParams = getDefaultBuildParams() - addSkipTestsParam(buildParams) - addImageBuildParams(buildParams, env.WEEKLY_TAG) - addDeployImageWithLatestTagParam(buildParams) - - buildJob(SEVERLESS_OPERATOR_DEPLOY, buildParams) - } - } - post { - failure { - addFailedStage(SEVERLESS_OPERATOR_DEPLOY) - } - } - } - } - post { - unsuccessful { - sendPipelineErrorNotification() - } - } -} - -def buildJob(String jobName, List buildParams, String jobKey = jobName) { - echo "[${jobKey}] Build ${jobName} with params ${buildParams}" - - def job = build(job: "${jobName}", wait: true, parameters: buildParams, propagate: false) - JOBS[jobKey] = job - - // Set Unstable if job did not succeed - if (!isJobSucceeded(jobKey)) { - addUnstableStage(jobKey) - unstable("Job ${jobName} finished with result ${job.result}") - } - return job -} - -def getJob(String jobKey) { - return JOBS[jobKey] -} - -String getJobUrl(String jobKey) { - echo "getJobUrl for ${jobKey}" - return getJob(jobKey)?.absoluteUrl ?: '' -} - -boolean isJobSucceeded(String jobKey) { - return getJob(jobKey)?.result == 'SUCCESS' -} - -boolean isJobUnstable(String jobKey) { - return getJob(jobKey)?.result == 'UNSTABLE' -} - -void addFailedStage(String jobKey = '') { - FAILED_STAGES.put("${env.STAGE_NAME}", jobKey) -} -void addUnstableStage(String jobKey = '') { - UNSTABLE_STAGES.put("${env.STAGE_NAME}", jobKey) -} - -void sendPipelineErrorNotification() { - String bodyMsg = "Kogito Cloud weekly job #${env.BUILD_NUMBER} was: ${currentBuild.currentResult}" - - paramsStr = '' - if (params.SKIP_TESTS) { - paramsStr += '\n- Tests skipped' - } - if (params.SKIP_IMAGES) { - paramsStr += '\n- Images skipped' - } - if (params.SKIP_OPERATOR) { - paramsStr += '\n- Operator skipped' - } - bodyMsg += paramsStr ? "\n\nConfiguration:${paramsStr}" : '\n' - - if (FAILED_STAGES.size() > 0) { - bodyMsg += '\nFailed stages: \n- ' - bodyMsg += FAILED_STAGES.collect { "${it.key} => ${getJobUrl(it.value)}" }.join('\n- ') - } - bodyMsg += '\n' - if (UNSTABLE_STAGES.size() > 0) { - bodyMsg += '\nUnstable stages: \n- ' - bodyMsg += UNSTABLE_STAGES.collect { "${it.key} => ${getJobUrl(it.value)}" }.join('\n- ') - } - bodyMsg += '\n' - bodyMsg += "\nPlease look here: ${env.BUILD_URL}" - emailext body: bodyMsg, subject: "[${getBuildBranch()}][d] Full Pipeline", - to: env.KOGITO_CI_EMAIL_TO -} - -List getDefaultBuildParams(String buildBranchName = '', String key = '') { - buildBranchName = buildBranchName ?: getBuildBranch() - List params = [] - addStringParam(params, 'DISPLAY_NAME', "${key ? "${key}-" : ''}${env.WEEKLY_TAG}") - addStringParam(params, 'GIT_CHECKOUT_DATETIME', getCheckoutDatetime()) - addBooleanParam(params, 'SEND_NOTIFICATION', true) - - return params -} - -void addSkipTestsParam(buildParams) { - addBooleanParam(buildParams, 'SKIP_TESTS', params.SKIP_TESTS) -} - -void addSkipIntegrationTestsParam(buildParams) { - addBooleanParam(buildParams, 'SKIP_INTEGRATION_TESTS', params.SKIP_TESTS) -} - -void addAppsParam(buildParams) { - addStringParam(buildParams, 'APPS_REF', "${getBuildBranch()}") - addStringParam(buildParams, 'APPS_URI', "https://github.com/${getGitAuthor()}/incubator-kie-kogito-apps") -} - -void addExamplesParam(buildParams) { - addStringParam(buildParams, 'EXAMPLES_URI', "https://github.com/${getGitAuthor()}/incubator-kie-kogito-examples") - addStringParam(buildParams, 'EXAMPLES_REF', "nightly-${getBuildBranch()}") -} - -void addImageBuildParams(List buildParams, String tag, String paramsPrefix = defaultImageParamsPrefix, String extraSuffix = '') { - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY_USER_CREDENTIALS_ID'), env.IMAGE_REGISTRY_USER_CREDENTIALS_ID) - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY_TOKEN_CREDENTIALS_ID'), env.IMAGE_REGISTRY_TOKEN_CREDENTIALS_ID) - addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY'), env.IMAGE_REGISTRY) - addStringParam(buildParams, constructKey(paramsPrefix, 'NAMESPACE'), env.IMAGE_NAMESPACE) - addStringParam(buildParams, constructKey(paramsPrefix, 'TAG'), tag) -} - -void addStringParam(List params, String key, String value) { - params.add(string(name: key, value: value)) -} - -void addBooleanParam(List params, String key, boolean value) { - params.add(booleanParam(name: key, value: value)) -} - -String constructKey(String prefix, String paramId) { - return prefix ? "${prefix}_${paramId}" : paramId -} - -String getBuildBranch() { - return env.GIT_BRANCH_NAME -} - -String getGitAuthor() { - return env.GIT_AUTHOR -} - -String getGitAuthorCredsId() { - return env.GIT_AUTHOR_CREDS_ID -} - -boolean isImagesDeploy() { - return !params.SKIP_IMAGES -} - -boolean isOperatorDeploy() { - return !params.SKIP_OPERATOR -} - -String getCurrentDate() { - return sh(returnStdout: true, script: 'date -u "+%Y-%m-%d"').trim() -} - -String getCheckoutDatetime() { - return params.GIT_CHECKOUT_DATETIME -} diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 6f6de1bd8..90b23a0ca 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -46,26 +46,15 @@ if (isMainStream()) { // Setup branch branch createSetupBranchJob() -if (isMainStream()) { - createSetupBranchCloudJob() -} // Nightly setupNightlyJob() -setupQuarkusPlatformJob(JobType.NIGHTLY) -if (isMainStream()) { - setupNightlyCloudJob() -} // Weekly setupWeeklyJob() -if (isMainStream()) { - setupWeeklyCloudJob() -} // Release setupReleaseArtifactsJob() -setupReleaseCloudJob() if (isMainStream()) { setupZipSourcesJob() } @@ -131,24 +120,6 @@ void createSetupBranchJob() { stringParam('KOGITO_VERSION', '', 'Kogito version') stringParam('DROOLS_VERSION', '', 'Drools version') booleanParam('DEPLOY', true, 'Should be deployed after setup ?') - booleanParam('SKIP_CLOUD_SETUP_BRANCH', !isMainStream(), 'Skip Cloud setup branch call') - } - } -} - -void createSetupBranchCloudJob() { - def jobParams = JobParamsUtils.getBasicJobParams(this, '0-setup-branch-cloud', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch.cloud", 'Kogito Setup Branch for Cloud') - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - - GIT_BRANCH_NAME: "${GIT_BRANCH}", - GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - stringParam('KOGITO_VERSION', '', 'Kogito version') - booleanParam('DEPLOY', true, 'Should be deployed after setup ?') } } } @@ -167,7 +138,6 @@ void setupNightlyJob() { KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { parameters { booleanParam('SKIP_TESTS', false, 'Skip all tests') - booleanParam('SKIP_CLOUD_NIGHTLY', !isMainStream(), 'Skip cloud nightly execution') } } } @@ -186,88 +156,10 @@ void setupWeeklyJob() { KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { parameters { booleanParam('SKIP_TESTS', false, 'Skip all tests') - booleanParam('SKIP_CLOUD_WEEKLY', !isMainStream(), 'Skip cloud weekly execution') } } } -void setupWeeklyCloudJob() { - def jobParams = JobParamsUtils.getBasicJobParams(this, '0-kogito-weekly-cloud', JobType.OTHER, "${jenkins_path}/Jenkinsfile.weekly.cloud", 'Kogito Weekly') - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - - GIT_BRANCH_NAME: "${GIT_BRANCH}", - GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - - IMAGE_REGISTRY_USER_CREDENTIALS_ID: "${CLOUD_IMAGE_REGISTRY_USER_CREDENTIALS_ID}", - IMAGE_REGISTRY_TOKEN_CREDENTIALS_ID: "${CLOUD_IMAGE_REGISTRY_TOKEN_CREDENTIALS_ID}", - IMAGE_REGISTRY: "${CLOUD_IMAGE_REGISTRY}", - IMAGE_NAMESPACE: "${CLOUD_IMAGE_NAMESPACE}", - BRANCH_FOR_LATEST: "${CLOUD_IMAGE_LATEST_GIT_BRANCH}", - - MAVEN_SETTINGS_CONFIG_FILE_ID: Utils.getMavenSettingsConfigFileId(this, JobType.NIGHTLY.name), - ARTIFACTS_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - booleanParam('SKIP_TESTS', false, 'Skip all tests') - - booleanParam('SKIP_IMAGES', false, 'To skip Images Deployment') - booleanParam('SKIP_OPERATOR', false, 'To skip Operator Deployment') - - stringParam('GIT_CHECKOUT_DATETIME', '', 'Git checkout date and time - (Y-m-d H:i)') - - booleanParam('USE_TEMP_OPENSHIFT_REGISTRY', false, 'If enabled, use Openshift registry to push temporary images') - } - } -} - -void setupNightlyCloudJob() { - def jobParams = JobParamsUtils.getBasicJobParams(this, '0-kogito-nightly-cloud', JobType.NIGHTLY, "${jenkins_path}/Jenkinsfile.nightly.cloud", 'Kogito Nightly') - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - - GIT_BRANCH_NAME: "${GIT_BRANCH}", - GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - - IMAGE_REGISTRY_USER_CREDENTIALS_ID: "${CLOUD_IMAGE_REGISTRY_USER_CREDENTIALS_ID}", - IMAGE_REGISTRY_TOKEN_CREDENTIALS_ID: "${CLOUD_IMAGE_REGISTRY_TOKEN_CREDENTIALS_ID}", - IMAGE_REGISTRY: "${CLOUD_IMAGE_REGISTRY}", - IMAGE_NAMESPACE: "${CLOUD_IMAGE_NAMESPACE}", - BRANCH_FOR_LATEST: "${CLOUD_IMAGE_LATEST_GIT_BRANCH}", - - MAVEN_SETTINGS_CONFIG_FILE_ID: Utils.getMavenSettingsConfigFileId(this, JobType.NIGHTLY.name), - ARTIFACTS_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - booleanParam('SKIP_TESTS', false, 'Skip all tests') - - booleanParam('SKIP_IMAGES', false, 'To skip Images Deployment') - booleanParam('SKIP_OPERATOR', false, 'To skip Operator Deployment') - - booleanParam('USE_TEMP_OPENSHIFT_REGISTRY', false, 'If enabled, use Openshift registry to push temporary images') - } - } -} - -void setupQuarkusPlatformJob(JobType jobType) { - def jobParams = JobParamsUtils.getBasicJobParams(this, 'quarkus-platform.deploy', jobType, "${jenkins_path}/Jenkinsfile.nightly.quarkus-platform", 'Kogito Quarkus platform job') - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - - GIT_BRANCH_NAME: "${GIT_BRANCH}", - GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - - QUARKUS_PLATFORM_NEXUS_URL: Utils.getMavenQuarkusPlatformRepositoryUrl(this), - QUARKUS_PLATFORM_NEXUS_CREDS: Utils.getMavenQuarkusPlatformRepositoryCredentialsId(this), - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams) -} - void setupReleaseArtifactsJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, '0-kogito-release', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.release", 'Kogito Artifacts Release') jobParams.env.putAll([ @@ -287,36 +179,6 @@ void setupReleaseArtifactsJob() { stringParam('GIT_TAG_NAME', '', 'Git tag to create. i.e.: 10.0.0-rc1') booleanParam('SKIP_TESTS', false, 'Skip all tests') - - booleanParam('SKIP_CLOUD_RELEASE', !isMainStream(), 'To skip Cloud release. To use whenever you have specific parameters to set for the Cloud release') - } - } -} - -void setupReleaseCloudJob() { - def jobParams = JobParamsUtils.getBasicJobParams(this, '0-kogito-release-cloud', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.release.cloud", 'Kogito Cloud Release') - jobParams.env.putAll([ - JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - - IMAGE_REGISTRY: "${CLOUD_IMAGE_REGISTRY}", - IMAGE_NAMESPACE: "${CLOUD_IMAGE_NAMESPACE}", - - GIT_BRANCH_NAME: "${GIT_BRANCH}", - GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - stringParam('RESTORE_FROM_PREVIOUS_JOB', '', 'URL to a previous stopped release job which needs to be continued') - - stringParam('RELEASE_VERSION', '', 'Version to release as Major.minor.micro. i.e: 10.0.0') - stringParam('GIT_TAG_NAME', '', 'Git tag to create. i.e.: 10.0.0-rc1') - - stringParam('APPS_URI', '', 'Override default. Git uri to the kogito-apps repository to use for building images.') - stringParam('APPS_REF', '', 'Override default. Git reference (branch/tag) to the kogito-apps repository to use for building images.') - - booleanParam('SKIP_TESTS', false, 'Skip all tests') - - booleanParam('SKIP_IMAGES_RELEASE', false, 'To skip Images Test & Deployment.') } } } @@ -352,4 +214,4 @@ incubator-kie-sandbox-quarkus-accelerator''', } } -} \ No newline at end of file +}