File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- pipeline
2- {
3- agent any
4- environment
5- {
6- PATH = " /usr/bin/:$PATH "
7- }
8- stages{
9- stage(" Git" )
10- {
11- steps{
12- git credentialsId : ' 48d5f80a-5851-4f96-9aee-f909eb748870' , url : ' https://github.com/kajendran1/sample-code-java.git'
13- echo ' suceesfully checkout'
14- }
15- }
16- stage(" Build" )
17- {
18- steps{
19- sh " mvn clean install"
20- echo ' build suceesfull'
1+ pipeline{
2+ agent any
3+ stages{
4+ stage(' checkout' ){
5+ steps{
6+ url : ' https://github.com/kajendran1/sample-code-java.git'
7+ }
8+ }
9+
10+ stage(' Build' ){
11+ steps{
12+ sh ' mvn clean install'
13+ }
14+ }
15+ stage(' Docker Image' ) {
16+ steps {
17+ script {
18+ sh ' docker build -t kaj'
19+ }
2120 }
21+ }
22+ stage(' deploy docker image' ){
23+ steps {
24+ script {
25+ withCredentials([usernameColonPassword(credentialsId : ' kajendran1' , variable : ' dockerpawd' )]) {
26+ sh ' docker login -u kajendran1 -p ${dockerpawd}'
27+ }
28+ sh ' docker push kajendran1/my-app-1.0 .'
2229 }
30+ }
2331 }
2432}
33+ }
You can’t perform that action at this time.
0 commit comments