|
|
@@ -100,21 +100,21 @@ pipeline {
|
|
|
|
|
|
docker.withRegistry("https://${registryUrl}", 'nexus') {
|
|
|
try {
|
|
|
- Try pulling the image from the registry
|
|
|
+ //Try pulling the image from the registry
|
|
|
echo "Trying to pull image: ${registryUrl}/${imageName}:${imageVersion}"
|
|
|
docker.image("${registryUrl}/${imageName}:${imageVersion}").pull()
|
|
|
} catch (Exception e) {
|
|
|
echo "Image pull failed. Attempting to build and push."
|
|
|
|
|
|
- Pull base image from Docker Hub
|
|
|
+ //Pull base image from Docker Hub
|
|
|
echo "Pulling base image: ${imageName}:${imageVersion}"
|
|
|
sh "docker pull ${imageName}:${imageVersion}"
|
|
|
|
|
|
- Tag the image for the private registry
|
|
|
+ //Tag the image for the private registry
|
|
|
echo "Tagging image for private registry"
|
|
|
sh "docker tag ${imageName}:${imageVersion} ${registryUrl}/${imageName}:${imageVersion}"
|
|
|
|
|
|
- Push the tagged image to the private registry
|
|
|
+ //Push the tagged image to the private registry
|
|
|
echo "Pushing image to private registry"
|
|
|
sh "docker push ${registryUrl}/${imageName}:${imageVersion}"
|
|
|
}
|