-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
83 lines (79 loc) · 3.57 KB
/
Jenkinsfile
File metadata and controls
83 lines (79 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Change Snapshot to your own DevCloud Artifactory repo name
def Snapshot = 'PROPEL'
library "security-ci-commons-shared-lib"
def NODE = nodeDetails("java")
pipeline {
options {
buildDiscarder(logRotator(artifactDaysToKeepStr: '1', artifactNumToKeepStr: '1', daysToKeepStr: '5', numToKeepStr: '10'))
}
agent {
docker {
image "${NODE['IMAGE']}"
label "${NODE['LABEL']}"
}
}
stages {
stage('Build and Test') {
steps {
checkout scm
dir('spring-filters-config') {
git branch: 'master', changelog: false, credentialsId: 'github.build.ge.com', poll: false, url: 'https://github.build.ge.com/predix/spring-filters-config.git'
}
sh '''#!/bin/bash -ex
source spring-filters-config/set-env-metering-filter.sh
unset NON_PROXY_HOSTS
unset HTTPS_PROXY_PORT
unset HTTPS_PROXY_HOST
mvn -B clean verify -s spring-filters-config/mvn_settings_noproxy.xml
'''
}
post {
always {
// Test reports
junit '**/surefire-reports/junitreports/TEST*.xml'
step([$class: 'JacocoPublisher', maximumBranchCoverage: '90', maximumInstructionCoverage: '90'])
}
}
}
stage('Publish Artifacts') {
when {
expression { env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'develop' }
}
environment {
DEPLOY_CREDS = credentials('uaa-predix-artifactory-upload-credentials')
MAVEN_CENTRAL_STAGING_PROFILE_ID=credentials('MAVEN_CENTRAL_STAGING_PROFILE_ID')
}
steps {
script {
if (env.BRANCH_NAME == 'master') {
echo 'Branch is master push to MAAXA and maven central'
sh '''#!/bin/bash -ex
apk update
apk add --no-cache gnupg
gpg --version
ln -s ${WORKSPACE} /working-dir
mvn clean deploy -B -s spring-filters-config/mvn_settings_noproxy.xml \\
-DaltDeploymentRepository=artifactory.releases::default::https://artifactory.build.ge.com/MAAXA \\
-Dartifactory.password=${DEPLOY_CREDS_PSW} \\
-D skipTests -e
#Deploy/Release to maven central repository
mvn clean deploy -B -P release -s spring-filters-config/mvn_settings_noproxy.xml \\
-D gpg.homedir=/working-dir/spring-filters-config/gnupg \\
-D stagingProfileId=$MAVEN_CENTRAL_STAGING_PROFILE_ID \\
-D skipTests -e
'''
}
else {
echo 'Branch is develop push to MAAXA-SNAPSHOT'
sh '''#!/bin/bash -ex
mvn clean deploy -B -s spring-filters-config/mvn_settings_noproxy.xml \\
-DaltDeploymentRepository=artifactory.releases::default::https://artifactory.build.ge.com/MAAXA-SNAPSHOT \\
-Dartifactory.password=${DEPLOY_CREDS_PSW} \\
-D skipTests -e
'''
}
}
}
}
}
}