-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Codebuild: Removing Cache property does not revert cache to NO_CACHE #18165
Comments
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
Thanks for opening the issue @NeilBostrom. The problem you're running into, I'm pretty sure, is that the CodeBuild API treats not provided fields as unchanged, and that's why removing the The correct way to unblock yourself would be to use Apologies for the bad experience. Thanks, |
In the meantime, you can try using escape hatches to set the cache type to |
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
Thanks @skinny85. I thought that might be the case, it was just a little unexpected. Feel free to close this and hopefully it will help someone along their similar journey of Googling. |
…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 #18165 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…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*
What is the problem?
First setting
Cache = Cache.Local(LocalCacheMode.DOCKER_LAYER),
on a CodeBuild Project and deploying will correctly set the Cache setting on the project.If you remove the
Cache
set from your source code, the CodeBuild project is not reverted back toNO_CACHE
. It leaves the previousDOCKER_LAYER
in place.This is unexpected as most properties revert to their default option when removed.
Reproduction Steps
What did you expect to happen?
Removing the
Cache =
should revert the CodeBuild project toNO_CACHE
What actually happened?
Nothing, removing the property leaves the previous caching property in place.
CDK CLI Version
2.3.0 (build beaa5b2)
Framework Version
No response
Node.js Version
v14.16.1
OS
Windows 11
Language
.NET
Language Version
.NET Core 6
Other information
The reason I spotted this was that I'm in the process of moving to arm64 in our CodeBuild projects. Applying the following change to our CDK stack fails:
The text was updated successfully, but these errors were encountered: