Commit Graph

35 Commits

Author SHA1 Message Date
Jesse Brown dba6e93edb
Initial spike of exec-env support
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-09-10 12:28:34 -05:00
Pavel Busko f2a3bd78a8
Restore cached launch layers not found in `appLayers` (#1346)
* 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>
2024-07-03 10:04:57 -04:00
Natalie Arellano 955ab5e7c9
Buildpack API 0.11 is supported as of lifecycle 0.19 (#1326)
Fixes https://github.com/buildpacks/lifecycle/issues/1322

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-03-28 12:36:36 -04:00
Johannes Dillmann 7bdfb331bb
Provide context directory for extensions (#1276)
* 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>
2024-02-15 10:40:12 -05:00
Natalie Arellano 874e2c17e8
Remove deprecated platform APIs (#1191)
* Remove deprecated platform APIs

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Adding back some things and removing more things

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix assertion

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix again

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix windows

Signed-off-by: Natalie Arellano <narellano@vmware.com>

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-13 12:44:10 -07:00
Natalie Arellano a12fbff57d
Remove deprecated buildpack APIs (#1148)
* 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>
2023-08-23 10:34:00 -04:00
Natalie Arellano fa9a11abd2
Detector changes for run image extension (#1011)
* 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>
2023-03-08 15:02:50 -05:00
Natalie Arellano 014ccebcee
Adds -run as an input to the analyzer & creator (#1005)
- Also adds unit tests for create inputs

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-02-13 11:08:57 -05:00
Natalie Arellano 3648072784
Consider platform API <= 0.6 and buildpack API <= 0.6 deprecated (#974)
* 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>
2022-12-12 10:28:37 -05:00
Olivier MOCQUAIS dcf0f8ff69
Implement RFC for SBOM describing lifecycle / launcher #958 (#944)
Signed-off-by: Olivier Mocquais <omocquais@vmware.com>

Signed-off-by: Olivier Mocquais <omocquais@vmware.com>
2022-11-21 16:00:53 -05:00
Michael de Senna 6a2b4bfd54
ci(lint): address most staticcheck alarms (#940)
* 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>
2022-10-25 17:48:29 -04:00
Natalie Arellano 2e739d6de5
Dockerfiles phase 1 (detect changes) (#860)
Detect changes to support Dockerfiles feature

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-06-08 10:09:31 -04:00
Jesse Brown 82298b73ee
Support SOURCE_DATE_EPOCH (#823)
* 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>
2022-03-10 13:26:39 -05:00
Mikey Boldt 4ebc445600
Process-specific working directory (#792)
* 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>
2022-01-26 12:10:59 -05:00
Natalie Arellano 7762adccff
Automatically update lifecycle.toml when new apis are added (#756)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-11-10 16:23:47 -05:00
Anthony Emengo f02ec0f830
Add sBOM functionality (#749)
* 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>
2021-11-10 15:53:04 -05:00
Natalie Arellano 9b72550dd3
Merge release/0.12.0 into main (#739)
* 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>
2021-10-26 12:27:59 -04:00
Natalie Arellano b8e2767db7
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>
2021-09-13 14:29:41 -04:00
dwillist f07f82e0e6 add required env var, platform API, buildpack API to support asset packages
Signed-off-by: dwillist <dthornton@vmware.com>
2021-04-22 15:39:16 -04:00
Yael Harel e6f3139931 Add support for Builpack API 0.6
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:07:32 -05:00
Yael Harel 527036c5f2 Add support to Platfrom API 0.6
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:02:55 -05:00
Natalie Arellano ca7f3010f9 Updates from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 14:54:59 -05:00
Emily Casey 3e36f22c0c Adds support for exec.d
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:05:53 -05:00
Yael Harel 394a5e0a3c Change defaults that are depending on the working dir to be under <layers>
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>
2020-10-29 14:37:35 -04:00
Emily Casey 38ad1ecb50
Apply suggestions from code review
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Natalie Arellano <natalieparellano@users.noreply.github.com>
2020-08-04 10:35:43 -04:00
Emily Casey b588898c6b Semantic handle of args in direct=false processes
* Resolves #354

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-03 11:18:14 -04:00
Emily Casey 257920c123 Address PR comments
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 18:03:18 -04:00
Emily Casey a537f9b6f9 Buidpack API 0.2 is supported
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:21:22 -04:00
Emily Casey f0c9efd731 Return error instead of panicking when requested API is unparsable
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:17:29 -04:00
Emily Casey 36db452da0 Hardcode platform/buildpack APIs
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:17:29 -04:00
Emily Casey cddc9b9a43 Multi-API lifecycle descriptor
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:13:16 -04:00
Javier Romero 2b15a568ee PR review changes
- Clean up acceptance tests
- Make PLATFORM_API configurable
- Add verification to rebaser
- Consolidate API compatibility method

Signed-off-by: Javier Romero <jromero@pivotal.io>
2020-01-23 11:34:09 -06:00
Javier Romero 29736fc477 Make api compatibility more concise.
Signed-off-by: Javier Romero <jromero@pivotal.io>
2020-01-22 20:33:39 -06:00
Javier Romero 3aea66c07f Add verification to all phase binaries
Signed-off-by: Javier Romero <jromero@pivotal.io>
2020-01-22 17:19:36 -06:00
Javier Romero 604e5eef91 Initial implementation and set of tests
Signed-off-by: Javier Romero <jromero@pivotal.io>
2020-01-22 16:59:22 -06:00