I have this jenkins job which is used to delete all items into AWS ECR repository:
pipeline {
agent any
environment {
AWS_ACCOUNT_ID="0000000021764"
AWS_DEFAULT_REGION="us-east-1"
IMAGE_REPO_NAME="testio"
IMAGE_TAG="latest"
REPOSITORY_URI = "0000000021764.dkr.ecr.us-east-1.amazonaws.com/testio:latest"
REPOSITORY_NAME = "testio"
}
stages{
stage('Delete all image in repository') {
steps {
script{
docker.withRegistry('https://0000000021764.dkr.ecr.us-east-1.amazonaws.com') {
sh '''
aws ecr batch-delete-image --repository-name $REPOSITORY_NAME --image-ids "$(aws ecr list-images --repository-name $REPOSITORY_NAME --query 'imageIds[*]' --output json
)" || true
'''
}
}
}
}
}
}
Is it possible to have dropdown list from which I can select which item to be deleted?