forked from HamzaBenyazid/account-sharing-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
64 lines (64 loc) · 1.94 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
def gv
def version
pipeline{
agent any
tools {
maven 'maven'
}
stages{
stage("init"){
steps{
script{
gv = load "script.groovy"
echo "loaded script.groovy"
}
}
}
stage("increment version"){
steps{
script{
echo "incrementing project version"
sh 'mvn build-helper:parse-version versions:set -DnewVersion=\\\${parsedVersion.majorVersion}.\\\${parsedVersion.minorVersion}.\\\${parsedVersion.nextIncrementalVersion} versions:commit'
version = readMavenPom().getVersion()
env.IMAGE_TAG = "$version-$BUILD_NUMBER"
echo "the new version is : ${version}"
}
}
}
stage("build docker-image"){
steps{
script{
// test are included here
echo "building the docker image ${IMAGE_TAG}"
gv.buildImage()
}
}
}
stage("push docker-image"){
steps{
script{
gv.pushImage()
}
}
}
// // stage("deploy"){
// // // docker login is already done in ec2
// // steps{
// // script{
// // def dockerCommand = "docker ps -aq | xargs -I {} docker rm -f {} && docker run -p 3000:8080 -d oubaydos/temp:${IMAGE_TAG}"
// // sshagent(['ec2-deployment-instance']) {
// // sh "ssh -o StrictHostKeyChecking=no [email protected] ${dockerCommand}"
// // }
// // }
// // }
// //
// // }
stage("commiting new version"){
steps{
script{
gv.commitVersion()
}
}
}
}
}