Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to skip a push if image already exists in ECR?

Tom Müller
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 31, 2022

I have a pipe which pushes to Amazon ECR. The repository is immutable. Can I configure the plugin, so that the pipeline skips pushing the image, if it already exists in ECR?

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2022

Hi @Tom Müller

Welcome to the community.

Unfortunately, it's not possible to skip the entire build for validating if an ECR image exists.
However, I do believe it would be possible if you could validate if an ECR image exists first then do a signal through an environment variable and lastly, do an if/else against the result.

Here's an example YAML configuration:

pipelines:
  default:
    - step:
        name: Test
        script:
          - export ECR_PUSH=0
          - echo "Validation here" # Validate if an ECR exists here then change the ECR_PUSH to 1 if it exists
          - if [ $ECR_PUSH = 1 ]; then echo "Proceed"; else exit 0; fi
          - pipe: some/pipes_here:1.0.1
            variables:
              VAR_TEST: "TEST"

Hope it helps and let me know if you have further questions that I can help with.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events