Failed to fetch private ECR image for pipeline build
Asked by Brian Sedgwick:

I'm trying to export a pipeline from one of my repos to use in setting up a pipeline in a second repo. The bitbucket-pipelines.yml I'm exporting from has the following contents. Note that there is a a pipeline build setup for the first repo in addition to the pipelines that are being exported.  

```
export: true

image: &ap-build-image
  name: $DOMAIN_OWNER.dkr.ecr.us-east-1.amazonaws.com/internal/build-piplines-image:FP-842
  aws:
    access-key: $AWS_ACCESS_KEY_ID
    secret-key: $AWS_SECRET_ACCESS_KEY

definitions:
  steps:
    # several steps are defined here with references '&'
  pipelines:
    code-artifact-package:
      # steps that have 'image: *ap-build-image' properties.

pipelines:
  branches:
    master:
      # steps
  custom:
    build:
      # steps

```

Don't get hung up on the pipelines here. They have run just fine.

The issue I'm having is in the repo that I'm importing the 'code-artifact-package' pipeline. That bitbucket-pipelines.yml file has the following contents

```
pipelines:
  branches:
    master:
      import: build-pipelines:master:code-artifact-package
  custom:
    build:
      import: build-pipelines:FP-842:code-artifact-package

```

When I try running the pipeline manually (from the FP-842 branch on my code) the first step (which uses the '\*ap-build-image' referenced image) fails to pull the image. I've verified that the image name is correct and that the tag name is correct, both by visually checking in aws console as well as pulling the image onto my local machine. I've verified the credentials I'm using multiple times and changed to use credentials that have unrestricted access in AWS. Still no joy. No matter what the same error shows up:

![Screenshot 2024-08-22 at 5.43.52?PM.png](/t5/image/serverpage/image-id/343361iDCF27D5933715B36/image-size/large?v=v2&px=999 "Screenshot 2024-08-22 at 5.43.52?PM.png")

I've have tried many variations of the pipeline script to rule out issues with the variables and with the importing and with the '\&' references to the image. None of those things appear to be the problem. I've tried endless variations of everything I can think of and I've spent hours combing through documentation and other questions posted here. The closest I've come is this question and answer, which did not help me resolve the issue:

<https://community.atlassian.com/t5/Bitbucket-questions/ECR-support-broken/qaq-p/1199512>

Please help!


Answers:
author: Brian Sedgwick
body: The complete solution was two-fold.

1. The use of $DOMAIN_OWNER in the image name is not supported according to a support response directly from the Atlassian team.

2. There was a typo in my naming of the image.


author: Brian Sedgwick
body: My problem is not solved, but for those who find this question you should know that one problem with the image specified in my YML file is the $DOMAIN_OWNER variable. I found out from support that variables in the image name are not supported.

My testing with a hard-coded image name resulted in the same error. So, while it may have been an issue in my setup, it was not the key issue. I still have no final resolution.

comments: author: Patrik S
body: Hello [@Brian Sedgwick](/t5/user/viewprofilepage/user-id/5574638) and welcome to the Community!

I see one of your colleagues has opened a support ticket to report this issue and one of our engineers is already assisting you on that case. Once that support ticket is resolved, if you feel comfortable, feel free to share the solution here on the community as it may help other users who may come across the same issue in the future.

Thank you, [@Brian Sedgwick](/t5/user/viewprofilepage/user-id/5574638) !

Patrik S


Tags: bitbucket-cloud

cloud