* Restore cached launch layers not found in appLayers
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* add platform api guard
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
---------
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
* Provide context folder for extensions
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* Address PR feedback
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* Split tests by platform API
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
* Add unit test for FindContexts
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* acceptnance tests
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* Address PR feedback
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
---------
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Philipp Stehle <philipp.stehle@sap.com>
* Remove buildpack APIs 0.2-0.6 according to https://github.com/buildpacks/rfcs/blob/main/text/0110-deprecate-apis.md
- Fix acceptance by updating fixtures to use newer Buildpack API version
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove backwards compatible glue for buildpacks missing API version
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Make a single constructor for lifecycle inputs
- The logic to update the default path for TOML files was repeated across phases
- In general it is safe to provide default values for inputs that might not be relevant to the current phase,
as these will be ignored when constructing a new service for the phase;
e.g., platform.LifecycleInputs.OrderPath will be ignored when constructing a lifecycle.Exporter
- As more inputs are shared across phases (e.g., analyzed.toml is now an input to the detect phase),
duplicating the logic for providing default values is becoming more cumbersome
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Read values from environment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Buildpack API: run.Dockerfiles are allowed instructions on versions >= 0.10
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Platform API: the detector accepts a new -run flag
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move responsibility for validating Dockerfiles into the buildpack package
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When verifying Dockerfiles, return the new base image name if necessary
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When determining the new runtime base image, use criteria outlined in the platform spec
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Platform API: the schema of analyzed.toml is updated to include run-image.extend = <true or false, default false>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* TESTME: Update analyzed.toml with new run image if needed
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* If extensions are used to switch the runtime base image, the detector should fail if the selected base image is not found in run.toml.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add fixture to test re-writing of analyzed.toml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move updating analyzed.toml into lifecycle package for easier testing
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't redefine -layers
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Revert "Replace print with logger in image_cache.go, fixes formatting (#1012)"
This reverts commit 6a10b63c67.
* Revert "Revert "Replace print with logger in image_cache.go, fixes formatting (#1012)""
This reverts commit 5780910ecf.
* Rename image -> images in run.toml
We pluralize all other list elements
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't enforce constraints for older extensions
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Rename function for clarity
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Consider platform API <= 0.6 and buildpack API <= 0.6 deprecated
according to https://github.com/buildpacks/rfcs/blob/main/text/0110-deprecate-apis.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix launcher acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix Windows
- Create usable symlink
- When process type has a '.' we need to provide .exe
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Keep default platform API as 0.3
Add warning when the env var is unset so that end users know they are defaulting to the default
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Unnest tests that pass on any platform API
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Improve output when only version is requested
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Quote platform API version
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* ci(lint): auto lint fixes
Signed-off-by: Michael de Senna <desenna@gmail.com>
* fix: replace deprecated funcs
Signed-off-by: Michael de Senna <desenna@gmail.com>
* ci(lint): fix many io/ioutil staticcheck
Signed-off-by: Michael de Senna <desenna@gmail.com>
* fix: import os
Signed-off-by: Michael de Senna <desenna@gmail.com>
Signed-off-by: Michael de Senna <desenna@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Support SOURCE_DATE_EPOCH
Platforms can set `SOURCE_DATE_EPOCH` to control the timestamp on the exported app images.
See https://github.com/buildpacks/lifecycle/issues/809 for more details.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Fixing 0.9 skip-layers test
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Added 0.9 exiter test
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Set working directory for processes running in bash shell
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Set working directory for processes running in cmd.exe
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Set working directory for direct processes
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Handle process working directory in build phase
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Simplify command to check working directory in test
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Support process working directory on different drive on Windows
Requires the `/d` flag on `cd` to change drive.
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Add tests for working directory with direct=false
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Use platform-specific path in CNB_APP_DIR
The `cd` for process-specific working directory fails on Windows
when it is given a Unix-style path.
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Add default working directory test
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Builder should warn if newer buildpacks write a bom in *.toml
Add 0.7 to buildpack APIs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* Combine validate and handle functionality
Rename concrete implementation per review feedback
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Cache sBOM
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* Copy BOMs to /layers/sbom/...
Instead of /layers/config/sbom/...
Fixes condition where unwanted sbom directories end up in final app image
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* Restore BOM layer of previous application image
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Migrate sBOM layer restore to analyze phase
It avoids requiring the daemon for the restore phase
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* Fix bugs
- Fix bug where unescaped buildpacks fail to have SBOM restored
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* SBOM media types
- Introduce support for Syft SBOM type
- Opt for application/spdx+json over text/spdx+json
in virtue of https://www.iana.org/assignments/media-types/application/spdx+json
- Validate against declared SBOM media types
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Run image should be locked to a digest in analyzed.toml (#720)
* Run image should be locked to a digest in analyzed.toml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use more flexible matcher for other test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update github actions to use cosign v1.2.0 (#708)
* Introduce new api version helpers (#705)
* Introduce new api version helpers
This makes the code a little easier to read.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update github actions to use cosign v1.2.0
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Add information about buildpacksio/lifecycle (#707)
* Introduce new api version helpers (#705)
* Introduce new api version helpers
This makes the code a little easier to read.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add information about buildpacksio/lifecycle
This information should be copied to the Docker Hub repo "about" section.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Small fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Small fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update steps for verifying SBOM
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update the README for platform 0.7 (#704)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix umask race (#722)
* Set umask before extracting layers to avoid race condition
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update archive/extract.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Anthony Emengo <aemengo@vmware.com>
* Don't try to set the umask outside of extract
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't try to read umask in extract
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Anthony Emengo <aemengo@vmware.com>
* Buildpack api 0.7 is not supported (#726)
* Buildpack api 0.7 is not supported
We missed this when backing out asset packages.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use the correct tag when signing the sbom (#729)
* Use the correct tag when signing the sbom
Also there is no need to parse the digest from `crane tag` because it does not change.
This will make the code less brittle.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add manifest sha when validating semver
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Ensure umask is unset when extracting archive (#727)
* Ensure umask is unset when extracting archive
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Get the current umask without changing it
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update per review comments
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Less confusing wording
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Reduce the diff
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Added comments
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Better wording
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add test that system umask is used to create non existent directory not in tar file
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Variable names and formatting
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Try to fix windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Avoid direct dependency on archive
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Make test setup simpler and update comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add build directive
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Apply suggestions from code review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix Codecov
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Set Umask as part of archive.Extract
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move the unlock methods to be under defer
instead at the end of the function in case setUmask will panic.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bump imgutil (#731)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix merge
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
Co-authored-by: Anthony Emengo <aemengo@vmware.com>
Co-authored-by: Yael Harel <yharel@vmware.com>
Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
* Introduce new api version helpers
This makes the code a little easier to read.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Notes:
* This commit introduces platfromAPI 0.5 as a supported API.
* The changes apply only for platformAPI >= 0.5.
* The path of the relevant files is being changed as part of Args after parsing the flags.
* Allow the user to set the layers flag in the detector.
Signed-off-by: Yael Harel <yharel@vmware.com>
- Clean up acceptance tests
- Make PLATFORM_API configurable
- Add verification to rebaser
- Consolidate API compatibility method
Signed-off-by: Javier Romero <jromero@pivotal.io>