So, I was new to ECR/ECR I already pushed an image to my repo with latest tag. But what happens when I push another image with latest tag to the same repo? Will the old one tag changes because I want them to be there. Also, I can't change the tag every time as I wrote a pipeline as below. Do we have to redeploy the image to ECS? Or is it done automatically when we push new image to ECR ?
stage('docker image') {
steps {
sh ''' #!/bin/bash
set -x
cd $WORKDIR/search-adapter-service
if [[ -f "/home/jenkins/.m2/settings.xml" ]]
then
mv /home/jenkins/.m2/settings.xml /home/jenkins/.m2/settings.xml_back
fi
$WORKDIR/apache-maven-3.6.3/bin/mvn clean install
'''
dir("$WORKDIR/search-adapter-service"){
script{
sh(script: "sudo docker build -t ${DOCKER_REGISTRY_REPO}:latest .")
sh(script: "sudo docker push ${DOCKER_REGISTRY_REPO}:latest")
1.I am expecting to it change the tag automatically for the old image. 2. Will it automatically also deploy to ECS? once we push? Or do we need to do it manually? If it can be automated. How do we achieve that?