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(codebuild): setting Cache.none() renders nothing in the template #18194

Merged
merged 8 commits into from
Jan 4, 2022

Conversation

skinny85
Copy link
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

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