-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
74 lines (73 loc) · 2.08 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
pipeline {
/* agent {
docker {
image 'maven:3.8.1-adoptopenjdk-11'
args '-v /root/.m2:/root/.m2'
}
} */
agent any
tools {
maven 'apache-maven-3.8.3'
}
environment {
DATE = new Date().format('yy.M')
TAG = "${DATE}.${BUILD_NUMBER}"
}
stages {
stage('Tooling versions') {
steps {
sh '''
docker --version
docker compose version
'''
}
}
stage('Build') {
steps {
sh 'mvn -B -DskipTests clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('Docker Build') {
steps {
script {
docker.build("joygoswami/taco-cloud:${TAG}")
}
}
}
stage('Pushing Docker Image to Dockerhub') {
steps {
script {
docker.withRegistry('https://registry.hub.docker.com', 'my_dockerhub_id') {
docker.image("joygoswami/taco-cloud:${TAG}").push()
docker.image("joygoswami/taco-cloud:${TAG}").push("latest")
}
}
}
}
/* stage('Deploy'){
steps {
sh "docker run --name taco-cloud -d -p 8081:8080 joygoswami/taco-cloud:${TAG}"
}
} */
/* stage('Deploy to AWS') {
environment {
DOCKER_HUB_LOGIN = credentials('docker-hub')
}
steps {
withAWS(credentials: 'aws-credentials', region: env.AWS_REGION) {
sh './gradlew awsCfnMigrateStack awsCfnWaitStackComplete -PsubnetId=$SUBNET_ID -PdockerHubUsername=$DOCKER_HUB_LOGIN_USR -Pregion=$AWS_REGION'
}
}
} */
}
}