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: Jenkins jobs updates and fixes for Apache 10 release #2101

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 45 additions & 25 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pipeline {
}
stage('Prepare for PR') {
when {
expression { return isRelease() || isCreatePr() }
expression { return isCreatePr() }
}
steps {
script {
Expand All @@ -88,14 +88,12 @@ pipeline {
}
steps {
script {
dir(getRepoName()) {
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
maven.mvnVersionsUpdateParentAndChildModules(
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
getProjectVersion(),
!isRelease()
)
}
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
maven.mvnVersionsUpdateParentAndChildModules(
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
getProjectVersion(),
!isRelease()
)
}
}
}
Expand All @@ -114,20 +112,18 @@ pipeline {
def mavenCommand = getMavenCommand().withProperty('maven.test.failure.ignore', true)
.withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : [])
.withOptions(env.KOGITO_APPS_BUILD_MVN_OPTS ? [ env.KOGITO_APPS_BUILD_MVN_OPTS ] : [])
.skipTests(skipTests)

def Closure mavenRunClosure = {
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run("clean $installOrDeploy")
}
if (params.SKIP_TESTS) {
mavenCommand.skipTests()
}

if (isRelease()) {
release.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId())
releaseUtils.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId())
mavenCommand.withProfiles(['apache-release'])
mavenRunClosure()
} else {
mavenRunClosure()
}

configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean $installOrDeploy")
}
}
}
Expand All @@ -143,7 +139,7 @@ pipeline {
}
stage('Create PR') {
when {
expression { return isRelease() || isCreatePr() }
expression { return isCreatePr() }
}
steps {
script {
Expand All @@ -167,6 +163,26 @@ pipeline {
}
}
}
stage('Commit and Create Tag') {
when {
expression { return isRelease() }
}
steps {
script {
dir(getRepoName()) {
if (githubscm.isThereAnyChanges()) {
def commitMsg = "[${getBuildBranch()}] Update version to ${getProjectVersion()}"
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.commitChanges(commitMsg, { githubscm.findAndStageNotIgnoredFiles('pom.xml') })
} else {
println '[WARN] no changes to commit'
}
githubscm.tagRepository(getGitTagName())
githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId())
}
}
}
}
}
post {
always {
Expand Down Expand Up @@ -211,11 +227,7 @@ void checkoutRepo() {
void commitAndCreatePR() {
def commitMsg = "[${getBuildBranch()}] Update version to ${getProjectVersion()}"
def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}."
if (isRelease()) {
prBody += '\nPlease do not merge, it should be merged automatically after testing.'
} else {
prBody += '\nPlease review and merge.'
}
prBody += '\nPlease review and merge.'
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.commitChanges(commitMsg, { githubscm.findAndStageNotIgnoredFiles('pom.xml') })
githubscm.pushObject('origin', getPRBranch(), getGitAuthorPushCredsId())
Expand Down Expand Up @@ -247,6 +259,10 @@ String getGitAuthorCredsId() {
return env.GIT_AUTHOR_CREDS_ID
}

String getGitAuthorPushCredsId() {
return env.GIT_AUTHOR_PUSH_CREDS_ID
}

String getBuildBranch() {
return params.BUILD_BRANCH_NAME
}
Expand Down Expand Up @@ -280,3 +296,7 @@ String getReleaseGpgSignKeyCredsId() {
String getReleaseGpgSignPassphraseCredsId() {
return env.RELEASE_GPG_SIGN_PASSPHRASE_CREDS_ID
}

String getGitTagName() {
return params.GIT_TAG_NAME
}
2 changes: 1 addition & 1 deletion .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ void setupReleaseDeployJob() {
booleanParam('CREATE_PR', false, 'Should we create a PR with the changes ?')
stringParam('PROJECT_VERSION', '', 'Optional if not RELEASE. If RELEASE, cannot be empty.')
stringParam('KOGITO_PR_BRANCH', '', 'PR branch name')
stringParam('GIT_TAG_NAME', '', 'Git tag to create. i.e.: 10.0.0-rc1')

booleanParam('SEND_NOTIFICATION', false, 'In case you want the pipeline to send a notification on CI channel for this run.')
}
Expand Down Expand Up @@ -303,7 +304,6 @@ void setupWeeklyDeployJob() {

booleanParam('SKIP_TESTS', false, 'Skip tests')


stringParam('GIT_CHECKOUT_DATETIME', '', 'Git checkout date and time - (Y-m-d H:i)')

booleanParam('SEND_NOTIFICATION', false, 'In case you want the pipeline to send a notification on CI channel for this run.')
Expand Down
Loading
Loading