This should bring in the latest imgutil changes that includes significant performance improvements in containerd storage docker daemon use.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Update Go version in test-s390x.yml
- Update Go version in Dockerfile
- Update Go version in go.mod
- Add aarch64 support to tools/image
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
To ensure ordering of stdout and stderr in build and generate phases, send the stdout and stderr of the executing command to the same stream (stdout).
This will have an outside effect of anyone consuming `lifecycle` as what was previously in stderr is now in stdout.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
kaniko is now maintained by chainguard-dev and is the recommended
kaniko to use. This will allow us to keep our dependencies up to date
and avoid issues with the unmaintained GoogleContainerTools/kaniko project.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
The `GITHUB_REF` includes the full `ref/heads...`and the `gh release create` is expecting the short branch/tag name.
This somehow works fine - but also breaks the UI for generating release notes. This should fix that.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
I think we are seeing flappy tests due to the potential for the registry and daemon case sharing the same variable. Lets duplicate the variable to remove the potential and do the cleanup in each test when block.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Make sure the warning message is safely guarded with a length check before attempting to access the first element of the slice.
Make sure the `ValidateOutputImageProvided` function is called first in the input resolve process to ensure the output image is provided before attempting to resolve the input image in other validation functions.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Windows artifacts are no longer built - the draft release validation needs to be updated to reflect that.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Only log once (per phase) when we have to get target distro information from /etc/os-release
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Save the distro information the first time we read /etc/os-release, so that we end up only reading that file once
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Ref: https://github.com/buildpacks/rfcs/pull/311
We don't want to block lifecycle releases on pack windows failure anymore. They are unstable and not something we are staffed to invest time into.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* bump upload-artifacts-action
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* bumping download-artifact to v4 as well
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
---------
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Restore succeeds (skipping over the layer) if layer contents are corrupted
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Exporter does not re-use layer from volume cache if layer contents are corrupted
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fixes
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add more detail to release instructions
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* moved things around (#1411)
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
Co-authored-by: Joey Brown <brown.joseph@salesforce.com>
The 1/N app layer logs are emitted _after_ the layers have been added. This can sometimes be an expensive operation depending on the layer size and export target.
When trying to understand performance during builds, this wording implies the previous log line before the app layers was responsible for the time between the log lines. Adjusting the wording will make it a bit clearer that the time between the two log lines includes both steps.
Before:
```bash
03:50:00 Adding layer 'buildpacksio/lifecycle:launch.sbom'
03:51:00 Adding 5/5 app layer(s)
````
After:
```bash
03:50:00 Adding layer 'buildpacksio/lifecycle:launch.sbom'
03:51:00 Added 5/5 app layer(s)
````
If we are more interested in going the other direction, where we keep "Adding 1/N app layers" and emitting multiple times or something I'm happy to iterate.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Make the test-fork.sh script correctly remove the Codecov step from build.yml.
Signed-off-by: hhiroshell <hhiroshell@gmail.com>
* Make the test-fork.sh script add the necessary permissions for pushing images to ghcr.io in the build and post-release workflows.
Signed-off-by: hhiroshell <hhiroshell@gmail.com>
---------
Signed-off-by: hhiroshell <hhiroshell@gmail.com>
* add failing test to restorer
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* restorer and exporter working as expected
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* lint
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update phase/restorer.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update phase/cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update cache/image_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update cache/volume_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update cache/volume_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update cache/volume_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update cache/volume_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* Update cache/volume_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* update based on feedback
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
* fix log
* temp fix
* this does not work as is. I think we need to modify img utils.
Image utils should fail with a Layer Not found in both ReuseLayer & GetLayer.
For GetLayer, when there is a missing blob, it's return an unexpected EOF error.
For ReuseLayer, when there is a missing blob, it's not returning an error but it should.
* add eof check
* add not exist check
* reuse layer test
* fix test regression
---------
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
Co-authored-by: Joey Brown <brown.joseph@salesforce.com>
* Surface registry error instead of logging it as debug
When permissions issues are encountered, it can be hard to determine the root cause
without the error returned from the registry
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix test expectation
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Target data: populate os/arch as well as distro information
Fixes https://github.com/buildpacks/lifecycle/issues/1371
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Only os and arch are truly required
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix one more unit
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix even more units
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* 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>
* Ensure read access to the run image selected by extensions
Co-authored-by: Nicolas Bender <nicolas.bender@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
* move read access check to the restorer cmd
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* guard behind platform version check
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
---------
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Nicolas Bender <nicolas.bender@sap.com>
* More fixes for target compat checking during detect
- If a buildpack fails to specify os/arch (but specifies distro) still check targets
- If the run image fails to specify os/arch (this should not happen actually as we will fail during analyze) still check targets
- Fix typo in buildpack descriptor struct so that we actually get stack information
- If we get distro information from /etc/os-release, persist this information to later invocations to that the log message
printed when errors are encountered will be accurate
- Don't override inner `i` in loop (this should not actually affect the outer loop but is confusing)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When stack is "any", don't infer empty target as it is not needed
Missing targets is sufficient for wildcard match
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove backwards compatible glue that actually causes fewer builds to succeed
Fixes https://github.com/buildpacks/lifecycle/issues/1355
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove exit (this was added for debugging purposes)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Reorder functions in file
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Also read distro information from /etc/os-release when checking target compat
https://github.com/buildpacks/lifecycle/pull/1347 reads the file when providing target env vars
to buildpacks during detect, but we also need to consider this info when deciding whether or not to run
detect for the buildpack
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Error if we don't find run image OS during analyze
And remove checks for missing OS later in the build, as it should always be there
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Read `/etc/os-release` file when distro information is not present in labels
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* fix unit tests
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
* Update phase/generator_test.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Pavel Busko <busko.pavel@gmail.com>
* Update phase/generator_test.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Pavel Busko <busko.pavel@gmail.com>
---------
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Signed-off-by: Pavel Busko <busko.pavel@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Prior to https://github.com/buildpacks/lifecycle/pull/1315, all keychains
passed to NewMultiKeychain were resolved keychains,
which prevented the credentials from becoming inaccessible after the lifecycle dropped privileges.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* go 1.22
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Updated golangci-lint to v1.57.2
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
---------
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
The spec and docs say that the run image distro and version should be
specified via the Docker image labels `io.buildpacks.base.distro.name`
and `io.buildpacks.base.distro.version`.
See:
https://github.com/buildpacks/spec/blob/buildpack/v0.10/platform.md#target-data
However, until now the lifecycle implementation was checking for
label names that were missing the `.base` substring from the name.
This causes distro name/version `buildpack.toml` target detection
to fail, as well as the env vars `CNB_TARGET_DISTRO_NAME` and
`CNB_TARGET_DISTRO_VERSION` not to be set correctly in the
buildpack environment.
Fixes#1324.
Signed-off-by: Ed Morley <501702+edmorley@users.noreply.github.com>
* Fix: log level and color level should be configurable via the env
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix version
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update order and comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update fixtures for exporter acceptance test
These were previously based on "real" images, but the actual content is unimportant.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix config and manifest shas
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix index sha
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update to correct sha, uggh
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix fixtures again and make test expectation more robust
We know the extension layer index so we should just use it
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Always set CNB_TARGET_* variables during detect, build, and generate
when the Buildpack API version is at least 0.10.
Previously, we only set these variables when the Platform API version was at least 0.12.
But, newer Buildpack APIs expect these variables regardless of the Platform API version.
If we are on an older platform, derive the target variables from the base image OS.
Fixes https://github.com/buildpacks/lifecycle/issues/1308
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix unit
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix unit again
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
in addition to the original top layer digest
to determine what is an extension layer and what is an original layer.
Relying on the original top layer digest (only) introduced errors
if the original run image had a duplicated top layer.
Fixes https://github.com/buildpacks/lifecycle/issues/1300
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
* Fix rebase run-image resolution
Currently, if `-run-image` is not set, `io.buildpacks.lifecycle.metdata[runImage.reference]` is used. This does not follow the [Run Image Resolution spec](https://github.com/buildpacks/spec/blob/main/platform.md#run-image-resolution), which specifies using `io.buildpacks.lifecycle.metdata[runImage.image]` and optionally `io.buildpacks.lifecycle.metdata[runImage.mirrors]`. Because of this, it ends up making `lifecycle rebase` without the `-run-image` flag a no-op because the run image is pinned to the same version instead of getting the latest.
This change simplfies and unifies the behavior for before and after Platform Version 0.12 so that they both read the same run-image data type (just from different locations), and then validate and resolve mirrors the same.
Signed-off-by: Ryan Brainard <966764+ryanbrainard@users.noreply.github.com>
* Rewrite if-else-if-else as switch for go-critic
This is to make go-critic happy. See https://github.com/go-critic/go-critic/issues/453.
Signed-off-by: Ryan Brainard <966764+ryanbrainard@users.noreply.github.com>
* Extract and test platform.GetRunImageFromMetadata
Signed-off-by: Ryan Brainard <966764+ryanbrainard@users.noreply.github.com>
---------
Signed-off-by: Ryan Brainard <966764+ryanbrainard@users.noreply.github.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>
* Exporter zeroes timestamps when adding extension layers to the app image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update fixture to fix Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use normalizing tar reader to fix Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Revert "Use normalizing tar reader to fix Windows"
This reverts commit 8c6c12c82c.
* Update fixture to fix Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update phase/exporter.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix format
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Try to fix Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Skip test on Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
We can remove docker & containerd pins:
- Docker was pinned to 23.x because of kaniko,
but now that kaniko has upgraded we can upgrade.
- Containerd used to be pinned as a purely transitive dependency,
but now that it has a require directive it should be okay to unpin it.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Consolidate methods that read and write platform spec'd TOML
in platform/files package.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Calculate lifecycle digest and output version as part of acceptance testing
This can help us diagnose weird failures in CI
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Go minor/patch dependencies will now be grouped, using the new
Dependabot grouping feature:
https://github.blog/changelog/2023-08-17-grouped-version-updates-by-semantic-version-level-for-dependabot/
Major updates, as well as security updates will still be opened as
separate PRs. I've not grouped GitHub Actions update PRs, since the
volume is typically much lower for those.
The custom open pull requests limit has been removed, since it is
no longer necessary, as there won't be as many open PRs.
In addition, the schedule has been changed from daily to weekly.
This reduces project maintenance toil (no more having to manually create
combined update PRs), plus makes it less painful for contributors to
subscribe to repository notifications (currently there is a lot of noise
from Dependabot PRs being opened/auto-rebased etc).
Signed-off-by: Ed Morley <501702+edmorley@users.noreply.github.com>
The default of emitting timings to info is too noisy. This change lets platforms that want to see timings do so by setting the log level to debug.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Update README
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Upgrade golang.org/x/sys to bump golang.org/x/net and patch vulnerabilities
- Patches CVE-2023-44487 and CVE-2023-39325
- Removes already patched CVEs from ignore list in .grype.yaml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix pack acceptance by letting the tag version float again
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix Platform 0.10 by writing the new run image reference to analyzed.toml after generate
Platform 0.10 expects to find the reference in analyzed.toml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix restorer
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add the support to the new --insecure-registry parameter
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add the support to the new --insecure-registry parameter in the creator command
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add keychain mock and handler test
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add support for a single insecure registry
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add support to multiple insecure registries
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Adjusted flag name
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Fix problem with the mock
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* InsecureRegistry to InsecureRegistries
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Address comment on FlagTags parity
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Parse the InsecureRegistry env variable with comma separated values
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Changed InsecureRegistry to InsecureRegistries
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Changing name at the env variable
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Exporter now accept insecure registries
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Bump up toward the latest version of imgutil
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Remove legacy guard
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add WithRegistrySetting with insecure registries into restorer
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add support for insecure registries to the rebaser
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add rebaser testdata directory to .gitignore
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Cleaned testdata directory
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Remove testdata rebaser entries from .gitignore
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add support to insecure registies for the read-write registry check
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Move registryHandler into its own file into the image package
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add dockerfile.windows
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Introducing GetInsecureRegistryOptions
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Fix linter problems
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Remove legacy guards and add test support to arm64
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Remove duplication and utilize new GetInsecureRegistryOptions function
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Extract common code for getting insecure registry options from imageRef
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Added cli flags behind proper guards
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Bumped up to the imgutil latest version with the insecure adjustment and renamed the getInsecureRegistryOptions function
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Make the getInsecureOptions a static method as a temporary solution to remove duplications
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Added insecure registry to the runImage in the rebaser
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Bump up to the latest version of imgutil with the multiple registries fix
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Go mod tidy
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Remove insecure-registry filter based on the imageRef
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Remove reduntant for loop and added a test for multiple GetInsecureOptions
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Don't remove whitespaces between buildpacks names
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add FlagInsecureRegistries behind 0.13 guards
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
---------
Signed-off-by: Domenico Luciani <dluciani@vmware.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>
* Add support for darwin-arm64 chipset
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Split darwin builder into a separate module extracting the code for a more generic use
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Split darwin.mk to lifecycle.mk and launcher.mk
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Update launcher.mk with a better naming
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Update lifecycle.mk with a better naming
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Adjusted called function
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
---------
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* restorer gets layers flag again
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* add explanatory debug logs so a reader knows why the buildpacks are read twice.
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* warn when a positional argument might have been a flag (#1147)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Add test for empty digest not returned
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance by providing a base image when we instantiate the remote run image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* timestamp logs and phase error message cherry-picks (#1164)
* timestamp logs for entry/exit for all the top-level Lifecycle package functions
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
fixing names
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
using defer to make one-liners for fun and profit
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
and today we thank our brave linters for preventing critical defects such as unnecessary trailing newlines from being merged. Its about time somebody thought of the children.
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* be more helpful when you dont recognize the phase
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Simplifies target matching logic per spec PR review (#1166)
* Update units without updating code
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update code
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Unpend test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add units for rebase without updating code
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update rebase code
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When we read the descriptor file, don't fill in "*" as a magic value as missing values are wildcard matches
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Stricter validation for rebase
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add -daemon to restorer (#1168)
This is needed when extensions were used to switch (but not extend) the run image
and we need to re-read the target data from the image config.
In such cases, we don't need the run image to exist in a registry,
because we don't need a manifest for kaniko.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove CNB_TARGET_ID according to https://github.com/buildpacks/spec/pull/374 and https://github.com/buildpacks/spec/pull/375 (#1175)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Field renames per spec review (#1170)
* Rename distributions -> distros in the buildpack spec
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Rename distributions -> distros in the platform spec
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* force pack acceptance tests to build with a version of go that can still make HTTP requests to docker daemon (#1158)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Joe Kimmel <jkimmel@vmware.com>
Co-authored-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* Remove deleteOrigImage function from the cache and relative test
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Revert "Remove deleteOrigImage function from the cache and relative test"
This reverts commit 17e646fc39602777a37977dd9416e59aa62f6d04.
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Implemented a new component called cache deleter which takes care of the deletion of the cache images
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Adjusted the name of the struct field
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Move the imade deleter instatiation up to the main
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add parameter to enable/diable the deletion functionality, for now always set has enabled
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add feature guard based on the platformAPI version
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Fixing some test titles
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Introduce ImageComparer component
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Add async go-subroutine to the delete call to speed up the process
```go
func Benchmark(b *testing.B) {
mockController := gomock.NewController(b)
fakeImageComparer := cacheMock.NewMockImageComparer(mockController)
testLogger := cmd.DefaultLogger
imageDeleter := NewImageDeleter(fakeImageComparer, testLogger, true)
for i := 0; i < b.N; i++ {
fakeOrigImage := fakes.NewImage("fake-image", "", local.IDIdentifier{ImageID: "fakeImage"})
fakeNewImage := fakes.NewImage("fake-image", "", local.IDIdentifier{ImageID: "fakeNewImage"})
fakeImageComparer.EXPECT().ImagesEq(fakeOrigImage, fakeNewImage).AnyTimes().Return(false, nil)
imageDeleter.DeleteOrigImageIfDifferentFromNewImage(fakeOrigImage, fakeNewImage)
}
}
```
The code above produced this result:
* without the go-subroutine
```
goos: darwin
goarch: amd64
pkg: github.com/buildpacks/lifecycle/cache
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Benchmark
Benchmark-12 3501 8995839 ns/op
PASS
```
* with the go-subroutine
```
goos: darwin
goarch: amd64
pkg: github.com/buildpacks/lifecycle/cache
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Benchmark
Benchmark-12 3560 9133704 ns/op
PASS
```
Speed increased by 1.53% ns/op
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
---------
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
* Require the CNB_PLATFORM_API env var to be set, instead of defaulting to (deprecated) version 0.3
Instead of defaulting to a newer Platform API version, which would silently change behavior
for platforms that do not currently set this env var.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* probably adds grype json output to the created github issue
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* specify json output and use jq query to select summary
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
small refactor of gh action shell script and better issue name
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
sev threshold explicitly set to high
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* grype release sev cutoff back to medium
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* When pulling remote image data, fail if the remote image is not found
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When validating dockerfiles, set extend to true if there are any instructions (vs more than one instruction)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update matching logic when considering if two image names are equivalent to ignore the digest portion of the reference if present (for the purpose of selecting data from run.toml to add to the lifecycle metadata label i.e., “run image for rebase”)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Comments and cleanup
Don't print `%!s(<nil>)` if nil is provided to the "parse maybe" function
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When exporting, continue to use run image identifier (which could be a digest reference or daemon image ID)
instead of falling back to image name when exporting to a daemon.
Previously, the digest reference was incorrect which caused the daemon not to find the image.
But when provided a correct digest reference the daemon can still find it.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add Contains method to structs that hold run image information for export
When determining if a provided reference is found in existing metadata, remove its digest -
except when setting the new run image "image" in analyzed.toml,
because we should always respect what the extension author wrote.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When finding the run image info for export, use the run image "image" (name)
in analyzed.toml as the search key, because the run image "reference" could be a daemon image ID
or include the digest, which isn't helpful when retrieving image names that are supposed to float.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix detector acceptance and add more logging
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix: use "image" instead of "reference" and also guard against image not found
when we are only updating the reference and target data in analyzed.toml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When checking read/write access, if there is no access, surface the error that occurred
This can be helpful in debugging failed builds where access is expected
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance by continuing when iterating through run image mirrors
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Point imgutil back to main
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Warn whenever --force is used
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Trying to make the diff better
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update name.ParseMaybe to return the tag & add tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Make the code simpler by re-using RunImageForExport within RunImageForRebase
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove unneeded check
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add hint about -force in the case that failure can be overridden
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* turn on additional linter checks including godoc comments
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* ... but only apply new stricter linting to commits going forward
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* fetch repo history to enable linting only since a previous commit
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* update new-from-rev since this PR has been open a while
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
- Fix daemon invocation by trying to read app image after we have a docker client
- Don't do stack validation for images built on newer platforms
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Clarify log messages and omitempty
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix accpetance by updating fixtures & update user check
- We shouldn't fail if extensions leave the user ID as root when extending the build image,
as the lifecycle will drop privileges to the provided -uid and -gid when running the build phase.
- If the user ID is still root, the `builder` will fail.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Small fixes from user testing
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fixes from user acceptance
- Removes -stack flag from analyzer
- Fixes debug log message
- Removes deprecated rand.Seed
Signed-off-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
* Bump linter to a version that will work with go 1.20
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Restorer should ensure ownership of kaniko directory
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* pull the less-than case for flags out of the switch
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* appease the windows linter
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Fix weird log output
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Co-authored-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
Co-authored-by: Joe Kimmel <jkimmel@vmware.com>
* metadata label is more clearly named and always has stacks
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Update exporter.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* Update exporter.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* (with @natalieparellano) simplify exporter interface by removing legacy stack arg and only constructing it when needed for metadata label
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* extensions get the same targets validation as buildpacks
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* extensions default to */* for os/arch detection
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Refactor: create new package for files in the platform spec
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move CNB business logic from file -> platform package
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update comment and var names for clarity
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove AccessChecker interface in favor of function signature type
- Remove unused testhelpers
- Make AccessChecker an emergent property of LifecycleInputs (vs something that needs to be set)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update comments with more info
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When rebasing, update stack/runImage key in lifecycle metadata label
if the provided run image does not match existing metadata.
See https://github.com/buildpacks/spec/pull/360
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update rebaser_test.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Previously: Treat images like politicians (if you suddenly can't find
them, they're probably corrupt).
Now: Treat images like accounting errors (if you can't find any, there's
no evidence of corruption)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Add more logging so we know when the lifecycle actually starts
In working through https://github.com/buildpacks/lifecycle/issues/1007
it was hard to know if the lifecycle had even started
when we were stuck in a loop trying to get the auth,
because the first log lines emitted by the lifecycle
were emitted after the Analyzer had started.
If we had this logging in place beforehand,
we would have known the problem was somewhere in Privileges()
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Rename variable to make it clearer
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update cmd/lifecycle/cli/command.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add history when adding buildpack or extension layers
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* REVERTME: point imgutil to feature branch
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Parse extension ID from history so that we can output a useful log message
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Avoid extra wrapping
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bump imgutil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance by overriding imgutil methods for "caching image"
We need to add to the launch cache when adding layers so that the next build will be faster
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add tests for layer factory
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add acceptance test for extender should update history
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move history methods to imgutil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix exporter acceptance by fixing imgutil
The digest for a remote image from imgutil
should match the digest for a remote image from ggcr
unless the user specifically requested modifications like overriding history
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add acceptance test; fix layer name when there is only one slice
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bump imgutil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
imgutil mutates the image (history) for newer platforms, so the SHA is different
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Point imgutil back to commit on main, also bump containerd
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* initial changes in layermetadata.go for FIXME
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* minor changes, var name and added TODO
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* Added check for empty string in layermetadata.go
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* checks in layermetadata_test.go for logger
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* api version check - logic moved
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* ran make format for modified files
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* removed comments
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* changes to DecodeLayerMetadataFile
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* check for version shifted from layers.go to layermetadata.go
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* resolved ineffectual assignment to err
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* added new it block, TODO resolve failing test
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* Fix failing test
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* removed unnecessary fmt
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
---------
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
* CNB_TARGET_ env vars
- allowed to be passed through in the env vars allow-list
- threaded through builder
- threaded through detector
- threaded through generator
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Update buildpack/generate.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* Update buildpack/generate.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* Update cmd/lifecycle/builder.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Validate the cache image and previous image in the analyze phase
Signed-off-by: Matthew Robertson <mattrobertson@google.com>
* Fix unit tests
Signed-off-by: Matthew Robertson <mattrobertson@google.com>
* Upgrade imgutil
Signed-off-by: Matthew Robertson <mattrobertson@google.com>
* allow-nondistributable-artifacts for windows images
Signed-off-by: Matthew Robertson <mattrobertson@google.com>
* Update docs
Signed-off-by: Matthew Robertson <mattrobertson@google.com>
---------
Signed-off-by: Matthew Robertson <mattrobertson@google.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Fix updating run image reference
We should use the reference that the extension wrote, as that is expected to be in the daemon (when building locally)
`ref.Context().RepositoryStr()` strips the reference of the registry which may not be desired;
we should trust the extension to write the correct reference instead.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance test by updating fixture
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update README
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use run image function instead of accessing the field directly
Safer in the case the run image is nil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Change fixture to point to pullable image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When running pack acceptance, don't consider release candidates or pre-releases
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Pin pack version for acceptance to v0.28.0
pack v0.29.0 accidentally declares support for platform API 0.12
and the acceptance tests aren't passing because `pack build` hasn't actually been updated
with support for platform API 0.12
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>
* Platform API: the restorer will update analyzed.toml with:
- digest ref for run image
- target data for run image
Additionally the restorer will download the run image manifest & config when extend is true
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update acceptance/extender_test.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* The extender accepts new -extended and -kind flags
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bring back selective package
Because we change the media types to be oci types (vs docker types) this changes the digest of the image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add acceptance test for run image extension
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Refactor
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: break me up into separate commits
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Validate extend config during buildpack/generate
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Address some TODOs and refactor
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Set io.buildpacks.rebasable
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix merge and restore selective package
imgutil/layout/sparse modifies the image media types which we don't want
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update analyzed.toml with digest reference or target data if needed
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>
* WIP: add acceptance test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: first assertion passes
FIXME: extended layers should be small
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: Second assertion passes
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add new assertions and rename variables for clarity; fix exporter units
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Save extended run image under <extended>/run
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Check for nil config and make the loop simpler
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix ineffectual assignment to err
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Cleanup extender tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix typo
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add positive assertion
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Make constants for asserted log lines
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Acceptance test passes
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix some TODOs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update imgutil to point to branch commit
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add support to extending daemon images
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix image ref when exporting to daemon
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* More fixes
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Improve script to test on fork
Clarify names of cosign secrets and remove Codecov
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Cleanup extender
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update comments
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Small fixes, units pass
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add generator units
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fixes
- We shouldn't try to use extension layers if they exist in <layers>/extended unless experimental features are enabled
- We only know the size of the compressed layer, so we can't use io.CopyN (but we don't need to guard against decompression bomb anyway since we control the layers)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Rename fixture dirs so that we can check out source code on Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bring back Cleanup()
We need access to the final image after all Dockerfiles have been applied,
so we need to create the working directory outside the applier loop.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update imgutil branch
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix restorer acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance test by making it less brittle
Instead of hard-coding the run image and run image top layer SHAs,
we can derive their values
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fixups from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix units
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Point imgutil back to main
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update generator.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update exporter.go
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Check err type when we fail to get a layer from a sparse image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
* Validate OS, Arch, Variant and optional labels on rebase
For 0.12 and beyond, rebase is now validating the OS, Arch, Variant and io.buildpack labels specific to OS. This can be skipped with the --force flag.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Copy io.buildpacks.base.* labels on rebase
For platforms running 0.12 and beyond, copy the io.buildpacks.base.* labels to the new image on rebase.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Copy io.buildpacks.base.* labels on rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Skip validation if the image was built < 0.12
If the target image was built prior to 0.12, do not run the additional validation. This is because the validation is not backwards compatible with older images. Older images may not have the required fields and we don't want to force platforms to use the `--force` flag.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
---------
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
While "release candidate" is still a pre-release, it conveys more readiness
than a "pre-release" or "preview release".
We'd like to ship pre-release lifecycle artifacts
so that users can test out new features without them being fully implemented
as they would in a release candidate.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* detect linux flavors by reading etc/os-release
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* little more cleanup and better tests
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* fix bad assertion in linux test
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* sure is a good thing those newlines will never make it into production
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* make format
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Update internal/fsutil/os_detection.go
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* cleanups
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Update internal/fsutil/os_detection.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* finish systemic rename
avoid conflating linux with partial sysd implementatations
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-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>
* Platform API: the restorer will update analyzed.toml with:
- digest ref for run image
- target data for run image
Additionally the restorer will download the run image manifest & config when extend is true
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update acceptance/extender_test.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* The extender accepts new -extended and -kind flags
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bring back selective package
Because we change the media types to be oci types (vs docker types) this changes the digest of the image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add acceptance test for run image extension
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Refactor
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: break me up into separate commits
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Validate extend config during buildpack/generate
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Address some TODOs and refactor
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Set io.buildpacks.rebasable
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix merge and restore selective package
imgutil/layout/sparse modifies the image media types which we don't want
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update analyzed.toml with digest reference or target data if needed
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>
* Save extended run image under <extended>/run
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Check for nil config and make the loop simpler
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix ineffectual assignment to err
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Cleanup extender tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix typo
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add positive assertion
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Make constants for asserted log lines
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add --force flag to rebase command
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Validate io.buildpacks.rebasable label on rebase
For platforms >= 0.12 - the rebaser will now fail if the io.buildpacks.rebasable label is set to false when the force flag is not set.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Read rebase from io.buildpacks.lifecycle.metdata runImage
For Platforms >= 0.12, the default rebase target has moved to the `runImage` key in the `io.buildpacks.lifecycle.metadata` label. This change allows the lifecycle to read the `runImage` key and use it as the default rebase target.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Validate io.buildpacks.rebasable label on rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Add --force flag to rebase command
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Read rebase from io.buildpacks.lifecycle.metdata runImage
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
---------
Signed-off-by: Jesse Brown <jabrown85@gmail.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>
* Platform API: the restorer will update analyzed.toml with:
- digest ref for run image
- target data for run image
Additionally the restorer will download the run image manifest & config when extend is true
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update acceptance/extender_test.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix merge and restore selective package
imgutil/layout/sparse modifies the image media types which we don't want
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update analyzed.toml with digest reference or target data if needed
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>
* Test organization and remove the requirement that we're exporting to a registry to use run image extensions
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Test that we don't update target data for older platforms
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove target partial and use helper function
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bump imgutil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use imgutil/sparse package instead of internal/selective package
We'll be able to fully remove internal/selective
when we update tests for the extender as part of https://github.com/buildpacks/lifecycle/issues/998
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't try to pull a builder image if it wasn't specified
Ensure we write a digest reference to analyzed.toml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add and update comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* all the bits i can do prior to imgutil getting the Variant merged
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* upgrade imgutil and incorporate arch Variant
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* move GetTargetFromImage to platform and move ID into just platform
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* add wildcard stack translation to target md
move common test fns to common places
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* only pull target metadata from runimage if we're in a newer API
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* use the * arch when autodetecting OS only
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* detector.go - debug logger
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* one wild and crazy test for wildcards
also fixes weird new linter requirement
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* preferentially detect windows
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Bump github.com/containerd/containerd from 1.6.18 to 1.7.0
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Only bump to 1.6.19 instead of 1.7.x until we can upgrade docker/docker
docker/docker 20.10.23 is incompatible with containerd 1.7.x+ due to the removal of sys/userns_deprecated.go
(upgrading containerd results in lifecycle compile errors like go/pkg/mod/github.com/docker/docker@v20.10.23+incompatible/pkg/archive/archive_unix.go:96:42: undefined: sys.RunningInUserNS)
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>
* initial setup for toml file schemas and structs
BpDescriptor reads and populates Targets data
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* correct-er detector for target selector
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* TargetMetadata.Equals: tests and impl nailed down
minor cleanup
nix mixins mixup
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* refactoring RunImage with some spillover
- RunImage has:
- Reference
- Target
While i was in there, some of the other *ImageReference types were
inconvient so I changed them to just be strings instead of structs
containing strings. This does have the effect of collapsing a table,
But as a newer contributor to this project I have the blessing and curse
of not feeling all that constrained by (nor aware of) past decisions.
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* NewDetector respects the alphabet
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* only replace stack with target for newer api versions
small cleanups / removal of unneeded check
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Equals->Satisfied and other cleanups
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* detector logic is probably all the way working
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* turns out the unit tests pass without the bin folders for these buildpack fixtures
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* analyzed.toml backwards compat shims
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* change detector to take analyzedMD struct rather than file
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* small cleanups
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* runImage only has one distribution and that small adjustment has someconsequences
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* move isWildcard to private method of detector
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* analyzed acceptance tests use ReadAnalyzed fn
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Updates
Update env/build.go
Update buildpack/bp_descriptor.go
Update default arch to amd64
use OS instead of Os
fixing mocks and fn calls after small change
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
* couple more easy fixes
fix descriptor test bc we decided that we _do_ want that behavior for old versions
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Targets are auto-detected based on contents of buildpack/bin
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
* Change AnalyzedMetadata struct to use pointers again
This allows us to remove our custom writer, while keeping the file schema unchanged in Platform API 0.12
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
* Fix nil pointer
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
Signed-off-by: Joe Kimmel <86852107+joe-kimmel-vmw@users.noreply.github.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
* Removes tee so that we can see if CI is really failing
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fixes regression introduced in refactor that assumed we could read the -layers flag before other flags
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't override user-provided order.toml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Read order.toml from environment if provided
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>
* 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>
* Pass in layers directory instead of defaulting to a "placeholder" input that will be updated later
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Assert layers directory
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fall back to default layers when directory not provided
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Consolidate -layers parsing
Signed-off-by: Natalie Arellano <narellano@vmware.com>
---------
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Implementation of the new flag to export to OCI layout format
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Adding reference to imgUtil for OCI layout
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Adding test coverage
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* updating to imgutil librery with the name.ref annotation
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* base on review feedback, I am removing the layout-repo configuration, now platforms must take care of mounting the inputs according to the image ref to path rules described in the RFC
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* reverting the change to remove the layout-dir
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* fixing dockerfile error for the acceptance tests
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* removing chmod validation on /layout-repo
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* pointing to the latest imgutil commit
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Update cmd/lifecycle/analyzer.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Apply suggestions from code review
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Fixing formatting issue
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* fixing errors after later refactor
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Apply suggestions from code review
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Using method layout.ParseIdentifier from imgUtil, and removing test case
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* simplifying the image_layout test cases
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* bumping imgutil version to 4cf98dd677d28557679e4f08941e891f640410cd
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
---------
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Before: "Previous image with name <run image name> not found"
After: "Image with name <run image name> not found"
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use launch cache when calling SaveAs on caching image
- Failure to use the launch cache will result in slower second builds,
due to the time it takes to pull layers from the daemon
- Improve creator acceptance test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Try to make test less flakey by forcing first build to be slower
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Updates go to version 1.19
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use go-version-file to detect go version
This is one less thing to change when we upgrade
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>
* Introduce -launcher-sbom as new flag to the exporter and creator
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add unit test and update acceptance test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
We need to configure git to use line feeds on Windows, otherwise
the test fixtures and hence the layer diff IDs will be different from the test expectations.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix regression in metadata.toml rendering
Moved the dynamic process serialization to a new field type and off of process. The TOML that was previously generated was not expected and the TOML library we use doesn't seem to have a way to render the table the way we expect. Making a new type for the single field `command` allows us to render the TOML the way we want.
Fixes: buildpacks/lifecycle#945
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Changes requested from pull request
- Minor reorganization of the code
- Fixed typos
- Removed some redundant checks in one test to not muddy the waters on what is being tested
- Updated some comments
- Removed debug code
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* acceptance: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* archive: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* auth: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* buildpack: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* cache: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* cmd/lifecycle: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* env: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* internal: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* launch: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* layers: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* priv: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* testhelpers: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* tools: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* lifecycle: move from io/ioutil to io and os packages
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-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>
* When platform API is at least 0.10, run the restore phase always but pass
-skip-restore as skip layers to skip layer metadata and SBOM restoration
This ensures:
- In the 5 phase invocation, the restorer can always run (for extension purposes)
- The 5 phase invocation will match the creator invocation
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix selective write test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Consolidate logic in the platform package
- Remove the platform/launch package as it is not needed to avoid having the launcher depend on the lifecycle
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Reinstate platform/launch package to keep the launcher binary smaller
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix constant
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't mount layers fixture in container
This way changes from the first build (/layers/config/metadata.toml, /layers/sbom, etc.)
are not propagated to the second build.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Set environment variables from the extended build image in the build context
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix format string
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Restorer pulls builder manifest and config
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Copy extend-config.toml from extension output to /layers/generated
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Only import kaniko on linux
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: units pass
Refactor buildpack build, detect, and generate to separate data model from service
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: fixed some TODOs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: addressed some more TODOs, units pass
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: units pass
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP: acceptance tests pass
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Address some minor TODOs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When running extender acceptance, don't mount in /workspace directory
This leads to incorrect permissions issues when running on linux
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't try to check for specific curl version
This appears flaky
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* fixes from testing. (#902)
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
* Lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add tests and TODO
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Change CNB_BUILDPACK_DIR -> CNB_EXTENSION_DIR
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fill in default generated dir
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Ensure kaniko doesn't try to pull 'oci:/kaniko/cache/base/sha256:XXX' from a remote registry
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix panic
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix assertion
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Pass build_id as UUID to Dockerfile
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add tests for selective package
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove kaniko fork
- Fix acceptance by adding CacheRunLayers option and moving 'ARG build_id=0' statements
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Dockerfile validation (#918)
* Add Dockerfile Validation
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
* use mobi buildkit dockerfile parsing
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
* Add units for Dockerfile validation
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix launcher
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Minor improvements
- Test ReadGroup for extensions
- Ensure stderr is captured for acceptance test that might expect it
- Read group.toml into an accurate struct (that has extension and optional set for extensions)
and set these fields to false before writing out to TOML or JSON
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Skip image extensions tests on Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
Co-authored-by: Javier Romero <rjavier@vmware.com>
Co-authored-by: Ozzy Osborne <bardweller@gmail.com>
* Implement overridable process args
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Apply suggestions from code review
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When there are no user-provided args, overridable args should be provided
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix user provided args for newer buildpack with no always-args
When there are no always-args, we need to check the buildpack API, because
it's not clear from the process definition if the buildpack is newer or older.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix: user-provided args should replace overridable args only if non-empty
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix: older platforms should always append
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
* Allow storing multiple commands instead of a single string (#900)
* Allow storing multiple commands instead of a single string
This is a first step to implementing #322. This PR is updating our internal structs to allow for a slice of commands while keeping the external API and behavior the same. A future PR will implement handling multiple commands depending on the API version and changing the behavior of the launcher and metadat file output changes.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Comment on usage of cmp.Option
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Add comment on Matches interface usage for testing
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Added test for launch.toml decoding branching logic
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Apply suggestions from code review
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Apply suggestions from code review
* fixup! Apply suggestions from code review
* Fix editing daemon settings
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fixing up existing tests
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Remove now unused process specific decode paths
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Remove now unused process specific decode paths
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Remove now unused process specific decode paths
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Remove now unused process specific decode paths
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Remove now unused process specific decode paths
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Remove now unused process specific decode paths
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Clean up more serialization paths
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Remove toml wrapping code
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Added comment on UnmarshalTOML
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Put back code I didn't mean to remove
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Update launch/launch.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* removed line
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Allow storing multiple commands instead of a single string
This is a first step to implementing #322. This PR is updating our internal structs to allow for a slice of commands while keeping the external API and behavior the same. A future PR will implement handling multiple commands depending on the API version and changing the behavior of the launcher and metadat file output changes.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Comment on usage of cmp.Option
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Add comment on Matches interface usage for testing
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Added test for launch.toml decoding branching logic
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Apply suggestions from code review
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Apply suggestions from code review
* fixup! Apply suggestions from code review
* Fix editing daemon settings
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Add GitHub Actions workflow to check if latest lifecycle release is on the latest patch of Go
Also scan the latest lifecycle image to see if any vulnerabilities are alerted
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Pass GH token to step
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update release version for lifecycle image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't create issue if it exists already
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Create issue if CVEs are found
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Upgrade go to 1.18 (#907)
* Use go 1.18 in CI
* Bump deps (except toml)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix process type parsing (#912)
* Use the last part of the path when trying to find matching process. (#903)
* Use the last part of the path when trying to find matching process.
The process was comparing the base path minus the extension, which was blocking types with a `.` in them from ever matching.
Fixes#895
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Upgrade go to 1.18 (#907)
* Use go 1.18 in CI
* Bump deps (except toml)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Test path lookup (#909)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Revert "Merge branch 'release/0.14.2' into jab/fix-process-type-parsing"
This reverts commit 6f56a31733, reversing
changes made to e544937760.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Bump imgutil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
* Use the last part of the path when trying to find matching process.
The process was comparing the base path minus the extension, which was blocking types with a `.` in them from ever matching.
Fixes#895
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* fixup! Use the last part of the path when trying to find matching process.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Upgrade go to 1.18 (#907)
* Use go 1.18 in CI
* Bump deps (except toml)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Test path lookup (#909)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Revert "Merge branch 'release/0.14.2' into jab/fix-process-type-parsing"
This reverts commit 6f56a31733, reversing
changes made to e544937760.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
To be more consistent with the arguments needed by the extender in phase 2
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Ignore .tool-versions for asdf and other tooling
* Allow new buildpack API to use new launch.toml format
- Buildpacks using the newer buildpack API must use the new launch.toml format
- The older format is still allowed on older buildpack API versions
Issue: https://github.com/buildpacks/lifecycle/issues/870
* Update buildpack/build_test.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Update buildpack/build_test.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Update buildpack/build_test.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Added Buildpack 0.10 as valid buildpack API
Fixed tests that were now invalid due to the default buildpack being 0.10
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Apply suggestions from code review
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
* Consolidate logic in the platform package
- Remove the platform/launch package as it is not needed to avoid having the launcher depend on the lifecycle
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Reinstate platform/launch package to keep the launcher binary smaller
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix constant
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Small fixes for Dockerfiles phase 1
* Looks for pre-populated output files in nested directories (e.g., ./generate) instead of the extension root
* Extensions must satisfy all requires they enlisted to provide
* Escape extension ID when locating Dockerfiles
* Resolve analyzed path if not provided
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix assertion
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix more assertions and unwrap errors
Signed-off-by: Natalie Arellano <narellano@vmware.com>
environment variable and/or in-memory keychain should omit it, instead of including it
with an empty header.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add credential helpers for Amazon and Azure
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* When using cloud credential helpers, resolve creds early
If the lifecycle is run as root, after dropping privileges it may not be able
to read cred helper files. By resolving creds in memory when the keychain is
instantiated, we avoid this edge case.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use identity token when provided, instead of ignoring it.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Preserve IdentityToken in AuthConfig
The registry -> header map allows us to reconstruct the AuthConfig when resolving the keychain.
By giving identity tokens a unique header, we are able to distinguish them from registry tokens.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove authConfig -> header -> authConfig round tripping for in-memory keychain
(now resolved keychain).
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Rename env_keychain.go to keychain.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* If rename fails, fall back to copy and delete on Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Rename internal/io to internal/fsutil
This avoids import collisions with go's io package
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* fsutil.Copy explicitly ignores weird edge cases
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Initialized the cache image to add an empty layer in case is needed
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
# This is the commit message #2:
Fixing compilation error caused by imgutil PR #141
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - Initialized the cache image to add an empty layer in case is needed
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Pointing to the latest imgutil empty layer branch
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Updating imgutil version after PR#142 was merged
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Acceptance tests pass with creator commented out
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix creator
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add unit tests for analyze inputs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add scaffold for analyzer builder unit tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add many unit tests, still have some TODOs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Address most TODOs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Acceptance tests pass
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* A few more TODOs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bring back go 1.16
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add unit test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix acceptance tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix units
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove nolint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove unneeded things
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use operations pattern
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Refactor tests to take advantage of operations pattern
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add missing tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Analyzer factory assigns "nop" services by default
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Try to fix registry handler test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move new package from cmd/lifecycle/platform to platform/inputs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Updates per PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Test the platform instead of the exiter
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Combine cmd/lifecycle/platform and platform
With some small changes to avoid an import cycle, we can make a meaningful platform package
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Clean up constructors
Eventually only the platform package should switch on platform api
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove ForAnalyzer struct
Having the analyzer factory take a list of args will ensure we don't forget
to update the creator when things change.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Combine cmd/launcher/platform and platform
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove comment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove spec alias
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move cache metadata back to platform
The lifecycle shouldn't have to depend on the cache package, just the interface
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add comment and remove unused vars
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add test for buildpack incompatibility error
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix typo
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Upgrade to go 1.17
Now that go 1.18 is out, go 1.16 is no longer supported.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix Windows
In go 1.17, child processes do not automatically inherit handles from the parent process.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Builder when validating bomfile media type against buildpack declared type
should strip optional parameter before checking equality
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use mime package to parse type
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Specify windows-2019 since windows-2022 is the default runner now (#816)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bump containerd to v1.5.10 (#822)
- Removes CVEs (CVE-2022-23648 & CVE-2021-43816) reported in containerd 1.5.8 & 1.5.9
Signed-off-by: matthewmcnew <mmcnew@pivotal.io>
* When restoring sbom files, silently ignore if the bp layers directory does not exist (#832)
This can happen when there are sbom files for launch but the cache is empty
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Matthew McNew <mmcnew@pivotal.io>
* Write sbom.legacy.json files for newer platform api
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't print empty bom for platform 0.9
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix function name
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Return empty bom for newer platform
Due to limitations of our TOML library, we can't add MarshalTOML to the top-level struct.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use standard capitalization for sbom
Signed-off-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>
As described in RFC 100, set the following environment variables when
running buildpack executables, which correspond to their positional
arguments.
In `detect`:
- CNB_PLATFORM_DIR
- CNB_BUILD_PLAN_PATH
In `build`:
- CNB_LAYERS_DIR
- CNB_PLATFORM_DIR
- CNB_BP_PLAN_PATH
Fixes#806.
Fixes#807.
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
* Add new flags to analyzer
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Use nop restorer when not supported by the platform.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Pass through skip layers from the creator
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Move empty check inside service
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix failing tests
Signed-off-by: Natalie Arellano <narellano@vmware.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>
* Warn when legacy bom is specified on buildpack API 0.7
as opposed to throwing an error. This allows for non-breaking platform migration from legacy bom table to sbom format
This commit partially reverts 880a801db2
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* Address PR comments
* Add test for top-level bom.version entry
* Don't show warning message if legacy BOM and new SBOM is provided
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* Bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0
Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 0.4.1 to 1.0.0.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v0.4.1...v1.0.0)
---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* Fix deprecation from updated toml library.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Update test to match new error format
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
* Fix slow performance for creator when restoring sbom layer from previous image in daemon
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add info statements and try to fix exporter flake on arm runner
We should at least log something when restoring the sbom layer. This aligns the logging
for sbom with the logging for layer content metadata.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Bumps imgutil and also updates indirect dependencies
The lifecycle and imgutil will be on the same version of ggcr.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Tidy
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix bug where sbom is not restored for launch=true cache=false layers
Because the layer directory does not exist in the build container, the lifecycle
did not bother to look for any sbom files.
This changes `eachDir` to `eachLayer`. Usages of the return value of `eachLayer`
will not fail if the layer directory does not exist.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Unit tests passing
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Acceptance tests passing
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Remove focus
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix format
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Make test setup simpler
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix format
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix volume permissions issue
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Updates from code review && fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Don't fail if failed to remove directory
This is the approach taken by analyzer acceptance and pack.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix bug when layers/sbom is not cleared if -skip-restore is used
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Error when previous bom is specified on buildpack API 0.7
instead of warning
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* Warn when new sbom is specified on buildpack API <0.7
Signed-off-by: Anthony Emengo <aemengo@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>
* first setup
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* unexpected arguments test
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* root user test
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* group toml file tests.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* delete old image after finish
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* add when
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* for delete default file new way
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* default empty group toml for other tests
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* plan toml tests
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* add example buildpack
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* no need cnb_platform_api during docker build
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* some fixme for before production warn
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* windows testing fixme
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* default file location tests are changed.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* no need detect in builder acceptance test
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* plan and order tomls are generated.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* error on verifying buildpack api Group.toml
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* Group and Plan PlaceHolder tests
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* remove unnecesary debug print from actual code.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* better explain
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* builder args are checked in build script
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* add space line 81
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* use func name instead of lines
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* CNB_APP_DIR test fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* CNB_BUILDPACKS_DIR test fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* cnb app dir test gitkeep for empty folder
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* CNB_LAYERS_DIR test fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* WIP: CNB_PLAN_PATH test need to debug.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* delete CNB_GROUP_PATH test
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* CNB_PLAN_PATH test is fixed
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* when-it fixes according to feedback
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* remove test focus
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* remove print
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* Apply suggestions from Natalie
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* Update acceptance/builder_test.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* typo fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* typo fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* for positive test copy and check metadata.toml file
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* change old comments
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* deleted parent when
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* remove cnb_asset env
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* delete unnecessary readme files from buildpack
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* missing new lines.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* delete unnecessary parts of buildpack.toml files
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* CNB_PLATFORM_DIR test
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* comment fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* build files clear unused parts
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* missing new lines
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* platform_dir fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* <layers> test are changed.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* lint errors
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* metadata.toml content for positive scenerio
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* buildpack 2
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* no need gitkeep
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* Update acceptance/builder_test.go
Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* Apply suggestions from code review
Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* suggestions
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* Update acceptance/builder_test.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* delete todo lines
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* positive checks
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* test fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* FIXME comment for windows.
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* remove duplicate function
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* all expected strings are full message
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* empty plan toml test are changed
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* remove focus
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* enable windows test and remove comment lines
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* some gramer issues
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* fix two error string
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* windows test fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* windows fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* Dockerfile fix windows
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* windows fix
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* just skip windows tests rn
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
* skip non-amd64
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
* Remove asset packages
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix env bug
Buildpacks update the environment for other buildpacks, so the same env should
be passed through to each buildpack.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* WIP - refactoring the analyzer tests replacing the 3 docker registries with only one
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - fixing formatting issue
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - fixing some review feedback
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - handling images privileges with a constant
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - updating the test cases to use the latest changes made to docker registry helper
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - Fixing some feedback from review and pointing to the imgUtil repo after the depending PR was merged
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - fixing some compiling issues after resolving conflict with master, but some tests are broken
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - Fixing tests after merging issues
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - renaming variables according to the latest format
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* WIP - adding cleanup statements
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
* Add run image to analyzed.toml, remove as input to exporter
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Update from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Updates for creator
Lock the run image to a digest in analyze function, to avoid duplicating logic in analyzer and creator.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Updates per code review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Updates from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Add TODO
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Cosign lifecycle images
- Sign when they are initially created
- Verify and sign when retagging
- Publish the public key as a release asset
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Check in public key
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Pass cosign password in environment (vs. stdin)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Generate checksums during package
Signed-off-by: Yael Harel <yharel@vmware.com>
* Calculate the sha256 while writing to the file
Signed-off-by: Yael Harel <yharel@vmware.com>
* Add the sha256 artifacts to the release
Signed-off-by: Yael Harel <yharel@vmware.com>
* rename linux to linux-x86-64 in the build and release yml files
Signed-off-by: Yael Harel <yharel@vmware.com>
* Add a new line at the end of each sha file
Signed-off-by: Yael Harel <yharel@vmware.com>
This changes make build to build for linux/amd64, windows/amd64, and
newly, linux/arm64. Binaries are built to paths like
out/$GOOS-$GOARCH/lifecycle, etc.
This also changes the CI image build process to build and attach the
amd64 binary to the build, and to include the linux/arm64 image in the
manifest list.
Acceptance tests were updated to build arch-specific binaries and to
look for them in the new correct place.
Signed-off-by: Jason Hall <jasonhall@redhat.com>
Otherwise the build will fail because secrets are not provided.
We don't intend to push an image, so there is no reason to login.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Also use module-aware go install to install version-pinned Go tooling,
instead of using tools/tools.go, and remove the separate Go module in
tools/
This change requires Go 1.16+ to build, so also update all CI configs to
use 1.16.
Signed-off-by: Jason Hall <jasonhall@redhat.com>
During analyze, Platform 0.7 and above will validate the build and stack image if the data is available to do so.
Addresses: #471
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Moved tests to LayerMetadataRestorer that were not already covered
- Introduced mock and expectations to remaining tests
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
- Requires GHA firewall exception, which was previously added by docker container
- Port is dynamic, as is source (docker containers + localhost) so all traffic must be allowed to the private IP, but public IP is not whitelisted so non-internal traffic will be blocked
Signed-off-by: Micah Young <ymicah@vmware.com>
* Add `make tidy` to init
* Make daemon socket writable
* Bump default timeout for tests in vscode
* Fuzzy match no `sh` executable path in tests
Signed-off-by: Javier Romero <rjavier@vmware.com>
- Adds CI best practices badge
- Documents insecure registries workaround
- Adds basic information for understanding and contributing to lifecycle
Signed-off-by: Natalie Arellano <narellano@vmware.com>
This is more in line with what the restorer does for buildpack api < 0.6 - when the metadata file has
cache=true and it is not in the cache, the file is deleted regardless of the value of launch.
Signed-off-by: Yael Harel <yharel@vmware.com>
The restorer is no longer able to distinguish layers that were marked cache=true in the app metadata
and are not in the cache (for whatever reason) from launch only layers.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
We could update the value of `contents` but it's not necessary and additionally shows that the restorer
prefers metadata that was written by the analyzer to metadata in the cache.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
The k8schain gcp provider is causing lifecycle to hang indefinitely. We believe it is similar to https://github.com/kubernetes/kubernetes/issues/86245. Reverting out this feature until we can reliably bring it back in.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
This helper simplifies running tests against remote Windows daemon from a Unix workstation
- Updates docker cli to 20.10.5
- Adds richgo, docker build compression
Signed-off-by: Micah Young <ymicah@vmware.com>
The launch, build and cache flags are set to false
Make this change to allow the buildpack author to append new values to the flags
instead of changing the existing ones
(according to the toml's spec, there shouldn't be duplicate values)
Signed-off-by: Yael Harel <yharel@vmware.com>
- Fixes cache images create with wrong format
- imgutil WithPlatform initializes OS-specific images
- Windows sim base layers are generated by imgutil instead of lifecycle
Signed-off-by: Micah Young <ymicah@vmware.com>
* Changes test helper signature to group related args
* Adds GHA step to add insecure-registries entry
* Test helpers will use the field to determine registry host
* Changes to use imgutil for authorized/readonly registries
Signed-off-by: Micah Young <ymicah@vmware.com>
- Fixes cache images create with wrong format
- imgutil WithPlatform initializes OS-specific images
- Windows sim base layers are generated by imgutil instead of lifecycle
Signed-off-by: Micah Young <ymicah@vmware.com>
Warn for buildpack API < 0.6 if the flags are in a types table
Error for buildpack API >= 0.6 if the flags are in the top level
Signed-off-by: Yael Harel <yharel@vmware.com>
The `k8schain` returned by `NewNoClient` will allow image authentication paths on public clouds that were previously unsupported without a cred helper.
The `tools/go.sum` changes brought to you by `make tidy`
Resolves: https://github.com/buildpacks/lifecycle/issues/426
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Reduce the number of calls to toml.DecodeFile and checking whether the buildpackAPI version is < or >= 0.6
- Move unsetFlags to be part of EncodeFalseFlags
Signed-off-by: Yael Harel <yharel@vmware.com>
- Set the launch, cache and build flags to false when restoring layer metadata
- Move the build, launch and cache flags into a types table in the toml file for buildpack API >= 0.6
Fail if the flags are at the top level
- For buildpack API < 0.6, the flags should be at the top level of the toml file
Warn and ignore if the flags are in a types table
- The exporter should ignore the launch, build and cache flags if they're not in the right format
- Rename <layers>/<layer> to <layers>/<layer>.ignore for buildpack API >= 0.6 if all of the types flags are set to false
Signed-off-by: Yael Harel <yharel@vmware.com>
Following the existing acceptance test patterns, the new acceptance test will use the test data mounted into an image to prove restorer is properly restoring data as expected.
The contents of the test data was created in-container and copied out of the container using the buildpacks in the testdata folders.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Introduce a new field in metadata.toml - Buildpack-default-process-type
- Remove the default field from each process in metadata.toml
- Sort the processes in metadata.toml alphabetically based on their types
- Don't fall back to old default process if another default buildpack overrided it and then the new default process was overrided by a non-default process
(X default -> Y default -> Y not-default ==> no default process)
Signed-off-by: Daniel Thornton <dwillist@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
Signed-off-by: Daniel Thornton <dwillist@vmware.com>
PlaformAPI and BuildpacksAPI doesn't depend on each other but
for unit tests, we have to set BuildpacksAPI when PlatformAPI is >= 0.5
otherwise exporter::makeBuildReport will fail.
Signed-off-by: Yael Harel <yharel@vmware.com>
Although parsing build.toml and launch.toml as layer descriptors doesn't cause issues if they are valid (because they are incorrectly assumed to be launch=false layers) if something goes wrong while parsing, this code can produce very misleading errors without this fix in place.
Signed-off-by: Emily Casey <ecasey@vmware.com>
If we do this, we can remove much duplication from our test code,
since we'll be testing each piece independently. This will also allow us to easily
add new "fallback" keychains in the future.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Falls back to slower behavior if the daemon does not accept empty layers. This allows the lifecycle to be compatible with podman which requires all layers to be preset during a docker load. buildpacks/imgutil#80
Fixes "manifest.json had unexpected number of entries" errors in analyze, export, and rebase resulting from a bug in our daemon save logic buildpacks/imgutil#63
Signed-off-by: Emily Casey <ecasey@vmware.com>
* rename some variables and add comment for clarity
* change fd3 filename to make clear that it is arbitrary
Signed-off-by: Emily Casey <ecasey@vmware.com>
When using image cache, the commit of new cache deletes the old cache. There is a check for if there is a previous cache image, but that check was happenign after the new cache was written to that tag.
https://github.com/buildpacks/lifecycle/issues/453
Signed-off-by: Jesse Brown <jabrown85@gmail.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>
Implemented as discussed [here](https://github.com/buildpacks/lifecycle/issues/425). Using the `io.buildpacks.stack.mixins` label of the working and new run image, lifecycle will now verify that mixins are present on the new base image prior to the rebase operation.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
* Ensures we use the same versions of GGCR and docker client library as imgutil to help library consumers avoid problems with dependencies
Signed-off-by: Emily Casey <ecasey@vmware.com>
Our magic bash command was mising some important curly brances and therefore the tenth argument was being set to the equivalent of
"${1}0" instead of "${10}".
Resolves#445
Signed-off-by: Emily Casey <ecasey@vmware.com>
Nanoserver 1809 will now be supported through January 2024. Therefore, we should use this image because it is smaller than ltsc2019.
* https://github.com/microsoft/Windows-Containers/issues/52
Signed-off-by: Emily Casey <ecasey@vmware.com>
According to the buildpack API in the CNB Speciication slice path globs should follow the pattern syntac defined in the Go standard library (Follow the pattern syntax defined in the Go standard library.). We were previously translating unix path separators in slice patterns into windows slice separators before matching. This contradicts the wording of the spec. Instead windows path separators should be notated with '\\' as described in the stdlib godoc.
Signed-off-by: Emily Casey <ecasey@vmware.com>
We previous used filepath.Glob for four purposes:
1. Globbing slice files - This was updated to use a combination of filepath.Walk and filepath.Match to match children of the app dir by relative path. We already had logic to unsure that no files outside of the app dir were included. A test was added to confirm this and prevent regressions
2. Globbing profile scripts - This commit changes the implementation so that we no longer use filepath.Glob here
3. Globbing layer.toml files - This commit changes the implementation so that we no longer use filepath.Glob here
4. Test logic - unsafe use of filepath.Glob is unchanged in the test code
Signed-off-by: Emily Casey <ecasey@vmware.com>
This requires extra processing in cmd/version.go because Version when it includes the commit will not contain
'-dirty'.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Without clean, the artifact will be what was built from the acceptance tests
(with a test version) since the source code didn't change between builds.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
- update github-script to the latest version v3.0.0
- refactor packager
- publish the linux and windows lifecycle images after all tests passed (on ubuntu)
- determine download urls for linux and windows in one step
- check that the head sha of the last successful workflow is the last sha
Signed-off-by: Yael Harel <yharel@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
For local development and commits to main, we derive the lifecycle version
from `git describe --tags`.
For new commits to release branches, we derive the lifecycle version
from the branch name.
New commits to main and release branches will trigger a new lifecycle image.
After publishing new releases, the lifecycle image will be re-tagged.
PRs to any branch won't trigger a new lifecycle image.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
```
go get -d github.com/golangci/golangci-lint
go mod tidy
```
Fixed one lint error that popped up after upgrading.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Update matching labels present on both images to value on run image
- Remove matching labels no long present on run image
- Add matching labels that are newly added on run image
- Ignore non-matching labels on both working and run image
Ref #390
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Sets `/s` on `cmd` to use consistent quote interpolation, matching Docker `RUN` syntax and Microsoft-recommended `SHELL` syntax:
From Docker Docs: https://docs.docker.com/engine/reference/builder/#run
> RUN <command> (shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows)
From Microsoft Docs on recommended usage: https://docs.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container#dockerfile
> # Restore the default Windows shell for correct batch processing.
> SHELL ["cmd", "/S", "/C"]
From Microsoft Docs on /s behavior and the legacy corner case it avoids: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd#remarks
- When not using /s, from my understanding, a user can have an ambiguous command when using a binaries with spaces in the name folled by space separated arguments.
Instead of allowing this ambiguous syntax, we should require users to split commands using `args` array. This follows Microsoft and Docker's recommended syntax.
This should have minimal change on existing behavior.
Signed-off-by: Micah Young <ymicah@vmware.com>
- Enables `!VAR!`-style env vars in process `args` with otherwise no change to existing behavior
- Sets `/v:on` on `cmd` to enable usage of env vars set in profile scripts, in the same scope, known as Delayed Expansion
From Microsoft Docs: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd
> If you enable delayed environment variable expansion, you can use the exclamation point character to substitute the value of an environment variable at run time.
Fixes https://github.com/buildpacks/lifecycle/issues/359
No change on existing behavior, besides now interpolating any defined `!VAR!`-style variables that would not have been interpreted before
Signed-off-by: Micah Young <ymicah@vmware.com>
* bumps to new imgutil that always adds security descriptor record
* allow windows image builds on any OS
Signed-off-by: Emily Casey <ecasey@vmware.com>
* Add and strip lifecycle dir from path
* Don't use full paths in entrypoint in tests or warning text
* Test cleanup
Signed-off-by: Emily Casey <ecasey@vmware.com>
For buildpacks with API 0.2, convert metadata version to top level version when constructing the buildpack plan during build
When running detect, always convert top level versions to metadata versions for consistency
Edge cases:
- For buildpacks with API 0.2, if top level version and metadata version are both specified, FAIL if they don’t match
- For buildpacks with API 0.3, if top level version and metadata version are both specified, FAIL
- For buildpacks with API 0.3, if top level version (only) is specified, WARN
Signed-off-by: Natalie Arellano <narellano@vmware.com>
* Uses Normalizing tar writer to fix paths when running on windows
* Move lifecycle.toml to top-level in archive
* Zeros UID/GID
Signed-off-by: Emily Casey <ecasey@vmware.com>
Keep internals of detector simpler, exporting lifecycle error on public members only
Few code typo fixes
Simplified error interface to only a single error until we need multiple
Simplified some case statements and type checking in a couple spots
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
introducing a lifecycle error is desirable to allow for finer grained error handling for eventual status code mapping.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Builpacks which do not return pass (`0`) or fail (`100`) will now have their output as well as the resulting `err` message logged at info level.
[Issue](https://github.com/buildpacks/lifecycle/issues/283)
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Docker copy removes file attributes for windows symlink directories that need to be preserved for certain tests
Signed-off-by: Emily Casey <ecasey@vmware.com>
* Add matched symlinks to the slice instead of the resolved target
* Slice layers should not include files globbing through a symlink
* Only clean up links to dirs, not the target dirs
* Normalize uid/gid of the parents of a matched file only if they are within the app dir
Signed-off-by: Emily Casey <ecasey@vmware.com>
Could still be improved by:
- Only rebuilding launcher when go files that launcher needs
have changed
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Include process type specific paths when processing profile.d scripts during launch.
Spec: https://github.com/buildpacks/spec/pull/98
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Include process type specific paths when processing env vars during launch.
Spec: https://github.com/buildpacks/spec/pull/98
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Skips all non-Files-prefixed entries
- Make test fixture clearer
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Malini Valliath <mvalliath@pivotal.io>
- More robust 'Files' prefix trimming
- Skip 'Hives' paths instead of trimming
- Make tests easier to debug
- Some minor test cleanup
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
- launcher increased in size due `runtime` import for `GOOS` detection
- inlined commands do not work well on Windows
Signed-off-by: Micah Young <ymicah@vmware.com>
- the Files/ Hives/ directories must be trimmed of the container image
layer before writing to the container filesystem
- Untar() -> UntarLayer() to justify adding container specific behavior
Signed-off-by: Anthony Emengo <anthonyemengojr@gmail.com>
- Pending discussion on how to handle potential Docker-in-Docker needs for build-linux
- Will open separate PR once other work is merged
Signed-off-by: Micah Young <ymicah@vmware.com>
* Default branch will be renamed from master to main
* Points GHA to main branch
* Removes references to master branch from test data
Signed-off-by: Emily Casey <ecasey@pivotal.io>
With the reproducibility improvements, it often happens that the old and
new cache images are the same. The original image should not be
deleted in this case.
This is an issue with remote images, where the image is deleted by
digest and both the old and new images share the same digest.
Signed-off-by: Lukas Berger <bergerl@google.com>
2020-06-01 16:08:52 -07:00
784 changed files with 44210 additions and 10624 deletions
<!--- Please provide a general summary of the issue. -->
<!-- Please provide a general summary of the issue. -->
---
@ -15,17 +17,20 @@ assignees: ''
### Reproduction
##### Steps
<!--- What steps should be taken to reproduce the issue? -->
<!-- What steps should be taken to reproduce the issue? -->
1.
2.
3.
##### Current behavior
<!--- What happened? Logs, etc. could go here. -->
<!-- What happened? Logs, etc. could go here. -->
##### Expected behavior
<!-- What did you expect to happen? -->
##### Expected
<!--- What did you expect to happen? -->
---
@ -33,10 +38,15 @@ assignees: ''
### Context
##### lifecycle version
<!--- If you can find this, it helps us pin down the issue. For example, run `pack inspect-builder BUILDER` which should report the lifecycle version in question. -->
<!-- If you can find this, it helps us pin down the issue. For example, run `pack builder inspect <builder name>` which should report the lifecycle version in question. -->
##### platform version(s)
<!--- For example run `pack report` and `docker info` and copy output here. -->
<!-- For example run `pack report` and `docker info` and copy output here, redacting any sensitive information. -->
##### anything else?
<!--- Tekton task version, kpack version, etc. -->
<!-- Add any other context that may help (e.g., Tekton task version, kpack version, etc.). -->
search_output=$(gh issue list --search "$title" --label "$label")
body="Latest lifecycle release v${{ steps.read-versions.outputs.latest-release-version }} is built with Go version ${{ steps.read-versions.outputs.latest-release-go-version }}; newer version ${{ steps.read-versions.outputs.latest-go-version }} is available."
if [ -z "${search_output// }" ]
then
echo "No issues matched search; creating new issue..."
tar xzvf ${{ env.ARTIFACTS_PATH }}/lifecycle-v${{ env.LIFECYCLE_VERSION }}+linux.x86-64.tgz -C tmp/
echo "GO_VERSION=$(go version tmp/lifecycle/lifecycle | cut -d ' ' -f 2 | sed -e 's/^go//')" >> $GITHUB_ENV
- name:Set release body text
run:|
cat << EOF > body.txt
# lifecycle v${{ env.LIFECYCLE_VERSION }}
Welcome to v${{ env.LIFECYCLE_VERSION }}, a ${{ env.RELEASE_KIND }} of the Cloud Native Buildpacks Lifecycle.
## Prerequisites
The lifecycle runs as a normal user in a series of unprivileged containers. To export images and cache image layers, it requires access to a Docker (compatible) daemon **or** an OCI registry.
## Install
Extract the .tgz file and copy the lifecycle binaries into a [build image](https://github.com/buildpacks/spec/blob/main/platform.md#build-image). The build image can then be orchestrated by a platform implementation such as the [pack CLI](https://github.com/buildpack/pack) or [tekton](https://github.com/tektoncd/catalog/tree/main/task/buildpacks).
## Lifecycle Image
An OCI image containing the lifecycle binaries is available at buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}.
We welcome contributions to this repository! To get a sense of what the team is currently focusing on, check out our [milestones](https://github.com/buildpacks/lifecycle/milestones). Issues labeled [good first issue](https://github.com/buildpacks/lifecycle/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and issues in our [docs repo](https://github.com/buildpacks/docs/issues?q=is%3Aissue+is%3Aopen+label%3Ateam%2Fimplementations) are great places to get started, but you are welcome to work on any issue that interests you. For issues requiring a greater degree of coordination, such as those labeled `status/needs-discussion` or that are part of larger epics, please reach out in the #implementation channel in [Slack](https://slack.buildpacks.io/).
### Development
Aside from the policies above, you may find [DEVELOPMENT.md](DEVELOPMENT.md) helpful in developing in this repository.
### Background
Here are some topics that might be helpful in further understanding the lifecycle:
* Cloud Native Buildpacks platform api spec
* Example platforms: [pack CLI](https://github.com/buildpack/pack), [Tekton](https://github.com/tektoncd/catalog/blob/master/task/buildpacks/0.1/README.md)
* Cloud Native Buildpacks buildpack api spec
* Example buildpack providers: [Google](https://github.com/GoogleCloudPlatform/buildpacks), [Heroku](https://www.heroku.com/), [Paketo](https://paketo.io/)
* The Open Container Initiative (OCI) and [OCI image spec](https://github.com/opencontainers/image-spec)
* Questions to deepen understanding:
* What are the different [lifecycle phases](https://buildpacks.io/docs/concepts/components/lifecycle/)? What is the purpose of each phase?
* What is a [builder](https://buildpacks.io/docs/concepts/components/builder/)? Is it required to run the lifecycle?
* What is the [untrusted builder workflow](https://medium.com/buildpacks/faster-more-secure-builds-with-pack-0-11-0-4d0c633ca619)? Why do we have this flow?
* What is the [launcher](https://github.com/buildpacks/spec/blob/main/platform.md#launch)? Why do we have a launcher?
* What does a [buildpack](https://buildpacks.io/docs/concepts/components/buildpack/) do? Where does it write data? How does it communicate with the lifecycle?
* What does a [platform](https://buildpacks.io/docs/concepts/components/platform/) do? What things does it know about that the lifecycle does not? How does it communicate with the lifecycle?
* What is a [stack](https://buildpacks.io/docs/concepts/components/stack/)? Who produces stacks? Why is the stack concept important for the lifecycle?
* The acceptance tests require the docker daemon to be able to communicate with a local containerized insecure registry. On Docker Desktop 3.3.x, this may result in failures such as: `Expected nil: push response: : Get http://localhost:<port>/v2/: dial tcp [::1]:<port>: connect: connection refused`. To fix these failures, it may be necessary to add the following to the Docker Desktop Engine config:
* macOS: Docker > Preferences > Docker Engine:
```
"insecure-registries": [
"<my-host-ip>/32"
]
```
### Testing GitHub actions on forks
The lifecycle release process involves chaining a series of GitHub actions together such that:
* The "build" workflow creates the artifacts
* .tgz files containing the lifecycle binaries, shasums for the .tgz files, an SBOM, etc.
* OCI images containing the lifecycle binaries, tagged with their commit sha (for more information, see RELEASE.md)
* The "draft-release" workflow finds the artifacts and downloads them, creating the draft release
* The "post-release" workflow re-tags the OCI images that were created during the "build" workflow with the release version
It can be rather cumbersome to test changes to these workflows, as they are heavily intertwined. Thus we recommend forking the buildpacks/lifecycle repository in GitHub and running through the entire release process end-to-end.
For the fork, it is necessary to add the following secrets:
* DOCKER_PASSWORD (if not using ghcr.io)
* DOCKER_USERNAME (if not using ghcr.io)
The tools/test-fork.sh script can be used to update the source code to reflect the state of the fork.
It can be invoked like so: `./tools/test-fork.sh <registry repo name>`
## Tasks
To test, build, and package binaries into an archive, simply run:
```bash
$ make all
```
This will create archives at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz` and `out/lifecycle-<LIFECYCLE_VERSION>+windows.x86-64.tgz`.
`LIFECYCLE_VERSION` defaults to the value returned by `git describe --tags` if not on a release branch (for more information about the release process, see [RELEASE](RELEASE.md)). It can be changed by prepending `LIFECYCLE_VERSION=<some version>` to the
`make` command. For example:
```bash
$ LIFECYCLE_VERSION=1.2.3 make all
```
Steps can also be run individually as shown below.
### Test
Formats, vets, and tests the code.
```bash
$ make test
```
#### Mocks
We use mock generators like most golang projects to help with our testing. To make new mocks:
```bash
$ make generate
$ make format lint
```
This is because the mock generator will make a larger diff that the formatter will fix.
### Build
Builds binaries to `out/linux/lifecycle/` and `out/windows/lifecycle/`.
```bash
$ make build
```
> To clean the `out/` directory, run `make clean`.
### Package
Creates archives at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz` and `out/lifecycle-<LIFECYCLE_VERSION>+windows.x86-64.tgz`, using the contents of the
`out/linux/lifecycle/` directory, for the given (or default) `LIFECYCLE_VERSION`.
This image is maintained by the [Cloud Native Buildpacks project](https://buildpacks.io/). The maintainers can be contacted via the [Cloud Native Buildpacks Slack](https://slack.buildpacks.io/), or by opening an issue on the `buildpacks/lifecycle` [GitHub repo](https://github.com/buildpacks/lifecycle).
# Supported tags
Supported tags are semver-versioned manifest lists - e.g., `0.12.0` or `0.12.0-rc.1`, pointing to one of the following os/architectures:
* `linux/amd64`
* `linux/arm64`
# About this image
Images are built in [GitHub actions](https://github.com/buildpacks/lifecycle/actions) and signed with [`cosign`](https://github.com/sigstore/cosign). To verify:
* `exporter` - Creates an image and caches layers.
Or:
* `creator` - Runs the five phases listed above in order.
### Run
* `launcher` - invokes choice of process
* `launcher` - Invokes a chosen process.
### Rebase
* `rebaser` - remotely patches images with new base image
* `rebaser` - Creates an image from a previous image with updated base layers.
## Development
To test, build, and package binaries into an archive, simply run:
```bash
$ make all
```
This will create an archive at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz`.
`LIFECYCLE_VERSION` defaults to the value in the `VERSION` file at the root of the repo . It can be changed by prepending `LIFECYCLE_VERSION=<some version>` to the
`make` command. For example:
```bash
$ LIFECYCLE_VERSION=1.2.3 make all
```
Steps can also be run individually as shown below.
### Test
Formats, vets, and tests the code.
```bash
$ make test
```
### Build
Builds binaries to `out/linux/lifecycle/`.
```bash
$ make build
```
> To clean the `out/` directory, run `make clean`.
### Package
Creates an archive at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz`, using the contents of the
`out/linux/lifecycle/` directory, for the given (or default) `LIFECYCLE_VERSION`.
```bash
$ make package
```
## Contributing
- [CONTRIBUTING](CONTRIBUTING.md) - Information on how to contribute and grow your understanding of the lifecycle.
- [DEVELOPMENT](DEVELOPMENT.md) - Further detail to help you during the development process.
- [RELEASE](RELEASE.md) - Further details about our release process.
* For newly supported Platform or Buildpack API versions, or breaking changes (e.g., API deprecations).
#### Pre-release aka release candidate
* Ideally we should ship a pre-release (waiting a few days for folks to try it out) before we ship a new minor.
* We typically don't ship pre-releases for patches or backports.
#### New patch
* For go version updates, CVE fixes / dependency bumps, bug fixes, etc.
* Review the latest commits on `main` to determine if any are unacceptable for a patch - if there are commits that should be excluded, branch off the latest tag for the current minor and cherry-pick commits over.
#### Backport
* New patch for an old minor. Typically, to help folks out who haven't yet upgraded from [unsupported APIs](https://github.com/buildpacks/rfcs/blob/main/text/0110-deprecate-apis.md).
* For go version updates, CVE fixes / dependency bumps, bug fixes, etc.
* Branch off the latest tag for the desired minor.
## Release Finalization Steps
### Step 1 - Prepare
Determine the type of release ([new minor](#new-minor), [pre-release](#pre-release-aka-release-candidate), [new patch](#new-patch), or [backport](#backport)) and prepare the branch accordingly.
**To prepare the release branch:**
1. Check open PRs for any dependabot updates that should be merged.
1. Create a release branch in the format `release/0.99.0-rc.1` (for pre-releases) or `release/0.99.0` (for final releases).
* New commits to this branch will trigger the `build` workflow and produce a lifecycle image: `buildpacksio/lifecycle:<commit sha>`.
1. If applicable, ensure the README is updated with the latest supported apis (example PR: https://github.com/buildpacks/lifecycle/pull/550).
* For final releases (not pre-releases), remove the pre-release note (`*`) for the latest apis.
**For final releases (not pre-releases):**
1. Ensure the relevant spec APIs have been released.
1. Ensure the `lifecycle/0.99.0` milestone on the [docs repo](https://github.com/buildpacks/docs/blob/main/RELEASE.md#lump-changes) is complete, such that every new feature in the lifecycle is fully explained in the `release/lifecycle/0.99` branch on the docs repo, and [migration guides](https://github.com/buildpacks/docs/tree/main/content/docs/reference/spec/migration) (if relevant) are included.
### Step 2 - Publish the Release
1. Manually trigger the `draft-release` workflow: Actions -> draft-release -> Run workflow -> Use workflow from branch: `release/<release version>`. This will create a draft release on GitHub using the artifacts from the `build` workflow run for the latest commit on the release branch.
1. Edit the release notes as necessary.
1. Perform any manual validation of the artifacts as necessary (usually none).
1. Edit the release page and click "Publish release".
* This will trigger the `post-release` workflow that will re-tag the lifecycle image from `buildpacksio/lifecycle:<commit sha>` to `buildpacksio/lifecycle:<release version>`.
* For final releases ONLY, this will also re-tag the lifecycle image from `buildpacksio/lifecycle:<commit sha>` to `buildpacksio/lifecycle:latest`.
### Step 3 - Follow-up
**For pre-releases:**
* Ask the relevant teams to try out the pre-released artifacts.
**For final releases:**
* Update the `main` branch to remove the pre-release note in [README.md](https://github.com/buildpacks/lifecycle/blob/main/README.md) and/or merge `release/0.99.0` into `main`.
* Ask the learning team to merge the `release/lifecycle/0.99` branch into `main` on the docs repo.
## Go version updates
Go version updates should be released as a [new minor](#new-minor) or [new patch](#new-patch) release.
### New Patch
If the go patch is in [actions/go-versions](https://github.com/actions/go-versions/pulls?q=is%3Apr+is%3Aclosed) then CI should pull it in automatically without any action needed.
We simply need to create the release branch and let the pipeline run.
### New Minor
We typically do this when the existing patch version exceeds 6 - e.g., `1.22.6`. This means we have about 6 months to upgrade before the current minor becomes unsupported due to the introduction of the new n+2 minor.
#### Steps
1. Update go.mod
1. Search for the old `major.minor`, there are a few files that need to be updated (example PR: https://github.com/buildpacks/lifecycle/pull/1405/files)
1. Update the linter to a version that supports the current `major.minor`
h.AssertStringContains(t,output,fmt.Sprintf("Copying SBOM lifecycle.%s to %s",extension,filepath.Join(path.RootDir,"layers","sbom","build","buildpacksio_lifecycle",extension)))
h.AssertStringContains(t,output,fmt.Sprintf("Copying SBOM launcher.%s to %s",extension,filepath.Join(path.RootDir,"layers","sbom","launch","buildpacksio_lifecycle","launcher",extension)))
h.AssertEq(t,inspect.Config.Labels["io.buildpacks.rebasable"],"false")// from testdata/exporter/container/layers/some-extended-dir/run/sha256_<sha>/blobs/sha256/<config>
t.Log("Adds extension layers")
typetestCasestruct{
expectedDiffIDstring
layerIndexint
}
testCases:=[]testCase{
{
expectedDiffID:"sha256:fb54d2566824d6630d94db0b008d9a544a94d3547a424f52e2fd282b648c0601",// from testdata/exporter/container/layers/some-extended-dir/run/sha256_<c72eda1c>/blobs/sha256/65c2873d397056a5cb4169790654d787579b005f18b903082b177d4d9b4aecf5 after un-compressing and zeroing timestamps
layerIndex:1,
},
{
expectedDiffID:"sha256:1018c7d3584c4f7fa3ef4486d1a6a11b93956b9d8bfe0898a3e0fbd248c984d8",// from testdata/exporter/container/layers/some-extended-dir/run/sha256_<c72eda1c>/blobs/sha256/0fb9b88c9cbe9f11b4c8da645f390df59f5949632985a0bfc2a842ef17b2ad18 after un-compressing and zeroing timestamps
h.AssertStringContains(t,output,"Skipping reuse for layer corrupted_buildpack:corrupted-layer: expected layer contents to have SHA 'sha256:258dfa0cc987efebc17559694866ebc91139e7c0e574f60d1d4092f53d7dff59'; found 'sha256:9e0b77ed599eafdab8611f7eeefef084077f91f02f1da0a3870c7ff20a08bee8'")
h.AssertEq(t,configFile.Config.Labels["io.buildpacks.rebasable"],"false")// from testdata/exporter/container/layers/some-extended-dir/run/sha256_<sha>/blobs/sha256/<config>
t.Log("Adds extension layers")
layers,err=remoteImage.Layers()
h.AssertNil(t,err)
typetestCasestruct{
expectedDigeststring
layerIndexint
}
testCases:=[]testCase{
{
expectedDigest:"sha256:08e7ad5ce17cf5e5f70affe68b341a93de86ee2ba074932c3a05b8770f66d772",// from testdata/exporter/container/layers/some-extended-dir/run/sha256_<c72eda1c>/blobs/sha256/65c2873d397056a5cb4169790654d787579b005f18b903082b177d4d9b4aecf5 after un-compressing, zeroing timestamps, and re-compressing
layerIndex:1,
},
{
expectedDigest:"sha256:0e74ef444ea437147e3fa0ce2aad371df5380c26b96875ae07b9b67f44cdb2ee",// from testdata/exporter/container/layers/some-extended-dir/run/sha256_<c72eda1c>/blobs/sha256/0fb9b88c9cbe9f11b4c8da645f390df59f5949632985a0bfc2a842ef17b2ad18 after un-compressing, zeroing timestamps, and re-compressing
layerIndex:2,
},
}
for_,tc:=rangetestCases{
layer:=layers[tc.layerIndex]
digest,err:=layer.Digest()
h.AssertNil(t,err)
h.AssertEq(t,digest.String(),tc.expectedDigest)
}
t.Log("sets the layers metadata label according to the new spec")
h.AssertStringDoesNotContain(t,secondOutput,"ca-certificates")// shows that first cache layer was used
h.AssertStringDoesNotContain(t,secondOutput,"No cached layer found for cmd RUN apt-get update && apt-get install -y tree")// shows that second cache layer was used
h.AssertStringContains(t,secondOutput,"Hello Extensions buildpack\ncurl")// output by buildpack, shows that curl is still installed in the unpacked cached layer
})
})
when("extending the run image",func(){
it.Before(func(){
h.SkipIf(t,api.MustParse(platformAPI).LessThan("0.12"),"Platform API < 0.12 does not support run image extension")
h.AssertStringDoesNotContain(t,secondOutput,"ca-certificates")// shows that first cache layer was used
h.AssertStringDoesNotContain(t,secondOutput,"No cached layer found for cmd RUN apt-get update && apt-get install -y tree")// shows that second cache layer was used