Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: repository_name in image property of the codebuild provider #785

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danxie1999
Copy link

Why?

The repository_name in image property of the codebuild provider does not work as expected. By design, we can set the repository_name if the ECR is hosted in the deployment account in the main deployment region. However, when set image property to repository name, it does not work.

When set repository_name in image property of the codebuild provider in the deployment_map, I am getting following error:

jsii.errors.JavaScriptError:
    @jsii/kernel.RuntimeError: Error: Repository arn should be in format 'arn:<PARTITION>:ecr:<REGION>:<ACCOUNT>:repository/<NAME>', got arn:aes:ecr:eu-central-1:123456789012/platform-test.

My deployment map file looks like below:

pipelines:
  - name: platform-test
    description: platform-test
    default_providers:
      source:
        provider: codecommit
      build:
        provider: codebuild
        properties:
          image:
            repository_name: platform-test
            tag: latest
          privileged: True
          environment_variables:
            CONTAINS_TRANSFORM: True

What?

in src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codebuild.py, the method determine_build_image should change from

            if repository_name:
                repository_arn = (
                    f"arn:aws:ecr:{ADF_DEPLOYMENT_REGION}:"
                    f"{ADF_DEPLOYMENT_ACCOUNT_ID}:{repository_name}"
                )

to

            if repository_name:
                repository_arn = (
                    f"arn:aws:ecr:{ADF_DEPLOYMENT_REGION}:"
                    f"{ADF_DEPLOYMENT_ACCOUNT_ID}:repository/{repository_name}"
                )

@danxie1999 danxie1999 force-pushed the fix/repository_name_codebuild_provider branch from 6c58ba1 to 208b26c Compare February 24, 2025 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant