Commit Graph

72 Commits

Author SHA1 Message Date
Jesse Brown 60a94c4b03
Update linter
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-02-28 12:03:32 -06:00
Jesse Brown 60bf07f8de
Remove Windows Support
I took a swing at removing any and all references to windows in this reference implementation.

Lifecycle no longer outputs a windows binary as a release artifact
Lifecycle no longer operates against windows containers

https://github.com/buildpacks/rfcs/pull/311
https://medium.com/buildpacks/deprecation-announcement-windows-container-feature-in-cloud-native-buildpacks-bbb70351343d

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2024-12-10 16:56:29 -06:00
Natalie Arellano 4d5a1b4437
Recover corrupted volume cache (#1410)
* 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>
2024-10-24 10:37:00 -04:00
Natalie Arellano df6be88240
Recover corrupted cache (#1381)
* 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>
2024-07-17 10:39:20 -04:00
Natalie Arellano 33c5b89004
Consolidate methods that read and write platform spec'd TOML (#1236)
* 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>
2023-11-03 14:17:52 -04:00
Natalie Arellano 6c7d16a718
Move lifecycle package to sub-directory (#1205)
* Move files

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

* Fix imports

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

* Update mockgen directives

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

* WIP: add TODOs

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

* Rename lifecycle -> phase

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

* Address TODOs by adding comments

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

* Update phase/handlers.go

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-26 11:30:50 -04:00
Natalie Arellano 7fda8e271f
Don't print 'Ignoring cache image "cache-image-name" because it was corrupt' (#1185)
when the cache image is not found

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-08-23 09:54:12 -04:00
Domenico Luciani 9f7f501b95
Remove async go-subroutine delete keeping it sync (#1152)
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
2023-07-13 16:08:06 -04:00
Domenico Luciani 9c455eb4dd
Stop deleting cache images (#1136)
* 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>
2023-07-12 17:31:30 -04:00
Natalie Arellano 5ae441444e
Fixes from user testing (#1117)
* 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>
2023-06-08 14:34:47 -04:00
Natalie Arellano 89a1cfebef
Add history when adding buildpack or extension layers (#1099)
* 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>
2023-05-30 14:35:39 -04:00
Matthew Robertson e9072582a6
Validate the cache image and previous image in the analyze phase (#1060)
* 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>
2023-05-09 11:58:53 -04:00
Harshal Mittal 6a10b63c67
Replace print with logger in image_cache.go, fixes formatting (#1012)
* Replace print with logger in image_cache.go, fixes formatting

Signed-off-by: Harshal Mittal <harshalmittal4@gmail.com>

* Add tests for image_cache logger

Signed-off-by: Harshal Mittal <harshalmittal4@gmail.com>

---------

Signed-off-by: Harshal Mittal <harshalmittal4@gmail.com>
2023-02-21 10:25:04 -05:00
Natalie Arellano 8040b9cccb
Fix creator acceptance test flake (#990)
* Use launch cache when calling SaveAs on caching image

- Failure to use the launch cache will result in slower second builds,
  due to the time it takes to pull layers from the daemon
- Improve creator acceptance test

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

* Try to make test less flakey by forcing first build to be slower

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-01-26 10:08:25 -05:00
Michael de Senna 6a2b4bfd54
ci(lint): address most staticcheck alarms (#940)
* ci(lint): auto lint fixes

Signed-off-by: Michael de Senna <desenna@gmail.com>

* fix: replace deprecated funcs

Signed-off-by: Michael de Senna <desenna@gmail.com>

* ci(lint): fix many io/ioutil staticcheck

Signed-off-by: Michael de Senna <desenna@gmail.com>

* fix: import os

Signed-off-by: Michael de Senna <desenna@gmail.com>

Signed-off-by: Michael de Senna <desenna@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2022-10-25 17:48:29 -04:00
Natalie Arellano 141d74b0a7
If rename fails, fall back to copy and delete on Windows (#856)
* If rename fails, fall back to copy and delete on Windows

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

* Rename internal/io to internal/fsutil

This avoids import collisions with go's io package

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

* fsutil.Copy explicitly ignores weird edge cases

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-05-05 16:17:03 -04:00
Juan Bustamante bb40e22710
Add empty layer before saving on remote images (#852)
Initialized the cache image to add an empty layer in case is needed

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>

# This is the commit message #2:

Fixing compilation error caused by imgutil PR #141

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>

* WIP - Initialized the cache image to add an empty layer in case is needed

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>

* Pointing to the latest imgutil empty layer branch

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>

* Updating imgutil version after PR#142 was merged

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
2022-05-04 13:37:42 -04:00
Natalie Arellano 86d84b37ee
Move logic out of cmd/lifecycle/analyzer.go (#805)
* Acceptance tests pass with creator commented out

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

* Fix creator

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

* Add unit tests for analyze inputs

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

* Add scaffold for analyzer builder unit tests

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

* Add many unit tests, still have some TODOs

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

* Address most TODOs

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

* Acceptance tests pass

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

* A few more TODOs

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

* Bring back go 1.16

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

* Add unit test

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

* Fix acceptance tests

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

* Fix units

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

* Remove nolint

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

* Remove unneeded things

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

* Use operations pattern

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

* Refactor tests to take advantage of operations pattern

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

* Add missing tests

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

* Fix lint

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

* Analyzer factory assigns "nop" services by default

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

* Try to fix registry handler test

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

* Move new package from cmd/lifecycle/platform to platform/inputs

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

* Updates per PR review

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

* Test the platform instead of the exiter

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

* Combine cmd/lifecycle/platform and platform

With some small changes to avoid an import cycle, we can make a meaningful platform package

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

* Clean up constructors

Eventually only the platform package should switch on platform api

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

* Remove ForAnalyzer struct

Having the analyzer factory take a list of args will ensure we don't forget
to update the creator when things change.

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

* Combine cmd/launcher/platform and platform

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

* Remove comment

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

* Remove spec alias

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

* Move cache metadata back to platform

The lifecycle shouldn't have to depend on the cache package, just the interface

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

* Add comment and remove unused vars

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

* Add test for buildpack incompatibility error

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

* Fix typo

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-05-04 11:45:26 -04:00
Mikey Boldt 6f56a15303
Fix lint issues (#787)
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
2022-01-03 11:45:29 -05:00
Yael Harel 2186200870
Move the layer metadata restorer and the layer sha store to a new package (#724)
* Move the layer metadata restorer and the layer sha store to a new package

Signed-off-by: Yael Harel <yharel@vmware.com>

* Remove code duplication of WriteTOML

Signed-off-by: Yael Harel <yharel@vmware.com>

* Create a utils package

Move most of utils.go and the function WriteTOML there

Signed-off-by: Yael Harel <yharel@vmware.com>

* Refactor the new utils package

Signed-off-by: Yael Harel <yharel@vmware.com>

* Make layermetadata an internal package

Signed-off-by: Yael Harel <yharel@vmware.com>

* Move the imageutils files to the image package

Signed-off-by: Yael Harel <yharel@vmware.com>

* Make encoding an internal package

Signed-off-by: Yael Harel <yharel@vmware.com>

* Add the ReadGroup test

Signed-off-by: Yael Harel <yharel@vmware.com>

* Delete image/utils_test.go

WriteTOML that was tested there  moved to the internal/encoding package

Signed-off-by: Yael Harel <yharel@vmware.com>

* Updates to #724 (layer metadata restorer) (#753)

* Merge main

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

* Rename layermetadata to layer

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

* Rename layer metadata restorer

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

* WIP - layers.go has all dependencies on buildpack

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

* WIP

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

* Fix imports

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

* Move some things back to lifecycle package and make str package internal

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

* Rename variable

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

* Make helper function private

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

* Small fix

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

* Fix

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

* Make structs and interface private

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

* Consolidate logic for layer metadata file

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

* Remove unneeded file

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

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-12-01 15:04:19 -05:00
Micah Young b592348df2
Merge branch 'main' into fix/analyzer-acceptance-windows 2021-03-25 11:16:25 -04:00
Natalie Arellano 2fd733bf29 Merge branch 'main' into add-gosec 2021-03-25 10:40:24 -04:00
Natalie Arellano 4624a8a5bf Skip only specific errors
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-24 16:55:12 -04:00
Micah Young 6d87ea6b02 Merge branch 'main' into fix/analyzer-acceptance-windows
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-22 09:55:34 -04:00
Natalie Arellano 5309991f67
Merge pull request #537 from buildpacks/opt-in-layer-caching
Opt in layer caching
2021-03-18 16:14:55 -04:00
Natalie Arellano ab0c8e9351 Turn on gosec
- test-only changes + nolint

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-18 13:51:46 -04:00
Micah Young 9aa0691529 Fixes signature for NewImageCache
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-17 12:17:19 -04:00
Micah Young 9ec3ad471b Removes uneeded temp dir
- Generated layers are handled by imgutil

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-17 12:17:19 -04:00
Micah Young 1fb3be6157 Bumps imgutil and latest registry helpers
- Use dual registries with shared data volume to test no-auth registries

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-17 12:17:19 -04:00
Micah Young 1defe582bd Update cache/image_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-17 12:16:41 -04:00
Micah Young 619a8366ce Changes to new image image constructors
- Fixes cache images create with wrong format
- imgutil WithPlatform initializes OS-specific images
- Windows sim base layers are generated by imgutil instead of lifecycle

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-17 12:16:41 -04:00
Micah Young 068224cb8c Fixes cache image with incorrect OS on windows
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-17 12:14:49 -04:00
Micah Young 2c5bfa049b Removes uneeded temp dir
- Generated layers are handled by imgutil

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 07:35:33 -04:00
Micah Young 52d2a503da Bumps imgutil and latest registry helpers
- Use dual registries with shared data volume to test no-auth registries

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 07:35:33 -04:00
Micah Young bc872621c9 Update cache/image_cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 07:35:33 -04:00
Micah Young 08d1e30e5a Changes to new image image constructors
- Fixes cache images create with wrong format
- imgutil WithPlatform initializes OS-specific images
- Windows sim base layers are generated by imgutil instead of lifecycle

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 07:35:33 -04:00
Micah Young 5403362835 Fixes cache image with incorrect OS on windows
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 07:35:33 -04:00
Javier Romero 99f42f5a95 Refactoring - create an EncoderDecoder interface
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-04 16:17:09 -05:00
Natalie Arellano 1e2b2d69a5 Move buildpack code into own package
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-02-16 09:57:48 -05:00
Natalie Arellano 6c6aba167b Updates from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 18:10:47 -05:00
Yael Harel 0207fb5f86 Resolve auth before dropping privileges
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-12-10 16:39:18 -05:00
Jesse Brown c0e33588c4
fix: Do not delete cache-img if the cache-img did not exist
When using image cache, the commit of new cache deletes the old cache. There is a check for if there is a previous cache image, but that check was happenign after the new cache was written to that tag.

https://github.com/buildpacks/lifecycle/issues/453
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-11-20 13:26:11 -06:00
Emily Casey e461c2ccfb Fixes test cleanup error on windows
* Ensures all opened files are properly closed.
* Bumps imgutil

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-08 11:30:24 -04:00
Emily Casey 60ddd29baf Enable errcheck
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-06 18:53:30 -04:00
Andrew Meyer 34742312b7 Test cleanup
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 79dc3aefd2 Strip 'sha256:' for Windows only
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Anthony Emengo 951f092bac Add ability to export Windows-based images
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
Signed-off-by: Micah Young <ymicah@vmware.com>
2020-06-26 11:15:41 -07:00
Lukas Berger bf3d0c140c Compare string values of image identifiers
Signed-off-by: Lukas Berger <bergerl@google.com>
2020-06-02 14:37:07 -07:00
Lukas Berger ce1a9c4525 Do not delete original cache image if it is the same as new image
With the reproducibility improvements, it often happens that the old and
new cache images are the same. The original image should not be
deleted in this case.

This is an issue with remote images, where the image is deleted by
digest and both the old and new images share the same digest.

Signed-off-by: Lukas Berger <bergerl@google.com>
2020-06-01 16:08:52 -07:00
Emily Casey 9789d5d13e make param name consistent
* params prefer 'diffID' to 'sha' for specificity
* errors messages prefer 'SHA' to 'diffID' for consistency
  * we should consider changing this convention this later

Signed-off-by: Emily Casey <ecasey@pivotal.io>
2020-02-03 12:15:42 -05:00