In the below code snippet:
IMAGES_TO_DELETE := $(aws ecr list-images --region $(ECR_REGION) --repository-name $(ECR_REPO) --filter "tagStatus=UNTAGGED" --query 'imageIds[*]' --output json)
.PHONY: target1 target2 cleanimage
cleanimage:
${DISPLAYINFO} "Clean untagged image from AWS ECR "
aws ecr batch-delete-image --region $(ECR_REGION) --repository-name $(ECR_REPO) --image-ids "$(IMAGES_TO_DELETE)" || true
${DISPLAYINFO} "Done"
target1:
# do something
target2:
# do something
IMAGES_TO_DELETE
gives imagelist, in JSON format.
IMAGES_TO_DELETE
supposed to be assigned when make cleanimage
executes
How to assign values to a variable under cleanimage
target?