forked from LoksaiETA/devops-java-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile1
57 lines (48 loc) · 1.48 KB
/
Jenkinsfile1
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
pipeline {
agent any
environment {
DOCKERHUB_CREDENTIALS=credentials('dockerloginid')
}
tools {
// Install the Maven version configured as "M3" and add it to the path.
maven "MAVEN"
}
stages {
stage('Build') {
steps {
// Get some code from a GitHub repository
//git branch: 'master', credentialsId: 'GIT_HUB_CREDENTIALS', url: //'https://github.com/LoksaiETA/Java-mvn-app2.git'
git 'https://github.com/LoksaiETA/Java-mvn-app2.git'
// Run Maven on a Unix agent.
//sh './gradle wrapper'
//sh './gradlew build'
sh "mvn -Dmaven.test.failure.ignore=true clean package"
// To run Maven on a Windows agent, use
// bat "mvn -Dmaven.test.failure.ignore=true clean package"
}
}
stage("Docker build"){
steps {
sh 'docker version'
sh 'docker build -t loksai-docker-demo .'
sh 'docker image list'
sh 'docker tag loksai-docker-demo loksaieta/loksai-docker-demo:loksai-docker-demo'
}
}
stage('Login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Push') {
steps {
sh 'docker push loksaieta/loksai-docker-demo:loksai-docker-demo'
}
}
stage("Deploy to K8s") {
steps {
sh "kubectl apply -f k8s-spring-boot-deployment.yml --kubeconfig="
}
}
}
}