Skip to content

Commit

Permalink
kie-issues#1255: agent docker config in main pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jstastny-cz committed May 24, 2024
1 parent 6a8d400 commit 0dcd9eb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .ci/jenkins/config/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ seed:
jenkinsfile: dsl/seed/jenkinsfiles/Jenkinsfile.seed.branch
jenkins:
email_creds_id: KOGITO_CI_NOTIFICATION_EMAILS
agent:
docker:
builder:
# At some point, this image will need to be changed when a release branch is created
# but we need to make sure the image exists first ... simple tag before setting up the branch ?
# See https://github.com/kiegroup/kie-issues/issues/551
image: quay.io/kiegroup/kogito-ci-build:main-latest
args: --privileged --group-add docker
6 changes: 6 additions & 0 deletions dsl/seed/jenkinsfiles/Jenkinsfile.seed.main
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ pipeline {
SEED_CONFIG_FILE_GIT_AUTHOR_PUSH_CREDS_ID: readSeedConfig().seed.config_file.git.author.push.credentials_id,
SEED_CONFIG_FILE_GIT_BRANCH: "${SEED_CONFIG_FILE_GIT_BRANCH}",
SEED_CONFIG_FILE_PATH: "${SEED_CONFIG_FILE_PATH}",
JENKINS_AGENT_DOCKER_BUILDER_IMAGE: readSeedConfig().jenkins.agent.docker.builder.image,
JENKINS_AGENT_DOCKER_BUILDER_ARGS: readSeedConfig().jenkins.agent.docker.builder.args,
ALL_BRANCHES: readSeedConfig().git.branches.collect { it.name }.join(','),
MAIN_BRANCH_NAME: readSeedConfig().git.branches.find { it.main_branch }?.name,
]
Expand Down Expand Up @@ -104,6 +106,8 @@ pipeline {
SEED_CONFIG_FILE_GIT_AUTHOR_PUSH_CREDS_ID: branchConfigFileInfo.push_credentials,
SEED_CONFIG_FILE_GIT_BRANCH: branchConfigFileInfo.branch,
SEED_CONFIG_FILE_PATH: branchConfigFileInfo.filepath,
JENKINS_AGENT_DOCKER_BUILDER_IMAGE: readSeedConfig().jenkins.agent.docker.builder.image,
JENKINS_AGENT_DOCKER_BUILDER_ARGS: readSeedConfig().jenkins.agent.docker.builder.args,
]
echo 'Got envProperties for generation'
echo "${envProperties}"
Expand Down Expand Up @@ -138,6 +142,8 @@ pipeline {
SEED_CONFIG_FILE_GIT_BRANCH: "${SEED_CONFIG_FILE_GIT_BRANCH}",
SEED_CONFIG_FILE_PATH: "${SEED_CONFIG_FILE_PATH}",
JENKINS_EMAIL_CREDS_ID: readSeedConfig().jenkins.email_creds_id,
JENKINS_AGENT_DOCKER_BUILDER_IMAGE: readSeedConfig().jenkins.agent.docker.builder.image,
JENKINS_AGENT_DOCKER_BUILDER_ARGS: readSeedConfig().jenkins.agent.docker.builder.args,
]
dir(scriptUtils.getDslSeedFolderAbsolutePath()) {
println "[INFO] Generate main seed job with properties ${envProperties}"
Expand Down
9 changes: 6 additions & 3 deletions dsl/seed/jobs/root_jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

// +++++++++++++++++++++++++++++++++++++++++++ root jobs ++++++++++++++++++++++++++++++++++++++++++++++++++++

import org.kie.jenkins.jobdsl.utils.JobParamsUtils
import org.kie.jenkins.jobdsl.KogitoConstants
import org.kie.jenkins.jobdsl.KogitoJobTemplate
import org.kie.jenkins.jobdsl.Utils
Expand All @@ -38,7 +37,6 @@ def jobParams = [
env: [:],
jenkinsfile: 'dsl/seed/jenkinsfiles/Jenkinsfile.release.prepare',
]
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)

KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
Expand Down Expand Up @@ -68,6 +66,9 @@ KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
env('SEED_BRANCH', Utils.getSeedBranch(this))
env('SEED_CREDENTIALS_ID', Utils.getSeedAuthorCredsId(this))
env('SEED_PUSH_CREDENTIALS_ID', Utils.getSeedAuthorPushCredsId(this))

env('AGENT_DOCKER_BUILDER_IMAGE', Utils.getJenkinsAgentDockerImage(this, 'builder'))
env('AGENT_DOCKER_BUILDER_ARGS', Utils.getJenkinsAgentDockerArgs(this, 'builder'))
}
}

Expand All @@ -85,7 +86,6 @@ def jobParamsRemove = [
env: [:],
jenkinsfile: 'dsl/seed/jenkinsfiles/Jenkinsfile.remove.branches',
]
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParamsRemove)

List nonMainBranches = ALL_BRANCHES.split(',').findAll { it != MAIN_BRANCH_NAME }
if (nonMainBranches) {
Expand All @@ -103,6 +103,9 @@ if (nonMainBranches) {
env('GIT_AUTHOR_PUSH_CREDENTIALS_ID', "${SEED_CONFIG_FILE_GIT_AUTHOR_PUSH_CREDS_ID}")
env('GIT_BRANCH_TO_BUILD', "${SEED_CONFIG_FILE_GIT_BRANCH}")
env('CONFIG_FILE_PATH', "${SEED_CONFIG_FILE_PATH}")

env('AGENT_DOCKER_BUILDER_IMAGE', Utils.getJenkinsAgentDockerImage(this, 'builder'))
env('AGENT_DOCKER_BUILDER_ARGS', Utils.getJenkinsAgentDockerArgs(this, 'builder'))
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions dsl/seed/jobs/seed_job_branch.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ pipelineJob("${GENERATION_BRANCH}/tools/toggle-dsl-triggers") {

env('JENKINS_EMAIL_CREDS_ID', Utils.getJenkinsEmailCredsId(this))

env('AGENT_DOCKER_BUILDER_IMAGE', Utils.getJenkinsAgentDockerImage(script, 'builder'))
env('AGENT_DOCKER_BUILDER_ARGS', Utils.getJenkinsAgentDockerArgs(script, 'builder'))
env('AGENT_DOCKER_BUILDER_IMAGE', Utils.getJenkinsAgentDockerImage(this, 'builder'))
env('AGENT_DOCKER_BUILDER_ARGS', Utils.getJenkinsAgentDockerArgs(this, 'builder'))
}

definition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class JobScriptsSpec extends Specification {
envVars.put('SEED_CONFIG_FILE_GIT_AUTHOR_PUSH_CREDS_ID', 'SEED_CONFIG_FILE_GIT_AUTHOR_PUSH_CREDS_ID')
envVars.put('SEED_CONFIG_FILE_GIT_BRANCH', 'SEED_CONFIG_FILE_GIT_BRANCH')
envVars.put('SEED_CONFIG_FILE_PATH', 'SEED_CONFIG_FILE_PATH')
envVars.put('JENKINS_AGENT_DOCKER_BUILDER_IMAGE', 'JENKINS_AGENT_DOCKER_BUILDER_IMAGE')
envVars.put('JENKINS_AGENT_DOCKER_BUILDER_ARGS', 'JENKINS_AGENT_DOCKER_BUILDER_ARGS')

envVars.put('GIT_JENKINS_CONFIG_PATH', 'GIT_JENKINS_CONFIG_PATH')
JobManagement jm = new JenkinsJobManagement(System.out, envVars, new File('.'))
Expand Down

0 comments on commit 0dcd9eb

Please sign in to comment.