leaked username

This commit is contained in:
Milan Petrovic 2025-06-11 14:31:00 +02:00
parent da1ed63bde
commit 7b3b3b8485

32
Jenkinsfile vendored
View file

@ -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') { stage('Build') {
steps { steps {
script { script {
@ -45,14 +31,18 @@ pipeline {
def imageTag = "${DOCKER_HUB_USER}/${dockerRepo}:${GIT_COMMIT_SHORT}" def imageTag = "${DOCKER_HUB_USER}/${dockerRepo}:${GIT_COMMIT_SHORT}"
withCredentials([usernamePassword( withCredentials([usernamePassword(
credentialsId: DOCKERHUB_CREDS, credentialsId: DOCKERHUB_CREDS,
usernameVariable: 'DOCKER_USER', usernameVariable: 'DOCKER_USER',
passwordVariable: 'DOCKER_PASS' passwordVariable: 'DOCKER_PASS'
)]) { )]) {
echo "Logging in to Docker Hub..." echo "Logging in to Docker Hub..."
sh "echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin" sh 'echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin'
echo "Pushing Docker image to ${imageTag}"
sh "docker push ${imageTag}" echo "Building Docker image ${imageTag}..."
sh "docker build -t ${imageTag} ."
echo "Pushing Docker image ${imageTag}..."
sh "docker push ${imageTag}"
} }
} }
} }