Skip to content

fix(codebuild): setting Cache.none() renders nothing in the template#18194

Merged
mergify[bot] merged 8 commits intoaws:masterfrom
skinny85:fix/codebuild-cache-none
Jan 4, 2022
Merged

fix(codebuild): setting Cache.none() renders nothing in the template#18194
mergify[bot] merged 8 commits intoaws:masterfrom
skinny85:fix/codebuild-cache-none

Conversation

@skinny85
Copy link
Copy Markdown
Contributor

When implementing caching in CodeBuild,
we made the default cache Cache.none(),
and, for that reason, do not render anything in the template for that type of cache.
However, that does not work well with the CodeBuild API,
which interprets the lack of a property as the signal to leave it unchanged.
Which means it's not possible currently to disable caching on a Project once it has been enabled once.

Fix this by differentiating between the case of "no Cache has been provided",
and "the none() Cache has been provided".

Closes #18165


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

@skinny85 skinny85 requested a review from rix0rrr December 27, 2021 19:38
@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Dec 27, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Dec 27, 2021
@github-actions github-actions bot added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label Dec 27, 2021
When implementing caching in CodeBuild,
we made the default cache `Cache.none()`,
and, for that reason, do not render anything in the template for that type of cache.
However, that does not work well with the CodeBuild API,
which interprets the lack of a property as the signal to leave it unchanged.
Which means it's not possible currently to disable caching on a Project once it has been enabled once.

Fix this by differentiating between the case of "no Cache has been provided",
and "the none() Cache has been provided".

Closes aws#18165
@skinny85 skinny85 force-pushed the fix/codebuild-cache-none branch from 3d91dd1 to a1c0115 Compare December 31, 2021 00:56
@skinny85 skinny85 requested a review from rix0rrr December 31, 2021 00:57
@skinny85
Copy link
Copy Markdown
Contributor Author

@rix0rrr I've changed the default like you asked. As you can see, this resulted in a lot of changes. Let me know if you still want to proceed with this direction - if so, I'll update the PR title and description. Thanks!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 4, 2022

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).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: a37958e
  • 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 cd51a5d into aws:master Jan 4, 2022
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 4, 2022

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).

@skinny85 skinny85 deleted the fix/codebuild-cache-none branch January 4, 2022 21:18
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…ws#18194)

When implementing caching in CodeBuild,
we made the default cache `Cache.none()`,
and, for that reason, do not render anything in the template for that type of cache.
However, that does not work well with the CodeBuild API,
which interprets the lack of a property as the signal to leave it unchanged.
Which means it's not possible currently to disable caching on a Project once it has been enabled once.

Fix this by differentiating between the case of "no Cache has been provided",
and "the none() Cache has been provided".

Closes aws#18165

----

*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-codebuild Related to AWS CodeBuild contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codebuild: Removing Cache property does not revert cache to NO_CACHE

3 participants