This is an automated email from the ASF dual-hosted git repository.
rantunes pushed a commit to branch kie-issues_821
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-pipelines.git
The following commit(s) were added to refs/heads/kie-issues_821 by this push:
new 86c35e23 Weekly cloud jobs
86c35e23 is described below
commit 86c35e23d890b6d3e1c13bc1d3e40079829325cc
Author: Rodrigo Antunes <[email protected]>
AuthorDate: Wed Jan 31 10:51:16 2024 -0300
Weekly cloud jobs
---
.ci/jenkins/Jenkinsfile.weekly | 13 +++
...Jenkinsfile.weekly => Jenkinsfile.weekly.cloud} | 105 +++++++++++++++++----
.ci/jenkins/dsl/jobs.groovy | 35 +++++++
3 files changed, 134 insertions(+), 19 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.weekly b/.ci/jenkins/Jenkinsfile.weekly
index 1e4d2c53..04abb86b 100644
--- a/.ci/jenkins/Jenkinsfile.weekly
+++ b/.ci/jenkins/Jenkinsfile.weekly
@@ -79,6 +79,19 @@ pipeline {
}
}
}
+
+ stage('Start Cloud weekly') {
+ when {
+ expression { !params.SKIP_CLOUD_WEEKLY }
+ }
+ steps {
+ script {
+ def buildParams = getDefaultBuildParams()
+ addSkipTestsParam(buildParams)
+ build(job: './0-kogito-weekly-cloud', wait: false,
parameters: buildParams, propagate: false)
+ }
+ }
+ }
}
post {
unsuccessful {
diff --git a/.ci/jenkins/Jenkinsfile.weekly
b/.ci/jenkins/Jenkinsfile.weekly.cloud
similarity index 53%
copy from .ci/jenkins/Jenkinsfile.weekly
copy to .ci/jenkins/Jenkinsfile.weekly.cloud
index 1e4d2c53..2970b848 100644
--- a/.ci/jenkins/Jenkinsfile.weekly
+++ b/.ci/jenkins/Jenkinsfile.weekly.cloud
@@ -3,8 +3,8 @@ import org.jenkinsci.plugins.workflow.libs.Library
@Library('jenkins-pipeline-shared-libraries')_
// Deploy jobs
-RUNTIMES_DEPLOY = 'kogito-runtimes.weekly-deploy'
-APPS_DEPLOY = 'kogito-apps.weekly-deploy'
+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
@@ -14,6 +14,8 @@ JOBS = [:]
FAILED_STAGES = [:]
UNSTABLE_STAGES = [:]
+defaultImageParamsPrefix = 'IMAGE'
+
// Should be multibranch pipeline
pipeline {
agent {
@@ -21,7 +23,7 @@ pipeline {
}
options {
- timeout(time: 900, unit: 'MINUTES')
+ timeout(time: 1380, unit: 'MINUTES')
}
// parameters {
@@ -30,11 +32,13 @@ pipeline {
environment {
// Some generated env is also defined into ./dsl/jobs.groovy file
+
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")
- CURRENT_DATE = getCurrentDate()
+ IMAGE_NAME_WEEKLY_SUFFIX = 'nightly'
- WEEKLY_TAG = """${getBuildBranch()}-${CURRENT_DATE}"""
+ // Use branch name in weekly tag as we may have parallel main and
release branch builds
+ WEEKLY_TAG = """${getBuildBranch()}-${getCurrentDate()}"""
}
stages {
@@ -48,34 +52,50 @@ pipeline {
}
}
- stage('Build & Deploy Kogito Runtimes') {
+ stage('Build & Deploy Images') {
+ when {
+ expression { return isImagesDeploy() }
+ }
steps {
script {
def buildParams = getDefaultBuildParams()
+ addImageBuildParams(buildParams, env.WEEKLY_TAG)
+ addDeployImageWithLatestTagParam(buildParams)
+
+ // For building
+ addAppsParam(buildParams)
+
+ // For testing
addSkipTestsParam(buildParams)
- addSkipIntegrationTestsParam(buildParams)
- buildJob(RUNTIMES_DEPLOY, buildParams)
+ addExamplesParam(buildParams)
+
+ buildJob(IMAGES_DEPLOY, buildParams)
}
}
post {
failure {
- addFailedStage(RUNTIMES_DEPLOY)
+ addFailedStage(IMAGES_DEPLOY)
}
}
}
- stage('Build & Deploy Kogito Apps') {
+ stage('Build & Deploy Serverless Operator') {
+ when {
+ expression { return isOperatorDeploy() }
+ }
steps {
script {
def buildParams = getDefaultBuildParams()
addSkipTestsParam(buildParams)
- addSkipIntegrationTestsParam(buildParams)
- buildJob(APPS_DEPLOY, buildParams)
+ addImageBuildParams(buildParams, env.WEEKLY_TAG)
+ addDeployImageWithLatestTagParam(buildParams)
+
+ buildJob(SEVERLESS_OPERATOR_DEPLOY, buildParams)
}
}
post {
failure {
- addFailedStage(APPS_DEPLOY)
+ addFailedStage(SEVERLESS_OPERATOR_DEPLOY)
}
}
}
@@ -126,7 +146,19 @@ void addUnstableStage(String jobKey = '') {
}
void sendPipelineErrorNotification() {
- String bodyMsg = "Kogito weekly job #${env.BUILD_NUMBER} was:
${currentBuild.currentResult}"
+ 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- '
@@ -143,9 +175,10 @@ void sendPipelineErrorNotification() {
to: env.KOGITO_CI_EMAIL_TO
}
-List getDefaultBuildParams() {
+List getDefaultBuildParams(String buildBranchName = '', String key = '') {
+ buildBranchName = buildBranchName ?: getBuildBranch()
List params = []
- addStringParam(params, 'DISPLAY_NAME', env.WEEKLY_TAG)
+ addStringParam(params, 'DISPLAY_NAME', "${key ? "${key}-" :
''}${env.WEEKLY_TAG}")
addStringParam(params, 'GIT_CHECKOUT_DATETIME', getCheckoutDatetime())
addBooleanParam(params, 'SEND_NOTIFICATION', true)
@@ -160,6 +193,28 @@ 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_CREDENTIALS'), env.IMAGE_REGISTRY_CREDENTIALS)
+ addStringParam(buildParams, constructKey(paramsPrefix, 'REGISTRY'),
env.IMAGE_REGISTRY)
+ addStringParam(buildParams, constructKey(paramsPrefix, 'NAMESPACE'),
env.IMAGE_NAMESPACE)
+ addStringParam(buildParams, constructKey(paramsPrefix, 'NAME_SUFFIX'),
(extraSuffix ? "${extraSuffix}-" : '') + env.IMAGE_NAME_WEEKLY_SUFFIX)
+ 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))
}
@@ -168,6 +223,10 @@ 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
}
@@ -180,8 +239,16 @@ String getGitAuthorCredsId() {
return env.GIT_AUTHOR_CREDS_ID
}
-String getGitAuthorPushCredsId() {
- return env.GIT_AUTHOR_PUSH_CREDS_ID
+boolean isDeployImagesLatestTag() {
+ return getBuildBranch() == env.BRANCH_FOR_LATEST
+}
+
+boolean isImagesDeploy() {
+ return !params.SKIP_IMAGES
+}
+
+boolean isOperatorDeploy() {
+ return !params.SKIP_OPERATOR
}
String getCurrentDate() {
@@ -189,5 +256,5 @@ String getCurrentDate() {
}
String getCheckoutDatetime() {
- return env.CURRENT_DATE + ' 02:00' // Cut-off 02:00AM
+ return params.GIT_CHECKOUT_DATETIME
}
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 73e59e1a..65a257c0 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -63,6 +63,9 @@ if (isMainStream()) {
// Weekly
setupWeeklyJob()
+if (isMainStream()) {
+ setupWeeklyCloudJob()
+}
// Release
setupReleaseArtifactsJob()
@@ -188,6 +191,38 @@ 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_CREDENTIALS: "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}",
+ IMAGE_REGISTRY: "${CLOUD_IMAGE_REGISTRY}",
+ IMAGE_NAMESPACE: "${CLOUD_IMAGE_NAMESPACE}",
+ BRANCH_FOR_LATEST: "${CLOUD_IMAGE_LATEST_GIT_BRANCH}",
+
+ MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
+ 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')
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]