funcionara???
This commit is contained in:
@@ -26,23 +26,26 @@ pipeline {
|
||||
stage ('Push to Docker Registry') {
|
||||
steps {
|
||||
script {
|
||||
withCredentials()
|
||||
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 = "https://dockerregistry.alexdev.es/${imageName}"
|
||||
// Aqu<71> usamos env.REGISTRY_URL para asegurarnos de que estamos usando la variable de entorno correcta
|
||||
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('https://dockerregistry.alexdev.es', 'dockerregistryalexdev') {
|
||||
echo "Vamos a ejecutar el docker tag"
|
||||
sh "docker tag clean-architecture-backend:${version} dockerregistry.alexdev.es/clean-architecture-backend:${version}"
|
||||
echo "Vamos a ejecutar el docker push"
|
||||
sh "docker push dockerregistry.alexdev.es/clean-architecture-backend:${version}"
|
||||
// Iniciar sesi<73>n y subir la imagen
|
||||
docker.withRegistry(${REGISTRY_URL}, 'dockerregistryalexdev') {
|
||||
withCredentials([string(credentialsId: 'docker-registry-url-to-push', variable: 'REGISTRY_URL_PUSH')]) {
|
||||
echo "Vamos a ejecutar el docker tag"
|
||||
sh "docker tag clean-architecture-backend:${version} ${REGISTRY_URL_PUSH}/clean-architecture-backend:${version}"
|
||||
echo "Vamos a ejecutar el docker push"
|
||||
sh "docker push ${REGISTRY_URL_PUSH}/clean-architecture-backend:${version}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user