From 7b3b3b8485593c1d40abce1230c3449487a5d82e Mon Sep 17 00:00:00 2001 From: Milan Petrovic <5rovicmilan8@gmail.com> Date: Wed, 11 Jun 2025 14:31:00 +0200 Subject: [PATCH] leaked username --- Jenkinsfile | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 827fa5819..7fe919bb9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,20 +23,6 @@ pipeline { } } - stage('Cred'){ - steps { - withCredentials([usernamePassword( - credentialsId: "580b959d-d40a-422f-a3d7-cf11b2ec7a4c", - usernameVariable: 'DOCKER_USER', - passwordVariable: 'DOCKER_PASS', - )]) { - echo "Logging in to Docker Hub..." - sh "echo ${env.DOCKER_USER}" - } - - } - } - stage('Build') { steps { script { @@ -45,14 +31,18 @@ pipeline { def imageTag = "${DOCKER_HUB_USER}/${dockerRepo}:${GIT_COMMIT_SHORT}" withCredentials([usernamePassword( - credentialsId: DOCKERHUB_CREDS, - usernameVariable: 'DOCKER_USER', - passwordVariable: 'DOCKER_PASS' + credentialsId: DOCKERHUB_CREDS, + usernameVariable: 'DOCKER_USER', + passwordVariable: 'DOCKER_PASS' )]) { - echo "Logging in to Docker Hub..." - sh "echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin" - echo "Pushing Docker image to ${imageTag}" - sh "docker push ${imageTag}" + echo "Logging in to Docker Hub..." + sh 'echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin' + + echo "Building Docker image ${imageTag}..." + sh "docker build -t ${imageTag} ." + + echo "Pushing Docker image ${imageTag}..." + sh "docker push ${imageTag}" } } }