-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
79 lines (72 loc) · 2.52 KB
/
Jenkinsfile
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
properties([
buildDiscarder( logRotator( numToKeepStr: '5' ) ),
disableConcurrentBuilds(),
parameters([
string( name: 'BUILD_NODE', defaultValue: 'omar-build', description: 'The build node to run on' ),
booleanParam(name: 'CLEAN_WORKSPACE', defaultValue: true, description: 'Clean the workspace at the end of the run' )
]),
pipelineTriggers([
[ $class: "GitHubPushTrigger" ]
]),
[
$class: 'GithubProjectProperty',
displayName: '',
projectUrlStr: 'https://github.com/ossimlabs/omar-ui-proto'
]
])
node( "${ BUILD_NODE }" ) {
stage("Checkout branch $BRANCH_NAME" ) {
checkout( scm )
}
stage( "Load Variables" ) {
withCredentials([
string( credentialsId: 'o2-artifact-project', variable: 'o2ArtifactProject' )
]) {
step ([
$class: "CopyArtifact",
filter: "common-variables.groovy",
flatten: true,
projectName: o2ArtifactProject
])
}
load "common-variables.groovy"
}
stage ( "Assemble" ) {
sh """
echo "registry = ${NPM_REGISTRY}" >> .npmrc
export CHROMEDRIVER_SKIP_DOWNLOAD=true
./gradlew assembleServerAndClient -PossimMavenProxy=${ OSSIM_MAVEN_PROXY }
"""
}
stage ( "Publish Docker App" ) {
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'dockerCredentials',
passwordVariable: 'DOCKER_REGISTRY_PASSWORD',
usernameVariable: 'DOCKER_REGISTRY_USERNAME'
]]) {
// Run all tasks on the app. This includes pushing to OpenShift and S3.
sh "./gradlew pushDockerImage -PossimMavenProxy=${ OSSIM_MAVEN_PROXY }"
}
}
try {
stage ( "OpenShift Tag Image" ) {
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'openshiftCredentials',
usernameVariable: 'OPENSHIFT_USERNAME',
passwordVariable: 'OPENSHIFT_PASSWORD'
]]) {
// Run all tasks on the app. This includes pushing to OpenShift and S3.
sh "./gradlew openshiftTagImage -PossimMavenProxy=${ OSSIM_MAVEN_PROXY }"
}
}
stage( "Clean Workspace" ) {
if ( "${ CLEAN_WORKSPACE }" == "true" ) {
step([ $class: 'WsCleanup' ])
}
}
} catch (e) {
echo e.toString()
}
}