Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-ISSUE: Updates and fixes for Apache 10 release #1245

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
140 changes: 15 additions & 125 deletions .ci/jenkins/Jenkinsfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import org.jenkinsci.plugins.workflow.libs.Library

kogitoRuntimesRepo = 'kogito-runtimes'
kogitoAppsRepo = 'kogito-apps'
kogitoExamplesRepo = 'kogito-examples'

ARTIFACTS_STAGING_STAGE = 'stage.artifacts.staging'
ARTIFACTS_RELEASE_STAGE = 'stage.artifacts.release'

JOB_PROPERTY_PREFIX = 'build'
JOB_RESULT_PROPERTY_KEY = 'result'
Expand Down Expand Up @@ -42,34 +40,27 @@ pipeline {
echo "Release properties imported from previous job: ${releaseProperties}"
}

assert getDroolsVersion()
assert getKogitoVersion()
assert getReleaseVersion()

currentBuild.displayName = getDisplayName()

sendNotification("Release Pipeline has started...\nKogito version = ${getKogitoVersion()}\n=> ${env.BUILD_URL}")

// Safety measure to not publish to main JBoss
if (getGitAuthor() != 'apache' && !getArtifactsRepositoryParam()) {
sendNotification("Git Author is different from `apache` and no `ARTIFACTS_REPOSITORY` parameter has been provided. Are you sure you want to continue ? => ${env.BUILD_URL}input")
input message: 'Should the pipeline continue with no `ARTIFACTS_REPOSITORY` defined ?', ok: 'Yes'
}
sendNotification("Release Pipeline has started...\nKogito version = ${getReleaseVersion()}\n=> ${env.BUILD_URL}")
}
}
post {
always {
setReleasePropertyIfneeded('kogito.version', getKogitoVersion())
setReleasePropertyIfneeded('release.version', getReleaseVersion())
setReleasePropertyIfneeded('git.tag.name', getGitTagName())
}
}
}

stage('Build & Deploy Kogito Runtimes') {
steps {
script {
def buildParams = getDefaultBuildParams(getKogitoVersion())
def buildParams = getDefaultBuildParams(getReleaseVersion())
addSkipTestsParam(buildParams)
addStringParam(buildParams, 'DROOLS_VERSION', getDroolsVersion())

addStringParam(buildParams, 'DROOLS_VERSION', getReleaseVersion())
buildJob(getDeployJobName(kogitoRuntimesRepo), buildParams)
}
}
Expand All @@ -78,26 +69,13 @@ pipeline {
stage('Build & Deploy Kogito Apps') {
steps {
script {
def buildParams = getDefaultBuildParams(getKogitoVersion())
def buildParams = getDefaultBuildParams(getReleaseVersion())
addSkipTestsParam(buildParams)

buildJob(getDeployJobName(kogitoAppsRepo), buildParams)
}
}
}

stage('Build & Deploy Kogito Examples') {
steps {
script {
def buildParams = getDefaultBuildParams(getKogitoVersion())
addSkipTestsParam(buildParams)
addStringParam(buildParams, 'DROOLS_VERSION', getDroolsVersion())

buildJob(getDeployJobName(kogitoExamplesRepo), buildParams)
}
}
}

stage('Artifacts\' staging finalization') {
steps {
script {
Expand All @@ -109,80 +87,15 @@ pipeline {
}
}

stage('Are staged artifacts released?') {
when {
// Execute only if artifacts repository was not given, which means the staging repository has been created
expression { return !getArtifactsRepositoryParam() && !areArtifactsReleased() }
}
steps {
script {
String body = "${getKogitoVersion()} artifacts are ready for release.\n" +
"Please release the staging repositories and then confirm here: ${env.BUILD_URL}input"
sendNotification(body)
input message: 'Has the staging repository been released ?', ok: 'Yes'

sendNotification('Artifacts have been released. Finalizing now the release ...')
setArtifactsReleased()
}
}
}

stage('Promote Kogito Runtimes') {
when {
expression { return isJobConsideredOk(getDeployJobName(kogitoRuntimesRepo)) }
}
steps {
script {
def buildParams = getDefaultBuildParams(getKogitoVersion())
addDeployBuildUrlParam(buildParams, getDeployJobName(kogitoRuntimesRepo))
addStringParam(buildParams, 'DROOLS_VERSION', getDroolsVersion())

buildJob(getPromoteJobName(kogitoRuntimesRepo), buildParams)
}
}
}

stage('Promote Kogito Apps') {
when {
expression { return isJobConsideredOk(getDeployJobName(kogitoAppsRepo)) }
}
steps {
script {
def buildParams = getDefaultBuildParams(getKogitoVersion())
addDeployBuildUrlParam(buildParams, getDeployJobName(kogitoAppsRepo))

buildJob(getPromoteJobName(kogitoAppsRepo), buildParams)
}
}
}

stage('Promote Kogito Examples') {
when {
expression { return isJobConsideredOk(getDeployJobName(kogitoExamplesRepo)) }
}
steps {
script {
def buildParams = getDefaultBuildParams(getKogitoVersion())
addStringParam(buildParams, 'DROOLS_VERSION', getDroolsVersion())
addDeployBuildUrlParam(buildParams, getDeployJobName(kogitoExamplesRepo))
addBooleanParam(buildParams, 'UPDATE_STABLE_BRANCH', isDeployAsLatest())

buildJob(getPromoteJobName(kogitoExamplesRepo), buildParams)
}
}
}

stage('Start Cloud release') {
when {
expression { isCloudRelease() }
}
steps {
script {
def buildParams = getDefaultBuildParams(getKogitoVersion())
addStringParam(buildParams, 'KOGITO_VERSION', getKogitoVersion())
addBooleanParam(buildParams, 'DEPLOY_AS_LATEST', isDeployAsLatest())
def buildParams = getDefaultBuildParams(getReleaseVersion())
addStringParam(buildParams, 'RELEASE_VERSION', getReleaseVersion())
addSkipTestsParam(buildParams)

build(job: './0-kogito-release-cloud', wait: false, parameters: buildParams, propagate: false)
}
}
Expand Down Expand Up @@ -257,10 +170,6 @@ String getDeployJobName(String repository) {
return "${repository}-deploy"
}

String getPromoteJobName(String repository) {
return "${repository}-promote"
}

String getJobPropertySuffix(String jobName) {
return "${JOB_PROPERTY_PREFIX}.${jobName}"
}
Expand Down Expand Up @@ -358,6 +267,7 @@ List getDefaultBuildParams(String version) {
addDisplayNameParam(buildParams, getDisplayName(version))
addStringParam(buildParams, 'PROJECT_VERSION', version)
addStringParam(buildParams, 'KOGITO_PR_BRANCH', "kogito-${version}")
addStringParam(buildParams, 'GIT_TAG_NAME', getGitTagName())
return buildParams
}

Expand Down Expand Up @@ -396,34 +306,22 @@ String constructKey(String prefix, String paramId) {
}

String getDisplayName(version = '') {
version = version ?: getKogitoVersion()
version = version ?: getReleaseVersion()
return "Release ${version}"
}

String getKogitoVersion() {
return params.KOGITO_VERSION ?: getReleaseProperty('kogito.version')
String getReleaseVersion() {
return params.RELEASE_VERSION ?: getReleaseProperty('release.version')
}

String getDroolsVersion() {
return params.DROOLS_VERSION ?: getReleaseProperty('drools.version')
String getGitTagName() {
return params.GIT_TAG_NAME ?: getReleaseProperty('git.tag.name')
}

String getGitAuthor() {
return env.GIT_AUTHOR
}

String getArtifactsRepositoryParam() {
return env['ARTIFACTS_REPOSITORY'] ?: ''
}

String getStagingRepository() {
return getArtifactsRepositoryParam() ?: env.DEFAULT_STAGING_REPOSITORY
}

boolean isDeployAsLatest() {
return params.DEPLOY_AS_LATEST || getReleaseProperty('deploy.latest')?.toBoolean()
}

boolean isCloudRelease() {
return !params.SKIP_CLOUD_RELEASE
}
Expand Down Expand Up @@ -455,11 +353,3 @@ boolean areArtifactsStaged() {
void setArtifactsStaged() {
setReleasePropertyIfneeded(ARTIFACTS_STAGING_STAGE, true)
}

boolean areArtifactsReleased() {
return hasReleaseProperty(ARTIFACTS_RELEASE_STAGE)
}

void setArtifactsReleased() {
setReleasePropertyIfneeded(ARTIFACTS_RELEASE_STAGE, true)
}
Loading
Loading