-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
35 lines (32 loc) · 845 Bytes
/
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
pipeline {
agent any
environment {
DOCKERHUB_CREDENTIALS = credentials('dockerhub_id')
}
stages {
stage('Build') {
steps {
sh 'chmod +x gradlew'
sh './gradlew --version'
sh './gradlew clean build'
}
}
stage('Test') {
steps {
sh './gradlew test'
}
}
stage('Deploy') {
steps {
sh 'docker build -t $DOCKERHUB_CREDENTIALS_USR/xyz-bank:latest .'
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
sh 'docker push $DOCKERHUB_CREDENTIALS_USR/xyz-bank:latest'
}
}
}
post {
always {
sh 'docker logout'
}
}
}