Skip to content

Commit

Permalink
[apache_migration] Update pipelines (#2967)
Browse files Browse the repository at this point in the history
Update pipelines
  • Loading branch information
radtriste authored Sep 11, 2023
1 parent 3f4e00d commit 1c74317
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 112 deletions.
44 changes: 44 additions & 0 deletions .ci/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@Library('jenkins-pipeline-shared-libraries')_

pr_check_script = null

pipeline {
agent {
label 'ubuntu'
}
options {
timestamps()
timeout(time: '720', unit: 'MINUTES')
}
environment {
BUILDCHAIN_PROJECT = 'kiegroup/optaplanner'
BUILDCHAIN_CONFIG_REPO = 'optaplanner'
BUILDCHAIN_CONFIG_FILE_PATH = '.ci/buildchain-config.yaml'

ENABLE_SONARCLOUD = 'true'
SONARCLOUD_ANALYSIS_MVN_OPTS = '-Dsonar.projectKey=org.optaplanner:optaplanner'
OPTAPLANNER_BUILD_MVN_OPTS = '-Prun-code-coverage'
}
stages {
stage('Initialize') {
steps {
script {
// load `pr_check.groovy` file from kogito-pipelines:main
dir('kogito-pipelines') {
checkout(githubscm.resolveRepository('kogito-pipelines', 'kiegroup', 'apache_migration', false, 'kie-ci')) // TODO to change back to kiegroup:main
pr_check_script = load 'dsl/scripts/pr_check.groovy'
}
}
}
}
stage('PR check') {
steps {
script {
dir('kogito-pipelines') {
pr_check_script.launch()
}
}
}
}
}
}
23 changes: 5 additions & 18 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ imageUtils = null

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 {
Expand All @@ -28,21 +26,13 @@ pipeline {
disableConcurrentBuilds(abortPrevious: true)
}

// parameters {
// For parameters, check into .jenkins/dsl/jobs.groovy file
// }

environment {
// Some generated env is also defined into .jenkins/dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

MAVEN_OPTS = '-Xms1024m -Xmx4g'

PR_BRANCH_HASH = "${util.generateHash(10)}"

// Maven configuration
MAVEN_DEPLOY_LOCAL_DIR = "${WORKSPACE}/maven_deploy_dir"
MAVEN_DEPLOY_LOCAL_DIR = "/tmp/maven_deploy_dir"
}

stages {
Expand Down Expand Up @@ -197,9 +187,6 @@ pipeline {
when {
expression { return shouldStageArtifacts() }
}
tools {
jdk 'kie-jdk11'
}
steps {
script {
// Stage release artifacts
Expand Down
16 changes: 4 additions & 12 deletions .ci/jenkins/Jenkinsfile.promote
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ imageUtils = null

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 {
Expand All @@ -27,13 +25,7 @@ pipeline {
disableConcurrentBuilds(abortPrevious: true)
}

// parameters {
// For parameters, check into .jenkins/dsl/jobs.groovy file
// }

environment {
// Some generated env is also defined into .jenkins/dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

PR_BRANCH_HASH = "${util.generateHash(10)}"
Expand Down
19 changes: 4 additions & 15 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,20 @@ import org.kie.jenkins.MavenCommand

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 {
timestamps()
timeout(time: 60, unit: 'MINUTES')
}

// parameters {
// For parameters, check into ./dsl/jobs.groovy file
// }

environment {
// Static env is defined into ./dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

// Keep here for visitibility
MAVEN_OPTS = '-Xms1024m -Xmx4g'

BRANCH_HASH = "${util.generateHash(10)}"
}

Expand Down
13 changes: 4 additions & 9 deletions .ci/jenkins/Jenkinsfile.turtle
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,17 @@ optaplannerRepo = 'optaplanner'

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 {
timestamps()
timeout(time: 3, unit: 'DAYS') // Turtle tests take ~2 days to complete.
disableConcurrentBuilds(abortPrevious: true)
}
// parameters {
// For parameters, check the .jenkins/dsl/jobs.groovy file.
// }
environment {
MAVEN_OPTS = '-Xms1024m -Xmx4g'
// Contains the email address of the team's Zulip channel.
OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")
}
Expand Down
12 changes: 6 additions & 6 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ KogitoJobUtils.createMainQuarkusUpdateToolsJob(this,

void setupProjectDroolsJob(String droolsBranch) {
def jobParams = JobParamsUtils.getBasicJobParamsWithEnv(this, 'optaplanner-drools-snapshot', JobType.NIGHTLY, 'ecosystem', "${jenkins_path_project}/Jenkinsfile.drools", 'Optaplanner testing against Drools snapshot')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.triggers = [ cron : 'H 2 * * *' ]
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
Expand Down Expand Up @@ -130,7 +130,7 @@ void setupProjectReleaseJob() {

void setupProjectPostReleaseJob() {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'optaplanner-post-release', JobType.RELEASE, "${jenkins_path_project}/Jenkinsfile.post-release", 'Optaplanner Post Release')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",

Expand Down Expand Up @@ -234,7 +234,7 @@ void setupSpecificBuildChainNightlyJob(String envName) {

void createSetupBranchJob() {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'optaplanner', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'OptaPlanner Setup Branch')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'optaplanner',
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
Expand Down Expand Up @@ -262,7 +262,7 @@ void createSetupBranchJob() {

void setupDeployJob(JobType jobType, String envName = '') {
def jobParams = JobParamsUtils.getBasicJobParamsWithEnv(this, 'optaplanner-deploy', jobType, envName, "${jenkins_path}/Jenkinsfile.deploy", 'Optaplanner Deploy')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
if (jobType == JobType.PULL_REQUEST) {
jobParams.git.branch = '${BUILD_BRANCH_NAME}'
jobParams.git.author = '${GIT_AUTHOR}'
Expand Down Expand Up @@ -340,7 +340,7 @@ void setupDeployJob(JobType jobType, String envName = '') {

void setupPromoteJob(JobType jobType) {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'optaplanner-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Optaplanner Promote')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",

Expand Down Expand Up @@ -383,7 +383,7 @@ void setupPromoteJob(JobType jobType) {
void setupOptaPlannerTurtleTestsJob(String constraintStreamImplType) {
def jobParams = JobParamsUtils.getBasicJobParams(this, "optaplanner-turtle-tests-${constraintStreamImplType}", JobType.OTHER, "${jenkins_path}/Jenkinsfile.turtle",
"Run OptaPlanner turtle tests with CS-${constraintStreamImplType} on a weekly basis.")
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
CONSTRAINT_STREAM_IMPL_TYPE: "${constraintStreamImplType}",
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}"
Expand Down
13 changes: 4 additions & 9 deletions .ci/jenkins/project/Jenkinsfile.drools
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ quickstartsRepo = 'optaplanner-quickstarts'

pipeline {
agent {
label 'ubuntu'
docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
}
}
environment {
// DROOLS_BRANCH should be defined directly into the job environment

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

MAVEN_OPTS = '-Xms1024m -Xmx4g'
}
tools {
maven env.BUILD_MAVEN_TOOL
jdk env.BUILD_JDK_TOOL
}
options {
timestamps()
Expand Down
6 changes: 0 additions & 6 deletions .ci/jenkins/project/Jenkinsfile.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ pipeline {
timeout(time: 1380, unit: 'MINUTES')
}

// parameters {
// For parameters, check into ./dsl/jobs.groovy file
// }

environment {
// Some generated env is also defined into ./dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

// Use branch name in nightly tag as we may have parallel main and release branch builds
Expand Down
28 changes: 4 additions & 24 deletions .ci/jenkins/project/Jenkinsfile.post-release
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ String stableBranchName = 'stable'

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 {
Expand All @@ -24,13 +22,7 @@ pipeline {
disableConcurrentBuilds(abortPrevious: true)
}

// parameters {
// For parameters, check into .jenkins/dsl/jobs.groovy file
// }

environment {
// Some generated env is also defined into .jenkins/dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

PR_BRANCH_HASH = "${util.generateHash(10)}"
Expand All @@ -48,10 +40,7 @@ pipeline {

// Verify version is set and if on right release branch
assert getProjectVersion()

assert getBuildBranch() == util.getReleaseBranchFromVersion(getProjectVersion())

installGithubCLI()
}
}
}
Expand Down Expand Up @@ -232,15 +221,6 @@ void commitAndForcePushBranch(String repo, String branch) {
}
}

void installGithubCLI() {
sh """
wget https://github.com/cli/cli/releases/download/v${env.GITHUB_CLI_VERSION}/gh_${env.GITHUB_CLI_VERSION}_linux_amd64.tar.gz
tar xzf gh_${env.GITHUB_CLI_VERSION}_linux_amd64.tar.gz
mv gh_${env.GITHUB_CLI_VERSION}_linux_amd64/bin/gh .
rm -r gh_${env.GITHUB_CLI_VERSION}_linux_amd64*
"""
}

void uploadDistribution(String directory) {
if (isNotTestingBuild()) {
echo "uploadDistribution for ${directory}"
Expand Down
6 changes: 0 additions & 6 deletions .ci/jenkins/project/Jenkinsfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ pipeline {
label 'ubuntu'
}

// parameters {
// For parameters, check into ./dsl/jobs.groovy file
// }

environment {
// Some generated env is also defined into ./dsl/jobs.groovy file

CI_EMAIL = credentials("${JENKINS_EMAIL_CREDS_ID}")
}

Expand Down
7 changes: 0 additions & 7 deletions .ci/jenkins/project/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ JOBS = [:]
FAILED_STAGES = [:]
UNSTABLE_STAGES = [:]

// Should be multibranch pipeline
pipeline {
agent {
label 'ubuntu'
Expand All @@ -20,13 +19,7 @@ pipeline {
timeout(time: 360, unit: 'MINUTES')
}

// parameters {
// For parameters, check into ./dsl/jobs.groovy file
// }

environment {
// Some generated env is also defined into ./dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

// Use branch name in nightly tag as we may have parallel main and release branch builds
Expand Down

0 comments on commit 1c74317

Please sign in to comment.