fix(ecr-assets): unable to use one Dockerfile to build multiple images#5705
fix(ecr-assets): unable to use one Dockerfile to build multiple images#5705mergify[bot] merged 8 commits intomasterfrom
Conversation
Since we use the source hash as the image ID, if we use different docker build options such as specifying a different `target`, `buildArgs` or a custom docker file name, we still get the same image ID. This means that if this image ID already exists, we skip the build. This makes it impossible to use the same docker build context to build multiple images. This fix exposes the ability to include extra information to the source hash fingerprint algorithm (in `assets.Staging`), and utilizes this capability to "salt" the hash with build arguments if they are provided. Fixes #5683
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
RomainMuller
left a comment
There was a problem hiding this comment.
That's a nice feature! I have some minor comments, but mostly stylistic (and quite frankly, besides the name being awkward, it's not that important).
- rename `extra` to `extraHash` so it makes more sense when extending `FingerprintOptions`. - build `extraHash` as an object instead of an array. - include `repositoryName` in fingerprint
…-source-hash-salt
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request is now being automatically merged. |
|
Can this behavior be disabled or tuned with some flag? We have the opposite problem where we pass CodeArtifact token as a build arg so every single synth generates a new Docker image. |
Since we use the source hash as the image ID, if we use different docker build options such as specifying a different
target,buildArgsor a custom docker file name, we still get the same image ID. This means that if this image ID already exists, we skip the build. This makes it impossible to use the same docker build context to build multiple images.This fix exposes the ability to include extra information to the source hash fingerprint algorithm (in
assets.Staging), and utilizes this capability to "salt" the hash with build arguments if they are provided.Fixes #5683
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license