From 80291dcda0bad77c86fdf91b57dc6270b212e723 Mon Sep 17 00:00:00 2001 From: Jan Rabcan Date: Wed, 20 Oct 2021 03:18:53 +0200 Subject: [PATCH] a. --- Jenkinsfile | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 542fe12..eba2505 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,34 +3,35 @@ pipeline { agent { dockerfile true } stages { + environment { + REGISTRY_CREDENTIALS = credentials('registry-credentials-id') + } stage('Installation') { - steps { + steps { echo "start Installation" echo "finish Installation" - } + } } stage('Build') { - steps { + steps { echo "Running ${env.BUILD_ID} on ${env.JENKINS_URL}" echo 'Building..' - sh 'docker build -t registry.proxyq.co/cd/website .' - } + sh 'docker build -t registry.proxyq.co/jenkins/website:${env.BUILD_ID} .' + } } stage('Test') { - steps { + steps { echo "start Testing" sh 'sleep 5' echo "finish Testing" - } + } } stage('Deploy') { - steps { - echo "${env.ENV_REGISTRY_URL}" -// docker.withRegistry("https://registry.proxyq.co", 'registry-credentials-id') { -// def customImage = docker.build("registry.proxyq.co/jenkins/website:${env.BUILD_ID}", '.') -// customImage.push() -// } -} + steps { + echo "${env.ENV_REGISTRY_URL}" + sh 'docker login https://registry.proxyq.co -u ${REGISTRY_CREDENTIALS_USR} -p ${REGISTRY_CREDENTIALS_PSW}' + sh 'docker push registry.proxyq.co/jenkins/website:${env.BUILD_ID}' + } } } }