forked from HamzaBenyazid/account-sharing-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.groovy
26 lines (26 loc) · 982 Bytes
/
script.groovy
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
def buildJar(){
echo "building the jar"
sh 'mvn clean package'
}
def buildImage(){
echo "${IMAGE_TAG}"
sh "docker build -t oubaydos/temp:${IMAGE_TAG} ."
}
def pushImage(){
echo "pushing the docker image"
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]){
sh "echo $PASSWORD | docker login -u $USERNAME --password-stdin"
sh "docker push oubaydos/temp:$IMAGE_TAG"
}
}
def commitVersion(){
withCredentials([usernamePassword(credentialsId: 'githubWithToken', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]){
sh "git config user.name 'jenkins'"
sh "git config user.email '[email protected]'"
sh "git remote set-url origin https://${PASSWORD}@github.com/HamzaBenyazid/account-sharing-app"
sh "git add . "
sh "git commit -m 'update version'"
sh "git push origin HEAD:${BRANCH_NAME}"
}
}
return this