Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#667: fix cleanup and settingsXml handling #3010

Merged
merged 4 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .ci/jenkins/Jenkinsfile.promote
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pipeline {
stage('Initialization') {
steps {
script {
cleanWs()
cleanWs(disableDeferredWipeout: true)

if (params.DISPLAY_NAME) {
currentBuild.displayName = params.DISPLAY_NAME
Expand Down Expand Up @@ -92,11 +92,14 @@ pipeline {
stage('Upload OptaPlanner documentation') {
steps {
script {
getMavenCommand()
.inDirectory(optaplannerRepository)
.skipTests(true)
.withProperty('full')
.run('clean install')
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
getMavenCommand()
.inDirectory(optaplannerRepository)
.skipTests(true)
.withProperty('full')
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
}
uploadDistribution(optaplannerRepository)
}
}
Expand All @@ -118,7 +121,7 @@ pipeline {
cleanup {
script {
// Clean also docker in case of usage of testcontainers lib
util.cleanNode('docker')
util.cleanNode()
}
}
}
Expand Down Expand Up @@ -246,7 +249,6 @@ void uploadDistribution(String directory) {

MavenCommand getMavenCommand() {
mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
if (env.MAVEN_DEPENDENCIES_REPOSITORY) {
mvnCmd.withDependencyRepositoryInSettings('deps-repo', env.MAVEN_DEPENDENCIES_REPOSITORY)
}
Expand Down
11 changes: 8 additions & 3 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ pipeline {
steps {
script {
dir(getRepoName()) {
maven.mvnVersionsSet(getMavenCommand(), getOptaPlannerVersion(), true)
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
maven.mvnVersionsSet(
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
getOptaPlannerVersion(),
true
)
}
}
}
}
Expand Down Expand Up @@ -84,7 +90,7 @@ pipeline {
}
cleanup {
script {
util.cleanNode('docker')
util.cleanNode()
}
}
}
Expand Down Expand Up @@ -128,7 +134,6 @@ String getGitAuthorCredsId() {

MavenCommand getMavenCommand() {
return new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
.withProperty('full')
}

Expand Down
8 changes: 5 additions & 3 deletions .ci/jenkins/Jenkinsfile.turtle
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ pipeline {
stage('Build OptaPlanner with turtle tests') {
steps {
script {
new MavenCommand(this)
// Use the same settings.xml as for the nightly builds, including a maven mirror.
.withSettingsXmlId('kie-release-settings')
// Use the same settings.xml as for the nightly builds, including a maven mirror.
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
new MavenCommand(this)
.inDirectory(optaplannerRepo)
.withOptions(['-U', '-e', '-fae', '-ntp'])
.withProperty('full')
.withProperty('runTurtleTests', true)
.withProperty('maven.test.failure.ignore', true)
.withProperty('constraintStreamImplType', getConstraintStreamImplType())
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void setupProjectDroolsJob(String droolsBranch) {
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
NOTIFICATION_JOB_NAME: 'Drools snapshot check',
DROOLS_BRANCH: droolsBranch,
MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
Expand Down Expand Up @@ -403,7 +404,8 @@ void setupOptaPlannerTurtleTestsJob(String constraintStreamImplType) {
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
CONSTRAINT_STREAM_IMPL_TYPE: "${constraintStreamImplType}",
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}"
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
])
jobParams.triggers = [ cron : 'H H * * 5' ] // Run every Friday.
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
Expand Down
34 changes: 21 additions & 13 deletions .ci/jenkins/project/Jenkinsfile.drools
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ pipeline {
stage('Build drools') {
steps {
script {
getMavenCommand(droolsRepo)
.withProperty('quickly')
.run('clean install')
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
getMavenCommand(droolsRepo)
.withProperty('quickly')
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
}
}
}
post {
Expand Down Expand Up @@ -67,10 +70,13 @@ pipeline {
stage('Build optaplanner') {
steps {
script {
getMavenCommand(optaplannerRepo)
.withProperty('maven.test.failure.ignore', true)
.withProperty('version.org.drools', env.DROOLS_VERSION)
.run('clean install')
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
getMavenCommand(optaplannerRepo)
.withProperty('maven.test.failure.ignore', true)
.withProperty('version.org.drools', env.DROOLS_VERSION)
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
}
}
}
post {
Expand All @@ -87,10 +93,13 @@ pipeline {
stage('Build optaplanner-quickstarts') {
steps {
script {
getMavenCommand(quickstartsRepo)
.withProperty('maven.test.failure.ignore', true)
.withProperty('version.org.drools', env.DROOLS_VERSION)
.run('clean install')
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
getMavenCommand(quickstartsRepo)
.withProperty('maven.test.failure.ignore', true)
.withProperty('version.org.drools', env.DROOLS_VERSION)
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
}
}
}
post {
Expand All @@ -108,7 +117,7 @@ pipeline {
}
cleanup {
script {
util.cleanNode('docker')
util.cleanNode()
}
}
}
Expand Down Expand Up @@ -146,7 +155,6 @@ void checkoutDroolsRepo() {

MavenCommand getMavenCommand(String directory) {
def mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId('kie-release-settings')
.inDirectory(directory)
if (env.BUILD_MVN_OPTS) {
mvnCmd.withOptions([ env.BUILD_MVN_OPTS ])
Expand Down
22 changes: 16 additions & 6 deletions .ci/jenkins/project/Jenkinsfile.post-release
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pipeline {
stage('Initialization') {
steps {
script {
cleanWs()
cleanWs(disableDeferredWipeout: true)

if (params.DISPLAY_NAME) {
currentBuild.displayName = params.DISPLAY_NAME
Expand Down Expand Up @@ -75,8 +75,20 @@ pipeline {
stage('Upload OptaPlanner distribution from Quickstarts') {
steps {
script {
getMavenCommand().inDirectory(optaplannerRepository).withProperty('quickly').withProperty('full').run('clean install')
getMavenCommand().inDirectory(quickstartsRepository).skipTests(true).withProperty('full').run('clean install')
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
getMavenCommand()
.inDirectory(optaplannerRepository)
.withProperty('quickly')
.withProperty('full')
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
getMavenCommand()
.inDirectory(quickstartsRepository)
.skipTests(true)
.withProperty('full')
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
}
uploadDistribution(quickstartsRepository)
}
}
Expand Down Expand Up @@ -124,8 +136,7 @@ pipeline {
}
cleanup {
script {
// Clean also docker in case of usage of testcontainers lib
util.cleanNode('docker')
util.cleanNode()
}
}
}
Expand Down Expand Up @@ -240,7 +251,6 @@ void uploadDistribution(String directory) {

MavenCommand getMavenCommand() {
mvnCmd = new MavenCommand(this, ['-fae'])
.withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
if (env.MAVEN_DEPENDENCIES_REPOSITORY) {
mvnCmd.withDependencyRepositoryInSettings('deps-repo', env.MAVEN_DEPENDENCIES_REPOSITORY)
}
Expand Down
2 changes: 2 additions & 0 deletions .ci/jenkins/project/Jenkinsfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ pipeline {
script {
saveReleaseProperties()
}
}
cleanup {
cleanWs()
}
success {
Expand Down