Skip to content

feat(ecr-assets): control docker image asset hash#16070

Merged
mergify[bot] merged 8 commits intoaws:masterfrom
amirfireeye:control-dockerimageasset-hash
Oct 7, 2021
Merged

feat(ecr-assets): control docker image asset hash#16070
mergify[bot] merged 8 commits intoaws:masterfrom
amirfireeye:control-dockerimageasset-hash

Conversation

@amirfireeye
Copy link
Copy Markdown
Contributor

@amirfireeye amirfireeye commented Aug 16, 2021

Docker build args are meant for build system specific configuration like http proxy or CodeArtifact tokens. Give the user an option to not hash build args so the DockerImageAsset hash can remain consistent even when using build args. An inconsistent hash means the asset is built every synth and that wastes time and space.

This change is backwards compatible as the default hashing behavior remains the same.

closes #15936


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Docker build args are meant for build system specific configuration like http proxy or CodeArtifact tokens. Give the user an option to not hash build args so the DockerImageAsset hash can remain consistent. An inconsistent hash means the asset is built every synth and that wastes time and space.

closes aws#15936
@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Aug 16, 2021

@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort @aws-cdk/aws-ecr-assets Related to AWS CDK Docker Image Assets p1 labels Aug 19, 2021
eladb
eladb previously requested changes Aug 22, 2021
Copy link
Copy Markdown
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call this option invalidation and have a boolean flag for each hash component.

Something like this:

{
  invalidation: {
    buildArgs: false,
    target: false,
    // etc
  }
}

So users will be able to opt out from using any component when a hash is calculated.

@mergify mergify bot dismissed eladb’s stale review August 22, 2021 10:43

Pull request has been modified.

@amirfireeye
Copy link
Copy Markdown
Contributor Author

@eladb done. I was initially thinking of doing the same, but then couldn't think of a use case where those would be useful. But I guess it can't hurt to have them around. Though skipping extraHash seems extra questionable 😄

@amirfireeye
Copy link
Copy Markdown
Contributor Author

@eladb anything else I need to do to make this mergeable? This issue is a huge resource waste for us with the number of pipelines we have.

eladb
eladb previously approved these changes Sep 9, 2021
Copy link
Copy Markdown
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 9, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed eladb’s stale review September 14, 2021 16:15

Pull request has been modified.

@amirfireeye
Copy link
Copy Markdown
Contributor Author

@eladb it seems like mergify skipped this PR for the latest release. Any idea how I can fix it?

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: ebdc485
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 13f67e7 into aws:master Oct 7, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Oct 7, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

njlynch pushed a commit that referenced this pull request Oct 11, 2021
Docker build args are meant for build system specific configuration like http proxy or CodeArtifact tokens. Give the user an option to not hash build args so the DockerImageAsset hash can remain consistent even when using build args. An inconsistent hash means the asset is built every synth and that wastes time and space.

This change is backwards compatible as the default hashing behavior remains the same.

closes #15936


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
Docker build args are meant for build system specific configuration like http proxy or CodeArtifact tokens. Give the user an option to not hash build args so the DockerImageAsset hash can remain consistent even when using build args. An inconsistent hash means the asset is built every synth and that wastes time and space.

This change is backwards compatible as the default hashing behavior remains the same.

closes aws#15936


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@aws-cdk/aws-ecr-assets Related to AWS CDK Docker Image Assets effort/small Small work item – less than a day of effort p1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(ecr-assets): image with variable buildArgs being rebuilt every time

4 participants