Skip to content

Commit 78fb7d7

Browse files
radtristejstastny-cz
and
jstastny-cz
committed
kie-issues#574 Initial ASF Jenkins CI Setup
deactivate PR checks Prepare for Apache migration Remove PR job [apache_migration] update pipelines (#1790) * Setup jenkinsfile * update pipelines Fix CI PR multibranchPipelineJob (#1808) Co-authored-by: jstastny-cz <[email protected]> Update `kiegroup` repository references to `apache` (#1806) Co-authored-by: radtriste <[email protected]> Co-authored-by: jstastny-cz <[email protected]>
1 parent 7b351a1 commit 78fb7d7

14 files changed

+99
-94
lines changed

.ci/environments/common/update_quarkus.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -euo pipefail
33

44
mvn_cmd="mvn ${BUILD_MVN_OPTS:-} ${BUILD_MVN_OPTS_QUARKUS_UPDATE:-}"
55

6-
source <(curl -s https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/install_quarkus.sh)
6+
source <(curl -s https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/install_quarkus.sh)
77

88
echo "Update project with Quarkus version ${QUARKUS_VERSION}"
99

.ci/environments/update.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ if [ -f "${env_path}/after.sh" ]; then
4444
fi
4545

4646
# Download `setup_integration_branch` script and execute
47-
curl -s https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/setup_integration_branch.sh | bash
47+
curl -s https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/setup_integration_branch.sh | bash

.ci/jenkins/Jenkinsfile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@Library('jenkins-pipeline-shared-libraries')_
2+
3+
pr_check_script = null
4+
5+
pipeline {
6+
agent {
7+
label 'ubuntu'
8+
}
9+
options {
10+
timestamps()
11+
timeout(time: 360, unit: 'MINUTES')
12+
}
13+
environment {
14+
BUILDCHAIN_PROJECT = 'apache/incubator-kie-kogito-examples'
15+
16+
KOGITO_EXAMPLES_BUILD_MVN_OPTS = '-Dvalidate-formatting'
17+
}
18+
stages {
19+
stage('Initialize') {
20+
steps {
21+
script {
22+
// load `pr_check.groovy` file from kogito-pipelines:main
23+
dir('kogito-pipelines') {
24+
checkout(githubscm.resolveRepository('incubator-kie-kogito-pipelines', 'apache', 'main', false, 'ASF_Cloudbees_Jenkins_ci-builds'))
25+
pr_check_script = load 'dsl/scripts/pr_check.groovy'
26+
}
27+
}
28+
}
29+
}
30+
stage('PR check') {
31+
steps {
32+
script {
33+
dir('kogito-pipelines') {
34+
pr_check_script.launch()
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}

.ci/jenkins/Jenkinsfile.deploy

+9-20
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,22 @@ examplesHelper = null
1010

1111
pipeline {
1212
agent {
13-
label 'kie-rhel8 && docker && kie-mem16g && !built-in'
14-
}
15-
16-
tools {
17-
maven env.BUILD_MAVEN_TOOL
18-
jdk env.BUILD_JDK_TOOL
13+
docker {
14+
image env.AGENT_DOCKER_BUILDER_IMAGE
15+
args env.AGENT_DOCKER_BUILDER_ARGS
16+
}
1917
}
2018

2119
options {
2220
timestamps()
2321
timeout(time: 180, unit: 'MINUTES')
2422
}
2523

26-
// parameters {
27-
// For parameters, check into ./dsl/jobs.groovy file
28-
// }
29-
3024
environment {
31-
// Static env is defined into ./dsl/jobs.groovy file
32-
3325
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")
3426

35-
// Keep here for visitibility
36-
MAVEN_OPTS = '-Xms1024m -Xmx4g'
37-
3827
PR_BRANCH_HASH = "${util.generateHash(10)}"
39-
MAVEN_DEPLOY_LOCAL_DIR = "${WORKSPACE}/maven_deploy_dir"
28+
MAVEN_DEPLOY_LOCAL_DIR = "/tmp/maven_deploy_dir"
4029
}
4130

4231
stages {
@@ -132,7 +121,7 @@ pipeline {
132121
if (params.SKIP_TESTS) {
133122
mvnCmd.skipTests() // Conflict somehow with Python testing. If `skipTests={anyvalue}` is set, then exec plugin is not executed ...
134123
}
135-
util.runWithPythonVirtualEnv(mvnCmd.getFullRunCommand('clean install'), 'swf')
124+
mvnCmd.run('clean install')
136125
}
137126
}
138127
}
@@ -259,7 +248,7 @@ void commitAndCreatePR() {
259248
prBody += '\nPlease review and merge.'
260249
}
261250
// Not using githubscm.commitChanges() because globbing won't work.
262-
// See: https://github.com/kiegroup/kogito-runtimes/pull/570#discussion_r449268738
251+
// See: https://github.com/apache/incubator-kie-kogito-runtimes/pull/570#discussion_r449268738
263252
addNotIgnoredPoms()
264253
sh "git commit -m '${commitMsg}'"
265254
githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID())
@@ -275,7 +264,7 @@ boolean shouldStageArtifacts() {
275264
}
276265

277266
boolean shouldDeployToRepository() {
278-
return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID && getGitAuthor() == 'kiegroup'
267+
return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID && getGitAuthor() == 'apache'
279268
}
280269

281270
boolean isRelease() {
@@ -347,7 +336,7 @@ void runMavenDeploy(boolean localDeployment = false) {
347336

348337
mvnCmd.skipTests(true).run('clean deploy')
349338

350-
util.runWithPythonVirtualEnv(mvnCmd.skipTests(true).getFullRunCommand('clean deploy'), 'swf')
339+
mvnCmd.skipTests(true).run('clean deploy')
351340
}
352341

353342
void runMavenStage() {

.ci/jenkins/Jenkinsfile.post-release

+4-19
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ import org.jenkinsci.plugins.workflow.libs.Library
33

44
pipeline {
55
agent {
6-
label 'kie-rhel8 && !built-in'
7-
}
8-
9-
tools {
10-
maven env.BUILD_MAVEN_TOOL
11-
jdk env.BUILD_JDK_TOOL
6+
docker {
7+
image env.AGENT_DOCKER_BUILDER_IMAGE
8+
args env.AGENT_DOCKER_BUILDER_ARGS
9+
}
1210
}
1311

1412
options {
@@ -19,7 +17,6 @@ pipeline {
1917

2018
environment {
2119
CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")
22-
GITHUB_CLI_VERSION = '0.11.1'
2320
}
2421

2522
stages {
@@ -34,10 +31,7 @@ pipeline {
3431

3532
// Verify version is set and if on right release branch
3633
assert getProjectVersion()
37-
3834
assert getBuildBranch() == util.getReleaseBranchFromVersion(getProjectVersion())
39-
40-
installGithubCLI()
4135
}
4236
}
4337
}
@@ -112,15 +106,6 @@ void checkoutTag(String repo, String tagName, String localBranchName = tagName)
112106
sh "git checkout tags/${tagName} -b ${localBranchName}"
113107
}
114108

115-
void installGithubCLI() {
116-
sh """
117-
wget https://github.com/cli/cli/releases/download/v${env.GITHUB_CLI_VERSION}/gh_${env.GITHUB_CLI_VERSION}_linux_amd64.tar.gz
118-
tar xzf gh_${env.GITHUB_CLI_VERSION}_linux_amd64.tar.gz
119-
mv gh_${env.GITHUB_CLI_VERSION}_linux_amd64/bin/gh .
120-
rm -r gh_${env.GITHUB_CLI_VERSION}_linux_amd64*
121-
"""
122-
}
123-
124109
void setDefaultBranch(String defaultBranch) {
125110
withCredentials([string(credentialsId: env.GITHUB_TOKEN_CREDS_ID, variable: 'GITHUB_TOKEN')]) {
126111
// gh command from https://github.com/cli/cli/issues/929#issuecomment-629253585

.ci/jenkins/Jenkinsfile.promote

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ examplesHelper = null
88

99
pipeline {
1010
agent {
11-
label 'rhel8 && !built-in'
11+
docker {
12+
image env.AGENT_DOCKER_BUILDER_IMAGE
13+
args env.AGENT_DOCKER_BUILDER_ARGS
14+
}
1215
}
1316

1417
options {

.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ changeTarget = env.ghprbTargetBranch ?: CHANGE_TARGET
88

99
pipeline {
1010
agent {
11-
label 'kie-rhel8 && docker && kie-mem16g && !built-in'
12-
}
13-
tools {
14-
maven env.BUILD_MAVEN_TOOL
15-
jdk env.BUILD_JDK_TOOL
11+
docker {
12+
image env.AGENT_DOCKER_BUILDER_IMAGE
13+
args env.AGENT_DOCKER_BUILDER_ARGS
14+
}
1615
}
1716
options {
1817
timestamps()
@@ -38,9 +37,9 @@ pipeline {
3837
stage('Build upstream projects') {
3938
steps {
4039
script {
41-
[ 'drools', 'kogito-runtimes', 'kogito-apps' ].each { project ->
40+
[ 'incubator-kie-drools', 'incubator-kie-kogito-runtimes', 'incubator-kie-kogito-apps' ].each { project ->
4241
dir(project) {
43-
githubscm.checkoutIfExists(project, changeAuthor, changeBranch, 'kiegroup', changeTarget, true)
42+
githubscm.checkoutIfExists(project, changeAuthor, changeBranch, 'apache', changeTarget, true)
4443
sh '.ci/environments/update.sh quarkus-3'
4544
getMavenCommand().withProperty('quickly').run('clean install')
4645
}
@@ -56,7 +55,7 @@ pipeline {
5655
env.BUILD_MVN_OPTS = "${env.BUILD_MVN_OPTS ?: ''} -s ${MAVEN_SETTINGS_FILE} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.test.failure.ignore=true"
5756
echo "BUILD_MVN_OPTS = ${BUILD_MVN_OPTS}"
5857

59-
util.runWithPythonVirtualEnv('.ci/environments/quarkus-3/before.sh rewrite', 'swf')
58+
sh '.ci/environments/quarkus-3/before.sh rewrite'
6059
}
6160
}
6261
}

.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone

+6-8
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ previousHash = ''
77

88
pipeline {
99
agent {
10-
label 'kie-rhel8 && docker && kie-mem16g && !built-in'
11-
}
12-
13-
tools {
14-
maven env.BUILD_MAVEN_TOOL
15-
jdk env.BUILD_JDK_TOOL
10+
docker {
11+
image env.AGENT_DOCKER_BUILDER_IMAGE
12+
args env.AGENT_DOCKER_BUILDER_ARGS
13+
}
1614
}
1715

1816
options {
@@ -57,7 +55,7 @@ pipeline {
5755
stage('Build upstream projects') {
5856
steps {
5957
script {
60-
[ 'drools', 'kogito-runtimes', 'kogito-apps' ].each { project ->
58+
[ 'incubator-kie-drools', 'incubator-kie-kogito-runtimes', 'incubator-kie-kogito-apps' ].each { project ->
6159
dir(project) {
6260
githubscm.checkoutIfExists(project, getGitAuthor(), getBuildBranch(), getBaseAuthor(), getBaseBranch(), true)
6361
sh '.ci/environments/update.sh quarkus-3'
@@ -75,7 +73,7 @@ pipeline {
7573
env.BUILD_MVN_OPTS = "${env.BUILD_MVN_OPTS ?: ''} -s ${MAVEN_SETTINGS_FILE} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.test.failure.ignore=true"
7674
echo "BUILD_MVN_OPTS = ${BUILD_MVN_OPTS}"
7775

78-
util.runWithPythonVirtualEnv('.ci/environments/quarkus-3/before.sh rewrite', 'swf')
76+
sh '.ci/environments/quarkus-3/before.sh rewrite'
7977
}
8078
}
8179
}

.ci/jenkins/Jenkinsfile.setup-branch

+7-18
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,25 @@ import org.kie.jenkins.MavenCommand
55

66
examplesHelper = null
77

8-
droolsRepo = 'drools'
9-
kogitoRuntimesRepo = 'kogito-runtimes'
10-
kogitoAppsRepo = 'kogito-apps'
8+
droolsRepo = 'incubator-kie-drools'
9+
kogitoRuntimesRepo = 'incubator-kie-kogito-runtimes'
10+
kogitoAppsRepo = 'incubator-kie-kogito-apps'
1111

1212
pipeline {
1313
agent {
14-
label 'kie-rhel8 && !built-in'
15-
}
16-
17-
tools {
18-
maven env.BUILD_MAVEN_TOOL
19-
jdk env.BUILD_JDK_TOOL
14+
docker {
15+
image env.AGENT_DOCKER_BUILDER_IMAGE
16+
args env.AGENT_DOCKER_BUILDER_ARGS
17+
}
2018
}
2119

2220
options {
2321
timestamps()
2422
timeout(time: 60, unit: 'MINUTES')
2523
}
2624

27-
// parameters {
28-
// For parameters, check into ./dsl/jobs.groovy file
29-
// }
30-
3125
environment {
32-
// Static env is defined into ./dsl/jobs.groovy file
33-
3426
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")
35-
36-
// Keep here for visitibility
37-
MAVEN_OPTS = '-Xms1024m -Xmx4g'
3827
}
3928

4029
stages {

.ci/jenkins/dsl/jobs.groovy

+12-10
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* This file is describing all the Jenkins jobs in the DSL format (see https://plugins.jenkins.io/job-dsl/)
33
* needed by the Kogito pipelines.
44
*
5-
* The main part of Jenkins job generation is defined into the https://github.com/kiegroup/kogito-pipelines repository.
5+
* The main part of Jenkins job generation is defined into the https://github.com/apache/incubator-kie-kogito-pipelines repository.
66
*
77
* This file is making use of shared libraries defined in
8-
* https://github.com/kiegroup/kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl.
8+
* https://github.com/apache/incubator-kie-kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl.
99
*/
1010

1111
import org.kie.jenkins.jobdsl.model.JenkinsFolder
@@ -67,7 +67,7 @@ List getExamplesBuildMvnOptions(JenkinsFolder jobFolder) {
6767
}
6868

6969
// PR checks
70-
KogitoJobUtils.createAllEnvironmentsPerRepoPRJobs(this) { jobFolder -> getMultijobPRConfig(jobFolder) }
70+
Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile")
7171

7272
// Init branch
7373
createSetupBranchJob()
@@ -98,7 +98,9 @@ if (isMainStream()) {
9898

9999
// Quarkus 3
100100
if (EnvUtils.isEnvironmentEnabled(this, 'quarkus-3')) {
101-
setupPrQuarkus3RewriteJob()
101+
// Deactivated due to ghprb not available on Apache Jenkins
102+
// TODO create PR job with branch source plugin
103+
// setupPrQuarkus3RewriteJob()
102104
setupStandaloneQuarkus3RewriteJob()
103105
}
104106
}
@@ -117,7 +119,7 @@ void setupSpecificBuildChainNightlyJob(String envName, Closure defaultJobParamsG
117119

118120
void createSetupBranchJob() {
119121
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Examples Init branch')
120-
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
122+
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
121123
jobParams.env.putAll([
122124
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
123125

@@ -144,7 +146,7 @@ void createSetupBranchJob() {
144146

145147
void setupReleaseDeployJob() {
146148
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-deploy', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Examples Deploy')
147-
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
149+
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
148150
jobParams.env.putAll([
149151
PROPERTIES_FILE_NAME: 'deployment.properties',
150152

@@ -186,7 +188,7 @@ void setupReleaseDeployJob() {
186188

187189
void setupReleasePromoteJob() {
188190
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-promote', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Examples Promote')
189-
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
191+
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
190192
jobParams.env.putAll([
191193
PROPERTIES_FILE_NAME: 'deployment.properties',
192194

@@ -222,7 +224,7 @@ void setupReleasePromoteJob() {
222224

223225
void setupPostReleaseJob() {
224226
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-post-release', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.post-release", 'Kogito Examples Post Release')
225-
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
227+
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
226228
jobParams.env.putAll([
227229
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
228230

@@ -246,7 +248,7 @@ void setupPostReleaseJob() {
246248

247249
void setupPrQuarkus3RewriteJob() {
248250
def jobParams = JobParamsUtils.getBasicJobParamsWithEnv(this, 'kogito-examples.rewrite', JobType.PULL_REQUEST, 'quarkus-3', "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.pr", 'Kogito Examples Quarkus 3 rewrite patch regeneration')
249-
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
251+
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
250252
jobParams.jenkinsfile = "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.pr"
251253
jobParams.pr.putAll([
252254
run_only_for_branches: [ "${GIT_BRANCH}" ],
@@ -266,7 +268,7 @@ void setupPrQuarkus3RewriteJob() {
266268
void setupStandaloneQuarkus3RewriteJob() {
267269
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples.quarkus-3.rewrite', JobType.TOOLS, "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.standalone", 'Kogito Examples Quarkus 3 rewrite patch regeneration')
268270
jobParams.env.putAll(EnvUtils.getEnvironmentEnvVars(this, 'quarkus-3'))
269-
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
271+
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
270272
jobParams.env.putAll([
271273
AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
272274
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",

0 commit comments

Comments
 (0)