Expected Behavior
When changing the buildpack environment variables, the buildpack layer cache should not be used so that a "fresh" build can take place.
Current Behavior
Changing environment variable (eg BP_WEB_SERVER from "nginx" to "" to disable auto-generation of nginx.conf) continues to re-use existing cached layer instead of building a fresh layer with auto-generation disabled.
Possible Solution
Include BP_WEB_SERVER (or maybe a hash of all env vars) in the layer metadata to act as a cache-buster.
Steps to Reproduce
- Build a sample app setting
-e BP_WEB_SERVER=nginx, ensuring that cache is enabled
- Remove this environment variable and build again
- Notice that in the build log, layer is still reused
- Notice in
/layers/paketo-buildpacks_nginx/nginx/env.launch/, env vars for APP_ROOT and PORT are still set when this should only happen when BP_WEB_SERVER=nginx
Motivations
This bug may catch out users who aren't aware that despite changing configuration, that config has not been used in their newly built image.
For us, we discovered it when switching to a hardcoded nginx.conf and were using {{env APP_ROOT}} until the layer cache got cleared causing builds to start failing.
Expected Behavior
When changing the buildpack environment variables, the buildpack layer cache should not be used so that a "fresh" build can take place.
Current Behavior
Changing environment variable (eg
BP_WEB_SERVERfrom"nginx"to""to disable auto-generation of nginx.conf) continues to re-use existing cached layer instead of building a fresh layer with auto-generation disabled.Possible Solution
Include
BP_WEB_SERVER(or maybe a hash of all env vars) in the layer metadata to act as a cache-buster.Steps to Reproduce
-e BP_WEB_SERVER=nginx, ensuring that cache is enabled/layers/paketo-buildpacks_nginx/nginx/env.launch/, env vars forAPP_ROOTandPORTare still set when this should only happen whenBP_WEB_SERVER=nginxMotivations
This bug may catch out users who aren't aware that despite changing configuration, that config has not been used in their newly built image.
For us, we discovered it when switching to a hardcoded
nginx.confand were using{{env APP_ROOT}}until the layer cache got cleared causing builds to start failing.