-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
2,252 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!groovy | ||
@Library('github.com/cloudogu/ces-build-lib@a5955fb') | ||
import com.cloudogu.ces.cesbuildlib.* | ||
|
||
node() { // No specific label | ||
|
||
properties([ | ||
// Keep only the last 10 build to preserve space | ||
buildDiscarder(logRotator(numToKeepStr: '10')), | ||
// Don't run concurrent builds for a branch, because they use the same workspace directory | ||
disableConcurrentBuilds() | ||
]) | ||
|
||
String emailRecipients = env.EMAIL_RECIPIENTS | ||
|
||
catchError { | ||
|
||
def mvnHome = tool 'M3' | ||
def javaHome = tool 'JDK8' | ||
def sonarQube = 'ces-sonar' | ||
|
||
Maven mvn = new Maven(this, mvnHome, javaHome) | ||
Git git = new Git(this) | ||
|
||
stage('Checkout') { | ||
checkout scm | ||
git.clean("") | ||
} | ||
|
||
stage('Build') { | ||
setupMaven(mvn) | ||
mvn 'clean install -DskipTests' | ||
archive '**/target/*.jar,**/target/*.zip' | ||
} | ||
|
||
stage('Unit Test') { | ||
mvn 'test' | ||
} | ||
|
||
stage('SonarQube') { | ||
withSonarQubeEnv(sonarQube) { | ||
mvn "$SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL " + | ||
//exclude generated code in target folder | ||
"-Dsonar.exclusions=target/**" | ||
} | ||
} | ||
} | ||
|
||
// Archive Unit and integration test results, if any | ||
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml' | ||
|
||
// email on fail | ||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailRecipients, sendToIndividuals: true]) | ||
} | ||
|
||
def setupMaven(mvn) { | ||
// TODO refactor this in an object-oriented way and move to build-lib | ||
if ("master".equals(env.BRANCH_NAME)) { | ||
mvn.additionalArgs = "-DperformRelease" | ||
currentBuild.description = mvn.getVersion() | ||
} else if (!"develop".equals(env.BRANCH_NAME)) { | ||
// CHANGE_ID == pull request id | ||
// http://stackoverflow.com/questions/41695530/how-to-get-pull-request-id-from-jenkins-pipeline | ||
if ( env.CHANGE_ID != null && env.CHANGE_ID.length() > 0 ) { | ||
echo 'build pr ' + env.CHANGE_ID + ' at ' + env.BRANCH_NAME | ||
mvn.additionalArgs = "-Dsonar.analysis.mode=preview " | ||
mvn.additionalArgs += "-Dsonar.github.pullRequest=${env.CHANGE_ID} " | ||
mvn.additionalArgs += "-Dsonar.github.repository=cloudogu/cas " | ||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-gh', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { | ||
mvn.additionalArgs += "-Dsonar.github.oauth=${env.PASSWORD} " | ||
} | ||
} else { | ||
echo 'build branch ' + env.BRANCH_NAME | ||
// run SQ analysis in specific project for feature, hotfix, etc. | ||
mvn.additionalArgs = "-Dsonar.branch=" + env.BRANCH_NAME | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ | |
<ul class="nav navbar-nav"> | ||
<li> | ||
<a href="{{casLogoutUrl}}"> | ||
Abmeldung | ||
Logout | ||
</a> | ||
</li> | ||
</ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
module Precious | ||
module Views | ||
class Compare < Layout | ||
include HasPage | ||
|
||
attr_reader :page, :diff, :versions, :message, :allow_editing | ||
|
||
def title | ||
"Vergleich von #{@page.title}" | ||
end | ||
|
||
def before | ||
@versions[0][0..6] | ||
end | ||
|
||
def after | ||
@versions[1][0..6] | ||
end | ||
|
||
def lines | ||
lines = [] | ||
@diff.diff.split("\n")[2..-1].each_with_index do |line, line_index| | ||
lines << { :line => line, | ||
:class => line_class(line), | ||
:ldln => left_diff_line_number(0, line), | ||
:rdln => right_diff_line_number(0, line) } | ||
end if @diff | ||
lines | ||
end | ||
|
||
def show_revert | ||
!@message | ||
end | ||
|
||
# private | ||
|
||
def line_class(line) | ||
if line =~ /^@@/ | ||
'gc' | ||
elsif line =~ /^\+/ | ||
'gi' | ||
elsif line =~ /^\-/ | ||
'gd' | ||
else | ||
'' | ||
end | ||
end | ||
|
||
@left_diff_line_number = nil | ||
|
||
def left_diff_line_number(id, line) | ||
if line =~ /^@@/ | ||
m, li = *line.match(/\-(\d+)/) | ||
@left_diff_line_number = li.to_i | ||
@current_line_number = @left_diff_line_number | ||
ret = '...' | ||
elsif line[0] == ?- | ||
ret = @left_diff_line_number.to_s | ||
@left_diff_line_number += 1 | ||
@current_line_number = @left_diff_line_number - 1 | ||
elsif line[0] == ?+ | ||
ret = ' ' | ||
else | ||
ret = @left_diff_line_number.to_s | ||
@left_diff_line_number += 1 | ||
@current_line_number = @left_diff_line_number - 1 | ||
end | ||
ret | ||
end | ||
|
||
@right_diff_line_number = nil | ||
|
||
def right_diff_line_number(id, line) | ||
if line =~ /^@@/ | ||
m, ri = *line.match(/\+(\d+)/) | ||
@right_diff_line_number = ri.to_i | ||
@current_line_number = @right_diff_line_number | ||
ret = '...' | ||
elsif line[0] == ?- | ||
ret = ' ' | ||
elsif line[0] == ?+ | ||
ret = @right_diff_line_number.to_s | ||
@right_diff_line_number += 1 | ||
@current_line_number = @right_diff_line_number - 1 | ||
else | ||
ret = @right_diff_line_number.to_s | ||
@right_diff_line_number += 1 | ||
@current_line_number = @right_diff_line_number - 1 | ||
end | ||
ret | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.