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>
2023-02-08 16:21:05 -05:00
515 changed files with 16562 additions and 12722 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-go.outputs.latest-release-version }} is built with Go version ${{ steps.read-go.outputs.latest-release-go-version }}; newer version ${{ steps.read-go.outputs.latest-go-version }} is available."
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."
body="Latest lifecycle release v${{ steps.read-go.outputs.latest-release-version }} triggered CVE(s) from Grype. For further details, see: $GITHUB_WORKFLOW_URL"
body="Latest lifecycle release v${{ steps.read-versions.outputs.latest-release-version }} triggered CVE(s) from Grype. For further details, see: $GITHUB_WORKFLOW_URL json: $(cat ${{ steps.scan-image.outputs.json }} | jq '.matches[] | .vulnerability | {id, severity, description}' )"
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 **beta** ${{ env.RELEASE_KIND }} of the Cloud Native Buildpacks Lifecycle.
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 daemon **or** Docker registry.
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 stack base image](https://github.com/buildpack/spec/blob/master/platform.md#stacks). 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/blob/master/task/buildpacks/0.1/README.md).
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 }}.
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, a cosign public key, an SBOM, etc.
* .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:
* COSIGN_PASSWORD (see [cosign](https://github.com/sigstore/cosign#generate-a-keypair))
* COSIGN_PRIVATE_KEY
* 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> <path to cosign public key>`
It can be invoked like so: `./tools/test-fork.sh <registry repo name>`
## Tasks
@ -77,6 +75,16 @@ Formats, vets, and tests the code.
$ 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/`.
@ -7,23 +7,28 @@ This image is maintained by the [Cloud Native Buildpacks project](https://buildp
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`
* `windows/amd64`
# 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:
* Locate the public key `lifecycle-v<tag>-cosign.pub` on the [releases page](https://github.com/buildpacks/lifecycle/releases)
* 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).
1. Create a release branch in the format `release/0.99.0-rc.1`. New commits to this branch will trigger the `build` workflow and produce a lifecycle image: `buildpacksio/lifecycle:<commit sha>`.
1. When ready to cut the release, manually trigger the `draft-release` workflow: Actions -> draft-release -> Run workflow -> Use workflow from branch: `release/0.99.0-rc.1`. 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.
1. When ready to publish the release, 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:0.99.0` but will NOT update the `latest` tag.
* For final releases (not pre-releases), remove the pre-release note (`*`) for the latest apis.
To cut a release:
**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.
1. Create a release branch in the format `release/0.99.0`. 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) and remove the pre-release note for the latest apis.
1. When ready to cut the release, manually trigger the `draft-release` workflow: Actions -> draft-release -> Run workflow -> Use workflow from branch: `release/0.99.0`. This will create a draft release on GitHub using the artifacts from the `build` workflow run for the latest commit on the release branch.
### 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.
1. When ready to publish the release, 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:0.99.0` and `buildpacksio/lifecycle:latest`.
1. Once released
- 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.
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.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.AssertStringContains(t,firstOutput,"Hello Extensions buildpack\ncurl")// output by buildpack, shows that curl was installed on the build image
t.Log("sets environment variables from the extended build image in the build context")
@ -146,12 +170,119 @@ func testExtenderFunc(platformAPI string) func(t *testing.T, when spec.G, it spe
h.WithFlags(extendFlags...),
h.WithArgs(extendArgs...),
)
h.AssertStringDoesNotContain(t,secondOutput,"Did not find cache key, pulling remote image...")
h.AssertStringDoesNotContain(t,secondOutput,"Error while retrieving image from cache: oci")
h.AssertStringDoesNotContain(t,secondOutput,"ca-certificates")// shows that 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
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