gbncvb
This commit is contained in:
@@ -26,22 +26,20 @@ pipeline {
|
||||
script {
|
||||
def version = "0.0.${env.BUILD_NUMBER}"
|
||||
def imageName = "clean-architecture-backend:${version}"
|
||||
|
||||
// Usando withCredentials para manejar el REGISTRY_URL
|
||||
withCredentials([string(credentialsId: 'docker-registry-url', variable: 'REGISTRY_URL')]) {
|
||||
// Aqu<71> usamos env.REGISTRY_URL para asegurarnos de que estamos usando la variable de entorno correcta
|
||||
def fullImageName = "${env.REGISTRY_URL}/${imageName}"
|
||||
|
||||
|
||||
withCredentials([
|
||||
string(credentialsId: 'docker-registry-url', variable: 'REGISTRY_URL'),
|
||||
usernamePassword(credentialsId: 'dockerregistryalexdev', usernameVariable: 'REGISTRY_USER', passwordVariable: 'REGISTRY_PASSWORD')
|
||||
]) {
|
||||
def fullImageName = "${REGISTRY_URL}/${imageName}"
|
||||
|
||||
// Construir la imagen
|
||||
sh "docker build --build-arg ENVIRONMENT=${env.ASP_ENVIRONMENT} -t ${imageName} ./CleanArchitecture/"
|
||||
|
||||
|
||||
// Iniciar sesi<73>n y subir la imagen
|
||||
docker.withRegistry(env.REGISTRY_URL, 'dockerregistryalexdev') {
|
||||
echo "Vamos a ejecutar el docker tag"
|
||||
sh "docker tag ${imageName} ${fullImageName}"
|
||||
echo "Vamos a ejecutar el docker push"
|
||||
sh "docker push ${fullImageName}"
|
||||
}
|
||||
sh "echo ${REGISTRY_PASSWORD} | docker login ${REGISTRY_URL} -u ${REGISTRY_USER} --password-stdin"
|
||||
sh "docker tag ${imageName} ${fullImageName}"
|
||||
sh "docker push ${fullImageName}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user