Is this a bug in CDK v2 codebuild.Project() construct? The Docker image parameter gets corrupted.

0

I have this CDKv2 code (fragment shown below):

        const dockerImageUriParameter = ssm.StringParameter
            .fromStringParameterName(
                this, 'DockerImageUriParam', '/codebuild-image-uri');

        const ecrRepo = ecr.Repository.fromRepositoryName(
            this, 'EcrRepo', dockerImageUriParameter.stringValue);

        const dockerImage = codebuild.LinuxBuildImage.fromEcrRepository(ecrRepo);

        const project = new codebuild.Project(this, 'AppCodeBuildProject', {
            projectName: cdk.Stack.of(this).stackName,
            description: 'my Application CodeBuild Project',
            environment: {
                privileged: true,
                computeType: codebuild.ComputeType.MEDIUM,
                buildImage: dockerImage
            },
            ... rest of code omitted for clarity ...

Upon inspection in the AWS Console, I see that the SSM parameter has the correct value, something like:

123456789012.dkr.ecr.us-west-2.amazonaws.com/cdk-xxxxxxxxx-container-assets-123456789012-us-west-2:888888e16a7935f3e9488835692573393ae1372efa06fd469999999999999999

However, the codebuild project gets configured with an incorrect-looking (based on Console inspection) image uri:

123456789012.dkr.ecr.us-west-2.amazonaws.com/123456789012.dkr.ecr.us-west-2.amazonaws.com/cdk-xxxxxxxxx-container-assets-123456789012-us-west-2:888b01e16a7935f3e9488835692573393ae1372efa06fd469999999999999999

Note how part of the URI is repeated.

What is going on here?

AlexR
gefragt vor einem Monat132 Aufrufe
1 Antwort
1
Akzeptierte Antwort

Still unclear whether that was a bug, but this works instead:

        const dockerImageUri = cdk.Fn.importValue('BuilderImageUriExport');
        const dockerImage = codebuild.LinuxBuildImage.fromDockerRegistry(dockerImageUri);
AlexR
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen