Cannot list image tags into Jenkins active choices dropdown

20 views
Skip to first unread message

P Terziev

unread,
Sep 10, 2023, 5:56:58 AM9/10/23
to Jenkins Users
I use this script to display dropdown values from AWS Ecr:

    def profile = "ecr"
    def region = "us-east-1"
    def cmd_output = "aws ecr describe-repositories --profile $profile --region $region --output yaml".execute()
    def awk_cmd_output = cmd_output | ['awk', '/repositoryName:/ {print $2}'].execute()
    def repo_names = awk_cmd_output.text.tokenize().reverse()
    return repo_names

When I run the command into linux shell I get:

    root test:~# aws ecr describe-repositories --profile ecr  --region us-east-1
    {
        "repositories": [
            {
                "repositoryArn": "arn23522033165aws:ecr:us-east-1:73522033165:repository/test",
                "registryId": "23522033165",
                "repositoryName": "test",
                "repositoryUri": "23522033165.dkr.ecr.us-east-1.amazonaws.com/test",
                "createdAt": "2023-09-07T22:30:50+00:00",
                "imageTagMutability": "MUTABLE",
                "imageScanningConfiguration": {
                    "scanOnPush": false
                },
                "encryptionConfiguration": {
                    "encryptionType": "AES256"
                }
            },
            {
                "repositoryArn": "arn:aws:ecr:us-east-1:23522033165:repository/test",
                "registryId": "23522033165",
                "repositoryName": "atlas-psp-mer-gateway",
                "repositoryUri": "23522033165.dkr.ecr.us-east-1.amazonaws.com/test",
                "createdAt": "2023-09-09T19:54:04+00:00",
                "imageTagMutability": "MUTABLE",
                "imageScanningConfiguration": {
                    "scanOnPush": false
                },
                "encryptionConfiguration": {
                    "encryptionType": "AES256"
                }
            },
    .....
    }

Above configuration was working file. But after changing aws credentials using `aws configure` the listing is not working. I added api user as IAM user with a group into security settings.
But still I can't list images versions from a registry.
Do you know how I can fix this issue?


Ref https://stackoverflow.com/questions/77074046/cannot-list-image-tags-into-jenkins-active-choices-dropdown
Reply all
Reply to author
Forward
0 new messages