Skip to content

Commit

Permalink
update pipelines (#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste authored Sep 8, 2023
1 parent 23122b5 commit e16c9e2
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 189 deletions.
6 changes: 1 addition & 5 deletions .ci/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ pipeline {
agent {
label 'ubuntu'
}
tools {
maven env.BUILD_MAVEN_TOOL
jdk env.BUILD_JDK_TOOL
}
options {
timeout(time: 120, unit: 'MINUTES')
}
Expand Down Expand Up @@ -97,7 +93,7 @@ String[] getImages() {
if (env.IMAGES_LIST) {
return env.IMAGES_LIST.split(',')
}
return util.runWithPythonVirtualEnv("make list | tr '\\n' ','", 'cekit', true).trim().split(',')
return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',')
}

String getChangeAuthor() {
Expand Down
13 changes: 5 additions & 8 deletions .ci/jenkins/Jenkinsfile.build-image
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ QUAY_REGISTRY = 'quay.io'

pipeline {
agent {
label 'ubuntu'
}
tools {
maven env.BUILD_MAVEN_TOOL
jdk env.BUILD_JDK_TOOL
docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
}
}
options {
timeout(time: 120, unit: 'MINUTES')
}
environment {
CI = true

// Linked to node label
// Use docker due to multiplatform build
CONTAINER_ENGINE = 'docker'
Expand Down Expand Up @@ -248,7 +245,7 @@ String getBuiltImageTag(String imageTag = '') {
}

void runPythonCommand(String cmd, boolean stdout = false) {
return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout)
return sh(returnStdout: stdout, script: cmd)
}

////////////////////////////////////////////////////////////////////////
Expand Down
13 changes: 5 additions & 8 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ TEST_FAILED_IMAGES = []

pipeline {
agent {
label 'ubuntu'
}

// Needed for local build
tools {
maven env.BUILD_MAVEN_TOOL
jdk env.BUILD_JDK_TOOL
docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
}
}

options {
Expand Down Expand Up @@ -421,7 +418,7 @@ String[] getImages() {
}

void runPythonCommand(String cmd, boolean stdout = false) {
return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout)
return sh(returnStdout: stdout, script: cmd)
}

String getQuarkusPlatformVersion() {
Expand Down
17 changes: 7 additions & 10 deletions .ci/jenkins/Jenkinsfile.promote
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@ deployProperties = [:]

pipeline {
agent {
label 'ubuntu'
docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
}
}

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}")

// Linked to node label
CONTAINER_ENGINE = 'podman'
CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false'
CONTAINER_ENGINE = 'docker'
CONTAINER_ENGINE_TLS_OPTIONS = ''

OPENSHIFT_API = credentials('OPENSHIFT_API')
OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY')
Expand Down Expand Up @@ -359,5 +356,5 @@ String[] getImages() {
}

void runPythonCommand(String cmd, boolean stdout = false) {
return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout)
return sh(returnStdout: stdout, script: cmd)
}
21 changes: 5 additions & 16 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,18 @@ import org.jenkinsci.plugins.workflow.libs.Library

pipeline {
agent {
label 'ubuntu'
}

// Needed for local build
tools {
maven env.BUILD_MAVEN_TOOL
jdk env.BUILD_JDK_TOOL
docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
}
}

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 {
Expand Down Expand Up @@ -182,5 +171,5 @@ String getCleanedReleaseNotes() {
}

void runPythonCommand(String cmd, boolean stdout = false) {
return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout)
return sh(returnStdout: stdout, script: cmd)
}
103 changes: 0 additions & 103 deletions .ci/jenkins/Jenkinsfile.update-prod-version

This file was deleted.

61 changes: 22 additions & 39 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import org.kie.jenkins.jobdsl.Utils
jenkins_path = '.ci/jenkins'

// PR checks
setupPrJob()
// TODO create PR job with branch source plugin
// setupPrJob()

// Init branch
createSetupBranchJob()
Expand All @@ -40,28 +41,27 @@ setupQuarkusUpdateJob()
void setupPrJob() {
setupBuildImageJob(JobType.PULL_REQUEST)

// TODO create PR job with branch source plugin
// def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images PR check")
// JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
// jobParams.pr.putAll([
// run_only_for_branches: [ "${GIT_BRANCH}" ],
// disable_status_message_error: true,
// disable_status_message_failure: true,
// commitContext: 'Retrieve and Launch Image Checks',
// contextShowtestResults: false,
// ])
// if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) {
// jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES'))
// }
// jobParams.env.putAll([
// AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
// ])
// KogitoJobTemplate.createPRJob(this, jobParams)
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images PR check")
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.pr.putAll([
run_only_for_branches: [ "${GIT_BRANCH}" ],
disable_status_message_error: true,
disable_status_message_failure: true,
commitContext: 'Retrieve and Launch Image Checks',
contextShowtestResults: false,
])
if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) {
jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES'))
}
jobParams.env.putAll([
AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
])
KogitoJobTemplate.createPRJob(this, jobParams)
}

void createSetupBranchJob() {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Images Init Branch')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'kogito-images',
GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
Expand Down Expand Up @@ -91,7 +91,7 @@ void setupDeployJob(JobType jobType) {
setupBuildImageJob(jobType)

def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-deploy', jobType, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Images Deploy')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
PROPERTIES_FILE_NAME: 'deployment.properties',

Expand Down Expand Up @@ -152,7 +152,7 @@ void setupBuildImageJob(JobType jobType) {
// Use jenkinsfile from the build branch
jobParams.git.author = '${SOURCE_AUTHOR}'
jobParams.git.branch = '${SOURCE_BRANCH}'
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
MAX_REGISTRY_RETRIES: 3,
TARGET_AUTHOR: Utils.getGitAuthor(this), // In case of a PR to merge with target branch
Expand Down Expand Up @@ -199,6 +199,7 @@ 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',
Expand Down Expand Up @@ -256,24 +257,6 @@ void setupPromoteJob(JobType jobType) {
}
}

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() {
KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-images', [:], [:], [], [
"source ~/virtenvs/cekit/bin/activate && python3 scripts/update-repository.py --quarkus-platform-version %new_version%"
Expand Down

0 comments on commit e16c9e2

Please sign in to comment.