From 47390ad05fe9ddca8abb6a83471f85133807a9a2 Mon Sep 17 00:00:00 2001 From: Tal Yitzhak Date: Sun, 29 Mar 2020 11:40:19 +0300 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3c9d5b1..be98dff 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,26 +30,33 @@ pipeline { //if the code is compiled, we test and package it in its distributable format; run IT and store in local repository } } - stage('Building Image') { - steps{ - script { - dockerImage = docker.build registry + ":latest" + + stage ('Build docker image') { + steps { + script { + docker.build('http://localhost:8082/artifactory/docker/spring-petclinic-hub:latest', 'docker') + } } - } } - stage('Deploy Image') { - steps{ - script { - docker.withRegistry( '', registryCredential ) { - dockerImage.push() - } + + stage ('Push image to Artifactory') { + steps { + rtDockerPush( + serverId: "tal-local-arti", + image: 'http://localhost:8082/artifactory/docker' + '/spring-petclinic-hub:latest', + host: "http://172.17.0.3:8080", + targetRepo: 'docker', + properties: 'project-name=docker1;status=stable' + ) } - } } - stage('Remove Unused docker image') { - steps{ - sh "docker rmi $registry:latest" - } + + stage ('Publish build info') { + steps { + rtPublishBuildInfo ( + serverId: "tal-local-arti" + ) + } } } -} \ No newline at end of file +}