Skip to content

Commit 1692d4e

Browse files
committed
chore(build): Fix ci bui
1 parent 72ef278 commit 1692d4e

File tree

5 files changed

+109
-4
lines changed

5 files changed

+109
-4
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ jdk:
77
- oraclejdk8
88
- openjdk7
99

10-
install: mvn install -DskipTests=true -q && cd ..
11-
script: mvn verify -B -q && cd ..
10+
install: mvn install -DskipTests=true -q
11+
script: mvn verify -B -q

Jenkinsfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
properties properties: [
2+
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
3+
disableConcurrentBuilds()
4+
]
5+
6+
@Library('mare-build-library')
7+
def git = new de.mare.ci.jenkins.Git()
8+
9+
timeout(60) {
10+
node {
11+
def buildNumber = env.BUILD_NUMBER
12+
def branchName = env.BRANCH_NAME
13+
def workspace = env.WORKSPACE
14+
def buildUrl = env.BUILD_URL
15+
16+
try {
17+
withEnv(["JAVA_HOME=${tool 'JDK8'}", "PATH+MAVEN=${tool 'Maven3'}/bin:${env.JAVA_HOME}/bin"]) {
18+
19+
// PRINT ENVIRONMENT TO JOB
20+
echo "workspace directory is $workspace"
21+
echo "build URL is $buildUrl"
22+
echo "build Number is $buildNumber"
23+
echo "branch name is $branchName"
24+
echo "PATH is $env.PATH"
25+
26+
stage('Checkout') {
27+
checkout scm
28+
}
29+
stage('Build') {
30+
sh "mvn package -DskipUnitTests=true"
31+
}
32+
33+
stage('Unit-Tests') {
34+
sh "mvn test -Dmaven.test.failure.ignore"
35+
}
36+
37+
stage('Integration-Tests') {
38+
// TODO add for OWASP ZAP version 2.7.0
39+
}
40+
41+
stage('Deploy') {
42+
if (git.isProductionBranch()) {
43+
sh "mvn -Prelease package source:jar gpg:sign install:install deploy:deploy"
44+
} else {
45+
sh "mvn deploy"
46+
}
47+
48+
stage('Sonar') {
49+
sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=hypery2k-github -Dsonar.login=${env['sonarcloud.io.token']}"
50+
}
51+
}
52+
53+
archiveArtifacts artifacts: '*/target/*.jar'
54+
junit healthScaleFactor: 1.0, testResults: '*/target/surefire-reports/TEST*.xml'
55+
}
56+
} catch (e) {
57+
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: 'github@martinreinhardt-online.de', body: "Please go to ${env.BUILD_URL}."
58+
throw e
59+
}
60+
}
61+
}

Jenkinsfile_release

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
properties properties: [
2+
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
3+
parameters([
4+
string(defaultValue: '', description: '', name: 'releaseVersion')]
5+
),
6+
disableConcurrentBuilds()
7+
]
8+
9+
timeout(20) {
10+
node {
11+
def buildNumber = env.BUILD_NUMBER
12+
def branchName = env.BRANCH_NAME
13+
def workspace = env.WORKSPACE
14+
def buildUrl = env.BUILD_URL
15+
16+
try {
17+
withEnv(["JAVA_HOME=${tool 'JDK8'}", "PATH+MAVEN=${tool 'Maven3'}/bin:${env.JAVA_HOME}/bin"]) {
18+
19+
// PRINT ENVIRONMENT TO JOB
20+
echo "workspace directory is $workspace"
21+
echo "build URL is $buildUrl"
22+
echo "build Number is $buildNumber"
23+
echo "branch name is $branchName"
24+
echo "PATH is $env.PATH"
25+
26+
stage('Checkout') {
27+
checkout scm
28+
}
29+
30+
stage('Start Release') {
31+
echo "releaseVersion: ${releaseVersion}"
32+
sh "mvn gitflow:release -DreleaseVersion=${releaseVersion} -DskipITs=true "
33+
}
34+
35+
}
36+
} catch (e) {
37+
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: 'github@martinreinhardt-online.de', body: "Please go to ${env.BUILD_URL}."
38+
throw e
39+
}
40+
}
41+
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# zap-java
1+
# ZAP Java Integration
2+
3+
[![Build Status](https://travis-ci.org/ContinuousSecurityTooling/zap-java.svg?branch=master)](https://travis-ci.org/ContinuousSecurityTooling/zap-java)

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,11 @@
259259
<releaseBranchPrefix>release/</releaseBranchPrefix>
260260
<hotfixBranchPrefix>hotfix/</hotfixBranchPrefix>
261261
<supportBranchPrefix>support/</supportBranchPrefix>
262+
<versionPrefix>v</versionPrefix>
262263
<origin>origin</origin>
263264
</gitFlowConfig>
264265
<keepBranch>false</keepBranch>
265-
<pushReleases>true</pushReleases>
266+
<pushReleases>false</pushReleases>
266267
</configuration>
267268
</plugin>
268269
<plugin>

0 commit comments

Comments
 (0)