Skip to content

Commit

Permalink
Merge branch 'master' into to/#113-refactoring-filemodel-naming
Browse files Browse the repository at this point in the history
  • Loading branch information
t-ober committed Oct 12, 2022
2 parents e91e842 + ee96fbc commit 8142c8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 124 deletions.
120 changes: 3 additions & 117 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
// general config values
////////////////////////////////


//// Rocket.Chat channel to publish updates
final String rocketChatChannel = "jenkins"


//// project build dir order
//// this list contains the build order
//// normally it *should* start with the project under investigation
Expand Down Expand Up @@ -93,12 +88,6 @@ if (env.BRANCH_NAME == "master") {

// deployment only
if (params.triggered == "true") {
// notify rocket chat about the started master branch deployment
rocketSend attachments: [],
channel: rocketChatChannel,
message: ":jenkins_triggered:\n" +
"*deploy* manually triggered on master branch of ${projects.get(0)}."
rawMessage: true

node {
// This displays colors using the 'xterm' ansi color map.
Expand Down Expand Up @@ -137,32 +126,17 @@ if (env.BRANCH_NAME == "master") {

/**
* Post processing
* Publish reports and notify rocket chat
* Publish reports
* Future clean workspace processes should be declared here
*/
stage('post processing') {
// publish reports
// publishReports()

// notify rocket chat about success
String buildMode = "deploy"
String branchName = params.pull_request_head_label

rocketSend attachments: [
[$class: 'MessageAttachment', color: 'green', title: 'go to logs', titleLink: env.BUILD_URL],],
channel: rocketChatChannel,
message: ":jenkins_party: \n" +
"${buildMode} successful!\n" +
"*repo:* ${urls.get(0)}/${projects.get(0)}\n" +
"*branch:* ${branchName} \n" +
"*deployedArtifacts:* ${deployedArtifacts}\n"
rawMessage: true

// set build to successfull
currentBuild.result = 'SUCCESS'
}


}

} catch (Exception exc) {
Expand All @@ -171,18 +145,6 @@ if (env.BRANCH_NAME == "master") {
String buildMode = "deploy"
String branchName = params.pull_request_head_label

// notify rocketchat about failure
rocketSend attachments: [
[$class: 'MessageAttachment', color: 'red', title: 'go to logs', titleLink: env.BUILD_URL],],
channel: rocketChatChannel,
message: ":jenkins_explode: \n" +
"${buildMode} failed!\n" +
"*repo:* ${urls.get(0)}/${projects.get(0)}\n" +
"*branch:* ${branchName} \n" +
"*errorMessage:* ${stageErrorMessage}\n" +
"See logs for details.",
rawMessage: true

// publish reports even on failure
publishReports()

Expand All @@ -195,13 +157,6 @@ if (env.BRANCH_NAME == "master") {
} else {

// merge into master
// notify rocket chat about the started master branch deployment
rocketSend attachments: [],
channel: rocketChatChannel,
message: ":jenkins_triggered:\n" +
"*deploy* triggered by merge ${params.pull_request_title} into master of ${projects.get(0)}."
rawMessage: true

node {
// This displays colors using the 'xterm' ansi color map.
ansiColor('xterm') {
Expand Down Expand Up @@ -282,27 +237,12 @@ if (env.BRANCH_NAME == "master") {

/**
* Post processing
* Publish reports and notify rocket chat
* Publish reports
* Future clean workspace processes should be declared here
*/
stage('post processing') {
// publish reports
publishReports()

// notify rocket chat about success
String buildMode = "merge"
String branchName = params.pull_request_head_label

rocketSend attachments: [
[$class: 'MessageAttachment', color: 'green', title: 'go to logs', titleLink: env.BUILD_URL],],
channel: rocketChatChannel,
message: ":jenkins_party: \n" +
"${buildMode} successful!\n" +
"*repo:* ${urls.get(0)}/${projects.get(0)}\n" +
"*branch:* ${branchName} \n" +
"*deployedArtifacts:* ${deployedArtifacts}\n"
rawMessage: true

}

} catch (exc) {
Expand All @@ -315,18 +255,6 @@ if (env.BRANCH_NAME == "master") {
buildMode = ""
}

// notify rocketchat about failure
rocketSend attachments: [
[$class: 'MessageAttachment', color: 'red', title: 'go to logs', titleLink: env.BUILD_URL],],
channel: rocketChatChannel,
message: ":jenkins_explode: \n" +
"${buildMode} failed!\n" +
"*repo:* ${urls.get(0)}/${projects.get(0)}\n" +
"*branch:* ${branchName} \n" +
"*errorMessage:* ${stageErrorMessage}\n" +
"See logs for details.",
rawMessage: true

// publish reports even on failure
publishReports()

Expand Down Expand Up @@ -365,26 +293,8 @@ if (env.BRANCH_NAME == "master") {

/// if the pipeline is scanned we don't want to execute anything
if (params.triggered == "true") {
// notify rocket chat about the started master branch deployment
rocketSend attachments: [],
channel: rocketChatChannel,
message: ":jenkins_triggered:\n" +
"*PR test* manually triggered on master branch of ${projects.get(0)}."
rawMessage: true

log(i, "PR test manually triggered by user.")

} else {
// notify rocket chat about the started PR run
rocketSend attachments: [],
channel: rocketChatChannel,
message: ":jenkins_triggered:\n" +
"*forcedPR* triggered with parameters:\n" +
"*repo:* ${urls.get(0)}/${projects.get(0)}\n" +
"*branch:* ${params.issue_title}\n" +
"*triggeredBy:* ${params.sender_login}",
rawMessage: true

log(i, "forced PR triggered by webhook. Parameters are:")
log(i, "issue_title: ${params.issue_title}")
log(i, "comment_body: ${params.comment_body}")
Expand Down Expand Up @@ -439,24 +349,12 @@ if (env.BRANCH_NAME == "master") {

/**
* Post processing
* Publish reports and notify rocket chat
* Publish reports
* Future clean workspace processes should be declared here
*/
stage('post processing') {
// publish reports
publishReports()

// notify rocket chat about success
String buildMode = "forcedPR"

rocketSend attachments: [
[$class: 'MessageAttachment', color: 'green', title: 'go to logs', titleLink: env.BUILD_URL],],
channel: rocketChatChannel,
message: ":jenkins_party: \n" +
"*repo:* ${urls.get(0)}/${projects.get(0)}\n" +
"${buildMode} successful!\n" +
"*branch:* ${featureBranchName}"
rawMessage: true
}

} catch (Exception exc) {
Expand All @@ -471,18 +369,6 @@ if (env.BRANCH_NAME == "master") {

println("[ERROR] [${date.format("dd/MM/yyyy")} - ${date.format("HH:mm:ss")}]" + exc)

// notify rocketchat about failure
rocketSend attachments: [
[$class: 'MessageAttachment', color: 'red', title: 'go to logs', titleLink: env.BUILD_URL],],
channel: rocketChatChannel,
message: ":jenkins_explode: \n" +
"${buildMode} failed!\n" +
"*repo:* ${urls.get(0)}/${projects.get(0)}\n" +
"*branch:* ${branchName} \n" +
"*errorMessage:* ${stageErrorMessage}\n" +
"See logs for details.",
rawMessage: true

// publish reports even on failure
publishReports()

Expand Down
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
id 'application' // creates a JVM executable
id 'maven-publish' // publish to a maven repo (local or mvn central, has to be defined)
id 'pmd' // code check, working on source code
id 'com.github.spotbugs' version '5.0.6' // code check, working on byte code
id 'com.diffplug.spotless' version '6.6.1'// code format
id 'com.github.spotbugs' version '5.0.7' // code check, working on byte code
id 'com.diffplug.spotless' version '6.7.0'// code format
id 'com.simonharrer.modernizer' version '2.1.0-1' // detect deprecated APIs
id 'com.github.onslip.gradle-one-jar' version '1.0.6' // pack a self contained jar
id 'jacoco' // java code coverage plugin
Expand Down Expand Up @@ -59,12 +59,12 @@ dependencies {

//JAXB (needed for hibernate, but not longer contained in JDK9+)
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'com.sun.xml.bind:jaxb-core:3.0.2'
implementation 'com.sun.xml.bind:jaxb-impl:3.0.2'
implementation 'com.sun.xml.bind:jaxb-core:4.0.0'
implementation 'com.sun.xml.bind:jaxb-impl:4.0.0'
implementation 'javax.activation:activation:1.1.1'

//database
implementation 'org.postgresql:postgresql:42.3.4'
implementation 'org.postgresql:postgresql:42.3.6'
implementation 'javax.persistence:javax.persistence-api:2.2'

// logging
Expand All @@ -76,11 +76,11 @@ dependencies {
implementation 'org.jetbrains:annotations:23.0.0'
annotationProcessor "info.picocli:picocli-codegen:$picoliVersion"
implementation "info.picocli:picocli:$picoliVersion"
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3'

//tests
testImplementation 'junit:junit:4.+'
testImplementation 'org.testcontainers:postgresql:1.17.1'
testImplementation 'org.testcontainers:postgresql:1.17.2'

}

Expand Down

0 comments on commit 8142c8a

Please sign in to comment.