forked from spring-projects/spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkinsfile
56 lines (53 loc) · 1.67 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
pipeline {
agent any
tools {
maven 'mvn'
}
environment {
JAVA_VERSION = "jdk11"
BUILD_COMMAND = "/usr/local/bin/mvn clean install -DskipTests"
}
stages {
stage('Checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/main']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/waseemahammed/spring-petclinic.git']]])
}
}
stage("Build"){
steps{
echo "Running build automation"
script{
//sh "./mvnw package"
//sh "java -jar target/*.jar"
sh "/usr/local/bin/mvn clean install -DskipTests"
}
}
}
stage("Build docker image and Push to repo"){
environment {
DOCKER_IMAGE_NAME = "waseemahammed/codepairing"
registryCredential = 'docker-hub-waseem'
}
steps{
script{
app = docker.build DOCKER_IMAGE_NAME + ":" + "$BUILD_NUMBER"
docker.withRegistry('',registryCredential){
app.push()
}
}
}
}
stage("Deploy to K8s"){
environment{
DOCKER_IMAGE_NAME = "waseemahammed/codepairing"
IMAGE_TAG = "${env.BUILD_NUMBER}"
}
steps{
script{
kubernetesDeploy(kubeconfigId: 'kubeconfig',
configs: 'kube.yaml')
}
}
}
}
}