forked from didinj/mean-stack-angular6-crud-example
/
Jenkinsfile
32 lines (30 loc) · 1.44 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
def docker_hub_username = '<docker_username>'
def img_name = 'book-store'
def img_tag = '<userx>'
def userName = '<userx>'
pipeline {
agent { label 'master' }
stages {
stage('Built image') {
steps {
sh "docker build . --build-arg var=user1 -t ${docker_hub_username}/${img_name}:${img_tag}"
}
}
stage('Push image to Docker Hub') {
steps {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'Dockerhub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh "docker login -u $USERNAME -p $PASSWORD"
sh "docker push ${docker_hub_username}/${img_name}:${img_tag}"
sh "docker logout"
}
}
}
// stage('Deploy book-store helm chart') {
// steps {
// sh "helm ls --tls --tls-ca-cert ~/.helm/ca.pem --tls-cert ~/.helm/cert.pem --tls-key ~/.helm/key.pem"
// sh "(git clone https://github.com/depauna/meetup-resources.git || cd meetup-resources && git reset --hard && git pull origin master)"
// sh "chmod u+x /var/jenkins_home/workspace/book-store/meetup-resources/meetup-resources/deployapp.sh && /var/jenkins_home/workspace/book-store/meetup-resources/meetup-resources/deployapp.sh ${docker_hub_username} ${img_name} ${img_tag} ${userName}
// }
// }
}
}