Compare commits

...

1238 Commits
v0.8.0 ... main

Author SHA1 Message Date
Jesse Brown 0f224448e5
Merge pull request #1534 from buildpacks/dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
2025-08-21 12:37:38 -05:00
dependabot[bot] d2f4fccf02
Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-21 15:21:02 +00:00
Jesse Brown 4fd9dc8da9
Merge pull request #1512 from buildpacks/dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.3.0
Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.3.0
2025-08-19 13:15:59 -05:00
Jesse Brown 84bbd62a05
Merge pull request #1532 from buildpacks/jab/bump-imgutil-4b1c8875ba7e
Bump imgutil for race fix
2025-08-14 14:46:42 -05:00
Jesse Brown 3eec76970d
Bump imgutil for race fix
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-08-14 12:40:41 -05:00
Jesse Brown 828680fd2d
Merge pull request #1530 from buildpacks/jab/bump-imgutil-081325
Pull up imgutil to latest on main
2025-08-13 11:21:21 -05:00
Jesse Brown c2d348fe76
Pull up imgutil to latest on main
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>
2025-08-13 08:24:05 -05:00
Jesse Brown 998df22b75
Merge pull request #1528 from buildpacks/dependabot/github_actions/actions/download-artifact-5
Bump actions/download-artifact from 4 to 5
2025-08-12 14:38:56 -05:00
Jesse Brown 22f90fc35f
Merge pull request #1529 from buildpacks/jab/go-1-24-6
Update to Go 1.24.6
2025-08-12 13:27:30 -05:00
Jesse Brown d61099a58b
Merge pull request #1526 from buildpacks/dependabot/go_modules/go-dependencies-3727568c2b
Bump the go-dependencies group across 1 directory with 3 updates
2025-08-12 10:19:54 -05:00
Jesse Brown c4730aeb7f
Update to Go 1.24.6
- 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>
2025-08-12 08:55:13 -05:00
Jesse Brown 61101937d3
Merge pull request #1525 from buildpacks/jab/merge-output-streams
Send stdout and stderr to the same stream (build and generate)
2025-08-12 08:29:39 -05:00
dependabot[bot] b26e08c712
Bump actions/download-artifact from 4 to 5
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-12 09:49:15 +00:00
dependabot[bot] c924316f12
Bump the go-dependencies group across 1 directory with 3 updates
Bumps the go-dependencies group with 2 updates in the / directory: [github.com/chainguard-dev/kaniko](https://github.com/chainguard-dev/kaniko) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `github.com/chainguard-dev/kaniko` from 1.25.0 to 1.25.1
- [Release notes](https://github.com/chainguard-dev/kaniko/releases)
- [Changelog](https://github.com/chainguard-dev/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chainguard-dev/kaniko/compare/v1.25.0...v1.25.1)

Updates `github.com/moby/buildkit` from 0.22.0 to 0.23.2
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.22.0...v0.23.2)

Updates `golang.org/x/sys` from 0.34.0 to 0.35.0
- [Commits](https://github.com/golang/sys/compare/v0.34.0...v0.35.0)

---
updated-dependencies:
- dependency-name: github.com/chainguard-dev/kaniko
  dependency-version: 1.25.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/moby/buildkit
  dependency-version: 0.23.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-version: 0.35.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-12 07:35:44 +00:00
Jesse Brown d99c20ea89
fixup! Send stdout and stderr to the same stream (build and generate)
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-08-11 09:53:26 -05:00
Jesse Brown ced3359adc
fixup! Send stdout and stderr to the same stream (build and generate)
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-08-11 09:48:59 -05:00
Jesse Brown 24b93c486f
fixup! Send stdout and stderr to the same stream (build and generate)
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-08-11 09:33:43 -05:00
Jesse Brown 5ac11c505d
Send stdout and stderr to the same stream (build and generate)
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>
2025-08-11 09:22:44 -05:00
Jesse Brown 8f1b15834c
Merge pull request #1521 from buildpacks/dependabot/go_modules/go-dependencies-8e2b8007e7
Bump the go-dependencies group across 1 directory with 4 updates
2025-07-29 15:42:47 -05:00
dependabot[bot] e25dc2d2f2
Bump the go-dependencies group across 1 directory with 4 updates
Bumps the go-dependencies group with 2 updates in the / directory: [github.com/awslabs/amazon-ecr-credential-helper/ecr-login](https://github.com/awslabs/amazon-ecr-credential-helper) and [github.com/containerd/containerd](https://github.com/containerd/containerd).


Updates `github.com/awslabs/amazon-ecr-credential-helper/ecr-login` from 0.9.1 to 0.10.1
- [Release notes](https://github.com/awslabs/amazon-ecr-credential-helper/releases)
- [Changelog](https://github.com/awslabs/amazon-ecr-credential-helper/blob/main/CHANGELOG.md)
- [Commits](https://github.com/awslabs/amazon-ecr-credential-helper/compare/v0.9.1...v0.10.1)

Updates `github.com/containerd/containerd` from 1.7.27 to 1.7.28
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.27...v1.7.28)

Updates `golang.org/x/sync` from 0.15.0 to 0.16.0
- [Commits](https://github.com/golang/sync/compare/v0.15.0...v0.16.0)

Updates `golang.org/x/sys` from 0.33.0 to 0.34.0
- [Commits](https://github.com/golang/sys/compare/v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: github.com/awslabs/amazon-ecr-credential-helper/ecr-login
  dependency-version: 0.10.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/containerd/containerd
  dependency-version: 1.7.28
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sync
  dependency-version: 0.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-version: 0.34.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-29 20:28:10 +00:00
Jesse Brown f27995af70
Merge pull request #1520 from buildpacks/dependabot/go_modules/github.com/docker/docker-28.3.3incompatible
Bump github.com/docker/docker from 28.3.1+incompatible to 28.3.3+incompatible
2025-07-29 15:26:04 -05:00
dependabot[bot] f3e3719918
Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 28.3.1+incompatible to 28.3.3+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v28.3.1...v28.3.3)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-version: 28.3.3+incompatible
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-29 20:04:05 +00:00
Jesse Brown 3a692e4a34
Merge pull request #1517 from buildpacks/jab/debug-draft-release
debug draft step to see why it does not like recent release branch
2025-07-18 11:27:38 -05:00
Jesse Brown f8bf3ed25e
debug draft step to see why it does not like recent release branch 2025-07-18 09:06:11 -05:00
Jesse Brown f992fd6a6d
Merge pull request #1516 from buildpacks/jab/go-1-24-5
Bump go to 1.24.5
2025-07-17 12:56:01 -05:00
Jesse Brown 669686636a
Bump go to 1.24.5
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-07-16 21:28:33 -05:00
Jesse Brown 21a01a93f5
Merge pull request #1513 from buildpacks/dependabot/go_modules/go-dependencies-b286305dda
Bump github.com/docker/docker from 28.3.0+incompatible to 28.3.1+incompatible in the go-dependencies group
2025-07-08 08:35:09 -05:00
dependabot[bot] 187d6555ad
Bump github.com/docker/docker in the go-dependencies group
Bumps the go-dependencies group with 1 update: [github.com/docker/docker](https://github.com/docker/docker).


Updates `github.com/docker/docker` from 28.3.0+incompatible to 28.3.1+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v28.3.0...v28.3.1)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-version: 28.3.1+incompatible
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-08 02:41:13 +00:00
dependabot[bot] d5a70ecfd6
Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.3.0
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.3.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.3.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-03 17:46:15 +00:00
Jesse Brown 096e921bc0
Merge pull request #1511 from AidanDelaney/feature/use-go-tools
Specify tool versions in go.mod
2025-07-03 12:44:59 -05:00
Aidan Delaney 9f602ab430 Specify tool versions in go.mod
Use go 1.24 style "tool" directive to specify tool
dependencies.

Signed-off-by: Aidan Delaney <aidan.delaney@gmail.com>
2025-07-03 09:31:27 +00:00
Jesse Brown eff4eb9d82
Merge pull request #1510 from buildpacks/jab/bump-imgutil-626
Bump imgutil and docker
2025-06-26 15:01:10 -05:00
Jesse Brown ed61c00263
Bump imgutil and docker
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-06-26 12:36:04 -05:00
Jesse Brown 07705bb60a
Merge pull request #1508 from buildpacks/jab/chainguard-kaniko
Replace GoogleContainerTools/kaniko with chainguard-dev/kaniko
2025-06-26 11:23:19 -05:00
Jesse Brown ee501aec0a
Replace GoogleContainerTools/kaniko with chainguard-dev/kaniko
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>
2025-06-26 09:37:01 -05:00
Jesse Brown 4e5936a962
Merge pull request #1507 from maxkrumpe/hotfix/bump-up-go-version
Bump go to version 1.24.4 to fix CVE-2025-22874
2025-06-24 09:18:42 -05:00
Max Krumpe f4c7a93419 bump go to version 1.24.4
Signed-off-by: Max Krumpe <max.krumpe@gmx.de>
2025-06-16 12:14:11 +02:00
Jesse Brown 64b78965f6
Merge pull request #1501 from buildpacks/jab/bump-go-1-24-3
bump go
2025-05-28 17:02:53 -05:00
Jesse Brown 906b0e0779
bump go 2025-05-28 11:40:14 -05:00
Jesse Brown fb74763226
Merge pull request #1500 from buildpacks/dependabot/go_modules/go-dependencies-d0ab6aa9b2
Bump the go-dependencies group with 4 updates
2025-05-28 11:14:59 -05:00
Jesse Brown c121049b41
bump imgutil 2025-05-28 10:00:00 -05:00
dependabot[bot] b98b668838
Bump the go-dependencies group with 4 updates
Bumps the go-dependencies group with 4 updates: [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko), [github.com/docker/docker](https://github.com/docker/docker), [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) and [github.com/moby/buildkit](https://github.com/moby/buildkit).


Updates `github.com/GoogleContainerTools/kaniko` from 1.23.2 to 1.24.0
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.23.2...v1.24.0)

Updates `github.com/docker/docker` from 27.0.3+incompatible to 28.1.1+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v27.0.3...v28.1.1)

Updates `github.com/google/go-containerregistry` from 0.20.2 to 0.20.4
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.20.2...v0.20.4)

Updates `github.com/moby/buildkit` from 0.14.1 to 0.22.0
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.14.1...v0.22.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-version: 1.24.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/docker/docker
  dependency-version: 28.1.1+incompatible
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: go-dependencies
- dependency-name: github.com/google/go-containerregistry
  dependency-version: 0.20.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/moby/buildkit
  dependency-version: 0.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-26 23:02:02 +00:00
Jesse Brown 761d2bdbb8
Merge pull request #1499 from buildpacks/dependabot/go_modules/go-dependencies-c9f32dbcca
Bump the go-dependencies group with 2 updates
2025-05-14 09:19:35 -05:00
dependabot[bot] 14a6c36c78
Bump the go-dependencies group with 2 updates
Bumps the go-dependencies group with 2 updates: [golang.org/x/sync](https://github.com/golang/sync) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `golang.org/x/sync` from 0.13.0 to 0.14.0
- [Commits](https://github.com/golang/sync/compare/v0.13.0...v0.14.0)

Updates `golang.org/x/sys` from 0.32.0 to 0.33.0
- [Commits](https://github.com/golang/sys/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-version: 0.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-version: 0.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-12 23:33:31 +00:00
Jesse Brown 40c408d453
Merge pull request #1496 from buildpacks/jab/bump-imgutil
Bump imgutil
2025-05-07 12:39:36 -05:00
Jesse Brown 99e4c87d75
Bump imgutil
This brings in the latest version of imgutil which includes a fix for insecure registry support.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-04-24 09:27:40 -05:00
Jesse Brown 8bdb640857
Merge pull request #1493 from buildpacks/jjbustamante/restore-exec-d-windows
Remove build unix constraint to exec_d.go and restore archive tar windows file
2025-04-21 11:41:40 -05:00
Juan Bustamante 997840b2f2 restoring archive/tar_windows.go
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
2025-04-20 18:39:44 -05:00
Juan Bustamante 4f7f331816 removing go:build unix because we already removed windows support
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
2025-04-17 19:06:45 -05:00
Juan Bustamante 55c8b988a5 removing the os build constraint and moving the linux implementation into exec_d
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
2025-04-16 15:08:45 -05:00
Jesse Brown 92d9833a46
Merge pull request #1494 from sap-contributions/update-vulnerable-deps
Update vulnerable dependencies
2025-04-16 11:36:27 -05:00
Pavel Busko 5f776886ec code lint
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
2025-04-16 14:47:09 +02:00
Pavel Busko d34588e569 update vulnerable dependencies
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
2025-04-16 14:26:25 +02:00
Juan Bustamante f923ae5e07 adding also archive windows file
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
2025-04-09 21:08:11 -05:00
Juan Bustamante 3d23976f2d restoring launch/exec_d_windows.go to being able to compile pack LCOW
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
2025-04-07 19:59:30 -05:00
Jesse Brown c895ed4002
Merge pull request #1486 from buildpacks/dependabot/go_modules/go-dependencies-6f573b709f
Bump the go-dependencies group across 1 directory with 3 updates
2025-03-19 09:03:11 -05:00
dependabot[bot] 0adc6dd8ad
Bump the go-dependencies group across 1 directory with 3 updates
Bumps the go-dependencies group with 3 updates in the / directory: [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml), [golang.org/x/sync](https://github.com/golang/sync) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `github.com/BurntSushi/toml` from 1.4.0 to 1.5.0
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v1.4.0...v1.5.0)

Updates `golang.org/x/sync` from 0.11.0 to 0.12.0
- [Commits](https://github.com/golang/sync/compare/v0.11.0...v0.12.0)

Updates `golang.org/x/sys` from 0.30.0 to 0.31.0
- [Commits](https://github.com/golang/sys/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 14:17:26 +00:00
Jesse Brown d4fe8f0554
Merge pull request #1481 from buildpacks/dependabot/github_actions/appleboy/ssh-action-1.2.2
Bump appleboy/ssh-action from 1.2.1 to 1.2.2
2025-03-18 09:11:59 -05:00
Jesse Brown 0727354ebf
Merge pull request #1482 from buildpacks/dependabot/go_modules/golang.org/x/net-0.36.0
Bump golang.org/x/net from 0.34.0 to 0.36.0
2025-03-18 09:11:33 -05:00
Jesse Brown e9bb570999
Merge pull request #1485 from buildpacks/dependabot/go_modules/github.com/containerd/containerd-1.7.27
Bump github.com/containerd/containerd from 1.7.26 to 1.7.27
2025-03-18 09:11:04 -05:00
dependabot[bot] 3760f4bb9c
Bump github.com/containerd/containerd from 1.7.26 to 1.7.27
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.7.26 to 1.7.27.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.26...v1.7.27)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 00:20:02 +00:00
dependabot[bot] 1b84db28e2
Bump golang.org/x/net from 0.34.0 to 0.36.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.34.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.34.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 01:51:23 +00:00
dependabot[bot] ed2e33c6e6
Bump appleboy/ssh-action from 1.2.1 to 1.2.2
Bumps [appleboy/ssh-action](https://github.com/appleboy/ssh-action) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](https://github.com/appleboy/ssh-action/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-11 00:11:40 +00:00
Jesse Brown 248343e3b7
Merge pull request #1476 from buildpacks/dependabot/go_modules/go-dependencies-cfb8bb1f27
Bump the go-dependencies group across 1 directory with 5 updates
2025-02-28 14:53:22 -06:00
dependabot[bot] 83faba2a2f
Bump the go-dependencies group across 1 directory with 5 updates
Bumps the go-dependencies group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/awslabs/amazon-ecr-credential-helper/ecr-login](https://github.com/awslabs/amazon-ecr-credential-helper) | `0.0.0-20240419161514-af205d85bb44` | `0.9.1` |
| [github.com/containerd/containerd](https://github.com/containerd/containerd) | `1.7.24` | `1.7.26` |
| [github.com/google/go-cmp](https://github.com/google/go-cmp) | `0.6.0` | `0.7.0` |
| [golang.org/x/sync](https://github.com/golang/sync) | `0.10.0` | `0.11.0` |
| [golang.org/x/sys](https://github.com/golang/sys) | `0.29.0` | `0.30.0` |



Updates `github.com/awslabs/amazon-ecr-credential-helper/ecr-login` from 0.0.0-20240419161514-af205d85bb44 to 0.9.1
- [Release notes](https://github.com/awslabs/amazon-ecr-credential-helper/releases)
- [Changelog](https://github.com/awslabs/amazon-ecr-credential-helper/blob/main/CHANGELOG.md)
- [Commits](https://github.com/awslabs/amazon-ecr-credential-helper/commits/v0.9.1)

Updates `github.com/containerd/containerd` from 1.7.24 to 1.7.26
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.24...v1.7.26)

Updates `github.com/google/go-cmp` from 0.6.0 to 0.7.0
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.6.0...v0.7.0)

Updates `golang.org/x/sync` from 0.10.0 to 0.11.0
- [Commits](https://github.com/golang/sync/compare/v0.10.0...v0.11.0)

Updates `golang.org/x/sys` from 0.29.0 to 0.30.0
- [Commits](https://github.com/golang/sys/compare/v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: github.com/awslabs/amazon-ecr-credential-helper/ecr-login
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-28 20:17:42 +00:00
Jesse Brown d71de96b56
Merge pull request #1418 from buildpacks/dependabot/go_modules/github.com/golang-jwt/jwt/v4-4.5.1
Bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1
2025-02-28 13:27:16 -06:00
Jesse Brown 05b0768a0b
Merge pull request #1473 from buildpacks/jab/go-1.24
go 1.24
2025-02-28 13:18:43 -06:00
Jesse Brown d1f38655a8
Remove format for constant strings in Logs
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-02-28 12:13:35 -06:00
Jesse Brown 60a94c4b03
Update linter
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-02-28 12:03:32 -06:00
Jesse Brown 3a30c0b597
go 1.24
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-02-28 10:37:53 -06:00
Jesse Brown c0cbaf1e02
Merge pull request #1470 from buildpacks/dependabot/github_actions/appleboy/ssh-action-1.2.1
Bump appleboy/ssh-action from 1.1.0 to 1.2.1
2025-02-28 09:40:21 -06:00
dependabot[bot] ba82c0d126
Bump appleboy/ssh-action from 1.1.0 to 1.2.1
Bumps [appleboy/ssh-action](https://github.com/appleboy/ssh-action) from 1.1.0 to 1.2.1.
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](https://github.com/appleboy/ssh-action/compare/v1.1.0...v1.2.1)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-28 15:12:11 +00:00
Jesse Brown fd1604734b
Merge pull request #1428 from buildpacks/dependabot/github_actions/codecov/codecov-action-5
Bump codecov/codecov-action from 4 to 5
2025-02-28 09:11:46 -06:00
Jesse Brown 7bd8e735ea
Merge pull request #1446 from buildpacks/dependabot/github_actions/anchore/scan-action-6
Bump anchore/scan-action from 3 to 6
2025-02-28 09:11:08 -06:00
Jesse Brown e2ec390385
Merge pull request #1466 from buildpacks/jab/use-github-ref-name
Use GITHUB_REF_NAME for draft action
2025-02-25 09:12:18 -06:00
Jesse Brown 3109b04667
Use GITHUB_REF_NAME for draft action
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>
2025-02-25 08:04:11 -06:00
Jesse Brown fe4a50b65f
Merge pull request #1469 from buildpacks/jab/remove-delete-race
Remove potential for exporter_test race
2025-02-24 15:45:35 -06:00
Jesse Brown 036e579e28
Remove potential for exporter_test race
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>
2025-02-24 14:48:12 -06:00
Jesse Brown 93c8b8b133
Merge pull request #1468 from buildpacks/jab/safer-arg-validation
Ensure lifecycle arg validation executed as expected.
2025-02-24 14:12:20 -06:00
Jesse Brown b05882d689
fixup! Ensure lifecycle arg validation executed as expected.
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-02-24 09:38:10 -06:00
Jesse Brown 5d193d0374
Ensure lifecycle arg validation executed as expected.
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>
2025-02-24 09:21:07 -06:00
Jesse Brown c8585e10fd
Merge pull request #1464 from joeybrown/release/logging-to-tests 2025-02-18 18:03:34 -06:00
Joey Brown 3a09c6dc98 add logging and thread sleep
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2025-02-13 10:17:25 -06:00
Jesse Brown 2c0f9bd6cd
Merge pull request #1461 from buildpacks/jabrown85-patch-1
Update draft-release.yml
2025-02-10 10:39:03 -06:00
Jesse Brown 35e4fb90bc
Update draft-release.yml
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>
2025-02-10 10:07:09 -06:00
Jesse Brown 9a7a3b586f
Merge pull request #1452 from gogolok/makefile_darwin_integration
Makefile: Use new build approach for darwin amd64+arm64
2025-01-16 09:47:54 -06:00
Robert Gogolok 93d5de7423 Makefile: Use new build approach for darwin amd64+arm64
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2025-01-16 10:53:05 +01:00
Jesse Brown 45b52d389a
Merge pull request #1438 from gogolok/create_dynamic_build_targets
Makefile: Create dynamic build targets
2025-01-10 08:43:33 -06:00
Robert Gogolok 89aeb9ca7a Makefile: Create dynamic build targets
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2025-01-09 23:49:54 +01:00
Jesse Brown b58433202e
Merge pull request #1449 from buildpacks/jab/bump-go-deps 2025-01-07 14:47:07 -06:00
Jesse Brown 92c59d39d9
fixup! Updating go deps for grype 2025-01-06 13:12:51 -06:00
Jesse Brown 952997fe48
Updating go deps for grype
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2025-01-06 13:03:12 -06:00
Jesse Brown 6fd74a9d56
Merge pull request #1444 from buildpacks/dependabot/go_modules/golang.org/x/crypto-0.31.0
Bump golang.org/x/crypto from 0.24.0 to 0.31.0
2025-01-06 12:24:53 -06:00
dependabot[bot] d5e9ad18c5
Bump golang.org/x/crypto from 0.24.0 to 0.31.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.24.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.24.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 17:56:38 +00:00
Jesse Brown 890ce690cf
Merge pull request #1441 from buildpacks/jab/remove-windows-support
Remove Windows Support
2025-01-06 11:02:08 -06:00
Jesse Brown e38a4b5eb6
fixup! Remove Windows Support
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2024-12-18 09:17:10 -06:00
dependabot[bot] 2191fc1b5f
Bump anchore/scan-action from 3 to 6
Bumps [anchore/scan-action](https://github.com/anchore/scan-action) from 3 to 6.
- [Release notes](https://github.com/anchore/scan-action/releases)
- [Changelog](https://github.com/anchore/scan-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/anchore/scan-action/compare/v3...v6)

---
updated-dependencies:
- dependency-name: anchore/scan-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 23:14:03 +00:00
Jesse Brown 2062d5fefc
Merge pull request #1442 from gogolok/dep_updates
Bump go-dependencies containerd, golang.org/x/sync and golang.org/x/sys
2024-12-11 09:36:53 -06:00
Robert Gogolok 1534af909b Bump golang.org/x/sys 0.28.0
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-11 00:12:00 +01:00
Robert Gogolok 84c043350b Bump golang.org/x/sync v0.10.0
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-11 00:11:43 +01: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
Robert Gogolok 7fd497eac2 Bump github.com/containerd/containerd v1.7.24
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-10 23:48:27 +01:00
Jesse Brown ddcded12be
Merge pull request #1439 from gogolok/support_freebsd_build_phase
Support FreeBSD build phase
2024-12-10 08:24:07 -06:00
Robert Gogolok 81ef5987de Support FreeBSD build phase
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-09 23:08:13 +01:00
Jesse Brown acd4499d35
Merge pull request #1437 from gogolok/correct_lifecycle_mk
lifecycle.mk: Add creater and extender symlinks
2024-12-09 09:41:57 -06:00
Robert Gogolok 68703b6cb7 lifecycle.mk: Add creater and extender symlinks
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-09 00:28:36 +01:00
Jesse Brown 8cfa351ee8
Merge pull request #1434 from gogolok/loop_deprecation
lint: Replace `exportloopref` by `copyloopvar` and `intrange`
2024-12-03 08:58:36 -06:00
Jesse Brown 564dcd3ef3
Merge pull request #1432 from gogolok/go_build_unix
Use `unix` build constraint
2024-12-03 08:57:33 -06:00
Robert Gogolok 32f1113b28 copyloopvar: Fix linter errors
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-03 09:48:36 +01:00
Robert Gogolok 23922f4d08 exportloopref: deprecation
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-03 09:48:28 +01:00
Robert Gogolok 605a233fcf Use `unix` build constraint
Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-02 23:26:23 +01:00
Jesse Brown 85540b4c90
Merge pull request #1431 from gogolok/remove_obsolete_build_constraint
Remove obsolete // +build lines
2024-12-02 10:18:19 -06:00
Robert Gogolok eea0ba6a02 Remove obsolete // +build lines
https://tip.golang.org/doc/go1.18#go-build-lines

Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
2024-12-02 16:26:34 +01:00
dependabot[bot] 3985f2e33a
Bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-19 00:03:45 +00:00
Natalie Arellano a058e93f60
Fix https://github.com/buildpacks/lifecycle/issues/1425 by providing insecure registries when we access the run image (#1426)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-11-18 10:23:55 -05:00
Natalie Arellano 21811fa4dc
Only log once (per phase) when we have to get target distro information from /etc/os-release (#1424)
* 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>
2024-11-15 11:08:29 -05:00
Jesse Brown 0690d133ca
Remove pack acceptance test on windows. (#1421)
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>
2024-11-11 10:44:21 -05:00
Jesse Brown 58f58e58a6
Silence non-impactful CVE - GHSA-v23v-6jw2-98fq (#1420)
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2024-11-07 14:44:52 -05:00
Jesse Brown 5517e86a56
bump upload-artifacts-action (#1419)
* 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>
2024-11-06 14:45:20 -05:00
dependabot[bot] e6091c97d3
Bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.0...v4.5.1)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 23:44:34 +00:00
dependabot[bot] 095affa914
Bump appleboy/ssh-action from 1.0.3 to 1.1.0 (#1404)
Bumps [appleboy/ssh-action](https://github.com/appleboy/ssh-action) from 1.0.3 to 1.1.0.
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](https://github.com/appleboy/ssh-action/compare/v1.0.3...v1.1.0)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-01 15:32:19 -04:00
Natalie Arellano 0872e08127
Silence non-impactful CVE (#1415)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-10-29 09:57:21 -04:00
dependabot[bot] 4a52e3c9e7
Bump the go-dependencies group across 1 directory with 7 updates (#1409)
* Bump the go-dependencies group across 1 directory with 7 updates

Bumps the go-dependencies group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) | `1.23.1` | `1.23.2` |
| [github.com/containerd/containerd](https://github.com/containerd/containerd) | `1.7.19` | `1.7.23` |
| [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) | `0.20.0` | `0.20.2` |
| [golang.org/x/sync](https://github.com/golang/sync) | `0.7.0` | `0.8.0` |
| [golang.org/x/sys](https://github.com/golang/sys) | `0.22.0` | `0.26.0` |



Updates `github.com/GoogleContainerTools/kaniko` from 1.23.1 to 1.23.2
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.23.1...v1.23.2)

Updates `github.com/containerd/containerd` from 1.7.19 to 1.7.23
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.19...v1.7.23)

Updates `github.com/docker/docker` from 26.1.5+incompatible to 27.0.3+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.5...v27.0.3)

Updates `github.com/google/go-containerregistry` from 0.20.0 to 0.20.2
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.20.0...v0.20.2)

Updates `github.com/moby/buildkit` from 0.13.2 to 0.14.1
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.13.2...v0.14.1)

Updates `golang.org/x/sync` from 0.7.0 to 0.8.0
- [Commits](https://github.com/golang/sync/compare/v0.7.0...v0.8.0)

Updates `golang.org/x/sys` from 0.22.0 to 0.26.0
- [Commits](https://github.com/golang/sys/compare/v0.22.0...v0.26.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: go-dependencies
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/moby/buildkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix errors

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2024-10-28 12:53:04 -04: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 0d51c49e94
Upgrade go and fix lint (#1405)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-10-24 09:45:39 -04:00
Natalie Arellano 2a5bb2f847
Add more detail to release instructions (#1406)
* 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>
2024-10-24 09:45:23 -04:00
Natalie Arellano dd23dd7de8
Update README for 0.20.x (#1401)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-09-16 11:00:35 -04:00
Jesse Brown ed3df30e1b
Adjust exporter App Layer log output (#1399)
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>
2024-09-11 16:12:44 -04:00
Jesse Brown 13adc3a8a8
Merge pull request #1390 from buildpacks/dependabot/go_modules/github.com/docker/docker-26.1.5incompatible
Bump github.com/docker/docker from 26.1.4+incompatible to 26.1.5+incompatible
2024-08-22 10:43:44 -05:00
Natalie Arellano 2e76236d20
When setting up buildpack env, process layers for a given buildpack in alphabetical order (#1394)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-08-20 15:45:26 -04:00
dependabot[bot] 191e6c4790
Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 26.1.4+incompatible to 26.1.5+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.4...v26.1.5)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-09 19:09:31 +00:00
Pavel Busko a43d5993a4
Fix run-image access check in restorer phase (#1386)
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Nicolas Bender <nicolas.bender@sap.com>
2024-07-29 11:44:11 -04:00
Hiroshi Hayakawa 9f262b3e5d
Adapt tools/test-fork.sh to the current GitHub Action workflows. (#1384)
* 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>
2024-07-18 11:07:37 -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 a87e12e6cd
Surface registry error (#1376)
* 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>
2024-07-11 09:34:05 -04:00
dependabot[bot] 12e2de8449
Bump google.golang.org/grpc from 1.64.0 to 1.64.1 (#1375)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.64.0 to 1.64.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.64.0...v1.64.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 09:50:09 -04:00
dependabot[bot] 4c40dcadaf
Bump the go-dependencies group across 1 directory with 6 updates (#1373)
* Bump the go-dependencies group across 1 directory with 6 updates

Bumps the go-dependencies group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) | `1.23.0` | `1.23.1` |
| [github.com/containerd/containerd](https://github.com/containerd/containerd) | `1.7.17` | `1.7.19` |
| [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) | `0.19.1` | `0.20.0` |
| [github.com/moby/buildkit](https://github.com/moby/buildkit) | `0.13.2` | `0.14.1` |
| [golang.org/x/sys](https://github.com/golang/sys) | `0.20.0` | `0.22.0` |



Updates `github.com/GoogleContainerTools/kaniko` from 1.23.0 to 1.23.1
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.23.0...v1.23.1)

Updates `github.com/containerd/containerd` from 1.7.17 to 1.7.19
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.17...v1.7.19)

Updates `github.com/docker/docker` from 26.1.2+incompatible to 26.1.3+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.2...v26.1.3)

Updates `github.com/google/go-containerregistry` from 0.19.1 to 0.20.0
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.19.1...v0.20.0)

Updates `github.com/moby/buildkit` from 0.13.2 to 0.14.1
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.13.2...v0.14.1)

Updates `golang.org/x/sys` from 0.20.0 to 0.22.0
- [Commits](https://github.com/golang/sys/compare/v0.20.0...v0.22.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/moby/buildkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Stay on the same version of buildkit as kaniko

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2024-07-09 14:54:19 -04:00
Natalie Arellano 04f1ad1d03
Fix CNB_TARGET_* env vars on older Platform API (#1374)
* 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>
2024-07-09 13:12:47 -04:00
Pavel Busko f2a3bd78a8
Restore cached launch layers not found in `appLayers` (#1346)
* Restore cached launch layers not found in appLayers

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>

* add platform api guard

Signed-off-by: Pavel Busko <pavel.busko@sap.com>

---------

Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
2024-07-03 10:04:57 -04:00
Pavel Busko a02be035c8
Ensure read access to the run image selected by extensions (#1364)
* 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>
2024-07-03 10:01:21 -04:00
dependabot[bot] 7b5a8ec1cf
Bump the go-dependencies group across 1 directory with 5 updates (#1360)
* Bump the go-dependencies group across 1 directory with 5 updates

Bumps the go-dependencies group with 3 updates in the / directory: [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml), [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) and [github.com/containerd/containerd](https://github.com/containerd/containerd).


Updates `github.com/BurntSushi/toml` from 1.3.2 to 1.4.0
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v1.3.2...v1.4.0)

Updates `github.com/GoogleContainerTools/kaniko` from 1.22.0 to 1.23.0
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.22.0...v1.23.0)

Updates `github.com/awslabs/amazon-ecr-credential-helper/ecr-login` from 0.0.0-20231213181459-b0fcec718dc6 to 0.0.0-20240419161514-af205d85bb44
- [Release notes](https://github.com/awslabs/amazon-ecr-credential-helper/releases)
- [Changelog](https://github.com/awslabs/amazon-ecr-credential-helper/blob/main/CHANGELOG.md)
- [Commits](https://github.com/awslabs/amazon-ecr-credential-helper/commits)

Updates `github.com/containerd/containerd` from 1.7.16 to 1.7.17
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.16...v1.7.17)

Updates `github.com/docker/docker` from 26.1.1+incompatible to 26.1.2+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.1...v26.1.2)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/awslabs/amazon-ecr-credential-helper/ecr-login
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix unit

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2024-06-05 16:15:50 -04:00
Natalie Arellano 36c0af0d81
Bump imgutil to pick up fixes for containerd and podman (#1361)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-06-05 13:47:22 -04:00
dependabot[bot] 85b745ca87
Bump azure/docker-login from 1 to 2 (#1359)
Bumps [azure/docker-login](https://github.com/azure/docker-login) from 1 to 2.
- [Release notes](https://github.com/azure/docker-login/releases)
- [Commits](https://github.com/azure/docker-login/compare/v1...v2)

---
updated-dependencies:
- dependency-name: azure/docker-login
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-05 12:37:24 -04:00
Natalie Arellano 73f6927abc
More fixes for target compat checking during detect (#1354)
* 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>
2024-05-14 14:10:16 -04:00
Dilip Gowda Bhagavan 1a1de0850a
fix: ibmcloud CLI nic attachment issue for s390x testing (#1353)
* fix: instance create issue for GH actions

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* fix: ibm cloud instance creation issue

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

---------

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>
2024-05-13 11:56:48 -04:00
Natalie Arellano 83efa75a14
Also read distro information from /etc/os-release when checking target compat (#1352)
* 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>
2024-05-10 11:56:44 -04:00
dependabot[bot] c0590cda08
Bump the go-dependencies group with 2 updates (#1351)
Bumps the go-dependencies group with 2 updates: [github.com/docker/docker](https://github.com/docker/docker) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `github.com/docker/docker` from 26.1.0+incompatible to 26.1.1+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.0...v26.1.1)

Updates `golang.org/x/sys` from 0.19.0 to 0.20.0
- [Commits](https://github.com/golang/sys/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-08 11:12:18 -04:00
dependabot[bot] 8a148423a3
Bump the go-dependencies group across 1 directory with 5 updates (#1349)
Bumps the go-dependencies group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) | `1.21.1` | `1.22.0` |
| [github.com/containerd/containerd](https://github.com/containerd/containerd) | `1.7.14` | `1.7.16` |
| [github.com/docker/docker](https://github.com/docker/docker) | `26.0.1+incompatible` | `26.1.0+incompatible` |
| [github.com/moby/buildkit](https://github.com/moby/buildkit) | `0.13.1` | `0.13.2` |
| [golang.org/x/sys](https://github.com/golang/sys) | `0.18.0` | `0.19.0` |



Updates `github.com/GoogleContainerTools/kaniko` from 1.21.1 to 1.22.0
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.21.1...v1.22.0)

Updates `github.com/containerd/containerd` from 1.7.14 to 1.7.16
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.14...v1.7.16)

Updates `github.com/docker/docker` from 26.0.1+incompatible to 26.1.0+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.0.1...v26.1.0)

Updates `github.com/moby/buildkit` from 0.13.1 to 0.13.2
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.13.1...v0.13.2)

Updates `golang.org/x/sys` from 0.18.0 to 0.19.0
- [Commits](https://github.com/golang/sys/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/moby/buildkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2024-05-06 18:12:00 -04:00
Pavel Busko effdf24b2c
Read `/etc/os-release` file when distro information is not present in labels (#1347)
* 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>
2024-05-06 16:33:51 -04:00
Natalie Arellano 44b70410fe
When a buildpack declares distro information, but a base image does not, (#1348)
consider it not a match

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-05-01 12:43:58 -04:00
Natalie Arellano 13d3691dd0
Try to fix test-s390x workflow (#1339)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-04-29 15:09:27 -04:00
Natalie Arellano 37d69857b6
Bump imgutil to pick up fix from https://github.com/buildpacks/imgutil/pull/269 (#1343)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-04-22 15:06:09 -04:00
Natalie Arellano 82fdf23a6d
Bump imgutil and docker (#1335)
* Bump imgutil and docker

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

* Grab latest and avoid using "AddOrReuse" method as it requires updating the caching image

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-04-16 12:58:09 -04:00
Pavel Busko 27ee43580b
Initialize default LayerMetadataRestorer and SBOMRestorer if none provided (#1333)
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
2024-04-11 11:43:22 -04:00
Jesse Brown 85f22a0fa5
Merge pull request #1334 from buildpacks/fix/keychain
Fix auth by wrapping keychain in a ResolvedKeychain
2024-04-10 10:10:01 -05:00
Natalie Arellano 267025743f Fix auth by wrapping keychain in a ResolvedKeychain
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>
2024-04-10 10:48:33 -04:00
Jesse Brown 137225b961
Merge pull request #1282 from buildpacks/dependabot/github_actions/codecov/codecov-action-4
Bump codecov/codecov-action from 3 to 4
2024-04-10 09:39:46 -05:00
Natalie Arellano fea544183a Provide CODECOV_TOKEN to Codecov
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-04-10 10:07:10 -04:00
Natalie Arellano f309b50003 Merge branch 'main' into dependabot/github_actions/codecov/codecov-action-4 2024-04-09 16:34:01 -04:00
Jesse Brown cd50eb8848
Add go-version-file to draft-release workflow (#1331)
We are getting warnings about go-version not being specified. This should fix that.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2024-04-05 15:08:23 -04:00
Jesse Brown bb9eb96766
go 1.22 (#1328)
* 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>
2024-04-05 13:11:18 -04:00
Jesse Brown 9c8340112a
Merge pull request #1315 from buildpacks/jab/keychain-allow-vendor-skip
Allow env vars to skip vendor specific keychain
2024-04-01 08:55:25 -05:00
dependabot[bot] feb0d757c9
Bump github.com/docker/docker (#1321)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 25.0.3+incompatible to 25.0.5+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v25.0.3...v25.0.5)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-28 12:38:08 -04:00
Natalie Arellano 955ab5e7c9
Buildpack API 0.11 is supported as of lifecycle 0.19 (#1326)
Fixes https://github.com/buildpacks/lifecycle/issues/1322

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-03-28 12:36:36 -04:00
dependabot[bot] a4e33e218a
Bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (#1318)
Bumps google.golang.org/protobuf from 1.32.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-28 10:53:07 -04:00
dependabot[bot] 9eaafdcfa8
Bump the go-dependencies group with 4 updates (#1323)
Bumps the go-dependencies group with 4 updates: [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko), [github.com/containerd/containerd](https://github.com/containerd/containerd), [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) and [github.com/moby/buildkit](https://github.com/moby/buildkit).


Updates `github.com/GoogleContainerTools/kaniko` from 1.21.0 to 1.21.1
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.21.0...v1.21.1)

Updates `github.com/containerd/containerd` from 1.7.13 to 1.7.14
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.13...v1.7.14)

Updates `github.com/google/go-containerregistry` from 0.19.0 to 0.19.1
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.19.0...v0.19.1)

Updates `github.com/moby/buildkit` from 0.12.5 to 0.13.1
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.12.5...v0.13.1)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
- dependency-name: github.com/moby/buildkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-28 09:54:22 -04:00
Ed Morley 9f9ac3cbc6
Use correct run image label name for distro name/version (#1325)
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>
2024-03-28 09:45:45 -04:00
Jesse Brown dff6494f28
Create README.md for auth package configuration
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2024-03-27 14:51:25 -05:00
Natalie Arellano 435d226f1e
Fix: log level and color level should be configurable via the env (#1314)
* 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>
2024-03-12 11:39:10 -04:00
Jesse Brown 5128c1360c
Allow env vars to skip vendor specific keychain
Vendor keychains can be slow or fail. This allows platform operators to skip them entirely.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2024-03-08 12:10:40 -06:00
Natalie Arellano 3a05fdea09
Update README for 0.19.x (#1313)
Also Platform API 0.13 is not supported in 0.18.x

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-03-07 16:41:24 -05:00
Natalie Arellano 548854fdf8
Fix post release workflow by calculating sha for linux-ppc64le (#1311)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-03-06 15:28:23 -05:00
dependabot[bot] f25f22c1de
Bump the go-dependencies group with 2 updates (#1310)
Bumps the go-dependencies group with 2 updates: [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `github.com/GoogleContainerTools/kaniko` from 1.20.1 to 1.21.0
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.20.1...v1.21.0)

Updates `golang.org/x/sys` from 0.17.0 to 0.18.0
- [Commits](https://github.com/golang/sys/compare/v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-06 12:25:31 -05:00
Natalie Arellano de7bcf582c
Update fixtures for exporter acceptance test (#1307)
* 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>
2024-03-04 12:33:37 -05:00
Natalie Arellano 1148b713e0
Always set CNB_TARGET_* variables during detect, build, and generate (#1309)
* 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>
2024-03-04 12:33:20 -05:00
Natalie Arellano f3f292c6b5
When copying extended run image layers, use the original number of layers (#1306)
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>
2024-03-01 13:41:46 -05:00
Philipp Stehle 41d885b2b4
refactor `phase/generator_test.go` (#1301)
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>
2024-03-01 12:09:36 -05:00
Ryan Brainard 73af3c126d
Fix rebase run-image resolution (#1305)
* 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>
2024-03-01 09:31:48 -05:00
Ryan Brainard f885774719
Document deprecatedRunImage as deprecated (#1304)
Signed-off-by: Ryan Brainard <966764+ryanbrainard@users.noreply.github.com>
2024-02-29 10:44:48 -05:00
Philipp Stehle 553c041228
refactor `phase/extender_test.go` (#1297)
* refactor `phase/extender_test.go`

Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>

* Review comments

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>

---------

Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2024-02-28 16:22:05 -05:00
Natalie Arellano 2d2da0b9f0
Fix typo (#1299)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-02-28 15:52:52 -05:00
Matthias Wessendorf 200b00a4a4
💄 Adding build and packaging support for ppc64le arch (#1303)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
2024-02-28 15:20:20 -05:00
Natalie Arellano 4ec55dce9b
Add debug statements to the extender (#1298)
* Add debug statements

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

* Add more debug info

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

* Add even more debug info

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-02-16 14:09:50 -05:00
Prashant Rewar 92bb4fb450
Make extensions not experimental for Platform 0.13 and above (#1295)
* Make extensions not experimental for Platform 0.13 and above

Signed-off-by: Prashant Rewar <108176843+prashantrewar@users.noreply.github.com>

* Fix failing acceptance test

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

---------

Signed-off-by: Prashant Rewar <108176843+prashantrewar@users.noreply.github.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2024-02-15 11:43:10 -05:00
Johannes Dillmann 7bdfb331bb
Provide context directory for extensions (#1276)
* Provide context folder for extensions

Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>

* Address PR feedback

Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>

* Split tests by platform API

Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>

* Add unit test for FindContexts

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>

* acceptnance tests

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Pavel Busko <pavel.busko@sap.com>

* Address PR feedback

Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>

---------

Signed-off-by: Pavel Busko <pavel.busko@sap.com>
Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Philipp Stehle <philipp.stehle@sap.com>
2024-02-15 10:40:12 -05:00
dependabot[bot] e2b30d8fe5
Bump the go-dependencies group with 1 update (#1296)
Bumps the go-dependencies group with 1 update: [golang.org/x/sys](https://github.com/golang/sys).


Updates `golang.org/x/sys` from 0.16.0 to 0.17.0
- [Commits](https://github.com/golang/sys/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-13 17:36:22 -05:00
Natalie Arellano d4e8609f49
Bump kaniko and remove buildkit pin (#1292)
Also remove ignore in .grype.yaml for patched CVE

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-02-12 11:22:41 -05:00
Natalie Arellano be5e24be99
Exporter zeroes timestamps when adding extension layers to the app image (#1289)
* 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>
2024-02-09 16:11:19 -05:00
Natalie Arellano 2f507d0121
Bumps imgutil to pick up layout package refactor & local package fix … (#1281)
* Bumps imgutil to pick up layout package refactor & local package fix for containerd storage

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

* Remove selective package, use sparse instead

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>
2024-02-09 13:26:50 -05:00
dependabot[bot] 121d349e68
Bump the go-dependencies group with 1 update (#1283)
Bumps the go-dependencies group with 1 update: [github.com/containerd/containerd](https://github.com/containerd/containerd).


Updates `github.com/containerd/containerd` from 1.7.12 to 1.7.13
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.12...v1.7.13)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-09 13:04:21 -05:00
dependabot[bot] ecbcbd94d4
Bump codecov/codecov-action from 3 to 4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 23:09:57 +00:00
Natalie Arellano 751c7a2737
Update pinned deps (#1280)
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>
2024-02-05 12:52:54 -05:00
dependabot[bot] 72671535c2
Bump github.com/opencontainers/runc from 1.1.9 to 1.1.12 (#1279)
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.9 to 1.1.12.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/v1.1.12/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.1.9...v1.1.12)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 12:22:39 -05:00
dependabot[bot] 7ab0850c64
Bump the go-dependencies group with 3 updates (#1277)
Bumps the go-dependencies group with 3 updates: [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko), [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) and [github.com/google/uuid](https://github.com/google/uuid).


Updates `github.com/GoogleContainerTools/kaniko` from 1.19.2 to 1.20.0
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.19.2...v1.20.0)

Updates `github.com/google/go-containerregistry` from 0.17.0 to 0.19.0
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.17.0...v0.19.0)

Updates `github.com/google/uuid` from 1.5.0 to 1.6.0
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 11:50:04 -05:00
Natalie Arellano 3c8876ce04
Fix s390x workflow now that go is upgraded (#1268)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-01-10 15:53:03 -05:00
dependabot[bot] 2548af4b8b
Bump the go-dependencies group with 6 updates (#1265)
Bumps the go-dependencies group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) | `1.17.0` | `1.19.2` |
| [github.com/docker/go-connections](https://github.com/docker/go-connections) | `0.4.0` | `0.5.0` |
| [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) | `0.16.1` | `0.17.0` |
| [github.com/google/uuid](https://github.com/google/uuid) | `1.4.0` | `1.5.0` |
| [golang.org/x/sync](https://github.com/golang/sync) | `0.5.0` | `0.6.0` |
| [golang.org/x/sys](https://github.com/golang/sys) | `0.15.0` | `0.16.0` |


Updates `github.com/GoogleContainerTools/kaniko` from 1.17.0 to 1.19.2
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.17.0...v1.19.2)

Updates `github.com/docker/go-connections` from 0.4.0 to 0.5.0
- [Commits](https://github.com/docker/go-connections/compare/v0.4.0...v0.5.0)

Updates `github.com/google/go-containerregistry` from 0.16.1 to 0.17.0
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.16.1...v0.17.0)

Updates `github.com/google/uuid` from 1.4.0 to 1.5.0
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.4.0...v1.5.0)

Updates `golang.org/x/sync` from 0.5.0 to 0.6.0
- [Commits](https://github.com/golang/sync/compare/v0.5.0...v0.6.0)

Updates `golang.org/x/sys` from 0.15.0 to 0.16.0
- [Commits](https://github.com/golang/sys/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/docker/go-connections
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2024-01-10 15:03:02 -05:00
Natalie Arellano b6a76bff09
Upgrade go (#1267)
* Upgrade to go 1.21

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

* Upgrade compilation images

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2024-01-10 14:29:05 -05:00
dependabot[bot] c8c4fc4f56
Bump actions/setup-go from 4 to 5 (#1253)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-10 12:00:37 -05:00
dependabot[bot] 6e199e6a64
Bump appleboy/ssh-action from 1.0.0 to 1.0.3 (#1266)
Bumps [appleboy/ssh-action](https://github.com/appleboy/ssh-action) from 1.0.0 to 1.0.3.
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Commits](https://github.com/appleboy/ssh-action/compare/v1.0.0...v1.0.3)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-10 12:00:10 -05:00
dependabot[bot] e9a83ae69a
Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#1259)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-10 11:59:48 -05:00
Kritka Sahni f8b8669119
Export app image and cache image in parallel (#1247)
* Export app image and cache image in parallel

Signed-off-by: kritka sahni <kritkasahni@google.com>

* Update platform/resolve_inputs.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Kritka Sahni <122665407+kritkasahni-google@users.noreply.github.com>

* Fix warning message for parallel export without cache image.

Signed-off-by: kritka sahni <kritkasahni@google.com>

* Add test for parallel export enabled.

Signed-off-by: kritka sahni <kritkasahni@google.com>

* Fix test for parallel export without cache image.

Signed-off-by: kritka sahni <kritkasahni@google.com>

* Fix test message for parallel export without cache image.

Signed-off-by: kritka sahni <kritkasahni@google.com>

---------

Signed-off-by: kritka sahni <kritkasahni@google.com>
Signed-off-by: Kritka Sahni <122665407+kritkasahni-google@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2023-12-14 16:59:52 -05:00
Natalie Arellano b8a92ac78d
Creator errors if detected order contains extensions (#1246)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-11-15 08:51:49 -05:00
dependabot[bot] dbd27bdef0
Bump the go-dependencies group with 2 updates (#1238)
* Bump the go-dependencies group with 2 updates

Bumps the go-dependencies group with 2 updates: [golang.org/x/sync](https://github.com/golang/sync) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `golang.org/x/sync` from 0.4.0 to 0.5.0
- [Commits](https://github.com/golang/sync/compare/v0.4.0...v0.5.0)

Updates `golang.org/x/sys` from 0.13.0 to 0.14.0
- [Commits](https://github.com/golang/sys/compare/v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump github.com/cilium/ebpf

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2023-11-13 11:20:48 -05: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 73648d2423
Fix post-release workflow (#1235)
* Fix post-release workflow

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

* Update grype config with non-impactful CVE

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-10-31 13:47:52 -04:00
dependabot[bot] 7c591d11d6
Bump the go-dependencies group with 1 update (#1234)
Bumps the go-dependencies group with 1 update: [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko).

- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-31 09:58:25 -04:00
Natalie Arellano 2b75adb9e5
Fix check release workflow (again) (#1233)
* Fix check release workflow by giving write permissions to the token

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

* Add permission to different scope

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-10-31 09:57:46 -04:00
dependabot[bot] cdd883cdaf
Bump github.com/google/uuid from 1.3.1 to 1.4.0 (#1226)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.3.1 to 1.4.0.
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.3.1...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 17:55:55 -04:00
Ed Morley 736b776093
Group minor/patch version Go Dependabot updates into one PR (#1228)
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>
2023-10-30 17:55:34 -04:00
Jesse Brown 653a46fa26
Print `Timer` logs in debug mode only (#1230)
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>
2023-10-30 17:51:30 -04:00
Natalie Arellano 9eec0f4f5c
Fix check release workflow by giving write permissions to the token (#1229)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-10-30 17:50:47 -04:00
Ralf Pannemans 2bf3ae75a0
Do not obscure error message (#1227)
Signed-off-by: Ralf Pannemans <ralf.pannemans@sap.com>
2023-10-27 13:05:32 -04:00
dependabot[bot] 367b451eb7
Bump appleboy/ssh-action from 0.1.10 to 1.0.0 (#1214)
Bumps [appleboy/ssh-action](https://github.com/appleboy/ssh-action) from 0.1.10 to 1.0.0.
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Commits](https://github.com/appleboy/ssh-action/compare/v0.1.10...v1.0.0)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 11:27:31 -04:00
dependabot[bot] 66472bc154
Bump actions/checkout from 3 to 4 (#1212)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 09:33:01 -04:00
dependabot[bot] a00c3832e3
Bump actions/upload-artifact from 2 to 3 (#1213)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 09:31:57 -04:00
Natalie Arellano 885847a4d5
Bump deps (#1221)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-10-18 09:31:31 -04:00
Ralf Pannemans ab2fe4f2f3
Fix usage of URL based registries (#1222)
Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
2023-10-18 09:30:08 -04:00
Natalie Arellano 6885b2e6ff
Update README and golang.org/x/sys (#1218)
* 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>
2023-10-17 17:05:03 -04:00
Dilip Gowda Bhagavan 292aa492a7
Add support for s390x (#1142)
* installing docker and jq

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* added support for s390x

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* adding back newline at end of file

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* adding back newline at end of file

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* updated release workflows

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* Running build and publish flow on fork

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* corrected typo

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* installing docker and jq

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* adding back newline at end of file

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* adding back newline at end of file

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* updated release workflows

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* corrected typo

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* reverting docker repo to buildpacksio

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* seperated s390x job to different file

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* removing hard coded values to secret

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* removed s390x conditon

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* adding s390x conditon

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

* correcting alignment in build.yml

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>

---------

Signed-off-by: Dilip Gowda Bhagavan <dilip.bhagavan@ibm.com>
Signed-off-by: Dilip Gowda Bhagavan <110233170+dilipgb@users.noreply.github.com>
2023-10-05 10:23:33 -04:00
Natalie Arellano 7ce5b70299
Fix regression in Platform API 0.10 (#1204)
* 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>
2023-10-03 15:24:29 -04:00
dependabot[bot] d0ed30b36f
Bump github.com/GoogleContainerTools/kaniko from 1.15.0 to 1.16.0 (#1206)
Bumps [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-27 14:58:16 -04:00
Natalie Arellano be881f29d5
Refactor lifecycle phase factories (#1207)
* Refactor lifecycle phase factories

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

* Add getter for lifecycle inputs

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-27 14:57:46 -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
Domenico Luciani 7ffcd58e74
Support insecure registries (#1140)
* 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>
2023-09-22 12:29:58 -04:00
Natalie Arellano 5b02ac1c8f
Bump deps (#1203)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-19 11:09:48 -04:00
Natalie Arellano 2b81abb8c4
Update cosign (#1201)
* Update some actions and configure dependabot to update actions

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

* Update cosign workflows to use keyless signing

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-19 10:02:28 -04:00
Natalie Arellano 06ffeedd58
Update some actions and configure dependabot to update actions (#1200)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-19 08:54:41 -04:00
Natalie Arellano 874e2c17e8
Remove deprecated platform APIs (#1191)
* Remove deprecated platform APIs

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

* Adding back some things and removing more things

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

* Fix assertion

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

* Fix again

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

* Fix windows

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-13 12:44:10 -07:00
Natalie Arellano b384d8c3e6
Fix setup-go by looking for go.mod within pack directory (#1197)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-09-12 12:32:51 -07:00
Juan Bustamante aeb177ca46
Adding missing flags for OCI Layout to restorer (#1195)
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
2023-09-07 12:37:49 -04:00
Natalie Arellano 105808ccf0
Removes backwards compatible glue for unsupported buildpack APIs (#1188)
Fixes https://github.com/buildpacks/lifecycle/issues/1187

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-08-25 11:32:57 -04:00
Natalie Arellano a12fbff57d
Remove deprecated buildpack APIs (#1148)
* Remove buildpack APIs 0.2-0.6 according to https://github.com/buildpacks/rfcs/blob/main/text/0110-deprecate-apis.md

- Fix acceptance by updating fixtures to use newer Buildpack API version

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

* Remove backwards compatible glue for buildpacks missing API version

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-08-23 10:34:00 -04:00
Natalie Arellano 325676eb6e
Update version of pack used in acceptance tests (#1182)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-08-23 10:33:11 -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
Jesse Brown f1e60ccc34
Merge pull request #1183 from buildpacks/dependabot/go_modules/github.com/google/uuid-1.3.1
Bump github.com/google/uuid from 1.3.0 to 1.3.1
2023-08-22 08:51:20 -05:00
dependabot[bot] f82c23bd4f
Bump github.com/google/uuid from 1.3.0 to 1.3.1
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 23:47:48 +00:00
Domenico Luciani c72dc20a93
Add support for darwin-arm64 chipset (#1169)
* 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>
2023-08-18 16:15:35 -04:00
Natalie Arellano df9ae90e17
Update github templates (#1179)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-08-10 12:19:42 -04:00
Natalie Arellano 56083d0680
Small improvements to the release notes template & check release workflow (#1178)
* Update release notes template

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

* Update test on fork script

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

* Fix

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

* Update check-latest-release to ignore pre-releases

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-08-10 12:19:32 -04:00
Natalie Arellano c3998654d3
Merge release/0.17.0 into main (#1177)
* 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>
2023-08-09 12:27:46 -04:00
dependabot[bot] 85fd513b83
Bump github.com/GoogleContainerTools/kaniko from 1.12.1 to 1.13.0 (#1162)
Bumps [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) from 1.12.1 to 1.13.0.
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.12.1...v1.13.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-09 11:02:23 -04:00
Aidan Delaney 7001b6a594
Report image name when restorer fails to pull (#1174)
Report the image name so end-users can take some action.

Signed-off-by: Aidan Delaney <adelaney21@bloomberg.net>
2023-08-03 15:06:31 -04:00
Joe Kimmel f8b3419877
Merge pull request #1160 from joe-kimmel-vmw/so-many-loggers-we-ran-out-of-flannel-shirts
timestamp logs for entry/exit for all the top-level Lifecycle package…
2023-07-27 13:48:30 -07:00
Joe Kimmel cc194b8666 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>
2023-07-27 11:24:20 -07:00
Joe Kimmel 28c0253427 using defer to make one-liners for fun and profit
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-27 09:18:22 -07:00
Joe Kimmel 8cb8336642
Merge pull request #1161 from joe-kimmel-vmw/its_just_a_phase
be more helpful when you dont recognize the phase
2023-07-26 16:12:58 -07:00
Joe Kimmel 9099967d7a be more helpful when you dont recognize the phase
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-26 12:10:47 -07:00
Joe Kimmel 217a234476 fixing names
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-26 10:18:16 -07:00
Joe Kimmel 1a36a3b642 timestamp logs for entry/exit for all the top-level Lifecycle package functions
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-25 18:08:02 -07:00
Joe Kimmel 1ca5500ad9
Merge pull request #1157 from joe-kimmel-vmw/upgrade-setup-go-action
upgrades setup-go to v4 which mostly sounds like it enables some cach…
2023-07-24 10:55:29 -07:00
Joe Kimmel 8f0cb5886a also upgrade check-latest-release and post-release
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-24 10:02:11 -07:00
Joe Kimmel ae64f8848f
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>
2023-07-24 12:08:50 -04:00
Joe Kimmel 1ff8931f47 upgrades setup-go to v4 which mostly sounds like it enables some caching by default
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-20 14:18:08 -07: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
Joe Kimmel e18a752b06
warn when a positional argument might have been a flag (#1147)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-12 14:08:19 -04:00
Natalie Arellano d14bae1e26
Require the CNB_PLATFORM_API env var to be set (#1145)
* 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>
2023-07-11 13:13:00 -04:00
Joe Kimmel e06b69b5ac
Merge pull request #1143 from joe-kimmel-vmw/restore-restorers-former-color
restorer gets layers flag again
2023-07-07 09:44:48 -07:00
Joe Kimmel 94c3d31ec0
Merge pull request #1144 from joe-kimmel-vmw/jd-add-restore-debug-logs
add explanatory debug logs so a reader knows why the buildpacks are r…
2023-07-07 09:44:19 -07:00
Joe Kimmel 44f4a7d8ab add explanatory debug logs so a reader knows why the buildpacks are read twice.
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-06 14:46:45 -07:00
Joe Kimmel 8cdec9dc8e restorer gets layers flag again
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-07-06 13:30:42 -07:00
Joe Kimmel 1744539c83
adds grype json output to the created github issue (#1131)
* 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>
2023-07-06 11:23:56 -04:00
dependabot[bot] 477aa7197d
Bump github.com/GoogleContainerTools/kaniko from 1.11.0 to 1.12.1 (#1137)
Bumps [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) from 1.11.0 to 1.12.1.
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.11.0...v1.12.1)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 16:24:23 -04:00
dependabot[bot] c8e89ce07b
Bump golang.org/x/sys from 0.9.0 to 0.10.0 (#1141)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.9.0 to 0.10.0.
- [Commits](https://github.com/golang/sys/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 16:23:52 -04:00
Natalie Arellano 84a94d59df
Fixes for run image extension (#1134)
* 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>
2023-07-05 16:23:20 -04:00
Natalie Arellano f7708d95e6
When checking read/write access, if there is no access, surface the e… (#1133)
* 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>
2023-06-26 15:21:13 -04:00
Natalie Arellano 94da70f6b6
Fixes for rebase (#1132)
* 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>
2023-06-23 10:45:19 -04:00
Joe Kimmel 12cb541fd1
turn on additional linter checks including godoc comments (#1110)
* 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>
2023-06-22 15:07:57 -04:00
Natalie Arellano 91593cf917
Bump go to 1.20 (#1130)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-06-15 12:54:08 -04:00
dependabot[bot] 7b886e0b80
Bump golang.org/x/sync from 0.2.0 to 0.3.0 (#1128)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.2.0 to 0.3.0.
- [Commits](https://github.com/golang/sync/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-15 11:08:28 -04:00
Natalie Arellano b1dd93cd14
Sets `check-latest` to always pull the latest version instead of the cached version (#1127)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-06-15 11:08:07 -04:00
dependabot[bot] 081106052c
Bump github.com/GoogleContainerTools/kaniko from 1.10.0 to 1.11.0 (#1120)
Bumps [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.10.0...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-14 15:28:22 -04:00
dependabot[bot] 9d07aa934c
Bump golang.org/x/sys from 0.8.0 to 0.9.0 (#1124)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/sys/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-14 15:19:45 -04:00
Natalie Arellano 7f4666ed2b
Fixes for rebase and log message improvements (#1122)
- 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>
2023-06-14 15:19:20 -04:00
Natalie Arellano 8bd0003a19
Clarify log messages and omitempty (#1125)
* 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>
2023-06-14 14:38:37 -04:00
dependabot[bot] 82da83291a
Bump github.com/BurntSushi/toml from 1.3.1 to 1.3.2 (#1121)
Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v1.3.1...v1.3.2)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-09 14:40:07 -04:00
Joe Kimmel 29e694f8c3
rename env var to CNB_TARGET_ARCH_VARIANT (#1119)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-06-09 14:36:21 -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
dependabot[bot] eac881f32a
Bump github.com/BurntSushi/toml from 1.3.0 to 1.3.1 (#1114)
Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-07 13:39:30 -04:00
Natalie Arellano 1fc9483341
Improved matching when selecting run image metadata (#1111)
We need to parse the reference in case the registry is not specified (defaults to Docker Hub)

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-06-07 13:38:25 -04:00
Joe Kimmel df5fca4fc0
metadata label is more clearly named and always has stacks (#1109)
* 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>
2023-06-06 15:58:17 -04:00
Joe Kimmel f9b8e9325a
extensions get the same targets validation as buildpacks (#1108)
* 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>
2023-06-06 13:51:24 -04:00
Natalie Arellano 28084b7412
Refactor: create new package for files in the platform spec (#1076)
* 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>
2023-06-02 13:32:32 -04:00
Natalie Arellano f506545986
Bump deps (#1103)
* Bump deps

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

* Bump imgutil, unpin BurntSushi/toml

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-06-01 12:11:57 -04:00
Natalie Arellano aa86fc68f7
When rebasing, update stack/runImage key in lifecycle metadata label (#1104)
* 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>
2023-06-01 12:11:29 -04:00
Natalie Arellano 0e55ae5ea9
Surface a more useful error message when we fail to add files to archive (#1105)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-06-01 12:10:32 -04:00
Joe Kimmel c2609a0a52
extender: better uid checks and error if uid ends as root (#1093)
updates to unit test

Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-06-01 12:08:04 -04:00
Joe Kimmel e1a8e5451d
probably fixes error message that calls images corrupt when they were just missing but honestly i'm not adding a unit test (#1107)
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>
2023-06-01 11:59:26 -04:00
Natalie Arellano 3f1a3461ca
Add more logging so we know when the lifecycle actually starts (#1106)
* 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>
2023-06-01 11:59:14 -04:00
dependabot[bot] ae5c3e572c
Bump github.com/GoogleContainerTools/kaniko from 1.9.2 to 1.10.0 (#1100)
Bumps [github.com/GoogleContainerTools/kaniko](https://github.com/GoogleContainerTools/kaniko) from 1.9.2 to 1.10.0.
- [Release notes](https://github.com/GoogleContainerTools/kaniko/releases)
- [Changelog](https://github.com/GoogleContainerTools/kaniko/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GoogleContainerTools/kaniko/compare/v1.9.2...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/GoogleContainerTools/kaniko
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-30 17:59:10 -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
Anushka Mittal 5dbedd3ca0
FIXME: pass the logger and print the warning inside (#1038)
* 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>
2023-05-30 11:07:39 -04:00
Joe Kimmel 5c29f544ea
Signed-off-by: Joe Kimmel <jkimmel@vmware.com> (#1092) (#1094)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-05-17 10:47:46 -04:00
dependabot[bot] da6d62cec1
Bump github.com/docker/distribution (#1089)
Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.1+incompatible to 2.8.2+incompatible.
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](https://github.com/docker/distribution/compare/v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 18:13:07 -04:00
Natalie Arellano a11cb6a5f0
Bump deps (#1088)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-05-11 17:37:02 -04:00
dependabot[bot] cf19426cf0
Bump github.com/google/go-containerregistry from 0.14.0 to 0.15.1 (#1085)
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.14.0 to 0.15.1.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.14.0...v0.15.1)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 16:15:59 -04:00
Joe Kimmel 1057837bae
Target envvars (#1078)
* 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>
2023-05-11 14:42:38 -04:00
Pavel Busko a2dfc786a6
Verify read access while selecting best `run-image` mirror (#1024)
* fallback to run image mirrors if unavailable

Signed-off-by: Pavel Busko <pavel.busko@sap.com>

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>

Add unit tests for run image resolution

Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Philipp Stehle <philipp.stehle@sap.com>
Signed-off-by: Ralf Pannemans <ralf.pannemans@sap.com>

Use ImageStrategy instead of AccessChecker to ease testing

Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Ralf Pannemans <ralf.pannemans@sap.com>

* Move determining ImageStrategy to ResolveInputs

Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Ralf Pannemans <ralf.pannemans@sap.com>

* Adapt acceptance tests for checking read access on run images

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Ralf Pannemans <ralf.pannemans@sap.com>

* Update acceptance/analyzer_test.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Ralf Pannemans <ralf.pannemans@googlemail.com>

---------

Signed-off-by: Johannes Dillmann <j.dillmann@sap.com>
Signed-off-by: Ralf Pannemans <ralf.pannemans@sap.com>
Signed-off-by: Ralf Pannemans <ralf.pannemans@googlemail.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Sumit Kulhadia <sumit.kulhadia@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@googlemail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2023-05-11 14:05:50 -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
Natalie Arellano 68b4ce9a55
Fixes for pack acceptance in the current-current-current configuration (#1075)
* Fixes for pack acceptance in the current-current-current configuration

Signed-off-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Add unit tests for fixes

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

---------

Signed-off-by: Joe Kimmel <joe-kimmel-vmw@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-04-28 15:43:52 -04:00
Joe Kimmel 710d938cf9
updating deps after go work sync (#1072)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-04-25 16:13:06 -04:00
Natalie Arellano 5eb4eac531
Fix updating run image reference (#1067)
* 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>
2023-04-17 22:44:43 +02:00
Joe Kimmel f48162ee68
put the breaks on single os detection by removing break (#1068)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-04-17 21:06:02 +02:00
Natalie Arellano e0e30117b3
Exporter changes for run image extension (#1055)
* 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>
2023-04-17 11:24:22 +02:00
Jesse Brown 627deb6dfb
0.12 Rebase Validation and Label Sync (#1056)
* 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>
2023-04-14 14:05:03 -04:00
Joe Kimmel c5a3549b07
Merge pull request #1064 from joe-kimmel-vmw/whyicoulbeastarnow
os and arch: buildpack targets should have stars
2023-04-10 16:05:24 -07:00
Joe Kimmel 0a96158154 os and arch: buildpack targets should have stars
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-04-07 14:15:30 -07:00
dependabot[bot] 1698cfaf58
Bump github.com/docker/docker (#1063)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 23.0.1+incompatible to 23.0.3+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v23.0.1...v23.0.3)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-06 14:42:05 -04:00
Natalie Arellano af79390a0b
Enable pre-releases in addition to release candidates (#1061)
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>
2023-04-05 18:28:37 -04:00
Joe Kimmel 1431839fad
what are wildcards if not a connection to the starry dynamo in the machinery of night? (#1053)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-04-05 16:01:27 -04:00
Joe Kimmel 39c4a7b571
detect linux flavors by reading etc/os-release (#1050)
* 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>
2023-04-05 16:00:54 -04:00
Natalie Arellano 21fb915dce
Extender changes for run image extension (#1022)
* 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>
2023-03-31 17:04:22 -04:00
dependabot[bot] 4aa121f4dc
Bump github.com/opencontainers/runc from 1.1.4 to 1.1.5 (#1052)
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.4 to 1.1.5.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/v1.1.5/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.1.4...v1.1.5)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-31 16:29:31 -04:00
Natalie Arellano b7f652a764
Merge lifecycle image fix & deps upgrade from release/0.16.1 into main (#1049)
* Ready release/0.16.1 (#1041)

* Fix log message when run image not found (#1004)

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>

* Bump containerd (#1015)

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

* 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>

* Bump golang.org/x/net from 0.5.0 to 0.7.0 (#1017)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.5.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.5.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Merge pull request #1036 from benri/bl/archive-pax-global-header

Ignore pax global header in tar extract

* Bump golang.org/x/sys from 0.5.0 to 0.6.0 (#1029)

Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github.com/containerd/containerd from 1.6.18 to 1.6.19 (#1040)

* 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>

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Harshal Mittal <harshalmittal4@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Harshal Mittal <harshalmittal4@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>

* Add sleep to "publish images" workflow (#1042)

It takes a few seconds for the image to be available

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

* Fix buildpacksio/lifecycle manifest create (#1043)

* Force lifecycle images to have docker media types

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

* Update go.mod to use latest imgutil

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

---------

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

* Bump kaniko & docker and unpin deps (#1045)

* Update kaniko & docker, unpin deps

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

* Update containerd

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

* Remove CVE ignores now that runc is unpinned

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

* Update to released kaniko

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

---------

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

* Ignore non-impactful runc CVE (#1047)

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

* Fix unit

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Harshal Mittal <harshalmittal4@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Harshal Mittal <harshalmittal4@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
2023-03-29 10:50:40 -04:00
Jesse Brown 2b6ddbb7af
Rebaser changes for run image extension (#1032)
* 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>
2023-03-28 11:39:39 -04:00
Natalie Arellano 47594c2c29
Restorer changes for run image extension (#1014)
* 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>
2023-03-28 11:23:24 -04:00
Joe Kimmel 1299eb80d1
Pull Os and Arch from RunImage; handle * Stacks (#1030)
* 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>
2023-03-22 17:32:33 -04:00
Natalie Arellano 00b292eb4a
Bump github.com/containerd/containerd from 1.6.18 to 1.6.19 (#1040)
* 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>
2023-03-20 15:53:28 -04:00
Philipp Stehle 584c6cbd35
Replace deprecated GHA ::set-output syntax (#1037)
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
2023-03-20 14:48:31 -04:00
dependabot[bot] 611dee801f
Bump golang.org/x/sys from 0.5.0 to 0.6.0 (#1029)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-20 13:29:45 -04:00
Jesse Brown a6d834bbf4
Merge pull request #1036 from benri/bl/archive-pax-global-header
Ignore pax global header in tar extract
2023-03-20 12:04:57 -05:00
Benjamin Leong d409e5a939
add test
Signed-off-by: Benjamin Leong <benri@users.noreply.github.com>
2023-03-16 16:18:04 -07:00
Benjamin Leong 310acf90e1
Ignore pax global header in tar extract
Signed-off-by: Benjamin Leong <benri@users.noreply.github.com>
2023-03-16 16:18:04 -07:00
Natalie Arellano fa9a11abd2
Detector changes for run image extension (#1011)
* Make a single constructor for lifecycle inputs

- The logic to update the default path for TOML files was repeated across phases
- In general it is safe to provide default values for inputs that might not be relevant to the current phase,
  as these will be ignored when constructing a new service for the phase;
  e.g., platform.LifecycleInputs.OrderPath will be ignored when constructing a lifecycle.Exporter
- As more inputs are shared across phases (e.g., analyzed.toml is now an input to the detect phase),
  duplicating the logic for providing default values is becoming more cumbersome

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

* Read values from environment

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

* Buildpack API: run.Dockerfiles are allowed instructions on versions >= 0.10

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

* Platform API: the detector accepts a new -run flag

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

* Move responsibility for validating Dockerfiles into the buildpack package

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

* When verifying Dockerfiles, return the new base image name if necessary

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

* When determining the new runtime base image, use criteria outlined in the platform spec

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

* Platform API: the schema of analyzed.toml is updated to include run-image.extend = <true or false, default false>

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

* TESTME: Update analyzed.toml with new run image if needed

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

* If extensions are used to switch the runtime base image, the detector should fail if the selected base image is not found in run.toml.

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

* Add fixture to test re-writing of analyzed.toml

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

* Move updating analyzed.toml into lifecycle package for easier testing

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

* Fix acceptance

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

* Don't redefine -layers

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

* Revert "Replace print with logger in image_cache.go, fixes formatting (#1012)"

This reverts commit 6a10b63c67.

* Revert "Revert "Replace print with logger in image_cache.go, fixes formatting (#1012)""

This reverts commit 5780910ecf.

* Rename image -> images in run.toml

We pluralize all other list elements

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

* Don't enforce constraints for older extensions

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

* Rename function for clarity

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

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-03-08 15:02:50 -05:00
Joe Kimmel 6d6b469717
Stack removal: detect phase and analyze.toml support Targets (#994)
* 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>
2023-03-07 15:19:09 -05:00
Joe Kimmel 2f308e4f08
updating development mock generator instructions to enshrine oral tradition from @naralleno (#1028)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-03-06 18:13:58 -05:00
Natalie Arellano b6af8b5515
Fix CI (#1027)
* 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>
2023-03-03 10:08:13 -05:00
Natalie Arellano 1400e8edce
Removes tee so that we can see if CI is really failing (#1025)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-03-01 18:01:40 -05:00
dependabot[bot] d99d58f834
Bump golang.org/x/net from 0.5.0 to 0.7.0 (#1017)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.5.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.5.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 18:35:57 -05:00
Natalie Arellano cad291f00a
Make a single constructor for lifecycle inputs (#1009)
* 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>
2023-02-28 12:01:34 -05:00
Aidan Delaney 4cb2bdcbc5
Add Layer Metadata test as living doc (#1019)
Layer Metadata is straightforward, adding a test to act as a living
document.

Signed-off-by: Aidan Delaney <adelaney21@bloomberg.net>
2023-02-23 10:06:36 -05:00
Juan Bustamante 03ee829704
Implement the capability to the phases to handle input/output images in OCI layout format (#969)
* 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>
2023-02-21 14:24:43 -05: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 4e537685ce
Update README for 0.16.0 (#1016)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-02-21 10:24:39 -05:00
Natalie Arellano e3e3590866
Bump containerd (#1015)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-02-21 10:24:31 -05:00
Joe Kimmel 3be3585644
tees test output to untracked file (#1013)
Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-02-17 11:40:57 -05:00
Natalie Arellano 014ccebcee
Adds -run as an input to the analyzer & creator (#1005)
- Also adds unit tests for create inputs

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-02-13 11:08:57 -05:00
Natalie Arellano 5382f323cf
Fix log message when run image not found (#1004)
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
dependabot[bot] 1398dfa30c
Bump github.com/google/go-containerregistry from 0.12.1 to 0.13.0 (#991)
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.12.1 to 0.13.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.12.1...v0.13.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-27 14:47:48 -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
Natalie Arellano 55ce12cecc
Bump deps (#989)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-01-24 13:52:55 -05:00
Natalie Arellano cabbe91325
Fix check release workflow (#987)
There is no go.mod before checkout

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2023-01-23 16:57:01 -05:00
dependabot[bot] 9b4c11c835
Bump github.com/docker/docker (#988)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.22+incompatible to 20.10.23+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v20.10.22...v20.10.23)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 16:56:48 -05:00
dependabot[bot] 73f5f1d291
Bump golang.org/x/sys from 0.3.0 to 0.4.0 (#982)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 16:56:24 -05:00
Joe Kimmel e5f7e4bb55
Launcher sboms copy only sbom extensions (#984)
* fsutils FilesWithExtensions filters directory listings

Signed-off-by: Joe Kimmel <jkimmel@vmware.com>

* exporter: launcher sbom copy

only copies sbom files

Signed-off-by: Joe Kimmel <jkimmel@vmware.com>

* exporter launcher sbom copy: more thorough test

Signed-off-by: Joe Kimmel <jkimmel@vmware.com>

Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-01-23 16:56:03 -05:00
Jesse Brown ec4e8d3e7e
Merge pull request #980 from buildpacks/dependabot/go_modules/github.com/docker/docker-20.10.22incompatible
Bump github.com/docker/docker from 20.10.21+incompatible to 20.10.22+incompatible
2023-01-13 10:32:26 -06:00
dependabot[bot] e5047bb3dd
Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.21+incompatible to 20.10.22+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v20.10.21...v20.10.22)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 00:11:47 +00:00
Jesse Brown e567b3c88f
Merge pull request #985 from joeybrown-sf/feature/rebase-digest
allow passing previous image in rebase cmd
2023-01-12 15:49:58 -06:00
Joey Brown 9614cad734
Update rebaser_test.go
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-10 16:34:56 -06:00
Joey Brown 62e5236814
Update rebaser_test.go
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-10 13:59:35 -06:00
Joey Brown b303de57f8
upgrade imgutils
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-10 13:53:26 -06:00
Joey Brown 9e8d9f576f
add a guard clause to ensure min API version
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-10 13:49:16 -06:00
Joey Brown 4be1c1c5ed
updated tests
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-09 11:08:20 -06:00
Joey Brown b41d4132c5
utilizing saveAs rather than rename
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-09 10:33:28 -06:00
Joe Kimmel 72bb70603f
rename CNB_ANALYZE_SKIP_LAYERS to CNB_SKIP_LAYERS (#981)
to match spec and resolve FIXME

Signed-off-by: Joe Kimmel <jkimmel@vmware.com>

Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
2023-01-06 16:37:47 -05:00
Joey Brown 50646839c8
add a test
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-06 14:44:32 -06:00
Joey Brown 90cdc81a26
rename working as expected
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-06 14:18:37 -06:00
Joey Brown d0caf2a428
rename image at the last moment
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-06 14:03:30 -06:00
Joey Brown e8b5735ee1
allow passing previous image
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
2023-01-06 10:59:14 -06:00
Natalie Arellano 4b1f2c3fa1
Fix pack acceptance (#979)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-16 15:47:06 -05:00
Natalie Arellano a31d64d13a
Bump deps (#978)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-15 15:48:40 -05:00
Natalie Arellano 6454eb0760
Updates go to version 1.19 (#973)
* Updates go to version 1.19

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

* Use go-version-file to detect go version

This is one less thing to change when we upgrade

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-15 09:57:43 -05:00
Natalie Arellano 213e143f5e
Remove unused functions (#976)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-14 14:31:11 -05:00
Natalie Arellano 960c36cd81
Improve detector log output (#975)
* Improve detector log output: when detect fails, print output as info level

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

* Refactor: detector has a log handler

This eliminates the need for a "multi logger"

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

* Make memory handler private

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>
2022-12-14 14:30:45 -05:00
Natalie Arellano 3648072784
Consider platform API <= 0.6 and buildpack API <= 0.6 deprecated (#974)
* Consider platform API <= 0.6 and buildpack API <= 0.6 deprecated
according to https://github.com/buildpacks/rfcs/blob/main/text/0110-deprecate-apis.md

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

* Fix launcher acceptance

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

* Fix Windows

- Create usable symlink
- When process type has a '.' we need to provide .exe

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

* Keep default platform API as 0.3

Add warning when the env var is unset so that end users know they are defaulting to the default

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

* Unnest tests that pass on any platform API

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

* Improve output when only version is requested

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

* Quote platform API version

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-12 10:28:37 -05:00
Natalie Arellano e1f7860500
Fix: rebase does not require stack.toml (#972)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-09 13:41:45 -05:00
dependabot[bot] da5da9bb53
Bump golang.org/x/sys from 0.2.0 to 0.3.0 (#971)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-07 13:09:29 -05:00
Natalie Arellano 02569f89db
Add launcher SBOM input (#963)
* Introduce -launcher-sbom as new flag to the exporter and creator

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

* Add unit test and update acceptance test

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-05 17:03:58 -05:00
Natalie Arellano 3627c94baf
Fix pack acceptance with 0.28.0-rc1 (#968)
We need to configure git to use line feeds on Windows, otherwise
  the test fixtures and hence the layer diff IDs will be different from the test expectations.

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-12-01 10:51:32 -05:00
Natalie Arellano 4e6e4f7ef2
Fix: set HOME for provided user after build image extension (#960) (#964)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-28 12:38:55 -05:00
Natalie Arellano 4c62475a8c
(updated with latest main) Allow setting environment variables using the build image (#962)
* Allow setting environment variables using the build image

Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>

* Add a few more unit tests

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

* Resolve absolute path of build config directory

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

Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-11-22 17:21:54 -05:00
Natalie Arellano 532fc6c413
Refactor platform inputs and consolidate logic in platform package (#961)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-22 10:26:59 -05:00
dependabot[bot] 6667e59fc6
Bump github.com/google/go-containerregistry from 0.12.0 to 0.12.1 (#955)
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.12.0 to 0.12.1.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.12.0...v0.12.1)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 16:01:33 -05:00
Olivier MOCQUAIS dcf0f8ff69
Implement RFC for SBOM describing lifecycle / launcher #958 (#944)
Signed-off-by: Olivier Mocquais <omocquais@vmware.com>

Signed-off-by: Olivier Mocquais <omocquais@vmware.com>
2022-11-21 16:00:53 -05:00
Natalie Arellano ef9a1449e4
Bump dependencies (go get -u ./...) (#952)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-09 13:50:15 -05:00
dependabot[bot] 64c41f844e
Bump github.com/docker/docker (#942)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.20+incompatible to 20.10.21+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.20...v20.10.21)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-09 11:13:39 -05:00
Natalie Arellano a1801c09fe
Bump golang.org/x/sys from 0.1.0 to 0.2.0 (#951)
Replaces https://github.com/buildpacks/lifecycle/pull/948 without bumping kaniko

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-08 17:04:38 -05:00
Natalie Arellano 51c7e68007
Fix special character escaping when marshaling launch process (#950)
* Add unit tests for marshal & unmarshal

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

* Fix: MarshalJSON() for older platforms should properly escape single string

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

* Fix: MarshalTOML() should properly escape single strings

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

* Fix: UnmarshalJSON()

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-08 16:45:52 -05:00
Natalie Arellano caf3d06c00
Use json to marshal command entry for older platform (#947)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-04 12:46:43 -04:00
Jesse Brown f78b5cec70
Fix regression in metadata.toml rendering (#946)
* Fix regression in metadata.toml rendering

Moved the dynamic process serialization to a new field type and off of process. The TOML that was previously generated was not expected and the TOML library we use doesn't seem to have a way to render the table the way we expect. Making a new type for the single field `command` allows us to render the TOML the way we want.

Fixes: buildpacks/lifecycle#945
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Changes requested from pull request

- Minor reorganization of the code
- Fixed typos
- Removed some redundant checks in one test to not muddy the waters on what is being tested
- Updated some comments
- Removed debug code

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2022-11-03 16:23:39 -04:00
Eng Zer Jun 5a4df34080
refactor: move from io/ioutil to io and os packages (#941)
* acceptance: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* archive: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* auth: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* buildpack: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* cache: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* cmd/lifecycle: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* env: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* internal: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* launch: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* layers: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* priv: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* testhelpers: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* tools: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* lifecycle: move from io/ioutil to io and os packages

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2022-10-31 10:56:33 -04: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 8dfa73f4df
Update README with latest apis (#930)
* Update README with latest apis

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

* Fix selective write test

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-10-24 11:57:50 -04:00
Natalie Arellano 8cf3678b28
Remove <image> as an argument to the extender (#926)
* Remove <image> as an argument to the extender

Favors passing the reference via analyzed.toml

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

* Fix confusing error messaging when failing to pull oci layout image

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

* Fix error expectation

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

* Fix selective write test

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

* Guard nil build image in extender factory

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-10-24 11:57:29 -04:00
Natalie Arellano d69768d861
Bump dependencies (go get -u ./...) (#938)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-10-24 11:57:15 -04:00
Michael de Senna ca6c1c9118
build: fix coverage (#936)
Signed-off-by: Michael de Senna <desenna@gmail.com>

Signed-off-by: Michael de Senna <desenna@gmail.com>
2022-10-21 12:41:38 -04:00
Natalie Arellano 7b5aa02886
Bump imgutil and docker (#933)
* Bump imgutil and docker

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

* Fix selective write test

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-10-19 16:51:55 -04:00
Natalie Arellano 4b33990e43
Fix creator restore bug (#929)
* When platform API is at least 0.10, run the restore phase always but pass
-skip-restore as skip layers to skip layer metadata and SBOM restoration

This ensures:
- In the 5 phase invocation, the restorer can always run (for extension purposes)
- The 5 phase invocation will match the creator invocation

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

* Fix selective write test

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-10-19 16:51:36 -04:00
Natalie Arellano 6643f35886
Merge release/0.15.0-rc.1 into main (#924)
* Bump containerd (fixes CVE-2022-31030) and runc (fixes CVE-2021-30465)

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

* Add .grype.yaml to ignore known non-impactful CVEs (#923)

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

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-10-11 12:02:07 -04:00
Natalie Arellano 2f8a818959
Dockerfiles phase 2 (#896)
* Consolidate logic in the platform package

- Remove the platform/launch package as it is not needed to avoid having the launcher depend on the lifecycle

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

* Reinstate platform/launch package to keep the launcher binary smaller

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

* Fix constant

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

* Remove comment

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

* WIP

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

* WIP

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

* Don't mount layers fixture in container

This way changes from the first build (/layers/config/metadata.toml, /layers/sbom, etc.)
are not propagated to the second build.

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

* Set environment variables from the extended build image in the build context

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

* Fix format string

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

* Restorer pulls builder manifest and config

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

* Copy extend-config.toml from extension output to /layers/generated

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

* Only import kaniko on linux

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

* WIP: units pass

Refactor buildpack build, detect, and generate to separate data model from service

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

* WIP: fixed some TODOs

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

* WIP: addressed some more TODOs, units pass

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

* WIP: units pass

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

* WIP: acceptance tests pass

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

* Address some minor TODOs

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

* When running extender acceptance, don't mount in /workspace directory

This leads to incorrect permissions issues when running on linux

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

* Don't try to check for specific curl version

This appears flaky

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

* fixes from testing. (#902)

Signed-off-by: Ozzy Osborne <bardweller@gmail.com>

Signed-off-by: Ozzy Osborne <bardweller@gmail.com>

* Lint

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

* Add tests and TODO

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

* Change CNB_BUILDPACK_DIR -> CNB_EXTENSION_DIR

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

* Fill in default generated dir

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

* Ensure kaniko doesn't try to pull 'oci:/kaniko/cache/base/sha256:XXX' from a remote registry

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

* Add test

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

* Fix panic

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

* Fix assertion

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

* Pass build_id as UUID to Dockerfile

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

* Add tests for selective package

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

* Remove kaniko fork

- Fix acceptance by adding CacheRunLayers option and moving 'ARG build_id=0' statements

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

* Fix windows

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

* Dockerfile validation (#918)

* Add Dockerfile Validation

Signed-off-by: Ozzy Osborne <bardweller@gmail.com>

* use mobi buildkit dockerfile parsing

Signed-off-by: Ozzy Osborne <bardweller@gmail.com>

Signed-off-by: Ozzy Osborne <bardweller@gmail.com>

* Add units for Dockerfile validation

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

* Fix launcher

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

* Minor improvements

- Test ReadGroup for extensions
- Ensure stderr is captured for acceptance test that might expect it
- Read group.toml into an accurate struct (that has extension and optional set for extensions)
  and set these fields to false before writing out to TOML or JSON

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

* Skip image extensions tests on Windows

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
Co-authored-by: Javier Romero <rjavier@vmware.com>
Co-authored-by: Ozzy Osborne <bardweller@gmail.com>
2022-10-07 11:09:58 -04:00
Natalie Arellano 0205531176
Implement overridable process args (#921)
* Implement overridable process args

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

* Apply suggestions from code review

Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>

* When there are no user-provided args, overridable args should be provided

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

* Fix user provided args for newer buildpack with no always-args

When there are no always-args, we need to check the buildpack API, because
it's not clear from the process definition if the buildpack is newer or older.

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

* Fix: user-provided args should replace overridable args only if non-empty

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

* Fix: older platforms should always append

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
2022-10-06 09:19:08 -04:00
Jesse Brown 68a937bb0a
Allow storing multiple commands instead of a single string (#920)
* Allow storing multiple commands instead of a single string (#900)

* Allow storing multiple commands instead of a single string

This is a first step to implementing #322. This PR is updating our internal structs to allow for a slice of commands while keeping the external API and behavior the same. A future PR will implement handling multiple commands depending on the API version and changing the behavior of the launcher and metadat file output changes.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Comment on usage of cmp.Option

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Add comment on Matches interface usage for testing

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Added test for launch.toml decoding branching logic

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Apply suggestions from code review

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Apply suggestions from code review

* fixup! Apply suggestions from code review

* Fix editing daemon settings

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

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>

* WIP

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

* Fixing up existing tests

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Remove now unused process specific decode paths

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Remove now unused process specific decode paths

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Remove now unused process specific decode paths

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Remove now unused process specific decode paths

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Remove now unused process specific decode paths

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Remove now unused process specific decode paths

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Clean up more serialization paths

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Remove toml wrapping code

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Added comment on UnmarshalTOML

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Put back code I didn't mean to remove

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Update launch/launch.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* removed line

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2022-09-30 13:54:33 -04:00
Natalie Arellano 52e7885192
Revert "Allow storing multiple commands instead of a single string (#900)" (#919)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-09-29 14:01:46 -04:00
Natalie Arellano 3fec123f29
Try to fix "check release" workflow (#916)
* Try to fix "check release" workflow

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

* Fix indent

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-09-28 09:53:11 -04:00
Jesse Brown 5fa84a4c38
Allow storing multiple commands instead of a single string (#900)
* Allow storing multiple commands instead of a single string

This is a first step to implementing #322. This PR is updating our internal structs to allow for a slice of commands while keeping the external API and behavior the same. A future PR will implement handling multiple commands depending on the API version and changing the behavior of the launcher and metadat file output changes.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Comment on usage of cmp.Option

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Add comment on Matches interface usage for testing

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Added test for launch.toml decoding branching logic

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Apply suggestions from code review

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Apply suggestions from code review

* fixup! Apply suggestions from code review

* Fix editing daemon settings

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

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2022-09-22 15:40:41 -04:00
Natalie Arellano 2885c01804
Add GitHub Actions workflow to update go when a new version is available (#910)
* Add GitHub Actions workflow to check if latest lifecycle release is on the latest patch of Go

Also scan the latest lifecycle image to see if any vulnerabilities are alerted

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

* Pass GH token to step

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

* Update release version for lifecycle image

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

* Don't create issue if it exists already

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

* Create issue if CVEs are found

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-09-19 16:08:11 -04:00
Natalie Arellano f1398cef14
Dockerfiles phase 1: update experimental mode env var (#881)
* Update experimental mode env var

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

* When CNB_EXPERIMENTAL_MODE is unset, default to `error`

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-09-19 10:54:36 -04:00
Natalie Arellano cdc31cf671
Merge release/0.14.2 into main (#913)
* Upgrade go to 1.18 (#907)

* Use go 1.18 in CI
* Bump deps (except toml)

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

* Fix process type parsing (#912)

* Use the last part of the path when trying to find matching process. (#903)

* Use the last part of the path when trying to find matching process.

The process was comparing the base path minus the extension, which was blocking types with a `.` in them from ever matching.

Fixes #895

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Upgrade go to 1.18 (#907)

* Use go 1.18 in CI
* Bump deps (except toml)

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

* Test path lookup (#909)

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

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

* Revert "Merge branch 'release/0.14.2' into jab/fix-process-type-parsing"

This reverts commit 6f56a31733, reversing
changes made to e544937760.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>

* Bump imgutil

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

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
2022-09-19 10:54:04 -04:00
Natalie Arellano 18f0abc6fe
Scan dev lifecycle images after they are published (but before they are re-tagged (#911)
with a non-dev version)

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-09-16 17:15:06 -04:00
Natalie Arellano a3304c34db Update setup-go
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-09-16 13:31:14 -04:00
Jesse Brown f3af3e0080
Use the last part of the path when trying to find matching process. (#903)
* Use the last part of the path when trying to find matching process.

The process was comparing the base path minus the extension, which was blocking types with a `.` in them from ever matching.

Fixes #895

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* fixup! Use the last part of the path when trying to find matching process.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Upgrade go to 1.18 (#907)

* Use go 1.18 in CI
* Bump deps (except toml)

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

* Test path lookup (#909)

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

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

* Revert "Merge branch 'release/0.14.2' into jab/fix-process-type-parsing"

This reverts commit 6f56a31733, reversing
changes made to e544937760.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2022-09-13 16:52:52 -04:00
Natalie Arellano 4f52db0a90
Remove -output-dir in favor of -generated (#898)
To be more consistent with the arguments needed by the extender in phase 2

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-08-24 12:19:57 -04:00
Natalie Arellano 0c057cd21d
Upgrade GHA runner (#897)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-08-24 12:19:00 -04:00
dependabot[bot] 6b0943ba43
Bump github.com/google/go-containerregistry from 0.10.0 to 0.11.0 (#885)
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-24 10:28:10 -04:00
Jesse Brown 328f07bbb3
Allow new buildpack API to use new launch.toml format (#889)
* Ignore .tool-versions for asdf and other tooling

* Allow new buildpack API to use new launch.toml format

- Buildpacks using the newer buildpack API must use the new launch.toml format
- The older format is still allowed on older buildpack API versions

Issue: https://github.com/buildpacks/lifecycle/issues/870

* Update buildpack/build_test.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Update buildpack/build_test.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Update buildpack/build_test.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Added Buildpack 0.10 as valid buildpack API

Fixed tests that were now invalid due to the default buildpack being 0.10

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Apply suggestions from code review

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2022-08-23 15:57:23 -04:00
Natalie Arellano 512528c687
Refactor: consolidate some logic in platform package (#875)
* Consolidate logic in the platform package

- Remove the platform/launch package as it is not needed to avoid having the launcher depend on the lifecycle

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

* Reinstate platform/launch package to keep the launcher binary smaller

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

* Fix constant

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

* Remove comment

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

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-08-23 14:30:47 -04:00
Natalie Arellano 81da25326c
Update dependencies (#883)
* Bump imgutil

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

* Bump deps to fix compile errors

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-07-19 15:19:46 -04:00
Natalie Arellano a9d5c7c2de
Small fixes for Dockerfiles phase 1 (#882)
* Small fixes for Dockerfiles phase 1

* Looks for pre-populated output files in nested directories (e.g., ./generate) instead of the extension root
* Extensions must satisfy all requires they enlisted to provide
* Escape extension ID when locating Dockerfiles
* Resolve analyzed path if not provided

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

* Fix assertion

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

* Fix more assertions and unwrap errors

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-07-19 10:53:44 -04:00
Natalie Arellano 60295970b6
Fix: a buildpack and extension with the same ID can both detect (#879)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-07-18 15:43:49 -04:00
Natalie Arellano cbdfa63223
Remove redundant acceptance tests (#874)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-07-18 15:42:46 -04:00
Javier Romero 746b0978f7
Fix: Output ANAYLYZING phase heading (#878)
On newer platform API versions, the lifecyle is not printing an expected ANALYZING step header

Signed-off-by: Javier Romero <rjavier@vmware.com>
2022-06-30 11:01:03 -04:00
Natalie Arellano ce23c6593a
Dockerfiles phase 1 (generate changes) (#869)
Generate changes to support Dockerfiles feature

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-06-28 10:38:08 -04:00
Natalie Arellano a23f9b1e4f
Move logger interface to own package (#867)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-06-24 13:24:40 -04:00
Natalie Arellano 2e739d6de5
Dockerfiles phase 1 (detect changes) (#860)
Detect changes to support Dockerfiles feature

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-06-08 10:09:31 -04:00
Natalie Arellano b5f8bad1f1
Bump deps (#863)
* Bump imgutil

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

* Bump other deps to fix linter

Update Makefile

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-05-27 13:58:40 -04:00
Natalie Arellano f1d94587d8
Apply the fix from https://github.com/buildpacks/lifecycle/pull/853 to ResolvedKeychain (#862)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-05-27 13:33:10 -04:00
dependabot[bot] 1a76076709
Bump github.com/google/go-containerregistry from 0.8.0 to 0.9.0 (#859)
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-27 11:09:39 -04:00
Natalie Arellano ce9e093c55
When the provided keychain is missing authorization information for a registry, the (#853)
environment variable and/or in-memory keychain should omit it, instead of including it
with an empty header.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-05-26 14:50:09 -04:00
Sambhav Kothari 7afe29415a
Make runLaunch public (#848)
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-05-26 11:13:51 -04:00
Natalie Arellano 51046e7a98
Add credential helpers for Amazon and Azure (#855)
* Add credential helpers for Amazon and Azure

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

* When using cloud credential helpers, resolve creds early

If the lifecycle is run as root, after dropping privileges it may not be able
to read cred helper files. By resolving creds in memory when the keychain is
instantiated, we avoid this edge case.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-05-25 17:57:27 -04:00
Natalie Arellano b81fe9c17e
Use identity token when provided, instead of ignoring it (#854)
* Use identity token when provided, instead of ignoring it.

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

* Preserve IdentityToken in AuthConfig

The registry -> header map allows us to reconstruct the AuthConfig when resolving the keychain.
By giving identity tokens a unique header, we are able to distinguish them from registry tokens.

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

* Remove authConfig -> header -> authConfig round tripping for in-memory keychain
(now resolved keychain).

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

* Rename env_keychain.go to keychain.go

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

* Add comment

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-05-25 17:34:13 -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
dependabot[bot] e498b7b189
Bump github.com/google/go-cmp from 0.5.7 to 0.5.8 (#851)
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.7 to 0.5.8.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.7...v0.5.8)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-04 13:36:32 -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
Natalie Arellano 277f3b2834
The lifecycle should ensure ownership of the launch cache dir (#847)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-04-21 10:39:21 -04:00
dependabot[bot] b6803be364
Bump github.com/BurntSushi/toml from 1.0.0 to 1.1.0 (#846)
Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-12 15:04:36 -04:00
Natalie Arellano 917c1acd25
Update README for latest apis (#836)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-04-01 10:20:24 -04:00
Natalie Arellano 4b0fe078d6
Turn go modules off with ENV (#843)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-03-30 11:05:00 -04:00
Natalie Arellano 774500dc77
Upgrade to go 1.17 (#839)
* Upgrade to go 1.17

Now that go 1.18 is out, go 1.16 is no longer supported.

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

* Fix Windows

In go 1.17, child processes do not automatically inherit handles from the parent process.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-03-29 12:41:25 -04:00
dependabot[bot] 410339eb56
Bump github.com/docker/docker (#837)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.13+incompatible to 20.10.14+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.13...v20.10.14)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-28 13:06:23 -04:00
Natalie Arellano 0f5a9cdd7f
Strip optional parameter before checking media type (#834)
* Builder when validating bomfile media type against buildpack declared type
should strip optional parameter before checking equality

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

* Use mime package to parse type

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-03-23 13:42:56 -04:00
Natalie Arellano a820b84f52
Merge release/0.13.5 into main (#833)
* Specify windows-2019 since windows-2022 is the default runner now (#816)

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

* Bump containerd to v1.5.10 (#822)

- Removes CVEs (CVE-2022-23648 & CVE-2021-43816) reported in containerd 1.5.8 & 1.5.9

Signed-off-by: matthewmcnew <mmcnew@pivotal.io>

* When restoring sbom files, silently ignore if the bp layers directory does not exist (#832)

This can happen when there are sbom files for launch but the cache is empty

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

Co-authored-by: Matthew McNew <mmcnew@pivotal.io>
2022-03-21 17:44:28 -04:00
Natalie Arellano 828906b144
Write sbom.legacy.json files for newer platform api (#825)
* Write sbom.legacy.json files for newer platform api

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

* Don't print empty bom for platform 0.9

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

* Fix function name

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

* Return empty bom for newer platform

Due to limitations of our TOML library, we can't add MarshalTOML to the top-level struct.

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

* Use standard capitalization for sbom

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-03-21 17:30:48 -04:00
dependabot[bot] 1f3a0c092b
Bump github.com/docker/docker (#826)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.12+incompatible to 20.10.13+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.12...v20.10.13)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-15 15:39:20 -04:00
Jesse Brown 82298b73ee
Support SOURCE_DATE_EPOCH (#823)
* Support SOURCE_DATE_EPOCH

Platforms can set `SOURCE_DATE_EPOCH` to control the timestamp on the exported app images.

See https://github.com/buildpacks/lifecycle/issues/809 for more details.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Fixing 0.9 skip-layers test

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Added 0.9 exiter test

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2022-03-10 13:26:39 -05:00
Matthew McNew 3ff2467525
Bump containerd to v1.5.10 (#822)
- Removes CVEs (CVE-2022-23648 & CVE-2021-43816) reported in containerd 1.5.8 & 1.5.9

Signed-off-by: matthewmcnew <mmcnew@pivotal.io>
2022-03-09 10:13:34 -05:00
Mikey Boldt 76dc230e3f
Set env vars for positional args in build and detect (#818)
As described in RFC 100, set the following environment variables when
running buildpack executables, which correspond to their positional
arguments.

In `detect`:

- CNB_PLATFORM_DIR
- CNB_BUILD_PLAN_PATH

In `build`:

- CNB_LAYERS_DIR
- CNB_PLATFORM_DIR
- CNB_BP_PLAN_PATH

Fixes #806.
Fixes #807.

Signed-off-by: Mikey Boldt <mboldt@vmware.com>
2022-03-04 15:30:16 -05:00
Natalie Arellano b0138eff17
Change working-directory to working-dir (#814)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-03-04 15:29:50 -05:00
Jesse Brown d9a734ec90
Merge pull request #817 from mboldt/dev-add-jq-yj
Add jq and yj as development prerequisites
2022-03-03 12:27:24 -06:00
Mikey Boldt b3975bf1b6 Add jq and yj as development prerequisites
They are required by the buildpack in buildpack/testdata/buildpack.

Signed-off-by: Mikey Boldt <mboldt@vmware.com>
2022-03-03 11:23:50 -06:00
Natalie Arellano 745886f649
Specify windows-2019 since windows-2022 is the default runner now (#816)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-03-03 11:02:57 -05:00
Natalie Arellano a176d44f72
Improve performance when restoring launch sboms from daemon (#800)
* Add new flags to analyzer

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

* Use nop restorer when not supported by the platform.

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

* Pass through skip layers from the creator

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

* Move empty check inside service

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

* Fix failing tests

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-02-10 12:05:39 -05:00
Mikey Boldt 4ebc445600
Process-specific working directory (#792)
* Set working directory for processes running in bash shell

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Set working directory for processes running in cmd.exe

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Set working directory for direct processes

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Handle process working directory in build phase

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Simplify command to check working directory in test

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Support process working directory on different drive on Windows

Requires the `/d` flag on `cd` to change drive.

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Add tests for working directory with direct=false

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Use platform-specific path in CNB_APP_DIR

The `cd` for process-specific working directory fails on Windows
when it is given a Unix-style path.

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Add default working directory test

Signed-off-by: Mikey Boldt <mboldt@vmware.com>
2022-01-26 12:10:59 -05:00
Natalie Arellano 9f48e5a10a
If there are is no sbom layer in the cache, still copy sbom files for launch that were restored (#798)
from the previous image.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-01-24 15:01:12 -05:00
Anthony Emengo 8df2237a8f
Warn when legacy bom is specified on buildpack API 0.7 (#794)
* Warn when legacy bom is specified on buildpack API 0.7

as opposed to throwing an error. This allows for non-breaking platform migration from legacy bom table to sbom format

This commit partially reverts 880a801db2

Signed-off-by: Anthony Emengo <aemengo@vmware.com>

* Address PR comments

* Add test for top-level bom.version entry
* Don't show warning message if legacy BOM and new SBOM is provided

Signed-off-by: Anthony Emengo <aemengo@vmware.com>
2022-01-24 13:47:17 -05:00
dependabot[bot] db1d753f63
Bump github.com/google/go-cmp from 0.5.6 to 0.5.7 (#796)
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.6 to 0.5.7.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.6...v0.5.7)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-24 12:35:42 -05:00
dependabot[bot] 4a6089b483
Bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0 (#790)
* Bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0

Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 0.4.1 to 1.0.0.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v0.4.1...v1.0.0)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix deprecation from updated toml library.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

* Update test to match new error format

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
2022-01-14 16:39:38 -05:00
dependabot[bot] 11ea281c1d
Bump github.com/google/go-containerregistry from 0.7.0 to 0.8.0 (#788)
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 16:50:59 -05:00
dependabot[bot] 1a934bdcb5
Bump github.com/docker/docker (#785)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.11+incompatible to 20.10.12+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.11...v20.10.12)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 16:50:34 -05:00
Mikey Boldt 6f56a15303
Fix lint issues (#787)
Signed-off-by: Mikey Boldt <mboldt@vmware.com>
2022-01-03 11:45:29 -05:00
Natalie Arellano b6408639c0
Fix slow performance for creator when restoring sbom layer from previ… (#784)
* Fix slow performance for creator when restoring sbom layer from previous image in daemon

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

* Add info statements and try to fix exporter flake on arm runner

We should at least log something when restoring the sbom layer. This aligns the logging
for sbom with the logging for layer content metadata.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-13 14:34:50 -05:00
Natalie Arellano 157e030cff
Don't run restorer tests for every buildpack api (#781)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-10 15:55:13 -05:00
Natalie Arellano 77904d2814
Organize analyze inputs (#782)
* Organize analyze inputs

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

* Rename struct back and update comments

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-10 10:29:58 -05:00
Natalie Arellano 42be2d161b
Remove separate packages for platform interface implementation (#771)
* Remove separate packages for platform interface implementation

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

* Update builder_test.go

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

* Update builder_test.go

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

* Add tests

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-07 10:17:20 -05:00
Natalie Arellano 071939dab9
Bumps imgutil and also updates indirect dependencies (#777)
* Bumps imgutil and also updates indirect dependencies

The lifecycle and imgutil will be on the same version of ggcr.

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

* Tidy

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-06 10:02:40 -05:00
Matej Vasek ab007b17fe
guard singleton connection (#779)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-06 09:51:46 -05:00
Matej Vasek 1f904803d9
Keep connection opened (#684)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-03 16:37:15 -05:00
Natalie Arellano bf99b6fdc7
Remove the pre-release note for 0.13.x (#778)
We forgot to do this when we cut 0.13.0.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-03 15:36:10 -05:00
dependabot[bot] d45c5fd9b4
Bump github.com/google/go-containerregistry from 0.6.0 to 0.7.0 (#774)
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-03 14:40:31 -05:00
Natalie Arellano dd0c0d5e16
Fix bug where sbom is not restored for launch=true cache=false layers (#773)
* Fix bug where sbom is not restored for launch=true cache=false layers

Because the layer directory does not exist in the build container, the lifecycle
did not bother to look for any sbom files.

This changes `eachDir` to `eachLayer`. Usages of the return value of `eachLayer`
will not fail if the layer directory does not exist.

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

* WIP

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

* Unit tests passing

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

* Acceptance tests passing

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

* Remove focus

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

* Fix format

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

* Make test setup simpler

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

* Fix format

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

* Fix volume permissions issue

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

* Updates from code review && fix

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

* Don't fail if failed to remove directory

This is the approach taken by analyzer acceptance and pack.

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

* Fix bug when layers/sbom is not cleared if -skip-restore is used

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-03 14:26:02 -05:00
Natalie Arellano 51280df55b
Bump ggcr & imgutil (#770)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-01 18:03:37 -05:00
Natalie Arellano e6cad2ecf1
Fix pack acceptance (#772)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-12-01 17:22:17 -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
dependabot[bot] 5744dae9b0
Bump github.com/docker/docker (#769)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.10+incompatible to 20.10.11+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.10...v20.10.11)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-29 12:43:19 -05:00
Natalie Arellano 496670f2ab
Update buildpack.toml to use sbom-formats (#768)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-11-18 14:06:00 -05:00
Natalie Arellano 9ba9bb88a9
Fix comment (#767)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-11-18 12:29:49 -05:00
Anthony Emengo 880a801db2
Error when previous bom is specified on buildpack API 0.7 (#764)
* Error when previous bom is specified on buildpack API 0.7

instead of warning

Signed-off-by: Anthony Emengo <aemengo@vmware.com>

* Warn when new sbom is specified on buildpack API <0.7

Signed-off-by: Anthony Emengo <aemengo@vmware.com>
2021-11-17 12:14:11 -05:00
Jesse Brown 196f637ace
Switch bom to sbom (#761) (#763)
Signed-off-by: Anthony Emengo <aemengo@vmware.com>

Co-authored-by: Anthony Emengo <aemengo@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-11-15 13:11:39 -05:00
Jesse Brown b1a2a7c624
Merge pull request #762 from aemengo/switch-bom-to-sbom-2
bom -> sbom 2
2021-11-11 12:29:58 -06:00
Anthony Emengo 91727236ce bom -> sbom
Signed-off-by: Anthony Emengo <anthonyemengojr@gmail.com>
2021-11-11 12:27:09 -05:00
Natalie Arellano 8e4dbe0deb
Update README with latest supported apis (#758)
* Update README with latest supported apis

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

* Also update lifecycle.toml

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-11-10 17:19:58 -05:00
Natalie Arellano 7762adccff
Automatically update lifecycle.toml when new apis are added (#756)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-11-10 16:23:47 -05:00
Natalie Arellano 6438e02f9a
Use sbom instead of bom as filename prefix for consistency (#759)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-11-10 16:17:07 -05:00
Natalie Arellano 075a63ee27
Don't print warnings about run image for older platform apis (#757)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-11-10 16:05:58 -05:00
Anthony Emengo f02ec0f830
Add sBOM functionality (#749)
* Builder should warn if newer buildpacks write a bom in *.toml

Add 0.7 to buildpack APIs

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

* Combine validate and handle functionality

Rename concrete implementation per review feedback

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

* Cache sBOM

Signed-off-by: Anthony Emengo <aemengo@vmware.com>

* Copy BOMs to /layers/sbom/...

Instead of /layers/config/sbom/...
Fixes condition where unwanted sbom directories end up in final app image

Signed-off-by: Anthony Emengo <aemengo@vmware.com>

* Restore BOM layer of previous application image

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

* Migrate sBOM layer restore to analyze phase

It avoids requiring the daemon for the restore phase

Signed-off-by: Anthony Emengo <aemengo@vmware.com>

* Fix bugs

- Fix bug where unescaped buildpacks fail to have SBOM restored

Signed-off-by: Anthony Emengo <aemengo@vmware.com>

* SBOM media types

- Introduce support for Syft SBOM type
- Opt for application/spdx+json over text/spdx+json
  in virtue of https://www.iana.org/assignments/media-types/application/spdx+json
- Validate against declared SBOM media types

Signed-off-by: Anthony Emengo <aemengo@vmware.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-11-10 15:53:04 -05:00
Mikey Boldt aaf097aa25
Get `make lint` to work out of the box with Go 1.17 (#748)
* Update golangci-lint to the latest version, and fix lint errors.

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Exit upon error getting the lifecycle layer.

Signed-off-by: Mikey Boldt <mboldt@vmware.com>

* Formatting and linting cleanup.

Signed-off-by: Mikey Boldt <mboldt@vmware.com>
2021-11-03 11:44:12 -04:00
dependabot[bot] 577dba3bf5
Bump github.com/docker/docker (#752)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.9+incompatible to 20.10.10+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.9...v20.10.10)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-26 13:11:08 -04:00
Vinod Anandan 422f462fe6
Update the SBOM generation (#750)
Signed-off-by: Vinod <vinod@owasp.org>
2021-10-26 12:34:10 -04:00
Natalie Arellano 9b72550dd3
Merge release/0.12.0 into main (#739)
* Run image should be locked to a digest in analyzed.toml (#720)

* Run image should be locked to a digest in analyzed.toml

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

* Use more flexible matcher for other test

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

* Update github actions to use cosign v1.2.0 (#708)

* Introduce new api version helpers (#705)

* Introduce new api version helpers

This makes the code a little easier to read.

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

* Fix

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

* Remove comment

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

* Fix lint

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

* Update github actions to use cosign v1.2.0

Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>

Co-authored-by: Natalie Arellano <narellano@vmware.com>

* Add information about buildpacksio/lifecycle (#707)

* Introduce new api version helpers (#705)

* Introduce new api version helpers

This makes the code a little easier to read.

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

* Fix

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

* Remove comment

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

* Fix lint

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

* Add information about buildpacksio/lifecycle

This information should be copied to the Docker Hub repo "about" section.

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

* Small fix

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

* Small fix

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

* Update steps for verifying SBOM

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

* Update the README for platform 0.7 (#704)

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

* Fix umask race (#722)

* Set umask before extracting layers to avoid race condition

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

* Add comment

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

* Update archive/extract.go

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

Co-authored-by: Anthony Emengo <aemengo@vmware.com>

* Don't try to set the umask outside of extract

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

* Don't try to read umask in extract

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

Co-authored-by: Anthony Emengo <aemengo@vmware.com>

* Buildpack api 0.7 is not supported (#726)

* Buildpack api 0.7 is not supported

We missed this when backing out asset packages.

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

* Fix

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

* Use the correct tag when signing the sbom (#729)

* Use the correct tag when signing the sbom

Also there is no need to parse the digest from `crane tag` because it does not change.
This will make the code less brittle.

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

* Add manifest sha when validating semver

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

* Fix

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

* Fix

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

* Ensure umask is unset when extracting archive (#727)

* Ensure umask is unset when extracting archive

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

* Add test

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

* Fix

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

* Get the current umask without changing it

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

* Fix

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

* Fix windows

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

* Fix windows

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

* Update per review comments

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

* Less confusing wording

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

* Reduce the diff

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

* Fix

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

* Added comments

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

* Better wording

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

* Add test that system umask is used to create non existent directory not in tar file

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

* Variable names and formatting

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

* Try to fix windows

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

* Avoid direct dependency on archive

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

* Make test setup simpler and update comment

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

* Add build directive

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

* Apply suggestions from code review

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

* Fix Codecov

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

* Fix lint

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

* Set Umask as part of archive.Extract

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

* Move the unlock methods to be under defer
instead at the end of the function in case setUmask will panic.

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

* Bump imgutil (#731)

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

* Fix merge

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

Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
Co-authored-by: Anthony Emengo <aemengo@vmware.com>
Co-authored-by: Yael Harel <yharel@vmware.com>
Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
2021-10-26 12:27:59 -04:00
Jesse Brown cbbd75231f
Pass `platform` when executing `lifecycle` subcommands (#747)
The `lifecycle <subcommand>` was not providing a platform, which was causing failures.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-10-25 15:03:10 -04:00
Jesse Brown 84dbba1f22
Merge pull request #746 from mboldt/autoupdate-build-constraints
Add new build constraints format.
2021-10-14 13:19:42 -05:00
Mikey Boldt 321d7d172d Add new build constraints format.
`make format` made these changes automatically.
For more context on the build constraint format change, see:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

Signed-off-by: Mikey Boldt <mboldt@vmware.com>
2021-10-12 11:58:21 -05:00
dependabot[bot] 919b8add4c
Bump github.com/docker/docker (#740)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.8+incompatible to 20.10.9+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.8...v20.10.9)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-05 09:30:32 -04:00
Natalie Arellano 8c2edb2a85
Untangle cmd and platform packages (#723)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-09-29 09:10:37 -04:00
Natalie Arellano 83ebcd4146
Add debug statements for exporter (#710)
* Add debug statements for exporter

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

* Fix

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

* Use simpler syntax

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-09-20 16:14:07 -04:00
Natalie Arellano b8e2767db7
Introduce new api version helpers (#705)
* Introduce new api version helpers

This makes the code a little easier to read.

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

* Fix

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

* Remove comment

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

* Fix lint

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-09-13 14:29:41 -04:00
Natalie Arellano 9895acb6a6
Sign sbom (#701)
* Sign SBOM after attaching it

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

* Fix

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

* Fix

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

* Fix

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

* Fix

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

* Use sbom sha when signing

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

* Update script to test on forks

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

* Sha is for layer, not manifest

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-09-07 14:09:31 -04:00
Halil İbrahim ceylan af5a4ea443
Adds acceptance tests for builder (#648)
* first setup

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* unexpected arguments test

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* root user test

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* group toml file tests.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* delete old image after finish

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* add when

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* for delete default file new way

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* default empty group toml for other tests

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* plan toml tests

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* add example buildpack

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* no need cnb_platform_api during docker build

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* some fixme for before production warn

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* windows testing fixme

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* default file location tests are changed.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* no need detect in builder acceptance test

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* plan and order tomls are generated.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* error on verifying buildpack api Group.toml

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* Group and Plan PlaceHolder tests

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* remove unnecesary debug print from actual code.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* better explain

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* builder args are checked in build script

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* add space line 81

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* use func name instead of lines

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* CNB_APP_DIR test fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* CNB_BUILDPACKS_DIR test fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* cnb app dir test gitkeep for empty folder

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* CNB_LAYERS_DIR test fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* WIP: CNB_PLAN_PATH test need to debug.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* delete CNB_GROUP_PATH test

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* CNB_PLAN_PATH test is fixed

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* when-it fixes according to feedback

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* remove test focus

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* remove print

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* Apply suggestions from Natalie

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* Update acceptance/builder_test.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* typo fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* typo fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* for positive test copy and check metadata.toml file

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* change old comments

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* deleted parent when

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* remove cnb_asset env

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* delete unnecessary readme files from buildpack

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* missing new lines.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* delete unnecessary parts of buildpack.toml files

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* CNB_PLATFORM_DIR test

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* comment fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* build files clear unused parts

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* missing new lines

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* platform_dir fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* <layers> test are changed.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* lint errors

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* metadata.toml content for positive scenerio

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* buildpack 2

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* no need gitkeep

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* Update acceptance/builder_test.go

Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* Apply suggestions from code review

Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* suggestions

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* Update acceptance/builder_test.go

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* delete todo lines

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* positive checks

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* test fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* FIXME comment for windows.

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* remove duplicate function

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* all expected strings are full message

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* empty plan toml test are changed

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* remove focus

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* enable windows test and remove comment lines

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* some gramer issues

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* fix two error string

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* windows test fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* windows fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* Dockerfile fix windows

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* windows fix

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* just skip windows tests rn

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

* skip non-amd64

Signed-off-by: Halil İbrahim ceylan <acolops@gmail.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
2021-09-07 10:12:18 -04:00
Natalie Arellano 49e641132e
Fix bp env bug & remove asset packages (#700)
* Remove asset packages

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

* Fix env bug

Buildpacks update the environment for other buildpacks, so the same env should
be passed through to each buildpack.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-09-02 17:42:46 -04:00
Jason Hall 3a6fd83bd0
Include arm64 artifacts in release (#680)
Signed-off-by: Jason Hall <jasonhall@redhat.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-09-01 14:23:46 -04:00
Natalie Arellano 90a36d1eb2
Add script to make testing on forks easier (#691)
* Add script to make testing on forks easier

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

* Remove unneeded quote

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

* Move script to file and make more flexible

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

* Fix

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

* Remove pack acceptance steps entirely

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-08-31 13:25:31 -04:00
Natalie Arellano ef606cf041
Add cdx sbom (#690)
* Generate cyclonedx bom and add it to the release

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

* Fix

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

* Fix

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

* Fix

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

* Loop over urls and download to same directory

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

* Update assets for pre-release

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

* Attach sbom using cosign

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

* Fix

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

* Fix

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-08-31 13:24:26 -04:00
Natalie Arellano aeabcc071f
Try to run tests on arm machine (#699)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Co-authored-by: Juan Bustamante <jbustamante@vmware.com>
2021-08-30 18:34:53 -04:00
Natalie Arellano 7af70d23f8
Add minimal exporter and creator acceptance tests (#698)
* Create scaffold

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

* Check output image in registry

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

* Check output image in daemon

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

* Fix

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

* Check output cache image

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

* Fix

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

* Skip cache image check

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

* Add minimal creator tests

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

* Introduce "phase" acceptance test helpers and update analyze tests to use them

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

* Acceptance tests are all passing maybe

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

* Tests are passing

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

* Remove unused functions

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

* Remove TODO

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

* Remove TODOs

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

* Try to fix Windows

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

Co-authored-by: Juan Bustamante <jbustamante@vmware.com>
2021-08-30 13:08:43 -04:00
Jason Hall bd3debf449
Install cosign using official GitHub Action (#694)
- use cosign installer in post-release too

Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-08-25 10:21:39 -04:00
Juan Bustamante 5374e0773c
WIP - Refactoring analyzer tests to use custom docker registry (#685)
* WIP - refactoring the analyzer tests replacing the 3 docker registries with only one

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

* WIP - fixing formatting issue

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

* WIP - fixing some review feedback

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

* WIP - handling images privileges with a constant

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

* WIP - updating the test cases to use the latest changes made to docker registry helper

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

* WIP - Fixing some feedback from review and pointing to the imgUtil repo after the depending PR was merged

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

* WIP - fixing some compiling issues after resolving conflict with master, but some tests are broken

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

* WIP - Fixing tests after merging issues

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

* WIP - renaming variables according to the latest format

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

* WIP - adding cleanup statements

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
2021-08-23 12:27:06 -04:00
Jason Hall dbbce69825
Use repository owner from GitHub Actions context (#695)
Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-08-20 10:11:26 -04:00
Natalie Arellano 49889a2e8c
Write run image in analyzed.toml and remove -run-image from exporter for platform 0.7+ (#662)
* Add run image to analyzed.toml, remove as input to exporter

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

* Update from PR review

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

* Updates for creator

Lock the run image to a digest in analyze function, to avoid duplicating logic in analyzer and creator.

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

* Updates per code review

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

* Updates from PR review

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

* Add TODO

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-08-17 16:39:39 -04:00
Natalie Arellano 604fafbd98
Cosign lifecycle images (#683)
* Cosign lifecycle images

- Sign when they are initially created
- Verify and sign when retagging
- Publish the public key as a release asset

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

* Check in public key

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

* Pass cosign password in environment (vs. stdin)

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

* Fix

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-08-17 11:43:29 -04:00
Natalie Arellano 8faa4ebb82
Remove docker compilation for linux binaries (#689)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-08-17 09:49:55 -04:00
dependabot[bot] 6921d078f0
Bump github.com/docker/docker (#687)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.7+incompatible to 20.10.8+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.7...v20.10.8)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-16 14:02:22 -04:00
dependabot[bot] 655ff8ddf2
Bump github.com/BurntSushi/toml from 0.3.1 to 0.4.1 (#688)
Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 0.3.1 to 0.4.1.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v0.3.1...v0.4.1)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-16 12:14:01 -04:00
Yael Harel 00119d33e2
Generate checksums during package (#679)
* Generate checksums during package

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

* Calculate the sha256 while writing to the file

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

* Add the sha256 artifacts to the release

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

* rename linux to linux-x86-64 in the build and release yml files

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

* Add a new line at the end of each sha file

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-08-12 11:32:34 -04:00
Natalie Arellano 8f801a55fd
Pause support for asset packages (#666)
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-22 17:16:15 -04:00
Natalie Arellano 0c5da2ac4c
Refactor analyzer fixtures (#668)
* Refactor analyzer fixtures

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-22 17:14:19 -04:00
Juan Bustamante b3590cab4a
Adding registry credentials validations - Issue 572 (#646)
* Adding registry credentials validations according to issue: #572

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
2021-07-22 13:55:26 -04:00
Natalie Arellano 7cee2d4f10
Merge pull request #676 from buildpacks/fix-image
Fix `make build-image-linux-amd64`
2021-07-21 20:59:29 +00:00
Natalie Arellano cc327cf50c Fix `make build-image-linux-amd64`
We need to translate the daemon architecture from x86_64

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-21 16:17:07 -04:00
Natalie Arellano 33a6cbe6a0
Merge pull request #664 from buildpacks/no-log-header
Don't print header when failed to parse
2021-07-21 16:11:25 +00:00
Natalie Arellano 75ec546d6c
Merge pull request #667 from buildpacks/printOutput
Print the output when decoding the plan toml file of a buildpack fails during detect
2021-07-20 20:55:30 +00:00
Natalie Arellano 404e9d5077 Update from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-20 16:32:11 -04:00
Yael Harel 42020da183 Change an assertion to match the Linux and Windows output messages
Newline in Linux is \n while in Windows is \r\n

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-07-20 16:29:37 -04:00
Yael Harel df089ed342 replace the new detector acceptance test with a unit test
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-07-20 16:16:03 -04:00
Yael Harel 4f711c2a1c Print the output when decoding the plan toml file of a buildpack fails during detect
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-07-20 15:00:14 -04:00
Natalie Arellano dbba763b8f
Merge pull request #665 from buildpacks/docs-requirements
Add Documentation Requirements to Release Process
2021-07-20 16:23:02 +00:00
Natalie Arellano dfaf8103ff Small change
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-20 12:01:16 -04:00
Natalie Arellano 88c2200724 Updates from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-20 11:45:59 -04:00
Natalie Arellano d713c5f9e1 Add Documentation Requirements to Release Process
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-20 10:27:23 -04:00
Natalie Arellano d020ec99f3 Don't print header when failed to parse
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-20 10:19:14 -04:00
Natalie Arellano 3297dacad3
Merge pull request #652 from buildpacks/pack-acceptance
Run pack acceptance tests on pushes to main & release/*
2021-07-13 14:00:13 +00:00
Natalie Arellano 32dc6bda98 Merge branch 'main' into pack-acceptance 2021-07-12 18:16:22 -04:00
Natalie Arellano caab214cd8
Merge pull request #660 from imjasonh/arm2
Fix typo in build.yaml related to arm64 build
2021-07-12 21:34:52 +00:00
Jason Hall 0b397de150 Fix typo in build.yaml related to arm64 build
Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-07-12 14:54:34 -04:00
Natalie Arellano 0ed863bb1f
Merge pull request #659 from imjasonh/arm
Build lifecycle binaries and images for linux/arm64
2021-07-12 18:38:50 +00:00
Jason Hall e0d2b69e1f Build lifecycle binaries and images for linux/arm64
This changes make build to build for linux/amd64, windows/amd64, and
newly, linux/arm64. Binaries are built to paths like
out/$GOOS-$GOARCH/lifecycle, etc.

This also changes the CI image build process to build and attach the
amd64 binary to the build, and to include the linux/arm64 image in the
manifest list.

Acceptance tests were updated to build arch-specific binaries and to
look for them in the new correct place.

Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-07-12 13:37:37 -04:00
Natalie Arellano f15f80c673
Merge pull request #658 from buildpacks/test-drop-privileges
Add acceptance test for analyzer dropping privileges
2021-07-09 15:20:32 +00:00
Natalie Arellano a6d8cd343b
Merge pull request #630 from imjasonh/syscall
Use syscall package instead of cgo
2021-07-08 21:23:47 +00:00
Jason Hall 15eaa2b480 Use syscall package instead of cgo
Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-07-08 16:38:28 -04:00
Natalie Arellano c333eb6334 Add acceptance test for analyzer dropping privileges
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-08 16:35:14 -04:00
Natalie Arellano 979103d8ef
Merge pull request #653 from aemengo/patch-1
Update example in #Caveats
2021-07-08 12:48:41 +00:00
Natalie Arellano f70dcab80e
Merge pull request #650 from aemengo/detect-cnb-assets-var
Show CNB_ASSETS env var conditionally during detect
2021-07-07 21:48:55 +00:00
Anthony Emengo fbf3c4b83c Address PR comments
* Remove NewDetectEnv
* Construct detect process like build process

Signed-off-by: Anthony Emengo <aemengo@vmware.com>
2021-07-07 16:38:23 -04:00
Natalie Arellano 4a7fd0a59c
Merge pull request #654 from buildpacks/docker-login
Don't try to login to docker for PRs
2021-07-07 20:34:40 +00:00
Natalie Arellano 19aee523d6 Don't try to login to docker for PRs
Otherwise the build will fail because secrets are not provided.
We don't intend to push an image, so there is no reason to login.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-07 13:52:36 -04:00
Anthony Emengo 766c761b56 Update example in #Caveats
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
2021-07-07 11:28:57 -04:00
Natalie Arellano 75eb6150ad Use released version of pack
The other branch is only needed on a fork.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-06 12:48:09 -04:00
Natalie Arellano 4be62057e7 Remove unneeded env var
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-06 12:40:56 -04:00
Natalie Arellano 4ced9ae338 Run pack acceptance tests on pushes to main & release/*
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-07-06 12:28:03 -04:00
Anthony Emengo 0371cb8d82 Show CNB_ASSETS env var conditionally during detect
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
2021-07-02 18:29:01 -04:00
Natalie Arellano cf2d0ed8f2
Merge pull request #647 from buildpacks/update-platform-0.7
Updates for platform 0.7
2021-07-02 17:47:27 +00:00
Natalie Arellano 1275e62ad9 Add test for destination tags on same registry
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-29 13:00:17 -04:00
Natalie Arellano 0fadd29c88 Don't make run image required for analyzer
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-28 14:50:42 -04:00
Natalie Arellano 7c91ca7d18 New analyzer inputs for platform 0.7
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-28 14:25:25 -04:00
Natalie Arellano ad8c97992d Add back -cache-image to analyzer so that we can check read/write access
Remove -order from analyzer as it is no longer needed

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-26 08:18:51 -04:00
Natalie Arellano 771ac0b9d0
Merge pull request #632 from buildpacks/dependabot/go_modules/github.com/golang/mock-1.6.0
Bump github.com/golang/mock from 1.5.0 to 1.6.0
2021-06-24 20:27:13 +00:00
Natalie Arellano 3eaf123d91
Merge pull request #640 from buildpacks/release-candidates-2
Semver tag release candidate lifecycle images
2021-06-24 20:26:39 +00:00
Natalie Arellano 244282d90c
Merge pull request #643 from buildpacks/update-imgutil
Bump imgutil to enable checking read/write access for registry image
2021-06-24 20:26:13 +00:00
Natalie Arellano 8eda858b74
Merge pull request #644 from buildpacks/revert-stack-id
Revert "Merge pull request #617 from buildpacks/jab/validate-stack"
2021-06-24 20:17:34 +00:00
Natalie Arellano d2fdd3a80d
Merge pull request #641 from sap-contributions/dont-swallow-original-error-message
Fix: launcher.go swallows downstream error messages
2021-06-24 20:17:20 +00:00
Natalie Arellano b54bc9d2ca Revert "Merge pull request #617 from buildpacks/jab/validate-stack"
This reverts commit 7c5f36b793, reversing
changes made to 162090f625.
2021-06-24 13:40:32 -04:00
Natalie Arellano dfdb1a2a11 Bump imgutil to enable checking read/write access for registry image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-24 13:32:28 -04:00
Philipp Stehle a29b587547 Fix: launcher.go swallows downstream error messages
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
2021-06-24 13:41:05 +02:00
Natalie Arellano 62fd914fef Remove version check
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-23 15:15:23 -04:00
Natalie Arellano da51bd6626 Use gh cli to create release
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-23 15:06:34 -04:00
Natalie Arellano 4f7ccfcc39 Update RELEASE.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-23 09:57:58 -04:00
Natalie Arellano 2b2c61e76a Semver tag release candidate lifecycle images
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-23 09:55:17 -04:00
dependabot[bot] f0ff2801bf
Bump github.com/golang/mock from 1.5.0 to 1.6.0
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/golang/mock
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-22 14:32:03 +00:00
Natalie Arellano 1d7a850cf0
Merge pull request #628 from imjasonh/deps
Update dependencies
2021-06-22 14:24:07 +00:00
Jason Hall b0f8657c53 Fix Windows acceptance test
Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-06-22 09:49:42 -04:00
Jason Hall c761b88420 Another attempt to fix Windows acceptance test
Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-06-21 15:43:40 -04:00
Jason Hall 8cb4cbc879 Try to fix Windows launcher acceptance test
Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-06-17 09:48:47 -04:00
Jason Hall 15e453a094 Update dependencies
Also use module-aware go install to install version-pinned Go tooling,
instead of using tools/tools.go, and remove the separate Go module in
tools/

This change requires Go 1.16+ to build, so also update all CI configs to
use 1.16.

Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-06-16 14:53:07 -04:00
Natalie Arellano 7c5f36b793
Merge pull request #617 from buildpacks/jab/validate-stack
Validate stack during analyze phase
2021-06-16 17:31:34 +00:00
Jesse Brown 55c17a5ca3
fixup! Validate stack during analyze phase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-15 10:40:05 -05:00
Jesse Brown cc21037f73
fixup! Validate stack during analyze phase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-14 16:53:40 -05:00
Natalie Arellano 162090f625
Merge pull request #591 from dwillist/asset_packages
Asset packages
2021-06-14 20:26:49 +00:00
Natalie Arellano 827739271c Pass platform to builder
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-14 15:49:21 -04:00
Jesse Brown efa1357c43
Validate stack during analyze phase
During analyze, Platform 0.7 and above will validate the build and stack image if the data is available to do so.

Addresses: #471

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-14 11:07:09 -05:00
Natalie Arellano 8e9b27e4e7
Merge pull request #626 from buildpacks/release-candidates
Add GHA for shipping release candidates
2021-06-11 20:08:35 +00:00
Natalie Arellano dfbda710c8 Fix windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-11 13:49:41 -04:00
Natalie Arellano fda1b6ee1e Fix not passing through bp env
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-11 13:41:00 -04:00
Natalie Arellano f0767a30d6 Merge branch 'main' into asset_packages
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-11 12:47:38 -04:00
Natalie Arellano fd43a4729a When constructing the environment, also check that the buildpack api supports asset packages
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-11 12:35:47 -04:00
Natalie Arellano edbabee025
Merge pull request #624 from buildpacks/no-sha-files
Don't write sha files when platform API >= 0.7
2021-06-10 15:24:53 +00:00
Natalie Arellano 46ec28d33a
Merge pull request #621 from buildpacks/jab/align-arg-with-spec
Re-Align analyzer with spec and creator
2021-06-10 15:16:23 +00:00
Jesse Brown 251ba00080
More PR requests
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-10 09:04:35 -05:00
Yael Harel 76b95b3821 Create two implementations to the LayerSHAStore
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-06-09 14:51:34 -04:00
Yael Harel debb186ed1 Rename layerAnalyzer to layerMetadataRestorer
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-06-09 13:48:13 -04:00
Natalie Arellano 9a2931dc0d Fix Codecov
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-08 15:32:26 -04:00
Natalie Arellano a7cdb8eb69 Update platform
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-08 15:00:35 -04:00
Natalie Arellano 873cf15e75 Apply few more suggestions from code review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-08 14:51:37 -04:00
Natalie Arellano 0632982dac Apply few suggestions from code review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-08 14:44:02 -04:00
Natalie Arellano 5dc5a88f57 Add instructions in RELEASE.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-08 14:22:44 -04:00
Natalie Arellano 438308fce7 Fixes
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-08 14:03:47 -04:00
Yael Harel cb53965d3e Address feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-06-04 16:37:01 -04:00
Natalie Arellano 8b77181444 Add GHA for shipping pre-releases.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-04 14:59:12 -04:00
Yael Harel f584e397d9 Create a LayerSHAStore interface
(instead of the CacheIsValid)

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-06-03 21:06:58 -04:00
Jesse Brown e1f3c71c6c
fixup! Re-Align analyzer with spec and creator
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-02 16:26:20 -05:00
Jesse Brown b3f3d52df7
fixup! fixup! Re-Align analyzer with spec and creator
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-01 16:13:22 -05:00
Natalie Arellano 98cad52ee4
Merge pull request #622 from buildpacks/dependabot/go_modules/github.com/google/go-cmp-0.5.6
Bump github.com/google/go-cmp from 0.5.5 to 0.5.6
2021-06-01 21:11:22 +00:00
Jesse Brown 33f945aa97
fixup! Re-Align analyzer with spec and creator
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-01 15:32:18 -05:00
Jesse Brown 0e2047a2aa
fixup! Re-Align analyzer with spec and creator
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-06-01 15:27:50 -05:00
Yael Harel a262941881 Keep the buildpacksToLayersSha structure in the DefaultLayerMetadataRestorer
instead of returning it from the Restore function

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-06-01 15:24:10 -04:00
Natalie Arellano 76e0a34ba3
Merge pull request #603 from buildpacks/contributing-2
Add CONTRIBUTING.md and DEVELOPMENT.md and update README.md
2021-06-01 19:07:53 +00:00
Yael Harel 8a9af603ec Move writeShaToFile to NewLayerMetadataRestorer
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-06-01 13:11:50 -04:00
Yael Harel 7934b649bc Adderss feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-06-01 10:59:56 -04:00
Natalie Arellano 10a1edd554
Update RELEASE.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-01 14:28:33 +00:00
Natalie Arellano a1ebdd1a41
Update RELEASE.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-01 14:27:13 +00:00
Natalie Arellano 7ed7a0d619
Update RELEASE.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-06-01 14:27:07 +00:00
Yael Harel 1f4074b453 Don't write sha files when platform API >= 0.7
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-05-28 12:04:17 -04:00
dependabot[bot] 326463f72d
Bump github.com/google/go-cmp from 0.5.5 to 0.5.6
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.5 to 0.5.6.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.5...v0.5.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-25 06:57:11 +00:00
Javier Romero 091c1f7bfc
Merge pull request #619 from buildpacks/feature/gitpod-just-works
Minor tweaks to setup gitpod usage
2021-05-25 00:31:19 -05:00
Jesse Brown 942ee2c82e
fixup! Re-Align analyzer with spec and creator
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-05-19 16:43:02 -05:00
Javier Romero 374e8774aa
Update settings.json
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-19 15:44:16 -05:00
Natalie Arellano 23ea8bdd20 Merge remote-tracking branch 'origin/natalieparellano-patch-1' into contributing-2 2021-05-19 15:29:08 -04:00
Natalie Arellano 5811854ea8 Merge branch 'main' into contributing-2 2021-05-19 15:26:09 -04:00
Jesse Brown d29b01627a
Re-Align analyzer with spec and creator
See [here](https://github.com/buildpacks/spec/pull/225#pullrequestreview-663490720)

We should still be taking in `<image>` to represent the write location and optionally the `<previous-image>` if no explicitly defined.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-05-19 13:28:08 -05:00
Natalie Arellano ac7046c2c5
Merge pull request #620 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.5.1
Bump github.com/google/go-containerregistry from 0.5.0 to 0.5.1
2021-05-19 16:22:09 +00:00
Natalie Arellano fab44466b5
Merge branch 'main' into feature/gitpod-just-works 2021-05-19 16:21:43 +00:00
dwillist 3ffc711f63 resolve merge conflicts
Signed-off-by: dwillist <dthornton@vmware.com>
2021-05-18 13:10:05 -04:00
Jesse Brown 22cfb66e89
Mock LayerMetadataRestorer in analzyer unit tests (#605)
- Moved tests to LayerMetadataRestorer that were not already covered
- Introduced mock and expectations to remaining tests

Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-05-18 11:39:18 -05:00
dwillist 1b3ee80953 replace platform v05 with pre06
Signed-off-by: dwillist <dthornton@vmware.com>
2021-05-18 11:43:20 -04:00
dwillist 323f6563e3 resolve merge conflicts
Signed-off-by: dwillist <dthornton@vmware.com>
2021-05-18 11:16:47 -04:00
dwillist 84115de444 update platform datatypes
Signed-off-by: dwillist <dthornton@vmware.com>
2021-05-18 11:12:17 -04:00
dependabot[bot] 5ec42aa2bc
Bump github.com/google/go-containerregistry from 0.5.0 to 0.5.1
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.5.0...v0.5.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-18 07:01:36 +00:00
Natalie Arellano 0a2db27dec
Merge pull request #607 from micahyoung/use-imgutil-ggcr-registry-helper
Bump imgutil and uses new registry helpers
2021-05-14 21:00:19 +00:00
Micah Young 4b27897047 Bumps imgutil and uses new registry helpers
- Requires GHA firewall exception, which was previously added by docker container
  - Port is dynamic, as is source (docker containers + localhost) so all traffic must be allowed to the private IP, but public IP is not whitelisted so non-internal traffic will be blocked

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-05-14 12:31:21 -04:00
Javier Romero d564804b07 Minor tweaks to setup gitpod usage
* Add `make tidy` to init
 * Make daemon socket writable
 * Bump default timeout for tests in vscode
 * Fuzzy match no `sh` executable path in tests

Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-14 16:13:14 +00:00
dwillist b8fbc1b8cf merge conflicts
Signed-off-by: dwillist <dthornton@vmware.com>
2021-05-13 17:16:29 -04:00
Natalie Arellano dd41c7bb4b
Merge pull request #611 from soniasingla/333
Fix G204 by adding comment
2021-05-13 17:56:25 +00:00
Natalie Arellano 916b898c87
Merge pull request #616 from micahyoung/fix/remove-gha-pinned-docker-cli-windows
Removes pinned Docker CLI for Windows GHA
2021-05-13 17:52:00 +00:00
dwillist 56ee88796c more feedback changes
Signed-off-by: dwillist <dthornton@vmware.com>
2021-05-13 03:05:46 -04:00
Micah Young 6787958c34 Removes pinned Docker CLI for Windows GHA
Latest version fixes issue with `docker attach`

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-05-12 09:28:20 -04:00
Natalie Arellano 9ceda0d9dc
Merge pull request #598 from buildpacks/dependabot/add-v2-config-file
Upgrade to GitHub-native Dependabot
2021-05-11 20:26:12 +00:00
Natalie Arellano 356576c860
Update CONTRIBUTING.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-05-11 16:02:18 +00:00
Natalie Arellano 5475df29d5
Update RELEASE.md
Fixed some formatting
2021-05-10 13:10:22 -04:00
dwillist 5ff86130c9 cleanup & feedback changes
Signed-off-by: dwillist <dthornton@vmware.com>
2021-05-07 03:07:49 -04:00
Sonia Singla 28ac71b7e6 Fix G204 by adding comment
Signed-off-by: Sonia Singla <soniasingla.1812@gmail.com>
2021-05-06 18:05:46 +00:00
Jesse Brown 06bc7289a9
Merge pull request #604 from JanKoehnlein/jk/gitpodify
Gitpodified the repo

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-05-06 10:28:58 -05:00
Jan Koehnlein 8316a8edea Gitpodified the repo
Signed-off-by: Jan Koehnlein <jan@gitpod.io>
2021-05-06 09:24:31 +00:00
dependabot-preview[bot] c5aa6d85d2 Upgrade to GitHub-native Dependabot 2021-05-03 16:37:31 -04:00
Natalie Arellano 7119678c53
Merge pull request #596 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.5.0
Bump github.com/google/go-containerregistry from 0.4.1 to 0.5.0
2021-05-03 19:17:11 +00:00
Natalie Arellano 2b5c0a047e Add CONTRIBUTING.md and DEVELOPMENT.md and update README.md
- Adds CI best practices badge
- Documents insecure registries workaround
- Adds basic information for understanding and contributing to lifecycle

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-05-03 13:54:11 -04:00
Jesse Brown 416e597e35
Run analyzer before detector (#582)
Run `analyzer` before `detector`

[Related RFC](https://github.com/buildpacks/rfcs/pull/135)
[Spec PR](https://github.com/buildpacks/spec/pull/197)

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Co-authored-by: Yael Harel <yharel@vmware.com>
2021-04-30 14:04:55 -05:00
dependabot-preview[bot] a0b1633583
Bump github.com/google/go-containerregistry from 0.4.1 to 0.5.0
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.4.1 to 0.5.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.4.1...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-29 17:14:20 +00:00
Natalie Arellano 3dc792afcf
Merge pull request #597 from buildpacks/release/0.11.2
Merge release/0.11.2 into main
2021-04-29 17:09:25 +00:00
Natalie Arellano 56ba78bfd6
Merge pull request #595 from buildpacks/add-debug-builder
Add debug statements to builder
2021-04-28 16:00:51 +00:00
Natalie Arellano 21b8fd3f1f
Merge pull request #592 from buildpacks/fix/restore-cached-layers-bp-0.6
Look in cache metadata to find cache layers if bp api >= 0.6
2021-04-28 15:41:06 +00:00
Yael Harel 7a5c3e6680 Add debug statements to builder
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-28 11:23:04 -04:00
Natalie Arellano eadff4c0bb Add comment
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-04-28 10:58:25 -04:00
Yael Harel 77b09a929e Remove extraneous when
It is already covered in the tests directly above.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-28 10:45:23 -04:00
Natalie Arellano 8821f80043 Fix formatting
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-27 17:45:51 -04:00
Natalie Arellano 808b29a79f Convert restorer units into table test
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-27 17:42:03 -04:00
Natalie Arellano e13cb71d51 Fix logger print
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-04-27 16:16:22 -04:00
Natalie Arellano 562919b9ae Don't write metadata file even for launch only layers when cache is inconsistent
This is more in line with what the restorer does for buildpack api < 0.6 - when the metadata file has
cache=true and it is not in the cache, the file is deleted regardless of the value of launch.

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-04-27 15:52:31 -04:00
Yael Harel 0ba0dd183f Handle edge case where app metadata and cache metadata are out of sync
The restorer is no longer able to distinguish layers that were marked cache=true in the app metadata
and are not in the cache (for whatever reason) from launch only layers.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-27 14:57:13 -04:00
Natalie Arellano f80df3c8fa Remove TODO
We could update the value of `contents` but it's not necessary and additionally shows that the restorer
prefers metadata that was written by the analyzer to metadata in the cache.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-26 14:53:05 -04:00
Natalie Arellano b368c915cc Skip if buildpack api is greater than or equal to 0.6
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-26 14:43:17 -04:00
Natalie Arellano 9bde998d0f Update skip message
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-26 14:07:11 -04:00
Natalie Arellano 02c79f82d2 Look in cache metadata to find cache layers if bp api >= 0.6
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-26 14:07:11 -04:00
Natalie Arellano 91821d1054
Merge pull request #593 from buildpacks/bump-imgutil
Bump imgutil to fix CI
2021-04-26 18:06:18 +00:00
Natalie Arellano b1513c6407 Bump imgutil to fix CI
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-26 13:52:32 -04:00
dwillist 2ab4678bd2 conditionally add ASSET_CACHE env var to build environment depending on platform API version
Signed-off-by: dwillist <dthornton@vmware.com>
2021-04-26 00:16:32 -04:00
dwillist f07f82e0e6 add required env var, platform API, buildpack API to support asset packages
Signed-off-by: dwillist <dthornton@vmware.com>
2021-04-22 15:39:16 -04:00
Yael Harel 8d93e58810
Merge pull request #581 from buildpacks/new_templates
Add chore and feature templates
2021-04-15 16:17:08 -04:00
Yael Harel a15705e2af Fixes per Natalie's feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-04-15 12:10:01 -04:00
Yael Harel 9b443d8d5f Add chore and feature templates
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-04-14 23:09:45 -04:00
Natalie Arellano a7428a55c2
Merge pull request #563 from buildpacks/add-codecov
Add codecov
2021-04-09 21:12:09 +00:00
Natalie Arellano 5a9429aa5a Update config
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-09 12:35:11 -04:00
Natalie Arellano 92b47a86f2
Merge pull request #541 from micahyoung/fix/analyzer-acceptance-windows
Fixes analyzer acceptance tests for Windows
2021-04-06 22:32:17 +00:00
Natalie Arellano b92fe24ece Try to fix Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-06 18:30:14 -04:00
Natalie Arellano c24f2302d5 Add Codecov
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-04-05 17:25:49 -04:00
Natalie Arellano 497c18cd6a
Merge pull request #562 from buildpacks/release/0.11.1
Merge release/0.11.1 into main
2021-04-02 16:21:59 +00:00
Natalie Arellano 0eedbf1e94
Merge pull request #551 from buildpacks/update-release-process-guide
Update RELEASE.md
2021-04-02 16:21:47 +00:00
Natalie Arellano 75df86ccfc
Merge pull request #560 from buildpacks/remove-k8schain
Remove k8schain
2021-03-31 21:08:23 +00:00
Jesse Brown 32a4e3e2f2
Remove k8schain
The k8schain gcp provider is causing lifecycle to hang indefinitely. We believe it is similar to https://github.com/kubernetes/kubernetes/issues/86245. Reverting out this feature until we can reliably bring it back in.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-31 15:52:46 -05:00
Natalie Arellano a1ee2390ea
Merge pull request #556 from buildpacks/release/0.11.0
Merge release/0.11.0 into main
2021-03-31 16:37:42 +00:00
Jesse Brown 6274261eb6
Apply suggestions from code review
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-03-30 14:13:51 -05:00
Natalie Arellano 5215f8e4ec Merge branch 'main' into release/0.11.0 2021-03-30 14:47:02 -04:00
Micah Young 2051b167d8 Fixes make docker-run-windows helper
This helper simplifies running tests against remote Windows daemon from a Unix workstation

- Updates docker cli to 20.10.5
- Adds richgo, docker build compression

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-27 07:50:59 -04:00
Natalie Arellano ef2576d609
Merge pull request #554 from buildpacks/unit-ignore
Add a unit test
2021-03-26 11:36:05 -04:00
Yael Harel 6d5219299b Add an empty string to `h.Mkfile`
to create an empty file

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-26 10:41:02 -04:00
Yael Harel e9cf4a6361 Add a unit test
rename <layers>/<layer> to <layers>/<layer>.ignore if the
launch, build and cache flags aren't specified

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-25 21:13:05 -04:00
Yael Harel ad4b9b2545
Merge pull request #553 from buildpacks/omit-types-table
buildpack API >= 0.6 - omit the types table when encoding the layer.toml file
2021-03-25 20:06:21 -04:00
Natalie Arellano 9a0f2273be
Merge pull request #552 from buildpacks/jab/fix-creator-default-order
Fix creator not replacing placeholder path for -order
2021-03-25 17:01:33 -04:00
Jesse Brown 5d723977d2
Update RELEASE.md
Updating more steps

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-25 15:43:43 -05:00
Yael Harel 18d1acfac6 Omit the types table when encoding the layer.toml file for buildpack API >= 0.6
The launch, build and cache flags are set to false

Make this change to allow the buildpack author to append new values to the flags
instead of changing the existing ones
(according to the toml's spec, there shouldn't be duplicate values)

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-25 16:32:30 -04:00
Jesse Brown e51dac7ebf
Fix creator not replacing placeholder path for -order
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-25 15:28:17 -05:00
Natalie Arellano 9f778c11a8
Merge pull request #550 from buildpacks/added-0.11.0-to-readme
Update README.md
2021-03-25 15:07:25 -04:00
Jesse Brown e5ab88bc3d
Update RELEASE.md 2021-03-25 11:44:34 -05:00
Jesse Brown 5dec88a165
Remove pre-release marker
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-25 11:37:31 -05:00
Jesse Brown 26483fca65
Update README.md 2021-03-25 11:36:12 -05:00
Jesse Brown 057670f7e1
Update README.md 2021-03-25 11:28:26 -05:00
Micah Young 072b3d5ddd Fixes sec
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-25 11:23:11 -04:00
Micah Young b592348df2
Merge branch 'main' into fix/analyzer-acceptance-windows 2021-03-25 11:16:25 -04:00
Natalie Arellano 4d153f9df0
Merge pull request #548 from buildpacks/add-gosec
Add gosec
2021-03-25 11:04:36 -04:00
Micah Young 3f09d11ef7 Remove unneeded jq
- Already present on runner

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-25 10:52:18 -04:00
Micah Young 93aa9e2a66 Changes GHA windows to build docker CLI from source
- Unknown integrity of docker-cli-builder binary: https://github.com/StefanScherer/docker-cli-builder/issues/13

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-25 10:52:18 -04:00
Natalie Arellano 2fd733bf29 Merge branch 'main' into add-gosec 2021-03-25 10:40:24 -04:00
Natalie Arellano 6599946631
Merge pull request #549 from buildpacks/bump-imgutil
Bump imgutil
2021-03-25 10:20:27 -04:00
Micah Young c98e9ce3cc Fixes GHA build powershell syntax
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-25 09:44:49 -04:00
Micah Young 918ddd6885 Fixes formatting
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-25 09:44:44 -04:00
Micah Young dbd01a2c06
Merge branch 'main' into fix/analyzer-acceptance-windows 2021-03-25 09:34:06 -04:00
Natalie Arellano ed506f5fc0 Bump imgutil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-24 17:04:31 -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
Natalie Arellano 35d19cc3d2 Sha file is not executable
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-24 12:32:47 -04:00
Natalie Arellano 120abfec07
Merge pull request #545 from buildpacks/exit-codes
Condense exit codes
2021-03-23 17:48:43 -04:00
Natalie Arellano dcf198250e Format
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-23 17:29:00 -04:00
Natalie Arellano c4b6e59e89 Add comment to clarify test expectation
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-23 17:08:55 -04:00
Natalie Arellano 09975cb1b8
Update platform/platform.go
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
2021-03-23 17:04:57 -04:00
Natalie Arellano f0b4cf554a Update variable initialization
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-23 12:13:40 -04:00
Natalie Arellano bf07a2a0e1 Check if key exists in map, otherwise return generic error
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-23 11:56:56 -04:00
Natalie Arellano 8faa92e831 Use iota for error type
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-23 11:50:46 -04:00
Natalie Arellano 2b18c6980e
Merge pull request #547 from buildpacks/dependabot/go_modules/k8s.io/klog/v2-2.8.0
Bump k8s.io/klog/v2 from 2.5.0 to 2.8.0
2021-03-23 11:11:01 -04:00
Micah Young a39a06edb4
Update testhelpers/docker.go
Signed-off-by: Micah Young <ymicah@vmware.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-03-23 06:33:29 -04:00
Natalie Arellano 661128fd5e Condense exit codes for platform API 0.6
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-22 18:03:04 -04:00
Micah Young e033d1c377 Adds GHA Docker version output
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-22 13:06:14 -04:00
Micah Young 1e588b88b9 Fixes detect acceptance helper order
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-22 09:56:53 -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 051fe16842 Fix windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-18 16:04:26 -04:00
Natalie Arellano 863f4ef5d4
Merge pull request #508 from buildpacks/jab/add-order-toml-in-layers
Add <layers>/order.toml resolution to detector
2021-03-18 15:12:02 -04:00
Natalie Arellano 1691da0875 Other changes
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-18 13:53:57 -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
Yael Harel 111e15ccf4 Remove double "Warning"
`logger.Warn` adds a "Warning" message at the beginning of the print

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-18 11:45:49 -04:00
dependabot-preview[bot] aa4fa93526
Bump k8s.io/klog/v2 from 2.5.0 to 2.8.0
Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.5.0 to 2.8.0.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.5.0...v2.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-18 06:23:02 +00:00
Yael Harel f3807d3399 Return stdout and stderr to the builder (in addition to the Logger)
We need to do it in order to see the build script output

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-17 19:45:47 -04:00
Natalie Arellano cd367e8cc3
Merge pull request #532 from micahyoung/fix/cache-image-windows
Fixes cache image with incorrect OS on windows
2021-03-17 14:57:35 -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 25d7512086 Cleans up acceptance analyzer test auth/no-auth reg variables
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
Jesse Brown 6db157c2d8
Merge pull request #544 from buildpacks/jab/add-k8schain
Added ggcr's k8schain to DefaultKeychain
2021-03-17 10:40:25 -05:00
Jesse Brown 97bb838dc8
Updating DefaultKeychain doc
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-17 09:02:14 -05:00
Emily Casey 772b86e43b
Merge pull request #546 from anvega/main
Add missing link to GH Actions to build status badge
2021-03-17 09:13:28 -04:00
Andres Vega 66be7f81ef
Add missing link to GH Actions to build status badge
Signed-off-by: Andres Vega <andresv@vmware.com>
2021-03-16 22:16:34 -07:00
Yael Harel 3ca28cd072 Add a TODO
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-16 16:46:48 -04:00
Micah Young f8d98380f2 Replaces acceptance varhelper with consts
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 10:18:22 -04:00
Micah Young 6bd40a98e0 Changes acceptance tests for rebasing
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 08:13:25 -04:00
Micah Young dc000fe7af Fixes acceptance analyzer tests to run on WCOW
* Changes test helper signature to group related args
* Adds GHA step to add insecure-registries entry
  * Test helpers will use the field to determine registry host
* Changes to use imgutil for authorized/readonly registries

Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 07:58:09 -04:00
Micah Young 78af042338 Cleans up acceptance analyzer test auth/no-auth reg variables
Signed-off-by: Micah Young <ymicah@vmware.com>
2021-03-16 07:35:33 -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
Yael Harel f80c0ccd77 Add a logger to the builder
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-15 20:51:32 -04:00
Natalie Arellano 94b091c417
Merge pull request #543 from buildpacks/jab/add-publish-output-during-export
Add output before saving image during export to indicate progress
2021-03-15 17:55:25 -04:00
Yael Harel d22675a97f Exporter warn/error if the launch/build/cache flags aren't in the right format in the toml file
Warn for buildpack API < 0.6 if the flags are in a types table
Error for buildpack API >= 0.6 if the flags are in the top level

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-15 15:49:54 -04:00
Jesse Brown 18279c9e46
Apply suggestions from code review
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2021-03-12 16:31:40 -06:00
Jesse Brown b3ca467925
fixed imports after merging in main changes
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-12 16:30:52 -06:00
Jesse Brown 57cb65b559
Add <layers>/order.toml resolution to detector
Co-authored-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-12 16:11:25 -06:00
Jesse Brown 56c8536d26
Updating message to include ... to show working status
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-12 16:05:54 -06:00
Yael Harel 53c486316a Cosmetic changes
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-12 14:32:05 -05:00
Jesse Brown 875e0f1fe0
Changed Publishing to Saving
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-12 12:31:55 -06:00
Yael Harel 9bd6a05415 Address feedback
- Remove pending test
- Decode LayerMetadataFile once per file

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-12 12:33:57 -05:00
Yael Harel 725f0c3fc0 Remove comment
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-11 15:48:56 -05:00
Jesse Brown 6d8b3b20fe
fixup! Added ggcr's k8schain to DefaultKeychain
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-10 14:21:24 -06:00
Yael Harel d6aa6e72ae Address Feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-09 12:35:10 -05:00
Jesse Brown 15d138b313
Added ggcr's k8schain to DefaultKeychain
The `k8schain` returned by `NewNoClient` will allow image authentication paths on public clouds that were previously unsupported without a cred helper.

The `tools/go.sum` changes brought to you by `make tidy`

Resolves: https://github.com/buildpacks/lifecycle/issues/426

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-09 11:03:17 -06:00
Jesse Brown 203221553c
Add output before saving image during export to indicate progress
Resolves: https://github.com/buildpacks/lifecycle/issues/500

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-09 10:18:43 -06:00
Yael Harel 099a233fd2 Unset the build, launch and cache flags only for buildpack API >= 0.6
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-08 20:26:38 -05:00
Natalie Arellano 11ca8ef99c
Merge pull request #534 from buildpacks/exec-d-windows
Pass file handle to exec.d on Windows
2021-03-08 16:54:51 -05:00
Yael Harel 1f8bae1526 Address PR feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-08 16:44:01 -05:00
Natalie Arellano 1f6fc0ee34 Merge branch 'main' into exec-d-windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-08 16:42:39 -05:00
Natalie Arellano 4fc8fdb8f0 Change Windows fixture to use bp api 0.6
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-03-08 15:50:40 -05:00
Emily Casey 4bfb55d7d0
Merge pull request #540 from buildpacks/dependabot/go_modules/github.com/google/go-cmp-0.5.5
Bump github.com/google/go-cmp from 0.5.4 to 0.5.5
2021-03-08 11:04:14 -05:00
dependabot-preview[bot] b6939067e4
Bump github.com/google/go-cmp from 0.5.4 to 0.5.5
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.4 to 0.5.5.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.4...v0.5.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-08 15:17:22 +00:00
Emily Casey b1a68aa10d
Merge pull request #539 from buildpacks/chore/imgutil-bump
chore: Update imgutil
2021-03-08 10:12:05 -05:00
Yael Harel 2373122d43 Change the encoderDecoder05-06 to be private
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-05 12:02:17 -05:00
Yael Harel 4943a042a0 Introduce the DefaultEncodersDecoders function
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-04 19:43:37 -05: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
Yael Harel 487bafcd62 Don't use one struct with all formats for LayerMetadataFile
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-04 12:11:46 -05:00
Yael Harel de2f8e6885 Address PR feedback:
- Reduce the number of calls to toml.DecodeFile and checking whether the buildpackAPI version is < or >= 0.6
- Move unsetFlags to be part of EncodeFalseFlags

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-03 22:39:50 -05:00
Jesse Brown 43438a6988
chore: Update imgutil
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-03-03 16:11:44 -06:00
Jesse Brown 63ee3a72e3
Merge pull request #538 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.4.1
Bump github.com/google/go-containerregistry from 0.4.0 to 0.4.1
2021-03-03 15:51:02 -06:00
dependabot-preview[bot] 2fd4a69688
Bump github.com/google/go-containerregistry from 0.4.0 to 0.4.1
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.4.0 to 0.4.1.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.4.0...v0.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-03 06:20:13 +00:00
Yael Harel acf521c053 Opt in layer caching:
- Set the launch, cache and build flags to false when restoring layer metadata

- Move the build, launch and cache flags into a types table in the toml file for buildpack API >= 0.6
Fail if the flags are at the top level

- For buildpack API < 0.6, the flags should be at the top level of the toml file
Warn and ignore if the flags are in a types table

- The exporter should ignore the launch, build and cache flags if they're not in the right format

- Rename <layers>/<layer> to <layers>/<layer>.ignore for buildpack API >= 0.6 if all of the types flags are set to false

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-03-02 15:47:57 -05:00
Natalie Arellano 8821424a7d
Merge pull request #535 from buildpacks/release-doc
Add more info to release page
2021-02-26 17:13:46 -05:00
Natalie Arellano 708df265ed Small updates
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-02-26 13:09:48 -05:00
Natalie Arellano aaf6da6e78 Try to fix
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-02-25 17:56:43 -05:00
Natalie Arellano ed27b77008 Updates from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-02-25 17:40:41 -05:00
Natalie Arellano bfe4ac526b Add more info to release page
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-02-25 16:31:22 -05:00
Natalie Arellano d9d94adf1c Pass file handle to exec.d on Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-02-24 14:56:06 -05:00
Emily Casey 7f1c2db042
Merge pull request #533 from buildpacks/dependabot/go_modules/github.com/golang/mock-1.5.0
Bump github.com/golang/mock from 1.4.4 to 1.5.0
2021-02-22 09:18:07 -05:00
dependabot-preview[bot] a845a80c9e
Bump github.com/golang/mock from 1.4.4 to 1.5.0
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.4.4 to 1.5.0.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/v1.4.4...v1.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-22 06:20:53 +00:00
Jesse Brown 89aed264d4
Merge pull request #527 from buildpacks/jab/resolve-sym-links-for-platform-env
Follow symlinks when building env from files.
2021-02-16 11:03:25 -06:00
Jesse Brown dc3d35ef18
Update env/env.go
Signed-off-by: Jesse Brown <jabrown85@gmail.com>

Co-authored-by: Emily Casey <ecasey@vmware.com>
2021-02-16 10:37:30 -06:00
Natalie Arellano a5ceff9602
Merge pull request #503 from buildpacks/chore/buildpack-package
Move buildpack code into own package
2021-02-16 10:21:33 -05:00
Jesse Brown 6dd617e107
Follow symlinks when building env from files.
Symlinks to directories should be evaluated so they can be skipped when building env.

Fixes #526

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-02-16 09:18:02 -06: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 b3ffb7ce34
Merge pull request #528 from buildpacks/jab/pin-ubuntu-18-workflow
Pin GitHub workflows to ubuntu-18.04
2021-02-16 09:48:38 -05:00
Jesse Brown 5b4bd49f42
Pin GitHub workflows to ubuntu-18.04
This fixes the build as the `ubuntu-latest` tag is now `20.04`.

See [more](https://github.com/actions/virtual-environments/issues/1816)

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-02-12 14:15:01 -06:00
Natalie Arellano 34b37f2c6c
Merge pull request #519 from buildpacks/pin-x-sys-tools
Fix tools & add make tidy
2021-02-08 12:50:27 -05:00
Natalie Arellano 4c9f30033f
Merge pull request #512 from buildpacks/jab/restorer-acceptance-tests
Add restorer acceptance tests
2021-02-08 12:44:16 -05:00
Natalie Arellano 49807e1dff
Merge pull request #520 from buildpacks/default-process
Default process
2021-02-08 12:42:33 -05:00
Jesse Brown 93219b34f5
Add restorer acceptance tests
Following the existing acceptance test patterns, the new acceptance test will use the test data mounted into an image to prove restorer is properly restoring data as expected.

The contents of the test data was created in-container and copied out of the container using the buildpacks in the testdata folders.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2021-02-05 14:58:32 -06:00
Yael Harel 7b24df17bb Cosmetic changes
Signed-off-by: Daniel Thornton <dwillist@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-05 12:29:21 -05:00
Yael Harel d410f33cc7 Changes:
- Introduce a new field in metadata.toml - Buildpack-default-process-type
- Remove the default field from each process in metadata.toml
- Sort the processes in metadata.toml alphabetically based on their types
- Don't fall back to old default process if another default buildpack overrided it and then the new default process was overrided by a non-default process
(X default -> Y default -> Y not-default ==> no default process)

Signed-off-by: Daniel Thornton <dwillist@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
Signed-off-by: Daniel Thornton <dwillist@vmware.com>
2021-02-05 09:22:00 -05:00
Yael Harel 4401dec2ac Error if there are multiple default processes in the same buildpack
no matter if they are having the same type or different types

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:16:55 -05:00
Yael Harel 5bfdbae414 Handle buildpack api < 0.6 with default process set:
Buildpacks that implements api < 0.6 should have the default value set to false

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:16:48 -05:00
Yael Harel 6e2fc9b528 Change the checkEntrypoint signature
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:16:39 -05:00
Yael Harel d7ab168860 Changes per feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:16:25 -05:00
Yael Harel 39b54f99de Review feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:16:17 -05:00
Yael Harel f890408127 Move some logic that relates to platform API from buildpacktoml to builder
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:15:32 -05:00
Yael Harel 196bc36e53 Add support of default process type to buildpacks
Signed-off-by: Daniel Thornton <dwillist@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:14:38 -05:00
Yael Harel e6f3139931 Add support for Builpack API 0.6
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-02-04 21:07:32 -05:00
Natalie Arellano 4358aa88f7 Add tidy to test targets
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-02-04 14:35:19 -05:00
Natalie Arellano 67586851cf Fix tools & add make tidy
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-29 16:16:08 -05:00
Natalie Arellano fae1fe27c0
Merge pull request #515 from buildpacks/release/0.10.2
Merge release/0.10.2 into main
2021-01-29 16:14:46 -05:00
Natalie Arellano 4559afd9e1
Merge pull request #507 from josegonzalez/rfc-134-working-dir
feat: set working directory on built image
2021-01-29 14:14:18 -05:00
Natalie Arellano 8a1a2af4d8 Mod tidy
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-29 12:02:45 -05:00
Natalie Arellano 391c12c734 Merge branch 'main' into release/0.10.2
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-29 12:02:14 -05:00
Jose Diaz-Gonzalez 1b8d76242a feat: set working directory on built image
Refs buildpacks/rfcs#134

Signed-off-by: Jose Diaz-Gonzalez <jose@seatgeek.com>
2021-01-28 12:35:54 -05:00
Emily Casey 960cf58365
Merge pull request #513 from buildpacks/mod-tidy
Run mod tidy
2021-01-25 11:19:46 -05:00
Natalie Arellano c75219d4bc Run mod tidy
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-22 16:59:45 -05:00
Natalie Arellano 79d63197c8
Merge pull request #511 from kamaln7/detector-goroutine-race
Fix goroutine race in detector
2021-01-22 13:59:19 -05:00
Kamal Nasser 3e3c86c5ea fix goroutine race in detector
Signed-off-by: Kamal Nasser <kamal@digitalocean.com>
2021-01-22 20:18:00 +02:00
Natalie Arellano 79e0fb2207
Merge pull request #509 from buildpacks/update-readme
Update README with 0.5 apis
2021-01-22 10:39:31 -05:00
Natalie Arellano a77e90db8b Add link
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-22 09:59:52 -05:00
Natalie Arellano b0c266b366 Add 0.10.x
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-22 09:51:56 -05:00
Natalie Arellano e232e5f4b0 Update README with 0.5 apis
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-21 17:08:14 -05:00
Natalie Arellano ee2fd58e6e
Merge pull request #498 from buildpacks/manifest-size
Manifest size
2021-01-21 16:55:02 -05:00
Yael Harel f97af70eab fix merge conflict following rebase on top of main
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:19:39 -05:00
Yael Harel 099e2d862a Set exporter.Buildpacks api to latest
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:16:00 -05:00
Yael Harel 89bfd234e8 clean tools/go.mod and tools/go.sum
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:16:00 -05:00
Yael Harel 8d5fadab03 Some changes following review feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:15:20 -05:00
Yael Harel 2df484a4ba Omit ManifestSize if it's set to zero
use omitzero instead of omitempty

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:15:20 -05:00
Yael Harel 2ef65f7ba2 Some exporter_test refactor
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:15:20 -05:00
Yael Harel a6f14b0db3 Change the tests
PlaformAPI and BuildpacksAPI doesn't depend on each other but
for unit tests, we have to set BuildpacksAPI when PlatformAPI is >= 0.5
otherwise exporter::makeBuildReport will fail.

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:15:20 -05:00
Yael Harel 57ef9b7120 remove extra ,
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:15:20 -05:00
Yael Harel ecd63db3c5 change ManifestSize in report.toml to int64
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:15:20 -05:00
Yael Harel 45c5c8e46c Fix failures of some tests
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:15:20 -05:00
Yael Harel 1d73abcd49 Use PR #86 from imgutil that adds ManifestSize
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:14:07 -05:00
Yael Harel 7c83b0ee0a Add manifest size to report.toml only for platform API >= 0.6
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:08:52 -05:00
Yael Harel e772f4f2a7 Add the manifest size to report.toml
in the exporter, rebaser and creator

Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:08:52 -05:00
Yael Harel 527036c5f2 Add support to Platfrom API 0.6
Signed-off-by: Yael Harel <yharel@vmware.com>
2021-01-21 16:02:55 -05:00
Natalie Arellano 50b3dc695c
Merge pull request #506 from buildpacks/pin-x-sys
Pin to older version of golang.org/x/sys
2021-01-21 15:47:25 -05:00
Natalie Arellano 5a40fcbd65 Tidy
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-20 10:40:02 -05:00
Natalie Arellano 54320ae915 Remove protobuf
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-20 10:31:32 -05:00
Natalie Arellano cafcb76217 Add replace and update imgutil
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-20 10:29:30 -05:00
Natalie Arellano f9c23c1ec5 Pin to older version of golang.org/x/sys
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2021-01-19 14:46:41 -05:00
Emily Casey d9c7de5395
Merge pull request #499 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.4.0
Bump github.com/google/go-containerregistry from 0.3.0 to 0.4.0
2021-01-14 15:39:33 -05:00
dependabot-preview[bot] 0132aca9c0
Bump github.com/google/go-containerregistry from 0.3.0 to 0.4.0
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/master/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.3.0...v0.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-14 06:39:16 +00:00
Emily Casey 9bb33743a0
Merge pull request #495 from buildpacks/release/0.10.1
Release/0.10.1
2021-01-04 14:17:42 -05:00
Emily Casey 6efb164726
Merge pull request #493 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.3.0
Bump github.com/google/go-containerregistry from 0.2.1 to 0.3.0
2021-01-04 10:47:09 -05:00
dependabot-preview[bot] 67001276a3
Bump github.com/google/go-containerregistry from 0.2.1 to 0.3.0
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.2.1 to 0.3.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/master/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.2.1...v0.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-22 06:31:42 +00:00
Emily Casey 36da1709ee
Merge pull request #492 from buildpacks/bugfix/no-layers-buildpack
Fixes when a buildpack with no layers stops launch env processing
2020-12-17 22:40:03 -05:00
Emily Casey 09baa31313 Fixes issues where a buildpack with no layers stops launch env processing
When processing the environment continue when a buildpack has no layers dir instead of returning.

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-17 22:26:26 -05:00
Emily Casey d5254c3aa4
Merge pull request #491 from buildpacks/bugfix/guard-nil-analyzed-image
Guards against nil analyzed image
2020-12-17 13:03:42 -05:00
Emily Casey 1e66862921 Guards against nil analyzed image
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-17 12:18:43 -05:00
Emily Casey 9832537834
Merge pull request #489 from buildpacks/fix/omit-build-report-if-empty
Omit build bom from report.toml if empty
2020-12-16 14:37:47 -05:00
Natalie Arellano f32ac4b4e4 Omit build bom from report.toml if empty
This will keep the output consistent for users of older platform APIs

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-16 10:31:16 -05:00
Emily Casey 948827c8f8
Merge pull request #488 from buildpacks/bugfix/build-and-launch-toml-arent-layers
Explicitly ignores build.toml and launch.toml when finding layers
2020-12-15 12:09:12 -05:00
Natalie Arellano 59e357af56 Add test for invalid build.toml
Also un-nest build.toml tests from "previous image doesn't exist"

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-15 10:52:46 -05:00
Emily Casey 6c73332c81 Explicitly ignores build.toml and launch.toml when finding layers
Although parsing build.toml and launch.toml as layer descriptors doesn't cause issues if they are valid (because they are incorrectly assumed to be launch=false layers) if something goes wrong while parsing, this code can produce very misleading errors without this fix in place.

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-15 09:39:31 -05:00
Emily Casey a0deffe106
Merge pull request #487 from buildpacks/fix/bump-imgutil
Pulls in imgutil fix for podman compat
2020-12-15 09:29:26 -05:00
Emily Casey 58a5f5a066
Merge pull request #409 from buildpacks/fix/339-auth-config
Resolve auth before dropping privileges
2020-12-14 18:47:02 -05:00
Emily Casey cda684e5fc Pulls in imgutil fix for podman compat
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-14 18:43:56 -05:00
Emily Casey a61a187bf9
Merge pull request #461 from buildpacks/feature/396-decouple-buildpack-plan-and-bom
Decouple buildpack plan and bom
2020-12-14 18:35:03 -05:00
Natalie Arellano 5fcf7197fe Add previous image to registry images for the creator
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 18:29:52 -05:00
Natalie Arellano 7c2aa51988 Fix new base image name
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 18:20:26 -05:00
Natalie Arellano d50dca3e2a Use import aliases
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 18:15:42 -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
Natalie Arellano 962fa27b15 Update from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 16:59:51 -05:00
Yael Harel 225003fc49 Minor edits
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 13:04:46 -05:00
Natalie Arellano 80e3022365 Add doc for exported function
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-12-14 12:46:33 -05:00
Yael Harel aed1de8f63 Re-export ReferenceForRepoName
pack is currently using this function.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 12:32:40 -05:00
Natalie Arellano 55b2547e62 Fix lint
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-12-14 12:15:34 -05:00
Yael Harel 8958ee14bf Add tests that use anonymous authentication with registry
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 12:10:19 -05:00
Natalie Arellano 81ce66c90d Small PR edits
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-12-14 11:36:13 -05:00
Yael Harel ffb6c9aef1 Move run image resolution earlier in command flow
We need to know the correct run image when we are still root.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-14 11:18:15 -05:00
Natalie Arellano a669a363f8 Update main to use the new function
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 18:43:06 -05:00
Natalie Arellano b978a0f7dd Fix typo and add to tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 18:31:10 -05:00
Natalie Arellano eddedb8a86 WIP: extract EnvKeychain and InMemoryKeychain
If we do this, we can remove much duplication from our test code,
since we'll be testing each piece independently. This will also allow us to easily
add new "fallback" keychains in the future.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 18:12:00 -05:00
Natalie Arellano 6b6b539bd6 Updates from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 17:28:58 -05:00
Natalie Arellano 14797d3a4d Fix merge conflicts with main
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 15:11:50 -05:00
Yael Harel 989bfc2d4c Some refactoring:
- Rename helper functions
- Replace resolveKeychain with registryImages and change the Privileges functions of the commands accordingly
- Create ResolveKeychainCmd for ResolveKeychain

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-12-11 14:59:03 -05:00
Natalie Arellano ca7f3010f9 Updates from PR review
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 14:54:59 -05:00
Natalie Arellano a1afff3576 Decouple buildpack plan and BOM
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-12-11 14:54:59 -05:00
Emily Casey f77cc9b374
Merge pull request #485 from buildpacks/bugfix/daemon-image
Bumps imgutil to fix daemon image bugs
2020-12-11 12:46:24 -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
Emily Casey 34f505982d Bumps imgutil to fix daemon image bugs
Falls back to slower behavior if the daemon does not accept empty layers. This allows the lifecycle to be compatible with podman which requires all layers to be preset during a docker load. buildpacks/imgutil#80

Fixes "manifest.json had unexpected number of entries"  errors in analyze, export, and rebase resulting from a bug in our daemon save logic buildpacks/imgutil#63

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-10 11:13:13 -05:00
Emily Casey ca47d3defd
Merge pull request #483 from buildpacks/feature/override-env
Changes default env file action to override
2020-12-09 11:57:32 -05:00
Emily Casey 6e6ca62447
Typo fixes
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2020-12-09 11:33:58 -05:00
Emily Casey ad4eb25ac1 Cleanup - addresses code review comments
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-08 17:50:31 -05:00
Emily Casey 9dd30ffdc0
Apply suggestions from code review
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Yael Harel <43007598+yaelharel@users.noreply.github.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
2020-12-08 15:47:31 -05:00
Emily Casey 831f3f579c
Update launch/launcher_test.go
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Jesse Brown <jabrown85@gmail.com>
2020-12-03 13:55:03 -05:00
Emily Casey f1e79eec9c
Apply suggestions from code review
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Jesse Brown <jabrown85@gmail.com>
2020-12-03 13:54:09 -05:00
Emily Casey d58ab15f71 Changes default env file action to override when layer is created by an 0.5+ buildpack
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-03 12:54:11 -05:00
Emily Casey f47f44084f
Merge pull request #482 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.2.1
Bump github.com/google/go-containerregistry from 0.2.0 to 0.2.1
2020-12-02 09:25:38 -05:00
dependabot-preview[bot] 10667573d7
Bump github.com/google/go-containerregistry from 0.2.0 to 0.2.1
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/master/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.2.0...v0.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-02 06:34:18 +00:00
Emily Casey 6d819987bf
Merge pull request #473 from buildpacks/exec.d
Exec.d
2020-12-01 17:00:45 -05:00
Emily Casey 069992f8e4 Address code review comments
* rename some variables and add comment for clarity
* change fd3 filename to make clear that it is arbitrary

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:45:51 -05:00
Emily Casey 9a83731032 Refactor launcher helper functions for clarity
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:05:54 -05:00
Emily Casey 2d84013fa0 Suggestions from code review
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:05:54 -05:00
Emily Casey ba9772f7b9 Update launch/exec_d_test.go
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2020-12-01 16:05:54 -05:00
Emily Casey 8282f72fb2 Address code review comments
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:05:54 -05:00
Emily Casey 756c49f10b Update launch/launcher_test.go
Co-authored-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:05:54 -05:00
Emily Casey f147e98657 No support for exec.d on windows yet
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:05:54 -05:00
Emily Casey 3e36f22c0c Adds support for exec.d
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 16:05:53 -05:00
Emily Casey cfacbf11ff
Merge pull request #481 from buildpacks/bump-imgutil
Bump imgutil to version with newest ggcr release
2020-12-01 11:14:19 -05:00
Emily Casey 9d781dedc6 Bump imgutil to version with newest ggcr release
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-12-01 09:32:13 -05:00
Emily Casey 9f10b45220
Merge pull request #479 from micahyoung/fix/export-fail-message
Fixes export error message
2020-11-30 14:14:26 -05:00
Emily Casey dadecdfb50
Merge pull request #478 from buildpacks/dependabot/go_modules/github.com/google/go-cmp-0.5.4
Bump github.com/google/go-cmp from 0.5.3 to 0.5.4
2020-11-30 09:09:23 -05:00
Micah Young 2650b3b209 Fixes export error message
- Was: "ERROR: failed to new app image"

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-11-25 15:33:04 -05:00
dependabot-preview[bot] e725927aa3
Bump github.com/google/go-cmp from 0.5.3 to 0.5.4
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.3...v0.5.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-25 06:46:13 +00:00
Emily Casey 550213b345
Merge pull request #476 from buildpacks/creator-in-readme
Mention creator in README
2020-11-20 15:51:34 -05:00
Emily Casey ec698fb713
Merge pull request #477 from buildpacks/fix/453-delete-cache-image-not-exists
fix: Do not delete cache-img if the cache-img did not exist
2020-11-20 15:46:17 -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 86ca41e244 Mention creator in README
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-11-19 19:09:23 -05:00
Emily Casey 0e19f4bb95
Merge pull request #475 from buildpacks/bugfix/supported-apis
Adds API version support table to README
2020-11-19 12:19:43 -05:00
Emily Casey 41e6d14aab Adds API version support table to README
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-11-19 10:36:17 -05:00
Emily Casey c7dfbe788c
Merge pull request #472 from buildpacks/update-actions-setup-go
Update actions/setup-go
2020-11-18 08:51:39 -05:00
Natalie Arellano 33055602b2 Update actions/setup-go
The old action uses set-env which is deprecated.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-11-17 15:29:24 -05:00
Emily Casey 32871f2f25
Merge pull request #464 from buildpacks/release/0.9.3
Release/0.9.3
2020-11-16 10:48:39 -05:00
Emily Casey d8a96dbd6f
Merge pull request #463 from buildpacks/dependabot/go_modules/github.com/google/go-cmp-0.5.3
Bump github.com/google/go-cmp from 0.5.2 to 0.5.3
2020-11-13 09:03:40 -05:00
Emily Casey 3df0e1f2c5
Merge pull request #462 from buildpacks/chore/424-update-gha
Update GitHub Actions workflows to use environment files
2020-11-13 09:01:14 -05:00
dependabot-preview[bot] 51f4a28ef5
Bump github.com/google/go-cmp from 0.5.2 to 0.5.3
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.2...v0.5.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-13 06:52:24 +00:00
Yael Harel 79bde45a10
Merge pull request #454 from buildpacks/393-defaults-layers
Change defaults that are depending on the working dir to be under <layers>
2020-11-12 20:34:26 -05:00
Yael Harel 6f28be833e Some formatting changes
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-11-12 20:06:25 -05:00
Natalie Arellano f85dc07123 Fix env syntax on Windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-11-12 17:56:01 -05:00
Natalie Arellano 1fa60d5997 Fix syntax
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-11-12 17:22:56 -05:00
Yael Harel e2ee4639c3 Refactoring following a code review
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-11-12 15:12:50 -05:00
Natalie Arellano bc54baf338 Update GitHub Actions workflows to use environment files
Fixes #424

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-11-12 14:54:27 -05:00
Yael Harel 626f133ee5 Apply more suggestions from code review
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-11-10 22:36:51 -05:00
Yael Harel a989e4f33d Fix new analyzer acceptance tests
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-11-09 21:26:52 -05:00
Yael Harel 59efbeafad Apply suggestions from code review
* Need to fix a new test in analyzer_test.go

Signed-off-by: Yael Harel <yharel@vmware.com>
2020-11-06 20:32:50 -05:00
Emily Casey 6de73b919d
Merge pull request #456 from buildpacks/fix/glob
Slices: Clean pattern before matching
2020-11-03 16:05:09 -05:00
Natalie Arellano 77ade3887e Clean pattern before matching
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-11-03 10:38:59 -05:00
Yael Harel 394a5e0a3c Change defaults that are depending on the working dir to be under <layers>
Notes:
* This commit introduces platfromAPI 0.5 as a supported API.
* The changes apply only for platformAPI >= 0.5.
* The path of the relevant files is being changed as part of Args after parsing the flags.
* Allow the user to set the layers flag in the detector.

Signed-off-by: Yael Harel <yharel@vmware.com>
2020-10-29 14:37:35 -04:00
Emily Casey b2ce634c61
Merge pull request #450 from buildpacks/feature/rebase-validate-mixins
feature: validate mixins during rebase
2020-10-26 13:21:51 -04:00
Jesse Brown ba6be4a8a7
fixup! feature: validate mixins during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-10-23 15:47:06 -05:00
Jesse Brown 85bfe69e76
fixup! feature: validate mixins during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-10-23 14:21:09 -05:00
Jesse Brown 67a5f5c654
fixup! feature: validate mixins during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-10-23 14:15:01 -05:00
Jesse Brown 9c5bae407f
fixup! feature: validate mixins during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-10-23 14:15:00 -05:00
Jesse Brown b5b4289e7d
fixup! feature: validate mixins during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-10-23 14:15:00 -05:00
Jesse Brown f50ab33d84
feature: validate mixins during rebase
Implemented as discussed [here](https://github.com/buildpacks/lifecycle/issues/425). Using the `io.buildpacks.stack.mixins` label of the working and new run image, lifecycle will now verify that mixins are present on the new base image prior to the rebase operation.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-10-23 14:15:00 -05:00
Emily Casey 75b37e8ceb
Merge pull request #452 from buildpacks/bump-imgutil
Bump imgutil
2020-10-23 12:51:46 -04:00
Emily Casey c76c5dc48b Bump imgutil
* Ensures we use the same versions of GGCR and docker client library as imgutil to help library consumers avoid problems with dependencies

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-23 11:40:10 -04:00
Emily Casey 69c187f263
Merge pull request #448 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.1.4
Bump github.com/google/go-containerregistry from 0.1.3 to 0.1.4
2020-10-23 11:29:33 -04:00
dependabot-preview[bot] 66180c2608
Bump github.com/google/go-containerregistry from 0.1.3 to 0.1.4
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/master/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.1.3...v0.1.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-22 06:44:36 +00:00
Emily Casey b35aa88e69
Merge pull request #447 from buildpacks/release/0.9.2
Release/0.9.2
2020-10-21 13:24:06 -04:00
Emily Casey ee48447617
Merge pull request #446 from buildpacks/bugfix/many-launcher-args
Bash process handles more than 9 args correctly
2020-10-20 18:52:04 -04:00
Emily Casey 55f3aa6f0c Bash process handles more than 9 args correctly
Our magic bash command was mising some important curly brances and therefore the tenth argument was being set to the equivalent of
"${1}0" instead of "${10}".

Resolves #445

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-20 18:38:53 -04:00
Emily Casey d097d1665e
Merge pull request #444 from buildpacks/fix-artifact-paths
Fix artifact paths in GHA
2020-10-19 18:27:18 -04:00
Emily Casey 7085de6baa Fixes artifact paths
* Removes unecessary 'Set up go env' steps

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-19 17:47:53 -04:00
Emily Casey f36e282bb4
Merge pull request #442 from buildpacks/bugfix/windows-builder-perms
Builds windows artifacts on linux
2020-10-19 16:40:01 -04:00
Emily Casey 0fe1676fd4
Merge pull request #443 from buildpacks/nanoserver-base-image
Changes windows base image back to nanoserver:1809
2020-10-19 16:39:40 -04:00
Emily Casey e5f7e15c60 Changes windows base image back to nanoserver:1809
Nanoserver 1809 will now be supported through January 2024. Therefore, we should use this image because it is smaller than ltsc2019.

* https://github.com/microsoft/Windows-Containers/issues/52

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-19 15:20:28 -04:00
Emily Casey 0710a0aed5 build, package, and image build do not need jq
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-19 15:19:31 -04:00
Emily Casey a182d7d6ef Build only if both linux & windows tests succeed
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-19 15:15:09 -04:00
Emily Casey a4543fb280 Builds windows artifacts on linux
* Fixes #441

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-19 14:56:37 -04:00
Emily Casey 0f9d101a2b
Merge pull request #418 from buildpacks/add-bp-homepage-to-md
Add buildpack homepage to metadata during build phase
2020-10-14 10:05:14 -04:00
Emily Casey b0694552d6
Merge pull request #439 from buildpacks/bugfix/windows-image
Use manifest tag instead of manifest list tag as windows base image
2020-10-13 18:10:57 -04:00
Danny Joyce 624786506d Remove homepage from the BOM and add homepage to exporter test
Signed-off-by: Danny Joyce <djoyce@pivotal.io>
2020-10-13 14:18:14 -04:00
Emily Casey 882595908c Use manifest tag instead of manifest list tag as windows base image
This is necessary because of this bug in imgutil https://github.com/buildpacks/imgutil/issues/54.

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-13 13:29:08 -04:00
Emily Casey 14fa46a15f
Merge pull request #438 from buildpacks/faster-builds
Faster linux builds
2020-10-13 12:45:38 -04:00
Emily Casey e1c56cfc79 Faster linux builds
* caches go modules in a volumes
* uses docker build to create linux compilation image

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-13 08:51:48 -04:00
Emily Casey 9c9f7a2dae
Merge pull request #437 from buildpacks/golang-1.15
Upgrade to golang 1.15
2020-10-13 08:46:26 -04:00
Emily Casey 46b248e8d7 golang 1.15
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-12 19:31:38 -04:00
Danny Joyce 011ce4baa0 Add homepage directly to group.toml
Signed-off-by: Danny Joyce <djoyce@pivotal.io>
2020-10-12 15:43:37 -04:00
Emily Casey 72aa23946c
Merge pull request #434 from buildpacks/bugfix/no-color-for-buildpacks
-no-color strips color from buidpack logs
2020-10-09 16:02:28 -04:00
Emily Casey 9315ca6a32 -no-color strips color from buidpack logs
* Resolves #329

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-08 18:28:29 -04:00
Emily Casey 5a59fc8b57
Merge pull request #432 from buildpacks/bugfix/safe-globs
Remove all unsafe usage of filepath.Glob
2020-10-08 17:56:26 -04:00
Emily Casey d55bd445cc Only abs profile script paths
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-08 17:25:49 -04:00
Emily Casey 322ce6ac15
Merge pull request #433 from buildpacks/chore/errcheck
Enable errcheck
2020-10-08 14:02:29 -04: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 de16638494 Fix windows slice globbing
According to the buildpack API in the CNB Speciication slice path globs should follow the pattern syntac defined in the Go standard library (Follow the pattern syntax defined in the Go standard library.). We were previously translating unix path separators in slice patterns into windows slice separators before matching. This contradicts the wording of the spec. Instead windows path separators should be notated with '\\' as described in the stdlib godoc.

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-07 17:45:12 -04:00
Emily Casey e487a8bbe8 Don't use forbidden characters in windows test fixtures
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file\#naming-conventions
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-07 17:20:39 -04:00
Emily Casey 23f1c9745a Remove all unsafe usage of filepath.Glob
We previous used filepath.Glob for four purposes:

1. Globbing slice files - This was updated to use a combination of filepath.Walk and filepath.Match to match children of the app dir by relative path. We already had logic to unsure that no files outside of the app dir were included. A test was added to confirm this and prevent regressions

2. Globbing profile scripts - This commit changes the implementation so that we no longer use filepath.Glob here

3. Globbing layer.toml files - This commit changes the implementation so that we no longer use filepath.Glob here

4. Test logic - unsafe use of filepath.Glob is unchanged in the test code

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-07 17:20:39 -04:00
Emily Casey dc9d6828f6
Merge pull request #431 from buildpacks/fix/dedup-commit-parsing
Remove double parsing of commit sha in Makefile
2020-10-07 10:14:37 -04:00
Natalie Arellano 62360803d5 Git rid of `-dirty`
It is currently used inconsistently between the lifecycle image tag and the
lifecycle version.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-07 09:53:34 -04:00
Emily Casey 60ddd29baf Enable errcheck
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-06 18:53:30 -04:00
Emily Casey e579e7edc9
Merge pull request #422 from TisVictress/main
Update windows base image to use LTSC Server Core 2019
2020-10-06 17:38:18 -04:00
Victoria Henry ba1a554bc9 Update windows base image to LTSC Server Core 2019
Signed-off-by: Victoria Henry <vhenry@vmware.com>
2020-10-06 13:21:55 -04:00
Natalie Arellano 408227b35b Remove double parsing of commit sha in Makefile
This requires extra processing in cmd/version.go because Version when it includes the commit will not contain
'-dirty'.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-06 11:41:23 -04:00
Emily Casey 9e4a36b023
Merge pull request #430 from buildpacks/fix-go-sum
Update go.sum and go mod tidy
2020-10-06 11:32:06 -04:00
Emily Casey 85d1b53d45 Tidy go mod in tools
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-06 11:11:00 -04:00
Emily Casey 9f820017d4 Update go.sum and go mod tidy
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-10-06 10:50:04 -04:00
Emily Casey 77735c391b
Merge pull request #427 from buildpacks/chore/382-document-release-process
Add release documentation
2020-10-06 09:51:57 -04:00
Natalie Arellano 5cc500f828 Update RELEASE.md
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-05 17:54:41 -04:00
Natalie Arellano fd943ff40c Add release documentation
Signed-off-by: Yael Harel <yharel@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-05 17:14:39 -04:00
Emily Casey 4f48d5a7fc
Merge pull request #415 from buildpacks/fix/389-github-actions-release
Move release automation to Github actions
2020-10-05 17:06:07 -04:00
Yael Harel dd4cc54ace Update README to be accurate
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-05 16:14:14 -04:00
Natalie Arellano 8b11bdd954 Fix version in build workflow
Without clean, the artifact will be what was built from the acceptance tests
(with a test version) since the source code didn't change between builds.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-05 12:31:21 -04:00
Yael Harel eb5db1a0bb Update per review feedback:
- update github-script to the latest version v3.0.0
- refactor packager
- publish the linux and windows lifecycle images after all tests passed (on ubuntu)
- determine download urls for linux and windows in one step
- check that the head sha of the last successful workflow is the last sha

Signed-off-by: Yael Harel <yharel@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-02 16:33:03 -04:00
Yael Harel c0dfdf41e0 format lint
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-10-02 16:33:03 -04:00
Yael Harel 040b8db1ae Move release automation to Github actions
For local development and commits to main, we derive the lifecycle version
from `git describe --tags`.
For new commits to release branches, we derive the lifecycle version
from the branch name.
New commits to main and release branches will trigger a new lifecycle image.
After publishing new releases, the lifecycle image will be re-tagged.
PRs to any branch won't trigger a new lifecycle image.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-10-02 16:33:03 -04:00
Danny Joyce fd366b4520 Use url for buildpack homepage instead of buildpack info struct
Signed-off-by: Danny Joyce <djoyce@pivotal.io>
2020-10-01 10:42:51 -04:00
Emily Casey 324e04c6b4
Merge pull request #420 from buildpacks/dependabot/go_modules/github.com/apex/log-1.9.0
Bump github.com/apex/log from 1.3.0 to 1.9.0
2020-09-30 09:44:53 -04:00
Emily Casey 5ba9ed5a56
Merge pull request #419 from buildpacks/dependabot/go_modules/github.com/google/go-containerregistry-0.1.3
Bump github.com/google/go-containerregistry from 0.1.1 to 0.1.3
2020-09-30 09:44:22 -04:00
Danny Joyce 71a881192e Add buildpack homepage to metadata during build phase
Signed-off-by: Danny Joyce <djoyce@pivotal.io>
2020-09-30 09:10:43 -04:00
dependabot-preview[bot] 91ca88f62a
Bump github.com/apex/log from 1.3.0 to 1.9.0
Bumps [github.com/apex/log](https://github.com/apex/log) from 1.3.0 to 1.9.0.
- [Release notes](https://github.com/apex/log/releases)
- [Changelog](https://github.com/apex/log/blob/master/History.md)
- [Commits](https://github.com/apex/log/compare/v1.3.0...v1.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-30 06:52:12 +00:00
dependabot-preview[bot] 9817aeabda
Bump github.com/google/go-containerregistry from 0.1.1 to 0.1.3
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.1.1 to 0.1.3.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/master/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.1.1...v0.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-30 06:51:46 +00:00
Emily Casey 72c95e1380
Merge pull request #417 from poy/update-deps
Updates dependencies
2020-09-29 18:25:18 -04:00
poy 411ec5d9d5 Updates dependencies
fixes #416

Signed-off-by: poy <poy@google.com>
2020-09-24 16:42:16 -06:00
Emily Casey c080172cff
Merge pull request #413 from buildpacks/clean-up-errors
Clean up error list in detector
2020-09-24 17:42:01 -04:00
Stephen Levine 2f74559b2a Clean up error list in detector
Signed-off-by: Stephen Levine <stephen.levine@gmail.com>
2020-09-22 12:56:03 -04:00
Emily Casey da5f948b97
Merge pull request #408 from buildpacks/chore/upgrade-golangci-lint
Upgrade golangci-lint to v1.30.0
2020-09-01 10:09:38 -04:00
Jesse Brown fac746e26b Upgrade golangci-lint to v1.30.0
```
go get -d github.com/golangci/golangci-lint
go mod tidy
```

Fixed one lint error that popped up after upgrading.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-31 15:43:43 -05:00
Emily Casey 8fca023ac6
Merge pull request #407 from buildpacks/feat/copy-bp-labels-from-stack
Sync io.buildpacks.stack.* labels from run image during rebase
2020-08-31 16:00:28 -04:00
Jesse Brown 70810357ad fixup! Sync io.buildpacks.stack.* labels from run image during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-31 13:23:54 -05:00
Jesse Brown 81ace380d7 fixup! Sync io.buildpacks.stack.* labels from run image during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-31 12:03:09 -05:00
Jesse Brown c1d14d3343 fixup! Sync io.buildpacks.stack.* labels from run image during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-31 12:01:30 -05:00
Jesse Brown 6a555842dd fixup! Sync io.buildpacks.stack.* labels from run image during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-31 10:15:58 -05:00
Jesse Brown 2701084419 fixup! Sync io.buildpacks.stack.* labels from run image during rebase
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-31 07:56:00 -05:00
Jesse Brown 0c1981458d Sync io.buildpacks.stack.* labels from run image during rebase
- Update matching labels present on both images to value on run image
- Remove matching labels no long present on run image
- Add matching labels that are newly added on run image
- Ignore non-matching labels on both working and run image

Ref #390

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-28 16:06:04 -05:00
Emily Casey 7879b8c9d6
Merge pull request #391 from buildpacks/local-lifecycle-image
Add Makefile target for local lifecycle image
2020-08-26 16:19:31 -04:00
Yael Harel dd4bb671ab Review feedback
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-26 14:51:59 -04:00
Emily Casey a3c8d02a37
Merge pull request #404 from buildpacks/dependabot/go_modules/github.com/google/go-cmp-0.5.2
Bump github.com/google/go-cmp from 0.5.1 to 0.5.2
2020-08-26 11:06:01 -04:00
dependabot-preview[bot] e04035ba18
Bump github.com/google/go-cmp from 0.5.1 to 0.5.2
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.1...v0.5.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-26 06:51:21 +00:00
Natalie Arellano 4a46563f8e Remove ineffectual strip
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-25 12:22:04 -04:00
Natalie Arellano 101f194a2c Update error messages
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-25 11:52:35 -04:00
Natalie Arellano 87b1727481 Ensure base image is pulled
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-25 11:45:26 -04:00
Emily Casey b9919d9827
Merge pull request #401 from micahyoung/bugfix/windows-cmd-env-var-syntax
Bugfix/windows cmd syntax
2020-08-25 10:03:59 -04:00
Micah Young 4f2991fb12 Fix Windows cmd profile tests
Signed-off-by: Micah Young <ymicah@vmware.com>
2020-08-24 18:33:38 -04:00
Emily Casey fbc6afe57e
Merge pull request #397 from buildpacks/bugfix/386-empty-cache-layer
Warn and continue when cached layer has no contents
2020-08-24 15:11:34 -04:00
Emily Casey dd2f800c6d Fix messages and add more tests
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-24 14:10:04 -04:00
Natalie Arellano 3922f389b6 Update tag used for local image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-24 12:20:07 -04:00
Micah Young 346706e294 Use consistent quote interpretation on Windows cmd
- Sets `/s` on `cmd` to use consistent quote interpolation, matching Docker `RUN` syntax and Microsoft-recommended `SHELL` syntax:

  From Docker Docs: https://docs.docker.com/engine/reference/builder/#run
  > RUN <command> (shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows)

  From Microsoft Docs on recommended usage: https://docs.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container#dockerfile
  > # Restore the default Windows shell for correct batch processing.
  > SHELL ["cmd", "/S", "/C"]

  From Microsoft Docs on /s behavior and the legacy corner case it avoids: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd#remarks
  - When not using /s, from my understanding, a user can have an ambiguous command when using a binaries with spaces in the name folled by space separated arguments.

Instead of allowing this ambiguous syntax, we should require users to split commands using `args` array. This follows Microsoft and Docker's recommended syntax.

This should have minimal change on existing behavior.

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-08-23 12:08:29 -04:00
Micah Young 90419b1c10 Fix Windows launcher env var usage in process command
- Enables `!VAR!`-style env vars in process `args` with otherwise no change to existing behavior
- Sets `/v:on` on `cmd` to enable usage of env vars set in profile scripts, in the same scope, known as Delayed Expansion

  From Microsoft Docs: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd
  > If you enable delayed environment variable expansion, you can use the exclamation point character to substitute the value of an environment variable at run time.

Fixes https://github.com/buildpacks/lifecycle/issues/359

No change on existing behavior, besides now interpolating any defined `!VAR!`-style variables that would not have been interpreted before

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-08-23 12:07:10 -04:00
Emily Casey d258156bd3 Update cache.go
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-21 14:48:16 -04:00
Emily Casey d90488b433 Warn and continue when cached layer has no contents
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-20 17:35:36 -04:00
Emily Casey 27fe925719
Merge pull request #334 from yaelharel/detector-acceptance
Detector acceptance
2020-08-18 10:21:51 -04:00
Yael Harel 633c2123b6 Styling changes
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-18 10:11:30 -04:00
Yael Harel dfb814089b Review feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-17 19:42:01 -04:00
Natalie Arellano c92e90d094 Add Makefile target for local lifecycle image
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-17 17:07:54 -04:00
Natalie Arellano a540cb7b82
Merge pull request #387 from buildpacks/fix/385-only-one-path
Bump imgutil
2020-08-14 16:20:40 -04:00
Natalie Arellano 4bcb74c9b5 Bump imgutil
This pulls in a fix for duplicate environment variables.

Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-14 15:17:49 -04:00
Natalie Arellano 6113be13e6
Merge pull request #383 from buildpacks/update-lifecycle-toml
Update lifeycle toml
2020-08-13 16:26:44 -04:00
Yael Harel 32d615b807 Update lifeycle toml
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-13 16:18:57 -04:00
Natalie Arellano f008562f30
Merge pull request #381 from buildpacks/fix-http-proxy
Pass through http(s) proxy variables to buildpacks environment
2020-08-13 16:00:06 -04:00
Natalie Arellano f1f29dcab4 Added comment
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-13 15:49:46 -04:00
Natalie Arellano 4f2cf16ebe
Merge pull request #377 from buildpacks/fix/376-warn-nonexisting-process-type
Warn when exporting with non-existing process type
2020-08-13 15:47:25 -04:00
Yael Harel 7da78d6e97 Update VERSION file
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-13 15:31:59 -04:00
Natalie Arellano c3c551fba3 Fix Windows
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-13 15:19:20 -04:00
Yael Harel 76a783351a Pass through http(s) proxy variables to buildpacks environment
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-13 14:45:43 -04:00
Natalie Arellano e93dc33147
Merge pull request #375 from buildpacks/set-workdir-in-lifecycle-image
Sets working dir to /layers in lifecycle image
2020-08-13 11:11:47 -04:00
Yael Harel c5adecf0fd Move the containerName and copyDir initialization and deletion
to one place for all of the analyzer acceptance tests

Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-12 14:56:38 -04:00
Natalie Arellano 5fd647dcc1 Remove some duplicated code
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-12 12:08:07 -04:00
Natalie Arellano 4497aa9bf1 When platform API >= 0.4 and default process type is not defined,
warn and set the entrypoint to /cnb/lifecycle/launcher

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-12 11:39:40 -04:00
Yael Harel 62f13cfb32 Delete container, volume and temp directory as part of it.After
Everything will be deleted even if the docker run command failed

Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-11 21:18:34 -04:00
Yael Harel c4b1a485be Fixed formatting errors
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-11 20:05:59 -04:00
Yael Harel a2767f276c Review feedback
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-11 19:55:43 -04:00
Yael Harel 9b90cdc63c Detector acceptance tests
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-10 14:49:46 -04:00
Emily Casey 61ccadf75e Sets working dir to /layers in lifecycle image
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-08 22:44:07 -04:00
Emily Casey f65216e2ad
Merge pull request #374 from buildpacks/fix-windows-image-sd
Fix PAX headers in windows lifecycle images
2020-08-08 20:59:08 -04:00
Emily Casey 2e522e334e windows image: lifecycle owned by regular user
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-08 20:49:56 -04:00
Emily Casey c7d0895672 Fix PAX headers in windows lifecycle images
* bumps to new imgutil that always adds security descriptor record
* allow windows image builds on any OS

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-08 19:36:49 -04:00
Emily Casey 77d2e073fd
Merge pull request #373 from buildpacks/keep-metadata-version
Leave metadata.version in buildpack plan provided to 0.2 buildpacks
2020-08-08 16:49:30 -04:00
Emily Casey f453b936d8 Leave metadata.version in buildpack plan provided to 0.2 buildpacks
Leave metadata.version in platform 0.3 BOM

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-08 16:26:23 -04:00
Emily Casey 7617cba81b
Merge pull request #370 from buildpacks/multicall-launcher
Multicall launcher
2020-08-07 20:53:04 -04:00
Emily Casey 190dff92ca Review feedback
* Add and strip lifecycle dir from path
* Don't use full paths in entrypoint in tests or warning text
* Test cleanup

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:20:36 -04:00
Emily Casey 3b7e7a3d4c more cleanup
* Set Platform API for build when creator is run

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:20:19 -04:00
Emily Casey d5cfd7567b Apply suggestions from code review
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 19:19:48 -04:00
Emily Casey ec96286b2b Apply suggestions from code review
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 19:19:48 -04:00
Emily Casey 8748dce446 cleanup
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:48 -04:00
Emily Casey ac0050333d Multicall launcher
* Adds acceptance tests
* Refactors launcher

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:47 -04:00
Emily Casey 095d036c2c Fix rebase errors
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:47 -04:00
Emily Casey a08f3ebdf4 fix windows
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:47 -04:00
Emily Casey 294a93d831 prepend process dir to path
* strip it out in the launch env

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:47 -04:00
Emily Casey 25c9ae85e2 Attempt to organize exporter
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:47 -04:00
Emily Casey cc490189e2 Set ENTRYPOINT
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:47 -04:00
Emily Casey 2a887360dc Adds process type symlinks
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 19:19:47 -04:00
Emily Casey 687be91ccf
Merge pull request #369 from buildpacks/feature/330-remove-top-level-version-2
Remove top level version
2020-08-07 17:48:30 -04:00
Natalie Arellano 1fcb8adb27 Fix tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 17:29:51 -04:00
Natalie Arellano 67e7638bd4 Update error and warning messages
ID is required but Name is optional

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 17:24:08 -04:00
Yael Harel 37c24b15d4 Fix code
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 16:12:36 -04:00
Emily Casey 08eec06dd1
Merge pull request #367 from yaelharel/bom-version-357
Remove top-level version from BOM
2020-08-07 16:07:41 -04:00
Yael Harel b3d1c4a439 Add unit tests for new error flows
(both top level and metadata versions are set to different values)

Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-07 15:41:48 -04:00
Natalie Arellano 1c15ff9a5a Nest buildpack toml detect tests in their own context
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-07 15:26:34 -04:00
Yael Harel 271d3e18ec Error message improvements
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 12:56:22 -04:00
Natalie Arellano 34f28649f7 Expose buildpack TOML detect and use in tests
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-07 12:27:36 -04:00
Natalie Arellano c9acf01c84 Return and error if both top level version and metadata version are set and do not match
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-07 12:07:21 -04:00
Natalie Arellano da635bf4de Mention buildpack name in the warning about top level version.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 11:09:49 -04:00
Natalie Arellano f4457cc3bd Update per review suggestions
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 11:00:50 -04:00
Yael Harel 841b014684 Remove top level version
For buildpacks with API 0.2, convert metadata version to top level version when constructing the buildpack plan during build
When running detect, always convert top level versions to metadata versions for consistency

Edge cases:
 - For buildpacks with API 0.2, if top level version and metadata version are both specified, FAIL if they don’t match
 - For buildpacks with API 0.3, if top level version and metadata version are both specified, FAIL
 - For buildpacks with API 0.3, if top level version (only) is specified, WARN

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-07 10:51:05 -04:00
Yael Harel d4cde19765 Fix import order
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-07 10:18:13 -04:00
Emily Casey 11d602e788
Merge pull request #371 from buildpacks/bugfix/rebase-preserves-platform
Bump imgutil
2020-08-07 09:25:30 -04:00
Emily Casey f302106ee9 Bump imgutil
* Preserves platform during Rebase for remote images

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-07 09:08:27 -04:00
Emily Casey ed539be43a
Merge pull request #366 from buildpacks/lifecycle-image-windows-2
Build lifecycle image for Windows and create manifest list
2020-08-06 18:50:23 -04:00
Yael Harel fe7ca01f35 Add unit tests
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-06 15:43:18 -04:00
Natalie Arellano 36d9e56014 Update .github/workflows/lifecycle-image.yml
Co-authored-by: Emily Casey <ecasey@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-06 10:00:27 -04:00
Yael Harel 117fcf22ad fixed formatting errors
Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-05 16:02:07 -04:00
Natalie Arellano 7aa2a64698 Point to real github & docker repos
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-05 12:18:27 -04:00
Natalie Arellano 2577b442ea FIXME: Add workflow for building Windows lifecycle image
Also create manifest list

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-05 12:00:03 -04:00
Yael Harel 3ac2eda9ec Remove top-level version from BOM
resolves: #357

Signed-off-by: Yael Harel <yharel@vmware.com>
2020-08-05 11:54:41 -04:00
Emily Casey b67143c61b
Merge pull request #365 from buildpacks/backwards-compatible-descriptor
Make lifecycle.toml backwards compatible
2020-08-05 11:14:05 -04:00
Emily Casey 56f89ef797 Make lifecycle.toml backwards compatible
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-05 10:59:03 -04:00
Natalie Arellano 14d4cb60bc Build remote image for windows if runtime GOOS is windows
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-08-05 10:48:13 -04:00
Emily Casey 22819d9463
Merge pull request #364 from buildpacks/creator-report
Adds -report flag to creator
2020-08-05 10:39:39 -04:00
Emily Casey b73b82b9ad Adds -report flag to creator
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-05 09:46:45 -04:00
Emily Casey 9b84aab235
Merge pull request #358 from buildpacks/semantic-shell-args
Semantic shell args
2020-08-04 18:08:32 -04:00
Emily Casey adf0956a52
Update launch/launcher_test.go
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Natalie Arellano <natalieparellano@users.noreply.github.com>
2020-08-04 14:31:21 -04:00
Emily Casey 3309dcc6ca
Merge pull request #363 from buildpacks/bugfix/package
packaging fixes
2020-08-04 14:30:27 -04:00
Emily Casey fe596d70e5 Adds missing creator.exe symlink for windows
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-04 13:47:42 -04:00
Emily Casey 27e3582b47 Improved comments and tests
* Explains what the bash magic is doing

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-04 13:24:36 -04:00
Emily Casey fc3937b940 packaging fixes
* Uses Normalizing tar writer to fix paths when running on windows
* Move lifecycle.toml to top-level in archive
* Zeros UID/GID

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-04 11:57:09 -04:00
Emily Casey 38ad1ecb50
Apply suggestions from code review
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Natalie Arellano <natalieparellano@users.noreply.github.com>
2020-08-04 10:35:43 -04:00
Emily Casey 0b42a49e68
Merge pull request #362 from buildpacks/bugfix/export-gid
Fix export GID
2020-08-03 19:20:27 -04:00
Emily Casey 75f8e9cb44 Export GID is the actual GID
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-03 16:23:29 -04:00
Emily Casey 2462fd45c9
Merge pull request #361 from buildpacks/feature/phase-specific-exit-codes-merge
Feature/phase specific exit codes merge
2020-08-03 13:29:52 -04:00
Emily Casey 9e33d21caf Comments describing error ranges
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-03 13:22:00 -04:00
Emily Casey 79c9df99ca Return lifecycle errors from all exported detect functions
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-03 13:05:28 -04:00
Jesse Brown 61adf33b0c PR suggestions
Keep internals of detector simpler, exporting lifecycle error on public members only
Few code typo fixes
Simplified error interface  to only a single error until we need multiple
Simplified some case statements and type checking in a couple spots

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:57:44 -04:00
Jesse Brown b51c5f9e4b introduce a lifecycle error
introducing a lifecycle error is desirable to allow for finer grained error handling for eventual status code mapping.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:51:21 -04:00
Jesse Brown 11bc174170 fix renames
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:49:48 -04:00
Jesse Brown a09132c7b8 Update cmd/exit.go
Co-authored-by: Emily Casey <ecasey@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:45:47 -04:00
Jesse Brown 8426de364c Update cmd/exit.go
Co-authored-by: Emily Casey <ecasey@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:40:18 -04:00
Jesse Brown 1e16926745 Update cmd/exit.go
Co-authored-by: Emily Casey <ecasey@vmware.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:40:18 -04:00
Jesse Brown 904d260d77 update rebaser with rebaser specific error codes
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:40:18 -04:00
Jesse Brown 3f7d030745 update exporter with exporter specific error codes
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:40:06 -04:00
Jesse Brown b255e00be9 update builder with builder specific error codes
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:38:21 -04:00
Jesse Brown ad18490797 update restorer with restorer specific error codes
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:38:21 -04:00
Jesse Brown 4827ae21f0 update analyzer with analyzer specific error codes
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:38:20 -04:00
Jesse Brown 6885c783de update detector with detector specific error codes
Added `102` for catch-all detect phase error.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-08-03 12:38:20 -04:00
Emily Casey 946c1a17d1 Fix tokenization in windows processes
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-03 11:24:41 -04:00
Emily Casey b588898c6b Semantic handle of args in direct=false processes
* Resolves #354

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-08-03 11:18:14 -04:00
Emily Casey ad5d287443
Merge pull request #347 from buildpacks/multi-api-lifecycle-descriptor
Multi api lifecycle descriptor
2020-07-30 18:06:43 -04:00
Emily Casey 257920c123 Address PR comments
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 18:03:18 -04:00
Emily Casey a90bc617b0 Validate buildpack APIs
* Quiet deprecation by default at launch time to avoid annoying runtime output

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:23:51 -04:00
Emily Casey f92458eb84 Exclude CNB_PLATFORM_API and CNB_DEPRECATION_MODE from process launch environment
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:21:22 -04:00
Emily Casey de5660f146 undo accidental type change to buildpack testdata
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:21:22 -04:00
Emily Casey a537f9b6f9 Buidpack API 0.2 is supported
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:21:22 -04:00
Emily Casey 080041335f Adds buidpack APIs to group.toml and metadata.toml
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:21:22 -04:00
Emily Casey 970c9ed62e Set CNB_PLATFORM_API in the app image
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:21:22 -04:00
Emily Casey 0f8870ecdd Next lifecycle version -> 0.9.0
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:17:29 -04:00
Emily Casey 35c6de70dd Apply new labels to lifecycle image
* Replaces dockerfile build/push with go script in lifecycle-image workflow

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:17:29 -04:00
Emily Casey 7ceee79482 Fix package-windows target
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:17:29 -04:00
Emily Casey f0c9efd731 Return error instead of panicking when requested API is unparsable
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:17:29 -04:00
Emily Casey 36db452da0 Hardcode platform/buildpack APIs
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:17:29 -04:00
Emily Casey cddc9b9a43 Multi-API lifecycle descriptor
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 12:13:16 -04:00
Emily Casey dd1c4e137d
Merge pull request #352 from buildpacks/report-toml
exporter and rebaser output a report.toml file
2020-07-30 11:47:09 -04:00
Emily Casey 0f85fa9d62 Update cmd/flags.go
Signed-off-by: Emily Casey <ecasey@vmware.com>

Co-authored-by: Jesse Brown <jabrown85@gmail.com>
2020-07-30 11:34:13 -04:00
Emily Casey 7227b3bd04 exporter and rebaser output a report.toml file
* Also, alphabetize some things

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-30 11:34:13 -04:00
Emily Casey 8c5b9ba15b
Merge pull request #353 from buildpacks/buildpack-provided-labels
Add buildpack-provided labels to the image
2020-07-30 10:47:58 -04:00
Emily Casey 209062ed95 Add buildpack-provided labels to the image
* Log added labels
* Resolves #321

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-29 18:23:00 -04:00
Emily Casey 5e896feeae
Merge pull request #351 from buildpacks/feature/output-detect-errs-info-level
feat: make buildpack detection errors info level
2020-07-29 18:15:12 -04:00
Jesse Brown 218612eae5 fixup! feat: make buildpack detection errors info level
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-29 16:02:54 -05:00
Jesse Brown aafdf3c5ef fixup! feat: make buildpack detection errors info level
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-29 15:55:40 -05:00
Emily Casey 83d69bbe1f
Merge pull request #348 from buildpacks/dependabot/go_modules/github.com/golang/mock-1.4.4
Bump github.com/golang/mock from 1.4.3 to 1.4.4
2020-07-29 14:54:39 -04:00
Jesse Brown 5a474fcb36 feat: make buildpack detection errors info level
Builpacks which do not return pass (`0`) or fail (`100`) will now have their output as well as the resulting `err` message logged at info level.

[Issue](https://github.com/buildpacks/lifecycle/issues/283)

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-29 10:44:20 -05:00
Emily Casey d16b743f94
Merge pull request #346 from buildpacks/feature/exit-code-detector-no-groups
feat: use more specific codes during detect
2020-07-29 11:05:50 -04:00
dependabot-preview[bot] 8e858e8676
Bump github.com/golang/mock from 1.4.3 to 1.4.4
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.4.3 to 1.4.4.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/v1.4.3...v1.4.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-29 08:31:28 +00:00
Jesse Brown abe415c679 fixup! feat: use more specific codes during detect
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-28 15:44:29 -05:00
Jesse Brown b40e82fd13 fixup! feat: use more specific codes during detect
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-28 15:37:21 -05:00
Jesse Brown bc3a420574 fixup! feat: use more specific codes during detect
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-28 15:29:05 -05:00
Jesse Brown 3a4427b452 fixup! feat: use more specific codes during detect
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-28 14:21:04 -05:00
Jesse Brown fd0825b559 feat: use more specific codes during detect
Platforms should have the ability to tell the difference between a detector failure because of no passing buildpacks and a detector failure because of no passing buildpacks that _had errors_ during detect.

Detector will now return a `100` or `101` depending on how detection failed.

[Issue #306](https://github.com/buildpacks/lifecycle/issues/306)
[Updatd Spec](https://github.com/buildpacks/spec/blob/platform/0.4/platform.md#outputs)

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-28 13:49:59 -05:00
Emily Casey f76b3e6a79
Merge pull request #340 from buildpacks/merge-slice-fix
Merge slice fixes into main
2020-07-24 13:45:54 -04:00
Emily Casey 86a6f79950
Merge pull request #341 from buildpacks/dependabot/go_modules/github.com/google/go-cmp-0.5.1
Bump github.com/google/go-cmp from 0.5.0 to 0.5.1
2020-07-24 10:14:04 -04:00
Emily Casey 46f9ad01df Remove duplicaiton in test helpers
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-23 17:24:45 -04:00
Emily Casey e2140ef330 Merge remote-tracking branch 'origin' into merge-slice-fix 2020-07-23 17:19:30 -04:00
Emily Casey 8b499fd19d Assert on windows specific entry names
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-23 17:05:41 -04:00
Emily Casey bf167f713b Godoc and other minor fixes
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-23 10:55:26 -04:00
Emily Casey 7138ed9533
Merge pull request #342 from greenhouse-org/docker-run-windows-fix
Fix make docker-run-windows branch merge-slice-fix
2020-07-23 09:45:25 -04:00
Micah Young 47d77ea441 Refactor docker-run-windows get source from .git
Workaround broken directory symlink behavior in docker build

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-07-22 20:28:33 -04:00
Emily Casey e43c68ee5e Fix windows tests and linting errors
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-22 11:30:38 -04:00
Emily Casey 1d6f7f4055 Dont run windows tests in docker contianer in GHA
Docker copy removes file attributes for windows symlink directories that need to be preserved for certain tests

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-22 10:28:58 -04:00
Emily Casey 05a81322b2 Handle windows directory symlinks
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-22 10:28:07 -04:00
dependabot-preview[bot] 8f2465970f
Bump github.com/google/go-cmp from 0.5.0 to 0.5.1
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.0...v0.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-22 08:43:17 +00:00
Emily Casey 41a52a0713 fix windows write/extract tests
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-20 19:30:39 -04:00
Emily Casey 036d00c4cd Adds tests for normalizing reader and writer
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-20 19:02:48 -04:00
Emily Casey 0766151ace merge slice fixes from 0.8.1 into main
refactors windows logic to use new layers package

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-20 17:55:40 -04:00
Emily Casey 63c5c6e6a2
Merge pull request #319 from buildpacks/analyzer-acceptance
Add analyzer acceptance tests
2020-07-20 13:28:24 -04:00
Natalie Arellano 0bf824f4f1 Update per review comments
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-07-20 12:53:16 -04:00
Natalie Arellano 3480edd303 Fix Makefile on Windows
- Reorganize test helpers
- Add small cross platform helpers (like variables)

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-07-16 16:18:41 -04:00
Emily Casey 9dd3dbcefa
Merge pull request #336 from buildpacks/fix-tar-reuse
Fixes tar reuse logic
2020-07-14 16:43:22 -04:00
Emily Casey f4e9cd93d1 Fixes tar reuse logic
* Fixes cache log messages

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-14 16:32:34 -04:00
Emily Casey 0dd0a6815b
Merge pull request #335 from buildpacks/fix-slice-symlinks
Fix handling of symlinks in slices
2020-07-14 14:50:48 -04:00
Emily Casey 397d7f58ee Stop iterating over children once we know a sliced suddir is not yet complete
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-14 12:58:38 -04:00
Emily Casey 7f9c331cb3 Fixed defered writer close error
* Removes unused test helpers

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-14 11:31:10 -04:00
Emily Casey ceb7a0291a tests modtime and uname/gname of created layers
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-14 10:33:42 -04:00
Emily Casey 2dba55f289 cleanup + more tests
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-14 10:12:18 -04:00
Emily Casey 9337c64e20 Fix slice bugs
* Add matched symlinks to the slice instead of the resolved target
* Slice layers should not include files globbing through a symlink
* Only clean up links to dirs, not the target dirs
* Normalize uid/gid of the parents of a matched file only if they are within the app dir

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-14 10:12:18 -04:00
Natalie Arellano f30916c9bd Remove staging fixture
It is always ignored, so why have it.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-07-09 17:00:25 -04:00
Natalie Arellano 1831e44125 Makefile only rebuilds binaries when go files have changed
Could still be improved by:
- Only rebuilding launcher when go files that launcher needs
  have changed

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-07-09 16:31:45 -04:00
Emily Casey f2cca3104c Create 0.8.1 release branch
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-09 13:15:49 -04:00
Natalie Arellano e84bde3965 Fix Windows
- Simplify binary helpers

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-07-08 15:35:25 -04:00
Natalie Arellano 8dc90adc9a Address some TODOs
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-07-07 16:34:47 -04:00
Natalie Arellano 8dcbed60c7 Add analyzer acceptance tests
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-07-07 14:29:13 -04:00
E Casey 3f3687bb03
Merge pull request #332 from greenhouse-org/fix/env-case-bug
Fix case-sensitivity bug when initializing env vars
2020-07-06 18:16:15 -04:00
E Casey c8b140ab73
Merge pull request #331 from greenhouse-org/bump-imgutil
Bump imgutil
2020-07-06 18:10:51 -04:00
Malini Valliath c5ca55f818 Fix case-sensitivity bug when initializing env vars
Signed-off-by: Malini Valliath <mvalliath@pivotal.io>
Signed-off-by: Victoria Henry<vhenry@pivotal.io>
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-07-06 12:55:48 -07:00
Micah Young 811bd0f19c Bump imgutil
- Uses newer windows layer writer with validation and permissions improvements

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-07-03 12:26:55 -04:00
E Casey 3f7e6655ba
Merge pull request #328 from buildpacks/feat/no-color-flag
Add -no-color flag
2020-07-02 13:59:44 -04:00
Jesse Brown 858d3bddb8 Add -no-color flag
Issue: #312

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-02 12:20:49 -05:00
E Casey c3ac0f4972
Merge pull request #327 from buildpacks/feature/process-specific-env
Implement process type specific env vars
2020-07-02 12:49:14 -04:00
Jesse Brown 80c37b7b8d Implement process type specific profile.d
Include process type specific paths when processing profile.d scripts during launch.

Spec: https://github.com/buildpacks/spec/pull/98

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-02 09:59:26 -05:00
Jesse Brown e5fe6ca2fb Implement process type specific env vars
Include process type specific paths when processing env vars during launch.

Spec: https://github.com/buildpacks/spec/pull/98

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-07-01 12:05:24 -05:00
E Casey dee8ab64d4
Merge pull request #325 from buildpacks/feature/321-cnb-buildpack-dir
Sets CNB_BUILDPACK_DIR in bp execution env during detect and build
2020-07-01 11:54:44 -04:00
Emily Casey 322ee31c36 CNB_BUILDPACK_DIR tests for windows
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-01 11:24:33 -04:00
Emily Casey 880053c88f Sets CNB_BUILDPACK_DIR in bp execution env during detect and build
* Resolves #320

Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-07-01 11:11:32 -04:00
E Casey a7e916f748
Merge pull request #310 from greenhouse-org/feature/export-windows-images-squashed
Add ability to export/launch Windows-based images
2020-07-01 10:48:06 -04:00
Andrew Meyer eb421a1ba0 Remove test dependency on bash for Windows
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Victoria Henry <vhenry@pivotal.io>
Signed-off-by: Micah Young<ymicah@vmware.com>
2020-06-30 15:56:11 -07:00
Andrew Meyer 5e2f70067e Fix failing tests
- We were writing improper layers for restorer_test.go

Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-29 14:13:58 -07:00
Emily Casey b62429efd7 Don't export Root and ExecExt
Signed-off-by: Emily Casey <ecasey@vmware.com>
2020-06-29 13:20:37 -07:00
Andrew Meyer 27587be7fa Remove LayerWriterFactory constructor
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Malini Valliath <mvalliath@pivotal.io>
2020-06-29 12:15:24 -07:00
Andrew Meyer 79c6b3d350 Update UntarLayer()
- Skips all non-Files-prefixed entries
- Make test fixture clearer

Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Malini Valliath <mvalliath@pivotal.io>
2020-06-29 12:05:36 -07:00
Andrew Meyer 78787a3c2f Revert removal of documentation strings in tar_test.go
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-29 11:08:35 -07:00
Micah Young e2f968771f Slight refactor of tar package
- Add LayerOS() helper to communicate intention

Signed-off-by: Micah Young <ymicah@vmware.com>
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 0880d8e670 Remove sys package, merge with env
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Micah Young <ymicah@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer c808922cf0 Update tar extraction and test
- More robust 'Files' prefix trimming
- Skip 'Hives' paths instead of trimming
- Make tests easier to debug
- Some minor test cleanup

Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer a2a8e32baf Update Makefile
- Restore removed LDFLAGS
- Bump linux compilation image go version

Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 1af518a16f Refactor Vars usage
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Anthony Emengo 2324097bc3 Add /s to Windows shell commands
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:42 -07:00
Andrew Meyer aabeb661a7 Refactor default vals to use 'var'
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer ba20c05e29 Flesh out launcher for windows
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
2020-06-26 11:15:42 -07:00
Micah Young 78886b642b Refactor Makefile for build-* target parity
- Allows faster builds
- Inline OS check since it is only used for -symlinks target

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-06-26 11:15:42 -07:00
Micah Young 19f5009143 Fix package-windows to run on Linux/Windows
Signed-off-by: Micah Young <ymicah@vmware.com>
2020-06-26 11:15:42 -07:00
Anthony Emengo c143b70c10 Fixes implementation of cleanImageLayerPath in archive#UntarLayer
Signed-off-by: Anthony Emengo <anthonyemengojr@gmail.com>
2020-06-26 11:15:42 -07:00
Micah Young bb8a894c37 Refactor make targets to run on Windows
- launcher increased in size due `runtime` import for `GOOS` detection
- inlined commands do not work well on Windows

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-06-26 11:15:42 -07:00
Anthony Emengo 3c77d7f773 Fixes restore phase on windows
- the Files/ Hives/ directories must be trimmed of the container image
  layer before writing to the container filesystem
- Untar() -> UntarLayer() to justify adding container specific behavior

Signed-off-by: Anthony Emengo <anthonyemengojr@gmail.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 038608425d Remove redundant env vars when running launcher
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Micah Young a14a8535e0 Remove make target for docker-run-linux
- Pending discussion on how to handle potential Docker-in-Docker needs for build-linux
- Will open separate PR once other work is merged

Signed-off-by: Micah Young <ymicah@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 77d86a06a1 Refactor default args to be more maintainable
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 0c5c2f12ac Fix launcher acceptance tests
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 5a8a481848 Fix format
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 4ee9527dc8 Remove whitespace
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 5c4d64fe74 Unexport syscallExecWithStdout
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer d7df44e82a Revert layer ID format change
- Revert back to ':'
- Rename layer tar file name instead to avoid colons

Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 5981f5cd9a Fix exporter tests
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07: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
Andrew Meyer 539f0817d0 Revert fatal error
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer ae3507e7a5 Remove testsyscall package
- Also fixed typo in makefile

Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:42 -07:00
Andrew Meyer 18c9b9f037 Slight makefile cleanup
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:41 -07:00
Andrew Meyer 0bdce4778e Update Makefile
- Add os-specific slash variable, for convenience
- Move PWD redefinition into Windows-only if-case

Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:41 -07:00
Andrew Meyer 4f069b9867 Use exec for windows sys call
Signed-off-by: Andrew Meyer <meyeran@vmware.com>
2020-06-26 11:15:41 -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
E Casey 1ef63ec511
Merge pull request #317 from buildpacks/dependabot/go_modules/github.com/golang/mock-1.4.3
Bump github.com/golang/mock from 1.3.1 to 1.4.3
2020-06-18 12:51:32 -04:00
dependabot-preview[bot] 0e46fe74d6
Bump github.com/golang/mock from 1.3.1 to 1.4.3
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.3.1 to 1.4.3.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/1.3.1...v1.4.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-18 15:48:31 +00:00
E Casey ec4bb16708
Merge pull request #318 from buildpacks/dependabot/go_modules/github.com/google/go-cmp-0.5.0
Bump github.com/google/go-cmp from 0.4.1 to 0.5.0
2020-06-18 11:41:39 -04:00
dependabot-preview[bot] 2aaa548248
Bump github.com/google/go-cmp from 0.4.1 to 0.5.0
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.4.1 to 0.5.0.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.4.1...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-18 15:18:05 +00:00
Emily Casey ed11deb852 master -> main
* Default branch will be renamed from master to main
* Points GHA to main branch
* Removes references to master branch from test data

Signed-off-by: Emily Casey <ecasey@pivotal.io>
2020-06-18 10:02:08 -04:00
E Casey 9e53a47b65
Merge pull request #316 from buildpacks/make-unit-excludes-acceptance
make unit excludes acceptance package
2020-06-16 13:36:08 -04:00
Emily Casey 837db54b3e make unit excludes acceptance package
Signed-off-by: Emily Casey <ecasey@pivotal.io>
2020-06-16 11:56:48 -04:00
E Casey 7de4e60927
Merge pull request #315 from buildpacks/314-adopt-race-neutral-terminology
Adopt race-neutral terminology
2020-06-16 11:19:03 -04:00
Simon Jones 141da70753 Use include and exclude in place of allow and block
Signed-off-by: Simon Jones <simonjones@vmware.com>
2020-06-16 11:02:29 -04:00
Simon Jones 2bedc78712 Adopt race-neutral terminology
Resolves #314

Signed-off-by: Simon Jones <simonjones@vmware.com>
2020-06-15 14:52:32 -04:00
E Casey 8bd6de23a2
Merge pull request #308 from lukasberger/skip-deleting-cache
Do not delete cache image when exporting cache if it is the same as before
2020-06-02 18:11:52 -04: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
784 changed files with 44210 additions and 10624 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
out

View File

@ -2,12 +2,14 @@
name: Bug
about: Bug report
title: ''
labels: status/triage, type/bug
labels: type/bug, status/triage
assignees: ''
---
### Summary
<!--- 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.). -->

26
.github/ISSUE_TEMPLATE/chore.md vendored Normal file
View File

@ -0,0 +1,26 @@
---
name: Chore
about: Suggest a chore that will help contributors and doesn't affect end users
title: ''
labels: type/chore, status/triage
assignees: ''
---
### Summary
<!-- Please describe why this chore matters, who will enjoy it and how. -->
---
### Proposal
<!-- How do you think the chore should be implemented? -->
---
### Context
<!-- Add any other context that may help. -->

33
.github/ISSUE_TEMPLATE/feature.md vendored Normal file
View File

@ -0,0 +1,33 @@
---
name: Feature request
about: Suggest a new feature or an improvement to existing functionality
title: ''
labels: type/enhancement, status/triage
assignees: ''
---
### Summary
<!-- Please describe the feature and why it matters. -->
---
### Proposal
<!-- How do you think the feature should be implemented? -->
---
### Related
<!-- If this feature addresses an RFC, please provide the RFC number below. -->
RFC #___
---
### Context
<!-- Add any other context that may help. -->

16
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
groups:
# Group all minor/patch go dependencies into a single PR.
go-dependencies:
update-types:
- "minor"
- "patch"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly

25
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,25 @@
<!-- 🎉🎉🎉 Thank you for the PR!!! 🎉🎉🎉 -->
### Summary
<!-- Please describe your changes at a high level. -->
#### Release notes
<!-- Please provide 1-2 sentences for release notes. -->
<!-- Example: When using platform API `0.7` or greater, the `creator` logs the expected phase header for the analyze phase -->
---
### Related
<!-- If this PR addresses an issue, please provide the issue number below. -->
Resolves #___
---
### Context
<!-- Add any other context that may help reviewers (e.g., code that requires special attention, etc.). -->

View File

@ -3,38 +3,227 @@ name: build
on:
push:
branches:
- master
- main
- 'release/**'
pull_request:
branches:
- master
- main
- 'release/**'
jobs:
test-and-build:
test-linux-amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up go
uses: actions/setup-go@v2-beta
- uses: actions/checkout@v4
with:
go-version: '1.14'
- name: Set up go env
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
fetch-depth: '0'
- name: Setup go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: 'go.mod'
- name: Install jq
run: |
mkdir -p deps/bin
curl -s -L -o deps/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x deps/bin/jq
echo "::add-path::${PWD}/deps/bin"
echo "${PWD}/deps/bin" >> $GITHUB_PATH
- name: Test
env:
TEST_COVERAGE: 1
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./out/tests/coverage-unit.txt
flags: unit,os_linux
fail_ci_if_error: true
verbose: true
test-linux-arm64:
runs-on: linux-arm64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Setup go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: 'go.mod'
- name: Test
run: |
make format || true
make test
build-and-publish:
needs:
- test-linux-amd64
- test-linux-arm64
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for all branches and tags
- name: Setup go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: 'go.mod'
- name: Install Cosign
uses: sigstore/cosign-installer@v3
- name: Set version
run: |
echo "LIFECYCLE_VERSION=$(go run tools/version/main.go)" | tee -a $GITHUB_ENV version.txt
- uses: actions/upload-artifact@v4
with:
name: version
path: version.txt
- name: Set tag
run: |
echo "LIFECYCLE_IMAGE_TAG=$(git describe --always --abbrev=7)" >> tag.txt
- uses: actions/upload-artifact@v4
with:
name: tag
path: tag.txt
- name: Build
run: |
make clean
make build
make package
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-x86-64
path: out/lifecycle-v*+linux.x86-64.tgz
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-x86-64-sha256
path: out/lifecycle-v*+linux.x86-64.tgz.sha256
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-arm64
path: out/lifecycle-v*+linux.arm64.tgz
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-arm64-sha256
path: out/lifecycle-v*+linux.arm64.tgz.sha256
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-ppc64le
path: out/lifecycle-v*+linux.ppc64le.tgz
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-ppc64le-sha256
path: out/lifecycle-v*+linux.ppc64le.tgz.sha256
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-s390x
path: out/lifecycle-v*+linux.s390x.tgz
- uses: actions/upload-artifact@v4
with:
name: lifecycle-linux-s390x-sha256
path: out/lifecycle-v*+linux.s390x.tgz.sha256
- name: Generate SBOM JSON
uses: CycloneDX/gh-gomod-generate-sbom@v2
with:
args: mod -licenses -json -output lifecycle-v${{ env.LIFECYCLE_VERSION }}-bom.cdx.json
version: ^v1
- uses: actions/upload-artifact@v4
with:
name: lifecycle-bom-cdx
path: lifecycle-v*-bom.cdx.json
- name: Calculate SBOM sha
run: |
shasum -a 256 lifecycle-v${{ env.LIFECYCLE_VERSION }}-bom.cdx.json > lifecycle-v${{ env.LIFECYCLE_VERSION }}-bom.cdx.json.sha256
- uses: actions/upload-artifact@v4
with:
name: lifecycle-bom-cdx-sha256
path: lifecycle-v*-bom.cdx.json.sha256
- uses: azure/docker-login@v2
if: github.event_name == 'push'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/download-artifact@v5
with:
name: tag
- name: Set env
run: |
cat tag.txt >> $GITHUB_ENV
- name: Publish images
if: github.event_name == 'push'
run: |
DOCKER_CLI_EXPERIMENTAL=enabled
LIFECYCLE_IMAGE_TAG=$(git describe --always --abbrev=7)
LINUX_AMD64_SHA=$(go run ./tools/image/main.go -lifecyclePath ./out/lifecycle-v*+linux.x86-64.tgz -tag buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-x86-64 | awk '{print $NF}')
echo "LINUX_AMD64_SHA: $LINUX_AMD64_SHA"
LINUX_ARM64_SHA=$(go run ./tools/image/main.go -lifecyclePath ./out/lifecycle-v*+linux.arm64.tgz -tag buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-arm64 -arch arm64 | awk '{print $NF}')
echo "LINUX_ARM64_SHA: $LINUX_ARM64_SHA"
LINUX_PPC64LE_SHA=$(go run ./tools/image/main.go -lifecyclePath ./out/lifecycle-v*+linux.ppc64le.tgz -tag buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-ppc64le -arch ppc64le | awk '{print $NF}')
echo "LINUX_PPC64LE_SHA: LINUX_PPC64LE_SHA"
LINUX_S390X_SHA=$(go run ./tools/image/main.go -lifecyclePath ./out/lifecycle-v*+linux.s390x.tgz -tag buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-s390x -arch s390x | awk '{print $NF}')
echo "LINUX_S390X_SHA: $LINUX_S390X_SHA"
docker manifest create buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG} \
buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-x86-64@${LINUX_AMD64_SHA} \
buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-arm64@${LINUX_ARM64_SHA} \
buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-ppc64le@${LINUX_PPC64LE_SHA} \
buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux-s390x@${LINUX_S390X_SHA}
MANIFEST_SHA=$(docker manifest push buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG})
echo "MANIFEST_SHA: $MANIFEST_SHA"
cosign sign -r -y \
-a tag=${LIFECYCLE_IMAGE_TAG} \
buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}@${MANIFEST_SHA}
cosign verify \
--certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/build.yml" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
-a tag=${LIFECYCLE_IMAGE_TAG} \
buildpacksio/lifecycle:${LIFECYCLE_IMAGE_TAG}
- name: Scan image
if: github.event_name == 'push'
uses: anchore/scan-action@v6
with:
image: buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}
pack-acceptance-linux:
if: github.event_name == 'push'
needs: build-and-publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: 'buildpacks/pack'
path: 'pack'
ref: 'main'
fetch-depth: 0 # fetch all history for all branches and tags
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'pack/go.mod'
- uses: actions/download-artifact@v5
with:
name: version
- uses: actions/download-artifact@v5
with:
name: tag
- name: Set env
run: |
cat version.txt >> $GITHUB_ENV
cat tag.txt >> $GITHUB_ENV
- uses: actions/download-artifact@v5
with:
name: lifecycle-linux-x86-64
path: pack
- name: Run pack acceptance
run: |
cd pack
git checkout $(git describe --abbrev=0 --tags) # check out the latest tag
LIFECYCLE_PATH="../lifecycle-v${{ env.LIFECYCLE_VERSION }}+linux.x86-64.tgz" \
LIFECYCLE_IMAGE="buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}" \
make acceptance

View File

@ -0,0 +1,127 @@
name: check-latest-release
on:
schedule:
- cron: 0 2 * * 1,4
workflow_dispatch: {}
jobs:
check-release:
runs-on:
- ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: 'go.mod'
- name: Get previous release tag
id: get-previous-release-tag
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
return github.rest.repos.getLatestRelease({
owner: "buildpacks",
repo: "lifecycle",
}).then(result => {
return result.data.tag_name
})
- name: Read go and release versions
id: read-versions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
#!/usr/bin/env bash
set -euo pipefail
LATEST_GO_VERSION=$(go version | cut -d ' ' -f 3)
LATEST_RELEASE_VERSION=${{ steps.get-previous-release-tag.outputs.result }}
wget https://github.com/buildpacks/lifecycle/releases/download/$LATEST_RELEASE_VERSION/lifecycle-$LATEST_RELEASE_VERSION+linux.x86-64.tgz -O lifecycle.tgz
tar xzf lifecycle.tgz
LATEST_RELEASE_GO_VERSION=$(go version ./lifecycle/lifecycle | cut -d ' ' -f 2)
echo "latest-go-version=${LATEST_GO_VERSION}" >> "$GITHUB_OUTPUT"
echo "latest-release-go-version=${LATEST_RELEASE_GO_VERSION}" >> "$GITHUB_OUTPUT"
LATEST_RELEASE_VERSION=$(echo $LATEST_RELEASE_VERSION | cut -d \v -f 2)
echo "latest-release-version=${LATEST_RELEASE_VERSION}" >> "$GITHUB_OUTPUT"
- name: Create issue if needed
if: ${{ steps.read-versions.outputs.latest-go-version != steps.read-versions.outputs.latest-release-go-version }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
#!/usr/bin/env bash
set -euo pipefail
title="Upgrade lifecycle to ${{ steps.read-versions.outputs.latest-go-version }}"
label=${{ steps.read-versions.outputs.latest-go-version }}
# Create label to use for exact search
gh label create "$label" || true
search_output=$(gh issue list --search "$title" --label "$label")
body="Latest lifecycle release v${{ steps.read-versions.outputs.latest-release-version }} is built with Go version ${{ steps.read-versions.outputs.latest-release-go-version }}; newer version ${{ steps.read-versions.outputs.latest-go-version }} is available."
if [ -z "${search_output// }" ]
then
echo "No issues matched search; creating new issue..."
gh issue create \
--label "type/bug" \
--label "status/triage" \
--label "$label" \
--title "$title" \
--body "$body"
else
echo "Found matching issues:"
echo $search_output
fi
- name: Scan latest release image
id: scan-image
uses: anchore/scan-action@v6
with:
image: buildpacksio/lifecycle:${{ steps.read-versions.outputs.latest-release-version }}
fail-build: true
severity-cutoff: medium
output-format: json
- name: Create issue if needed
if: failure() && steps.scan-image.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
#!/usr/bin/env bash
set -euo pipefail
title="CVE(s) found in v${{ steps.read-versions.outputs.latest-release-version }}"
label=cve
# Create label to use for exact search
gh label create "$label" || true
search_output=$(gh issue list --search "$title" --label "$label")
GITHUB_WORKFLOW_URL=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
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}' )"
if [ -z "${search_output// }" ]
then
echo "No issues matched search; creating new issue..."
gh issue create \
--label "type/bug" \
--label "status/triage" \
--label "$label" \
--title "$title" \
--body "$body"
else
echo "Found matching issues:"
echo $search_output
fi

209
.github/workflows/draft-release.yml vendored Normal file
View File

@ -0,0 +1,209 @@
name: draft-release
on:
workflow_dispatch:
jobs:
draft-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install jq
run: |
mkdir -p deps/bin
curl -s -L -o deps/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x deps/bin/jq
echo "${PWD}/deps/bin" >> $GITHUB_PATH
- name: Derive lifecycle version from branch name
run: |
[[ $GITHUB_REF =~ ^refs\/heads\/release/(.*)$ ]] && version=${BASH_REMATCH[1]}
if [[ -z "${version}" ]]; then
echo "lifecycle version not detected."
exit 1
fi
echo "LIFECYCLE_VERSION=$version" >> $GITHUB_ENV
- name: Determine download urls for linux-x86-64, linux-arm64, linux-ppc64le, linux-s390x
id: artifact-urls
# FIXME: this script should be updated to work with actions/github-script@v6
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
return github.actions
.listRepoWorkflows({
owner: "${{ github.repository_owner }}",
repo: "lifecycle",
})
.then(workflows_result => {
let workflows = workflows_result.data.workflows
.filter(a => a.name === "build" && a.state === "active")
.map(a => a.id);
if (workflows.length === 0) {
throw "no active workflows found with name build"
}
return workflows[0]
})
.then(workflow_id => {
return github.actions.listWorkflowRunsForRepo({
owner: "${{ github.repository_owner }}",
repo: "lifecycle",
workflow_id: workflow_id,
branch: "release/${{ env.LIFECYCLE_VERSION }}",
event: "push"
})
})
.then(workflow_runs_result => {
let workflow_runs = workflow_runs_result.data.workflow_runs
.filter(run => run.conclusion === "success")
.filter(run => run.head_sha === "${{ github.sha }}");
if (workflow_runs.length === 0) {
throw "no successful workflow runs found for commit"
}
return workflow_runs[0].id
})
.then(workflow_runid => {
return github.actions.listWorkflowRunArtifacts({
owner: "${{ github.repository_owner }}",
repo: "lifecycle",
run_id: workflow_runid
})
})
.then(artifacts_result => {
let tuples = artifacts_result.data.artifacts
.map(artifact => [artifact.name, artifact.archive_download_url]);
let urlList = new Array();
tuples.forEach(function(tuple) {
if (tuple[0].includes("lifecycle-")) {
urlList.push(tuple[1]);
}
})
if (urlList.length === 0) {
throw "no artifacts found"
}
if (urlList.length != 10) {
// found too many artifacts
// list them and throw
console.log(urlList);
throw "there should be exactly 10 artifacts, found " + urlList.length + " artifacts"
}
return urlList.join(",")
})
- name: Download artifacts
run: |
mkdir artifacts
echo "ARTIFACTS_PATH=$PWD/artifacts" >> $GITHUB_ENV
urls=$(echo '${{ steps.artifact-urls.outputs.result }}' | jq -r . )
for url in $(echo $urls | tr "," "\n"); do
curl -sL -w 'RESP_CODE:%{response_code}\n' \
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
-o tmp-artifact.zip $url
unzip -d artifacts tmp-artifact.zip
rm tmp-artifact.zip
done
- name: Combine checksums
run: |
cd ${{ env.ARTIFACTS_PATH }}
cat *.sha256 | sort > lifecycle-v${{ env.LIFECYCLE_VERSION }}-checksums.txt
rm *.sha256
- name: Set pre-release kind
if: "contains(env.LIFECYCLE_VERSION, 'rc') || contains(env.LIFECYCLE_VERSION, 'pre')" # e.g., 0.99.0-rc.1
run: |
echo "RELEASE_KIND=pre-release" >> $GITHUB_ENV
- name: Set release kind
if: "!contains(env.LIFECYCLE_VERSION, 'rc') && !contains(env.LIFECYCLE_VERSION, 'pre')"
run: |
echo "RELEASE_KIND=release" >> $GITHUB_ENV
- name: Get previous release tag
id: get-previous-release-tag
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
return github.rest.repos.getLatestRelease({
owner: "buildpacks",
repo: "lifecycle",
}).then(result => {
return result.data.tag_name
})
- name: Setup go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: 'go.mod'
- name: Get go version
id: get-go-version
run: |
mkdir tmp
tar xzvf ${{ env.ARTIFACTS_PATH }}/lifecycle-v${{ env.LIFECYCLE_VERSION }}+linux.x86-64.tgz -C tmp/
echo "GO_VERSION=$(go version tmp/lifecycle/lifecycle | cut -d ' ' -f 2 | sed -e 's/^go//')" >> $GITHUB_ENV
- name: Set release body text
run: |
cat << EOF > body.txt
# lifecycle v${{ env.LIFECYCLE_VERSION }}
Welcome to v${{ env.LIFECYCLE_VERSION }}, a ${{ env.RELEASE_KIND }} of the Cloud Native Buildpacks Lifecycle.
## Prerequisites
The lifecycle runs as a normal user in a series of unprivileged containers. To export images and cache image layers, it requires access to a Docker (compatible) daemon **or** an OCI registry.
## Install
Extract the .tgz file and copy the lifecycle binaries into a [build image](https://github.com/buildpacks/spec/blob/main/platform.md#build-image). The build image can then be orchestrated by a platform implementation such as the [pack CLI](https://github.com/buildpack/pack) or [tekton](https://github.com/tektoncd/catalog/tree/main/task/buildpacks).
## Lifecycle Image
An OCI image containing the lifecycle binaries is available at buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}.
## Features
* TODO
* Updates go to version ${{ env.GO_VERSION }}
## Bugfixes
* TODO
## Chores
* TODO
**Full Changelog**: https://github.com/buildpacks/lifecycle/compare/${{ steps.get-previous-release-tag.outputs.result }}...release/${{ env.LIFECYCLE_VERSION }}
## Contributors
We'd like to acknowledge that this release wouldn't be as good without the help of the following amazing contributors:
TODO
EOF
- name: Create pre-release
if: "contains(env.LIFECYCLE_VERSION, 'rc') || contains(env.LIFECYCLE_VERSION, 'pre')" # e.g., 0.99.0-rc.1
run: |
cd ${{ env.ARTIFACTS_PATH }}
gh release create v${{ env.LIFECYCLE_VERSION }} \
$(ls | sort | paste -sd " " -) \
--draft \
--notes-file ../body.txt \
--prerelease \
--target $GITHUB_REF_NAME \
--title "lifecycle v${{ env.LIFECYCLE_VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
if: "!contains(env.LIFECYCLE_VERSION, 'rc') && !contains(env.LIFECYCLE_VERSION, 'pre')"
run: |
cd ${{ env.ARTIFACTS_PATH }}
gh release create v${{ env.LIFECYCLE_VERSION }} \
$(ls | sort | paste -sd " " -) \
--draft \
--notes-file ../body.txt \
--target $GITHUB_REF_NAME \
--title "lifecycle v${{ env.LIFECYCLE_VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,27 +0,0 @@
name: lifecycle-image
on:
release:
types:
- published
jobs:
build-lifecycle-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Get metadata
id: get_metadata
run: |
echo ::set-output name=LIFECYCLE_VERSION::`echo ${{ github.event.release.tag_name }} | cut -d "v" -f2`
echo ::set-output name=BUILDPACK_API::`cat Makefile | grep BUILDPACK_API?= | cut -d "=" -f2`
echo ::set-output name=PLATFORM_API::`cat Makefile | grep PLATFORM_API?= | cut -d "=" -f2`
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: buildpacksio/lifecycle
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: .github/workflows/lifecycle-image/Dockerfile
buildargs: LIFECYCLE_URI=https://github.com/buildpacks/lifecycle/releases/download/v${{ steps.get_metadata.outputs.LIFECYCLE_VERSION }}/lifecycle-v${{ steps.get_metadata.outputs.LIFECYCLE_VERSION }}+linux.x86-64.tgz,LIFECYCLE_VERSION=${{ steps.get_metadata.outputs.LIFECYCLE_VERSION }},BUILDPACK_API=${{ steps.get_metadata.outputs.BUILDPACK_API }},PLATFORM_API=${{ steps.get_metadata.outputs.PLATFORM_API }}
tags: "latest,${{ steps.get_metadata.outputs.LIFECYCLE_VERSION }}"

View File

@ -1,24 +0,0 @@
# Stage 1
FROM ubuntu:bionic AS download-and-extract-lifecycle
ARG LIFECYCLE_URI
WORKDIR /tmp
RUN apt-get update && apt-get install -y wget
RUN wget $LIFECYCLE_URI -O lifecycle.tgz && tar xzvf lifecycle.tgz
# Stage 2
FROM gcr.io/distroless/static
ARG LIFECYCLE_VERSION
ARG BUILDPACK_API
ARG PLATFORM_API
COPY --from=download-and-extract-lifecycle /tmp/lifecycle /cnb/lifecycle
LABEL io.buildpacks.builder.metadata="{\"lifecycle\":{\"version\":\"$LIFECYCLE_VERSION\",\"api\":{\"buildpack\":\"$BUILDPACK_API\",\"platform\":\"$PLATFORM_API\"}}}"
WORKDIR /layers

128
.github/workflows/post-release.yml vendored Normal file
View File

@ -0,0 +1,128 @@
name: post-release
on:
release:
types:
- published # trigger for releases and pre-releases
jobs:
retag-lifecycle-images:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: 'go.mod'
- name: Install crane
run: |
go install github.com/google/go-containerregistry/cmd/crane@latest
- name: Install cosign
uses: sigstore/cosign-installer@v3
- uses: azure/docker-login@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set env
run: |
echo "LIFECYCLE_VERSION=$(echo ${{ github.event.release.tag_name }} | cut -d "v" -f2)" >> $GITHUB_ENV
echo "LIFECYCLE_IMAGE_TAG=$(git describe --always --abbrev=7)" >> $GITHUB_ENV
- name: Verify lifecycle images
run: |
LINUX_AMD64_SHA=$(cosign verify --certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/build.yml" --certificate-oidc-issuer https://token.actions.githubusercontent.com buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-x86-64 | jq -r .[0].critical.image.\"docker-manifest-digest\")
echo "LINUX_AMD64_SHA: $LINUX_AMD64_SHA"
echo "LINUX_AMD64_SHA=$LINUX_AMD64_SHA" >> $GITHUB_ENV
LINUX_ARM64_SHA=$(cosign verify --certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/build.yml" --certificate-oidc-issuer https://token.actions.githubusercontent.com buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-arm64 | jq -r .[0].critical.image.\"docker-manifest-digest\")
echo "LINUX_ARM64_SHA: $LINUX_ARM64_SHA"
echo "LINUX_ARM64_SHA=$LINUX_ARM64_SHA" >> $GITHUB_ENV
LINUX_PPC64LE_SHA=$(cosign verify --certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/build.yml" --certificate-oidc-issuer https://token.actions.githubusercontent.com buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-ppc64le | jq -r .[0].critical.image.\"docker-manifest-digest\")
echo "LINUX_PPC64LE_SHA: $LINUX_PPC64LE_SHA"
echo "LINUX_PPC64LE_SHA=$LINUX_PPC64LE_SHA" >> $GITHUB_ENV
LINUX_S390X_SHA=$(cosign verify --certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/build.yml" --certificate-oidc-issuer https://token.actions.githubusercontent.com buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-s390x | jq -r .[0].critical.image.\"docker-manifest-digest\")
echo "LINUX_S390X_SHA: $LINUX_S390X_SHA"
echo "LINUX_S390X_SHA=$LINUX_S390X_SHA" >> $GITHUB_ENV
- name: Download SBOM
run: |
gh release download --pattern '*-bom.cdx.json' ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Retag lifecycle images & create manifest list - semver
run: |
DOCKER_CLI_EXPERIMENTAL=enabled
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-x86-64@${{ env.LINUX_AMD64_SHA }} ${{ env.LIFECYCLE_VERSION }}-linux-x86-64
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-arm64@${{ env.LINUX_ARM64_SHA }} ${{ env.LIFECYCLE_VERSION }}-linux-arm64
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-ppc64le@${{ env.LINUX_PPC64LE_SHA }} ${{ env.LIFECYCLE_VERSION }}-linux-ppc64le
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-s390x@${{ env.LINUX_S390X_SHA }} ${{ env.LIFECYCLE_VERSION }}-linux-s390x
docker manifest create buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }} \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}-linux-x86-64@${{ env.LINUX_AMD64_SHA }} \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}-linux-arm64@${{ env.LINUX_ARM64_SHA }} \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}-linux-ppc64le@${{ env.LINUX_PPC64LE_SHA }} \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}-linux-s390x@${{ env.LINUX_S390X_SHA }}
MANIFEST_SHA=$(docker manifest push buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }})
echo "MANIFEST_SHA: $MANIFEST_SHA"
cosign sign -r -y \
-a tag=${{ env.LIFECYCLE_VERSION }} \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}@${MANIFEST_SHA}
cosign verify \
--certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/post-release.yml" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
-a tag=${{ env.LIFECYCLE_VERSION }} \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}
cosign attach sbom --sbom ./*-bom.cdx.json --type cyclonedx buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}
cosign sign -r -y \
-a tag=${{ env.LIFECYCLE_VERSION }} --attachment sbom \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}@${MANIFEST_SHA}
cosign verify \
--certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/post-release.yml" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
-a tag=${{ env.LIFECYCLE_VERSION }} --attachment sbom \
buildpacksio/lifecycle:${{ env.LIFECYCLE_VERSION }}
- name: Retag lifecycle images & create manifest list - latest
if: "!contains(env.LIFECYCLE_VERSION, 'rc') && !contains(env.LIFECYCLE_VERSION, 'pre')"
run: |
DOCKER_CLI_EXPERIMENTAL=enabled
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-x86-64@${{ env.LINUX_AMD64_SHA }} latest-linux-x86-64
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-arm64@${{ env.LINUX_ARM64_SHA }} latest-linux-arm64
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-ppc64le@${{ env.LINUX_PPC64LE_SHA }} latest-linux-ppc64le
crane tag buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}-linux-s390x@${{ env.LINUX_S390X_SHA }} latest-linux-s390x
docker manifest create buildpacksio/lifecycle:latest \
buildpacksio/lifecycle:latest-linux-x86-64@${{ env.LINUX_AMD64_SHA }} \
buildpacksio/lifecycle:latest-linux-arm64@${{ env.LINUX_ARM64_SHA }} \
buildpacksio/lifecycle:latest-linux-ppc64le@${{ env.LINUX_PPC64LE_SHA }} \
buildpacksio/lifecycle:latest-linux-s390x@${{ env.LINUX_S390X_SHA }}
MANIFEST_SHA=$(docker manifest push buildpacksio/lifecycle:latest)
echo "MANIFEST_SHA: $MANIFEST_SHA"
cosign sign -r -y \
-a tag=latest \
buildpacksio/lifecycle:latest@${MANIFEST_SHA}
cosign verify \
--certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/post-release.yml" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
-a tag=latest \
buildpacksio/lifecycle:latest
cosign attach sbom --sbom ./*-bom.cdx.json --type cyclonedx buildpacksio/lifecycle:latest
cosign sign -r -y \
-a tag=${{ env.LIFECYCLE_VERSION }} --attachment sbom \
buildpacksio/lifecycle:latest@${MANIFEST_SHA}
cosign verify \
--certificate-identity-regexp "https://github.com/${{ github.repository_owner }}/lifecycle/.github/workflows/post-release.yml" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
-a tag=${{ env.LIFECYCLE_VERSION }} --attachment sbom \
buildpacksio/lifecycle:latest

87
.github/workflows/test-s390x.yml vendored Normal file
View File

@ -0,0 +1,87 @@
name: test-s390x
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches:
- main
- 'release/**'
jobs:
test-linux-s390x:
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release*')
runs-on: ubuntu-latest
env:
ZVSI_FP_NAME: bp-floating-ci-${{ github.run_id }}
ZVSI_INSTANCE_NAME: bp-zvsi-ci-${{ github.run_id }}
ZVSI_ZONE_NAME: ca-tor-1
ZVSI_PROFILE_NAME: bz2-4x16
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: install ibmcli and setup ibm login
run: |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
ibmcloud login -q --apikey ${{ secrets.IBMCLOUD_API_KEY }} -r ca-tor
ibmcloud plugin install vpc-infrastructure
- name: Creation of ZVSI
id: ZVSI
run: |
#creation of zvsi
ibmcloud is instance-create $ZVSI_INSTANCE_NAME ${{ secrets.ZVSI_VPC }} $ZVSI_ZONE_NAME $ZVSI_PROFILE_NAME ${{ secrets.ZVSI_SUBNET }} --image ${{ secrets.ZVSI_IMAGE }} --keys ${{ secrets.ZVSI_KEY }} --resource-group-id ${{ secrets.ZVSI_RG_ID }} --primary-network-interface "{\"name\":\"eth0\",\"allow_ip_spoofing\":false,\"subnet\": {\"name\":\"${{ secrets.ZVSI_SUBNET }}\"},\"security_groups\":[{\"id\":\"${{ secrets.ZVSI_SG }}\"}]}"
#Reserving a floating ip to the ZVSI
ibmcloud is floating-ip-reserve $ZVSI_FP_NAME --zone $ZVSI_ZONE_NAME --resource-group-id ${{ secrets.ZVSI_RG_ID }} --in $ZVSI_INSTANCE_NAME
#Bouding the Floating ip to the ZVSI
ibmcloud is floating-ip-update $ZVSI_FP_NAME --nic eth0 --in $ZVSI_INSTANCE_NAME
sleep 60
#Saving the Floating IP to login ZVSI
ZVSI_HOST=$(ibmcloud is floating-ip $ZVSI_FP_NAME | awk '/Address/{print $2}')
echo $ZVSI_HOST
echo "IP=${ZVSI_HOST}" >> $GITHUB_OUTPUT
- name: Status of ZVSI
run: |
check=$(ibmcloud is ins| awk '/'$ZVSI_INSTANCE_NAME'/{print $3}')
while [[ $check != "running" ]]
do
check=$(ibmcloud is ins | awk '/'$ZVSI_INSTANCE_NAME'/{print $3}')
if [[ $check == 'failed' ]]
then
echo "Failed to run the ZVSI"
break
fi
done
- name: Install dependencies and run all tests on s390x ZVSI
uses: appleboy/ssh-action@v1.2.2
env:
GH_REPOSITORY: ${{ github.server_url }}/${{ github.repository }}
GH_REF: ${{ github.ref }}
with:
host: ${{ steps.ZVSI.outputs.IP }}
username: ${{ secrets.ZVSI_SSH_USER }}
key: ${{ secrets.ZVSI_PR_KEY }}
envs: GH_REPOSITORY,GH_REF
command_timeout: 100m
script: |
apt-get update -y
apt-get install -y wget curl git make gcc jq docker.io
wget https://go.dev/dl/go1.24.6.linux-s390x.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.24.6.linux-s390x.tar.gz
export PATH=$PATH:/usr/local/go/bin
git clone ${GH_REPOSITORY} lifecycle
cd lifecycle && git checkout ${GH_REF}
go env
export PATH=$PATH:~/go/bin
make format || true
make test
- name: Cleanup ZVSI
if: ${{ steps.ZVSI.conclusion == 'success' && always() }}
run: |
#Delete the created ZVSI
ibmcloud is instance-delete $ZVSI_INSTANCE_NAME --force
sleep 20
#Release the created FP
ibmcloud is floating-ip-release $ZVSI_FP_NAME --force

11
.gitignore vendored
View File

@ -3,6 +3,15 @@
*.coverprofile
*.test
*~
.tool-versions
/out
.vscode
acceptance/testdata/*/container/cnb/lifecycle/*
acceptance/testdata/*/**/container/cnb/lifecycle/*
acceptance/testdata/*/**/container/docker-config/*
acceptance/testdata/exporter/container/cnb/run.toml
acceptance/testdata/exporter/container/layers/*analyzed.toml
acceptance/testdata/exporter/container/other_layers/*analyzed.toml
acceptance/testdata/restorer/container/layers/*analyzed.toml

19
.gitpod.yml Normal file
View File

@ -0,0 +1,19 @@
tasks:
# allow socket to be writable by all
# (necessary for acceptance tests / calls from within container)
- init: chmod ugo+w /var/run/docker.sock
# build linux to install dependencies
- init: make tidy build-linux
github:
prebuilds:
master: true
branches: true
pullRequests: true
pullRequestsFromForks: true
addCheck: true
vscode:
extensions:
- golang.go
- ms-azuretools.vscode-docker

5
.grype.yaml Normal file
View File

@ -0,0 +1,5 @@
ignore:
- vulnerability: CVE-2015-5237 # false positive, see https://github.com/anchore/grype/issues/558
- vulnerability: CVE-2021-22570 # false positive, see https://github.com/anchore/grype/issues/558
- vulnerability: CVE-2024-41110 # non-impactful as we only use docker as a client
- vulnerability: GHSA-v23v-6jw2-98fq # non-impactful as we only use docker as a client

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"go.testTimeout": "10m",
"go.testFlags": [
"-v"
]
}

42
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,42 @@
## Policies
This repository adheres to the following project policies:
- [Code of Conduct][code-of-conduct] - How we should act with each other.
- [Contributing][contributing] - General contributing standards.
- [Security][security] - Reporting security concerns.
- [Support][support] - Getting support.
## Contributing to this repository
### Welcome
We welcome contributions to this repository! To get a sense of what the team is currently focusing on, check out our [milestones](https://github.com/buildpacks/lifecycle/milestones). Issues labeled [good first issue](https://github.com/buildpacks/lifecycle/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and issues in our [docs repo](https://github.com/buildpacks/docs/issues?q=is%3Aissue+is%3Aopen+label%3Ateam%2Fimplementations) are great places to get started, but you are welcome to work on any issue that interests you. For issues requiring a greater degree of coordination, such as those labeled `status/needs-discussion` or that are part of larger epics, please reach out in the #implementation channel in [Slack](https://slack.buildpacks.io/).
### Development
Aside from the policies above, you may find [DEVELOPMENT.md](DEVELOPMENT.md) helpful in developing in this repository.
### Background
Here are some topics that might be helpful in further understanding the lifecycle:
* Cloud Native Buildpacks platform api spec
* Example platforms: [pack CLI](https://github.com/buildpack/pack), [Tekton](https://github.com/tektoncd/catalog/blob/master/task/buildpacks/0.1/README.md)
* Cloud Native Buildpacks buildpack api spec
* Example buildpack providers: [Google](https://github.com/GoogleCloudPlatform/buildpacks), [Heroku](https://www.heroku.com/), [Paketo](https://paketo.io/)
* The Open Container Initiative (OCI) and [OCI image spec](https://github.com/opencontainers/image-spec)
* Questions to deepen understanding:
* What are the different [lifecycle phases](https://buildpacks.io/docs/concepts/components/lifecycle/)? What is the purpose of each phase?
* What is a [builder](https://buildpacks.io/docs/concepts/components/builder/)? Is it required to run the lifecycle?
* What is the [untrusted builder workflow](https://medium.com/buildpacks/faster-more-secure-builds-with-pack-0-11-0-4d0c633ca619)? Why do we have this flow?
* What is the [launcher](https://github.com/buildpacks/spec/blob/main/platform.md#launch)? Why do we have a launcher?
* What does a [buildpack](https://buildpacks.io/docs/concepts/components/buildpack/) do? Where does it write data? How does it communicate with the lifecycle?
* What does a [platform](https://buildpacks.io/docs/concepts/components/platform/) do? What things does it know about that the lifecycle does not? How does it communicate with the lifecycle?
* What is a [stack](https://buildpacks.io/docs/concepts/components/stack/)? Who produces stacks? Why is the stack concept important for the lifecycle?
[code-of-conduct]: https://github.com/buildpacks/.github/blob/main/CODE_OF_CONDUCT.md
[contributing]: https://github.com/buildpacks/.github/blob/main/CONTRIBUTING.md
[security]: https://github.com/buildpacks/.github/blob/main/SECURITY.md
[support]: https://github.com/buildpacks/.github/blob/main/SUPPORT.md
[pull-request-process]: https://github.com/buildpacks/.github/blob/main/CONTRIBUTIONS.md#pull-request-process

105
DEVELOPMENT.md Normal file
View File

@ -0,0 +1,105 @@
# Development
## Prerequisites
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
* macOS: _(built-in)_
* Windows:
* `choco install git -y`
* `git config --global core.autocrlf false`
* [Go](https://golang.org/doc/install)
* macOS: `brew install go`
* Windows: `choco install golang -y`
* [Docker](https://www.docker.com/products/docker-desktop)
* [jq](https://stedolan.github.io/jq/) and [yj](https://github.com/sclevine/yj) utilities
* macOS: `brew install jq yj`
* Windows:
* `choco insall jq -y`
* `go get github.com/sclevine/yj`
* Make (and build tools)
* macOS: `xcode-select --install`
* Windows:
* `choco install cygwin make -y`
* `[Environment]::SetEnvironmentVariable("PATH", "C:\tools\cygwin\bin;$ENV:PATH", "MACHINE")`
### Caveats
* The acceptance tests require the docker daemon to be able to communicate with a local containerized insecure registry. On Docker Desktop 3.3.x, this may result in failures such as: `Expected nil: push response: : Get http://localhost:<port>/v2/: dial tcp [::1]:<port>: connect: connection refused`. To fix these failures, it may be necessary to add the following to the Docker Desktop Engine config:
* macOS: Docker > Preferences > Docker Engine:
```
"insecure-registries": [
"<my-host-ip>/32"
]
```
### Testing GitHub actions on forks
The lifecycle release process involves chaining a series of GitHub actions together such that:
* The "build" workflow creates the artifacts
* .tgz files containing the lifecycle binaries, shasums for the .tgz files, an SBOM, etc.
* OCI images containing the lifecycle binaries, tagged with their commit sha (for more information, see RELEASE.md)
* The "draft-release" workflow finds the artifacts and downloads them, creating the draft release
* The "post-release" workflow re-tags the OCI images that were created during the "build" workflow with the release version
It can be rather cumbersome to test changes to these workflows, as they are heavily intertwined. Thus we recommend forking the buildpacks/lifecycle repository in GitHub and running through the entire release process end-to-end.
For the fork, it is necessary to add the following secrets:
* DOCKER_PASSWORD (if not using ghcr.io)
* DOCKER_USERNAME (if not using ghcr.io)
The tools/test-fork.sh script can be used to update the source code to reflect the state of the fork.
It can be invoked like so: `./tools/test-fork.sh <registry repo name>`
## Tasks
To test, build, and package binaries into an archive, simply run:
```bash
$ make all
```
This will create archives at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz` and `out/lifecycle-<LIFECYCLE_VERSION>+windows.x86-64.tgz`.
`LIFECYCLE_VERSION` defaults to the value returned by `git describe --tags` if not on a release branch (for more information about the release process, see [RELEASE](RELEASE.md)). It can be changed by prepending `LIFECYCLE_VERSION=<some version>` to the
`make` command. For example:
```bash
$ LIFECYCLE_VERSION=1.2.3 make all
```
Steps can also be run individually as shown below.
### Test
Formats, vets, and tests the code.
```bash
$ make test
```
#### Mocks
We use mock generators like most golang projects to help with our testing. To make new mocks:
```bash
$ make generate
$ make format lint
```
This is because the mock generator will make a larger diff that the formatter will fix.
### Build
Builds binaries to `out/linux/lifecycle/` and `out/windows/lifecycle/`.
```bash
$ make build
```
> To clean the `out/` directory, run `make clean`.
### Package
Creates archives at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz` and `out/lifecycle-<LIFECYCLE_VERSION>+windows.x86-64.tgz`, using the contents of the
`out/linux/lifecycle/` directory, for the given (or default) `LIFECYCLE_VERSION`.
```bash
$ make package
```

44
IMAGE.md Normal file
View File

@ -0,0 +1,44 @@
# Quick reference
This image is maintained by the [Cloud Native Buildpacks project](https://buildpacks.io/). The maintainers can be contacted via the [Cloud Native Buildpacks Slack](https://slack.buildpacks.io/), or by opening an issue on the `buildpacks/lifecycle` [GitHub repo](https://github.com/buildpacks/lifecycle).
# Supported tags
Supported tags are semver-versioned manifest lists - e.g., `0.12.0` or `0.12.0-rc.1`, pointing to one of the following os/architectures:
* `linux/amd64`
* `linux/arm64`
# About this image
Images are built in [GitHub actions](https://github.com/buildpacks/lifecycle/actions) and signed with [`cosign`](https://github.com/sigstore/cosign). To verify:
* Run:
```
cosign version # must be at least 2.0.0
cosign verify \
--certificate-identity-regexp "https://github.com/buildpacks/lifecycle/.github/workflows/post-release.yml" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
buildpacksio/lifecycle:<tag>
```
A CycloneDX SBOM is "attached" to the image and signed with [`cosign`](https://github.com/sigstore/cosign). To verify:
* Run:
```
cosign version # must be at least 2.0.0
cosign verify \
--certificate-identity-regexp "https://github.com/buildpacks/lifecycle/.github/workflows/post-release.yml" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
-a tag=<tag> -attachment sbom \
buildpacksio/lifecycle:<tag>
cosign download sbom buildpacksio/lifecycle:<tag>
```
# Using this image
With [pack](https://github.com/buildpack/pack):
* `pack build <target> --lifecycle-image buildpacksio/lifecycle:<tag>`
With [tekton](https://github.com/tektoncd/catalog/tree/main/task/buildpacks-phases/0.2):
* Provide as param `LIFECYCLE_IMAGE` in taskrun
***
[Source](https://github.com/buildpacks/lifecycle/blob/main/IMAGE.md) for this page

307
Makefile
View File

@ -1,112 +1,168 @@
GOCMD?=go
GOARCH?=amd64
GOENV=GOARCH=$(GOARCH) CGO_ENABLED=0
ifeq ($(OS),Windows_NT)
SHELL:=cmd.exe
PWD?=$(subst /,\,${CURDIR})
LDFLAGS=-s -w
BLANK:=
/:=\$(BLANK)
else
/:=/
endif
PARSED_COMMIT:=$(shell git rev-parse --short HEAD)
ifeq ($(LIFECYCLE_VERSION),)
LIFECYCLE_VERSION:=$(shell go run tools/version/main.go)
LIFECYCLE_IMAGE_TAG?=$(PARSED_COMMIT)
else
LIFECYCLE_IMAGE_TAG?=$(LIFECYCLE_VERSION)
endif
ACCEPTANCE_TIMEOUT?=2400s
GOCMD?=go
GOENV=GOARCH=$(GOARCH) CGO_ENABLED=0
LIFECYCLE_DESCRIPTOR_PATH?=lifecycle.toml
SCM_REPO?=github.com/buildpacks/lifecycle
SCM_COMMIT?=$(PARSED_COMMIT)
LDFLAGS=-s -w
LDFLAGS+=-X 'github.com/buildpacks/lifecycle/cmd.Version=$(LIFECYCLE_VERSION)'
LDFLAGS+=-X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=$(SCM_REPO)'
LDFLAGS+=-X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=$(SCM_COMMIT)'
LDFLAGS+=-X 'github.com/buildpacks/lifecycle/cmd.PlatformAPI=$(PLATFORM_API)'
GOBUILD=go build $(GOFLAGS) -ldflags "$(LDFLAGS)"
LDFLAGS+=-X 'github.com/buildpacks/lifecycle/cmd.Version=$(LIFECYCLE_VERSION)'
GOBUILD:=go build $(GOFLAGS) -ldflags "$(LDFLAGS)"
GOTEST=$(GOCMD) test $(GOFLAGS)
LIFECYCLE_VERSION?=$(shell cat VERSION)
PLATFORM_API?=0.3
BUILDPACK_API?=0.2
SCM_REPO?=github.com/buildpacks/lifecycle
PARSED_COMMIT:=$(shell git rev-parse --short HEAD)
SCM_COMMIT?=$(PARSED_COMMIT)
BUILD_DIR?=$(PWD)/out
COMPILATION_IMAGE?=golang:1.13-alpine
BUILD_DIR?=$(PWD)$/out
SOURCE_COMPILATION_IMAGE?=lifecycle-img
BUILD_CTR?=lifecycle-ctr
DOCKER_CMD?=make test
define LIFECYCLE_DESCRIPTOR
[api]
platform = "$(PLATFORM_API)"
buildpack = "$(BUILDPACK_API)"
[lifecycle]
version = "$(LIFECYCLE_VERSION)"
endef
GOFILES := $(shell $(GOCMD) run tools$/lister$/main.go)
all: test build package
build: build-linux build-windows
GOOS_ARCHS = linux/amd64 linux/arm64 linux/ppc64le linux/s390x darwin/amd64 darwin/arm64
build-linux-lifecycle: export GOOS:=linux
build-linux-lifecycle: OUT_DIR:=$(BUILD_DIR)/$(GOOS)/lifecycle
build-linux-lifecycle: GOENV:=GOARCH=$(GOARCH) CGO_ENABLED=1
build-linux-lifecycle: DOCKER_RUN=docker run --workdir=/lifecycle -v $(OUT_DIR):/out -v $(PWD):/lifecycle $(COMPILATION_IMAGE)
build-linux-lifecycle:
@echo "> Building lifecycle/lifecycle for linux..."
mkdir -p $(OUT_DIR)
$(DOCKER_RUN) sh -c 'apk add build-base && $(GOENV) $(GOBUILD) -o /out/lifecycle -a ./cmd/lifecycle'
build: build-linux-amd64 build-linux-arm64 build-linux-ppc64le build-linux-s390x
build-image-linux-amd64: build-linux-amd64 package-linux-amd64
build-image-linux-amd64: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+linux.x86-64.tgz
build-image-linux-amd64:
$(GOCMD) run ./tools/image/main.go -daemon -lifecyclePath $(ARCHIVE_PATH) -os linux -arch amd64 -tag lifecycle:$(LIFECYCLE_IMAGE_TAG)
build-linux-launcher: export GOOS:=linux
build-linux-launcher: OUT_DIR?=$(BUILD_DIR)/$(GOOS)/lifecycle
build-linux-launcher:
@echo "> Building lifecycle/launcher for linux..."
mkdir -p $(OUT_DIR)
$(GOENV) $(GOBUILD) -o $(OUT_DIR)/launcher -a ./cmd/launcher
test $$(du -m $(OUT_DIR)/launcher|cut -f 1) -le 3
build-image-linux-arm64: build-linux-arm64 package-linux-arm64
build-image-linux-arm64: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+linux.arm64.tgz
build-image-linux-arm64:
$(GOCMD) run ./tools/image/main.go -daemon -lifecyclePath $(ARCHIVE_PATH) -os linux -arch arm64 -tag lifecycle:$(LIFECYCLE_IMAGE_TAG)
build-linux-symlinks: export GOOS:=linux
build-linux-symlinks: OUT_DIR:=$(BUILD_DIR)/$(GOOS)/lifecycle
build-linux-symlinks:
@echo "> Creating phase symlinks for linux..."
ln -sf lifecycle $(OUT_DIR)/detector
ln -sf lifecycle $(OUT_DIR)/analyzer
ln -sf lifecycle $(OUT_DIR)/restorer
ln -sf lifecycle $(OUT_DIR)/builder
ln -sf lifecycle $(OUT_DIR)/exporter
ln -sf lifecycle $(OUT_DIR)/rebaser
ln -sf lifecycle $(OUT_DIR)/creator
build-image-linux-ppc64le: build-linux-ppc64le package-linux-ppc64le
build-image-linux-ppc64le: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+linux.ppc64le.tgz
build-image-linux-ppc64le:
$(GOCMD) run ./tools/image/main.go -daemon -lifecyclePath $(ARCHIVE_PATH) -os linux -arch ppc64le -tag lifecycle:$(LIFECYCLE_IMAGE_TAG)
build-linux: build-linux-lifecycle build-linux-symlinks build-linux-launcher
build-image-linux-s390x: build-linux-s390x package-linux-s390x
build-image-linux-s390x: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+linux.s390x.tgz
build-image-linux-s390x:
$(GOCMD) run ./tools/image/main.go -daemon -lifecyclePath $(ARCHIVE_PATH) -os linux -arch s390x -tag lifecycle:$(LIFECYCLE_IMAGE_TAG)
build-windows: export GOOS:=windows
build-windows: OUT_DIR:=$(BUILD_DIR)/$(GOOS)/lifecycle
build-windows:
@echo "> Building for windows..."
mkdir -p $(OUT_DIR)
$(GOENV) $(GOBUILD) -o $(OUT_DIR)/launcher -a ./cmd/launcher
test $$(du -m $(OUT_DIR)/launcher|cut -f 1) -le 3
$(GOENV) $(GOBUILD) -o $(OUT_DIR)/lifecycle.exe -a ./cmd/lifecycle
ln -sf lifecycle.exe $(OUT_DIR)/analyzer.exe
ln -sf lifecycle.exe $(OUT_DIR)/restorer.exe
ln -sf lifecycle.exe $(OUT_DIR)/builder.exe
ln -sf lifecycle.exe $(OUT_DIR)/exporter.exe
ln -sf lifecycle.exe $(OUT_DIR)/rebaser.exe
ln -sf lifecycle.exe $(OUT_DIR)/creator.exe
define build_targets
build-$(1)-$(2): build-$(1)-$(2)-lifecycle build-$(1)-$(2)-symlinks build-$(1)-$(2)-launcher
build-darwin: export GOOS:=darwin
build-darwin: OUT_DIR:=$(BUILD_DIR)/$(GOOS)/lifecycle
build-darwin:
@echo "> Building for macos..."
mkdir -p $(OUT_DIR)
$(GOENV) $(GOBUILD) -o $(OUT_DIR)/launcher -a ./cmd/launcher
test $$(du -m $(OUT_DIR)/launcher|cut -f 1) -le 3
$(GOENV) $(GOBUILD) -o $(OUT_DIR)/lifecycle -a ./cmd/lifecycle
ln -sf lifecycle $(OUT_DIR)/detector
ln -sf lifecycle $(OUT_DIR)/analyzer
ln -sf lifecycle $(OUT_DIR)/restorer
ln -sf lifecycle $(OUT_DIR)/builder
ln -sf lifecycle $(OUT_DIR)/exporter
ln -sf lifecycle $(OUT_DIR)/rebaser
build-$(1)-$(2)-lifecycle: $(BUILD_DIR)/$(1)-$(2)/lifecycle/lifecycle
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/lifecycle: export GOOS:=$(1)
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/lifecycle: export GOARCH:=$(2)
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/lifecycle: OUT_DIR?=$$(BUILD_DIR)/$$(GOOS)-$$(GOARCH)/lifecycle
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/lifecycle: $$(GOFILES)
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/lifecycle:
@echo "> Building lifecycle/lifecycle for $$(GOOS)/$$(GOARCH)..."
mkdir -p $$(OUT_DIR)
$$(GOENV) $$(GOBUILD) -o $$(OUT_DIR)/lifecycle -a ./cmd/lifecycle
build-$(1)-$(2)-symlinks: export GOOS:=$(1)
build-$(1)-$(2)-symlinks: export GOARCH:=$(2)
build-$(1)-$(2)-symlinks: OUT_DIR?=$$(BUILD_DIR)/$$(GOOS)-$$(GOARCH)/lifecycle
build-$(1)-$(2)-symlinks:
@echo "> Creating phase symlinks for $$(GOOS)/$$(GOARCH)..."
ln -sf lifecycle $$(OUT_DIR)/detector
ln -sf lifecycle $$(OUT_DIR)/analyzer
ln -sf lifecycle $$(OUT_DIR)/restorer
ln -sf lifecycle $$(OUT_DIR)/builder
ln -sf lifecycle $$(OUT_DIR)/exporter
ln -sf lifecycle $$(OUT_DIR)/rebaser
ln -sf lifecycle $$(OUT_DIR)/creator
ln -sf lifecycle $$(OUT_DIR)/extender
build-$(1)-$(2)-launcher: $$(BUILD_DIR)/$(1)-$(2)/lifecycle/launcher
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/launcher: export GOOS:=$(1)
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/launcher: export GOARCH:=$(2)
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/launcher: OUT_DIR?=$$(BUILD_DIR)/$$(GOOS)-$$(GOARCH)/lifecycle
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/launcher: $$(GOFILES)
$$(BUILD_DIR)/$(1)-$(2)/lifecycle/launcher:
@echo "> Building lifecycle/launcher for $$(GOOS)/$$(GOARCH)..."
mkdir -p $$(OUT_DIR)
$$(GOENV) $$(GOBUILD) -o $$(OUT_DIR)/launcher -a ./cmd/launcher
test $$$$(du -m $$(OUT_DIR)/launcher|cut -f 1) -le 3
endef
$(foreach ga,$(GOOS_ARCHS),$(eval $(call build_targets,$(word 1, $(subst /, ,$(ga))),$(word 2, $(subst /, ,$(ga))))))
generate-sbom: run-syft-linux-amd64 run-syft-linux-arm64 run-syft-linux-ppc64le run-syft-linux-s390x
run-syft-linux-amd64: install-syft
run-syft-linux-amd64: export GOOS:=linux
run-syft-linux-amd64: export GOARCH:=amd64
run-syft-linux-amd64:
@echo "> Running syft..."
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.cdx.json
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.cdx.json
run-syft-linux-arm64: install-syft
run-syft-linux-arm64: export GOOS:=linux
run-syft-linux-arm64: export GOARCH:=arm64
run-syft-linux-arm64:
@echo "> Running syft..."
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.cdx.json
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.cdx.json
run-syft-linux-ppc64le: install-syft
run-syft-linux-ppc64le: export GOOS:=linux
run-syft-linux-ppc64le: export GOARCH:=ppc64le
run-syft-linux-ppc64le:
@echo "> Running syft..."
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.cdx.json
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.cdx.json
run-syft-linux-s390x: install-syft
run-syft-linux-s390x: export GOOS:=linux
run-syft-linux-s390x: export GOARCH:=s390x
run-syft-linux-s390x:
@echo "> Running syft..."
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/lifecycle.sbom.cdx.json
syft $(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher -o json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.syft.json -o spdx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.spdx.json -o cyclonedx-json=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle/launcher.sbom.cdx.json
install-syft:
@echo "> Installing syft..."
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
define install-go-tool
@echo "> Installing $(1)..."
$(GOCMD) install $(1)@$(shell $(GOCMD) list -m -f '{{.Version}}' $(2))
endef
install-goimports:
@echo "> Installing goimports..."
cd tools; $(GOCMD) install golang.org/x/tools/cmd/goimports
$(call install-go-tool,golang.org/x/tools/cmd/goimports,golang.org/x/tools)
install-yj:
@echo "> Installing yj..."
cd tools; $(GOCMD) install github.com/sclevine/yj
$(call install-go-tool,github.com/sclevine/yj,github.com/sclevine/yj)
install-mockgen:
@echo "> Installing mockgen..."
cd tools; $(GOCMD) install github.com/golang/mock/mockgen
$(call install-go-tool,github.com/golang/mock/mockgen,github.com/golang/mock)
install-golangci-lint:
@echo "> Installing golangci-lint..."
cd tools; $(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint
$(call install-go-tool,github.com/golangci/golangci-lint/v2/cmd/golangci-lint,github.com/golangci/golangci-lint/v2)
lint: install-golangci-lint
@echo "> Linting code..."
@ -119,55 +175,70 @@ generate: install-mockgen
format: install-goimports
@echo "> Formating code..."
test -z $$(goimports -l -w -local github.com/buildpacks/lifecycle .)
$(if $(shell goimports -l -w -local github.com/buildpacks/lifecycle .), @echo Fixed formatting errors. Re-run && exit 1)
verify-jq:
ifeq (, $(shell which jq))
$(error "No jq in $$PATH, please install jq")
endif
tidy:
@echo "> Tidying modules..."
$(GOCMD) mod tidy
test: unit acceptance
unit: verify-jq format lint install-yj
# append coverage arguments
ifeq ($(TEST_COVERAGE), 1)
unit: GOTESTFLAGS:=$(GOTESTFLAGS) -coverprofile=./out/tests/coverage-unit.txt -covermode=atomic
endif
unit: out
unit: UNIT_PACKAGES=$(shell $(GOCMD) list ./... | grep -v acceptance)
unit: format lint tidy install-yj
@echo "> Running unit tests..."
$(GOTEST) -v -count=1 ./...
$(GOTEST) $(GOTESTFLAGS) -v -count=1 $(UNIT_PACKAGES)
acceptance: format lint
out:
@mkdir out || (exit 0)
mkdir out$/tests || (exit 0)
acceptance: format tidy
@echo "> Running acceptance tests..."
$(GOTEST) -v -count=1 -tags=acceptance ./acceptance/...
acceptance-darwin: format lint
@echo "> Running acceptance tests..."
$(GOTEST) -v -count=1 -tags=acceptance ./acceptance/...
$(GOTEST) -v -count=1 -tags=acceptance -timeout=$(ACCEPTANCE_TIMEOUT) ./acceptance/...
clean:
@echo "> Cleaning workspace..."
rm -rf $(BUILD_DIR)
package: package-linux package-windows
package: generate-sbom package-linux-amd64 package-linux-arm64 package-linux-ppc64le package-linux-s390x
package-linux: export LIFECYCLE_DESCRIPTOR:=$(LIFECYCLE_DESCRIPTOR)
package-linux: GOOS:=linux
package-linux: GOOS_DIR:=$(BUILD_DIR)/$(GOOS)
package-linux: ARCHIVE_NAME=lifecycle-v$(LIFECYCLE_VERSION)+$(GOOS).x86-64
package-linux:
@echo "> Writing descriptor file for $(GOOS)..."
mkdir -p $(GOOS_DIR)
echo "$${LIFECYCLE_DESCRIPTOR}" > $(GOOS_DIR)/lifecycle.toml
package-linux-amd64: GOOS:=linux
package-linux-amd64: GOARCH:=amd64
package-linux-amd64: INPUT_DIR:=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle
package-linux-amd64: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+$(GOOS).x86-64.tgz
package-linux-amd64: PACKAGER=./tools/packager/main.go
package-linux-amd64:
@echo "> Packaging lifecycle for $(GOOS)/$(GOARCH)..."
$(GOCMD) run $(PACKAGER) --inputDir $(INPUT_DIR) -archivePath $(ARCHIVE_PATH) -descriptorPath $(LIFECYCLE_DESCRIPTOR_PATH) -version $(LIFECYCLE_VERSION)
@echo "> Packaging lifecycle for $(GOOS)..."
tar czf $(BUILD_DIR)/$(ARCHIVE_NAME).tgz -C $(GOOS_DIR) lifecycle.toml lifecycle
package-linux-arm64: GOOS:=linux
package-linux-arm64: GOARCH:=arm64
package-linux-arm64: INPUT_DIR:=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle
package-linux-arm64: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+$(GOOS).arm64.tgz
package-linux-arm64: PACKAGER=./tools/packager/main.go
package-linux-arm64:
@echo "> Packaging lifecycle for $(GOOS)/$(GOARCH)..."
$(GOCMD) run $(PACKAGER) --inputDir $(INPUT_DIR) -archivePath $(ARCHIVE_PATH) -descriptorPath $(LIFECYCLE_DESCRIPTOR_PATH) -version $(LIFECYCLE_VERSION)
package-windows: export LIFECYCLE_DESCRIPTOR:=$(LIFECYCLE_DESCRIPTOR)
package-windows: GOOS:=windows
package-windows: GOOS_DIR:=$(BUILD_DIR)/$(GOOS)
package-windows: ARCHIVE_NAME=lifecycle-v$(LIFECYCLE_VERSION)+$(GOOS).x86-64
package-windows:
@echo "> Writing descriptor file for $(GOOS)..."
mkdir -p $(GOOS_DIR)
echo "$${LIFECYCLE_DESCRIPTOR}" > $(GOOS_DIR)/lifecycle.toml
package-linux-ppc64le: GOOS:=linux
package-linux-ppc64le: GOARCH:=ppc64le
package-linux-ppc64le: INPUT_DIR:=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle
package-linux-ppc64le: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+$(GOOS).ppc64le.tgz
package-linux-ppc64le: PACKAGER=./tools/packager/main.go
package-linux-ppc64le:
@echo "> Packaging lifecycle for $(GOOS)/$(GOARCH)..."
$(GOCMD) run $(PACKAGER) --inputDir $(INPUT_DIR) -archivePath $(ARCHIVE_PATH) -descriptorPath $(LIFECYCLE_DESCRIPTOR_PATH) -version $(LIFECYCLE_VERSION)
@echo "> Packaging lifecycle for $(GOOS)..."
tar czf $(BUILD_DIR)/$(ARCHIVE_NAME).tgz -C $(GOOS_DIR) lifecycle.toml lifecycle
.PHONY: verify-jq
package-linux-s390x: GOOS:=linux
package-linux-s390x: GOARCH:=s390x
package-linux-s390x: INPUT_DIR:=$(BUILD_DIR)/$(GOOS)-$(GOARCH)/lifecycle
package-linux-s390x: ARCHIVE_PATH=$(BUILD_DIR)/lifecycle-v$(LIFECYCLE_VERSION)+$(GOOS).s390x.tgz
package-linux-s390x: PACKAGER=./tools/packager/main.go
package-linux-s390x:
@echo "> Packaging lifecycle for $(GOOS)/$(GOARCH)..."
$(GOCMD) run $(PACKAGER) --inputDir $(INPUT_DIR) -archivePath $(ARCHIVE_PATH) -descriptorPath $(LIFECYCLE_DESCRIPTOR_PATH) -version $(LIFECYCLE_VERSION)

112
README.md
View File

@ -1,72 +1,74 @@
# Lifecycle
![Build Status](https://github.com/buildpacks/lifecycle/workflows/build/badge.svg)
[![Build Status](https://github.com/buildpacks/lifecycle/workflows/build/badge.svg)](https://github.com/buildpacks/lifecycle/actions)
[![GoDoc](https://godoc.org/github.com/buildpacks/lifecycle?status.svg)](https://godoc.org/github.com/buildpacks/lifecycle)
[![codecov](https://codecov.io/gh/buildpacks/lifecycle/branch/main/graph/badge.svg)](https://codecov.io/gh/buildpacks/lifecycle/tree/main)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4748/badge)](https://bestpractices.coreinfrastructure.org/projects/4748)
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/buildpacks/lifecycle)
A reference implementation of the [Cloud Native Buildpacks specification](https://github.com/buildpacks/spec).
This lifecycle implements the following versioned APIs
* Buildpack API 0.2
* Platform API 0.3
## Supported APIs
| Lifecycle Version | Platform APIs | Buildpack APIs |
|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| 0.20.x | [0.7][p/0.7], [0.8][p/0.8], [0.9][p/0.9], [0.10][p/0.10], [0.11][p/0.11], [0.12][p/0.12], [0.13][p/0.13], [0.14][p/0.14] | [0.7][b/0.7], [0.8][b/0.8], [0.9][b/0.9], [0.10][b/0.10], [0.11][b/0.11] |
| 0.19.x | [0.7][p/0.7], [0.8][p/0.8], [0.9][p/0.9], [0.10][p/0.10], [0.11][p/0.11], [0.12][p/0.12], [0.13][p/0.13] | [0.7][b/0.7], [0.8][b/0.8], [0.9][b/0.9], [0.10][b/0.10], [0.11][b/0.11] |
| 0.18.x | [0.7][p/0.7], [0.8][p/0.8], [0.9][p/0.9], [0.10][p/0.10], [0.11][p/0.11], [0.12][p/0.12] | [0.7][b/0.7], [0.8][b/0.8], [0.9][b/0.9], [0.10][b/0.10] |
| 0.17.x | [0.3][p/0.3], [0.4][p/0.4], [0.5][p/0.5], [0.6][p/0.6], [0.7][p/0.7], [0.8][p/0.8], [0.9][p/0.9], [0.10][p/0.10], [0.11][p/0.11], [0.12][p/0.12] | [0.2][b/0.2], [0.3][b/0.3], [0.4][b/0.4], [0.5][b/0.5], [0.6][b/0.6], [0.7][b/0.7], [0.8][b/0.8], [0.9][b/0.9], [0.10][b/0.10] |
| 0.16.x | [0.3][p/0.3], [0.4][p/0.4], [0.5][p/0.5], [0.6][p/0.6], [0.7][p/0.7], [0.8][p/0.8], [0.9][p/0.9], [0.10][p/0.10], [0.11][p/0.11] | [0.2][b/0.2], [0.3][b/0.3], [0.4][b/0.4], [0.5][b/0.5], [0.6][b/0.6], [0.7][b/0.7], [0.8][b/0.8], [0.9][b/0.9] |
| 0.15.x | [0.3][p/0.3], [0.4][p/0.4], [0.5][p/0.5], [0.6][p/0.6], [0.7][p/0.7], [0.8][p/0.8], [0.9][p/0.9], [0.10][p/0.10] | [0.2][b/0.2], [0.3][b/0.3], [0.4][b/0.4], [0.5][b/0.5], [0.6][b/0.6], [0.7][b/0.7], [0.8][b/0.8], [0.9][b/0.9] |
| 0.14.x | [0.3][p/0.3], [0.4][p/0.4], [0.5][p/0.5], [0.6][p/0.6], [0.7][p/0.7], [0.8][p/0.8], [0.9][p/0.9] | [0.2][b/0.2], [0.3][b/0.3], [0.4][b/0.4], [0.5][b/0.5], [0.6][b/0.6], [0.7][b/0.7], [0.8][b/0.8] |
| 0.13.x | [0.3][p/0.3], [0.4][p/0.4], [0.5][p/0.5], [0.6][p/0.6], [0.7][p/0.7], [0.8][p/0.8] | [0.2][b/0.2], [0.3][b/0.3], [0.4][b/0.4], [0.5][b/0.5], [0.6][b/0.6], [0.7][b/0.7] |
## Commands
[b/0.2]: https://github.com/buildpacks/spec/blob/buildpack/v0.2/buildpack.md
[b/0.3]: https://github.com/buildpacks/spec/tree/buildpack/v0.3/buildpack.md
[b/0.4]: https://github.com/buildpacks/spec/tree/buildpack/v0.4/buildpack.md
[b/0.5]: https://github.com/buildpacks/spec/tree/buildpack/v0.5/buildpack.md
[b/0.6]: https://github.com/buildpacks/spec/tree/buildpack/v0.6/buildpack.md
[b/0.7]: https://github.com/buildpacks/spec/tree/buildpack/v0.7/buildpack.md
[b/0.8]: https://github.com/buildpacks/spec/tree/buildpack/v0.8/buildpack.md
[b/0.9]: https://github.com/buildpacks/spec/tree/buildpack/v0.9/buildpack.md
[b/0.10]: https://github.com/buildpacks/spec/tree/buildpack/v0.10/buildpack.md
[b/0.11]: https://github.com/buildpacks/spec/tree/buildpack/v0.11/buildpack.md
[p/0.2]: https://github.com/buildpacks/spec/blob/platform/v0.2/platform.md
[p/0.3]: https://github.com/buildpacks/spec/blob/platform/v0.3/platform.md
[p/0.4]: https://github.com/buildpacks/spec/blob/platform/v0.4/platform.md
[p/0.5]: https://github.com/buildpacks/spec/blob/platform/v0.5/platform.md
[p/0.6]: https://github.com/buildpacks/spec/blob/platform/v0.6/platform.md
[p/0.7]: https://github.com/buildpacks/spec/blob/platform/v0.7/platform.md
[p/0.8]: https://github.com/buildpacks/spec/blob/platform/v0.8/platform.md
[p/0.9]: https://github.com/buildpacks/spec/blob/platform/v0.9/platform.md
[p/0.10]: https://github.com/buildpacks/spec/blob/platform/v0.10/platform.md
[p/0.11]: https://github.com/buildpacks/spec/blob/platform/v0.11/platform.md
[p/0.12]: https://github.com/buildpacks/spec/blob/platform/v0.12/platform.md
[p/0.13]: https://github.com/buildpacks/spec/blob/platform/v0.13/platform.md
[p/0.14]: https://github.com/buildpacks/spec/blob/platform/v0.14/platform.md
\* denotes unreleased version
## Usage
### Build
* `detector` - chooses buildpacks (via `/bin/detect`)
* `analyzer` - restores launch layer metadata from the previous build
* `restorer` - restores cache
* `builder` - executes buildpacks (via `/bin/build`)
* `exporter` - creates image and stores cache
Either:
* `analyzer` - Reads metadata from the previous image and ensures registry access.
* `detector` - Chooses buildpacks (via `/bin/detect`) and produces a build plan.
* `restorer` - Restores layer metadata from the previous image and from the cache, and restores cached layers.
* `builder` - Executes buildpacks (via `/bin/build`).
* `exporter` - Creates an image and caches layers.
Or:
* `creator` - Runs the five phases listed above in order.
### Run
* `launcher` - invokes choice of process
* `launcher` - Invokes a chosen process.
### Rebase
* `rebaser` - remotely patches images with new base image
* `rebaser` - Creates an image from a previous image with updated base layers.
## Development
To test, build, and package binaries into an archive, simply run:
```bash
$ make all
```
This will create an archive at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz`.
`LIFECYCLE_VERSION` defaults to the value in the `VERSION` file at the root of the repo . It can be changed by prepending `LIFECYCLE_VERSION=<some version>` to the
`make` command. For example:
```bash
$ LIFECYCLE_VERSION=1.2.3 make all
```
Steps can also be run individually as shown below.
### Test
Formats, vets, and tests the code.
```bash
$ make test
```
### Build
Builds binaries to `out/linux/lifecycle/`.
```bash
$ make build
```
> To clean the `out/` directory, run `make clean`.
### Package
Creates an archive at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz`, using the contents of the
`out/linux/lifecycle/` directory, for the given (or default) `LIFECYCLE_VERSION`.
```bash
$ make package
```
## Contributing
- [CONTRIBUTING](CONTRIBUTING.md) - Information on how to contribute and grow your understanding of the lifecycle.
- [DEVELOPMENT](DEVELOPMENT.md) - Further detail to help you during the development process.
- [RELEASE](RELEASE.md) - Further details about our release process.

73
RELEASE.md Normal file
View File

@ -0,0 +1,73 @@
# Release Finalization
## Types of releases
#### New minor
* For newly supported Platform or Buildpack API versions, or breaking changes (e.g., API deprecations).
#### Pre-release aka release candidate
* Ideally we should ship a pre-release (waiting a few days for folks to try it out) before we ship a new minor.
* We typically don't ship pre-releases for patches or backports.
#### New patch
* For go version updates, CVE fixes / dependency bumps, bug fixes, etc.
* Review the latest commits on `main` to determine if any are unacceptable for a patch - if there are commits that should be excluded, branch off the latest tag for the current minor and cherry-pick commits over.
#### Backport
* New patch for an old minor. Typically, to help folks out who haven't yet upgraded from [unsupported APIs](https://github.com/buildpacks/rfcs/blob/main/text/0110-deprecate-apis.md).
* For go version updates, CVE fixes / dependency bumps, bug fixes, etc.
* Branch off the latest tag for the desired minor.
## Release Finalization Steps
### Step 1 - Prepare
Determine the type of release ([new minor](#new-minor), [pre-release](#pre-release-aka-release-candidate), [new patch](#new-patch), or [backport](#backport)) and prepare the branch accordingly.
**To prepare the release branch:**
1. Check open PRs for any dependabot updates that should be merged.
1. Create a release branch in the format `release/0.99.0-rc.1` (for pre-releases) or `release/0.99.0` (for final releases).
* New commits to this branch will trigger the `build` workflow and produce a lifecycle image: `buildpacksio/lifecycle:<commit sha>`.
1. If applicable, ensure the README is updated with the latest supported apis (example PR: https://github.com/buildpacks/lifecycle/pull/550).
* For final releases (not pre-releases), remove the pre-release note (`*`) for the latest apis.
**For final releases (not pre-releases):**
1. Ensure the relevant spec APIs have been released.
1. Ensure the `lifecycle/0.99.0` milestone on the [docs repo](https://github.com/buildpacks/docs/blob/main/RELEASE.md#lump-changes) is complete, such that every new feature in the lifecycle is fully explained in the `release/lifecycle/0.99` branch on the docs repo, and [migration guides](https://github.com/buildpacks/docs/tree/main/content/docs/reference/spec/migration) (if relevant) are included.
### Step 2 - Publish the Release
1. Manually trigger the `draft-release` workflow: Actions -> draft-release -> Run workflow -> Use workflow from branch: `release/<release version>`. This will create a draft release on GitHub using the artifacts from the `build` workflow run for the latest commit on the release branch.
1. Edit the release notes as necessary.
1. Perform any manual validation of the artifacts as necessary (usually none).
1. Edit the release page and click "Publish release".
* This will trigger the `post-release` workflow that will re-tag the lifecycle image from `buildpacksio/lifecycle:<commit sha>` to `buildpacksio/lifecycle:<release version>`.
* For final releases ONLY, this will also re-tag the lifecycle image from `buildpacksio/lifecycle:<commit sha>` to `buildpacksio/lifecycle:latest`.
### Step 3 - Follow-up
**For pre-releases:**
* Ask the relevant teams to try out the pre-released artifacts.
**For final releases:**
* Update the `main` branch to remove the pre-release note in [README.md](https://github.com/buildpacks/lifecycle/blob/main/README.md) and/or merge `release/0.99.0` into `main`.
* Ask the learning team to merge the `release/lifecycle/0.99` branch into `main` on the docs repo.
## Go version updates
Go version updates should be released as a [new minor](#new-minor) or [new patch](#new-patch) release.
### New Patch
If the go patch is in [actions/go-versions](https://github.com/actions/go-versions/pulls?q=is%3Apr+is%3Aclosed) then CI should pull it in automatically without any action needed.
We simply need to create the release branch and let the pipeline run.
### New Minor
We typically do this when the existing patch version exceeds 6 - e.g., `1.22.6`. This means we have about 6 months to upgrade before the current minor becomes unsupported due to the introduction of the new n+2 minor.
#### Steps
1. Update go.mod
1. Search for the old `major.minor`, there are a few files that need to be updated (example PR: https://github.com/buildpacks/lifecycle/pull/1405/files)
1. Update the linter to a version that supports the current `major.minor`
1. Fix any lint errors as necessary

View File

@ -1 +0,0 @@
0.8.0

View File

@ -1,9 +1,7 @@
// +build acceptance
package acceptance
import (
"io/ioutil"
"fmt"
"os"
"os/exec"
"path/filepath"
@ -13,52 +11,50 @@ import (
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var buildDir string
const (
expectedVersion = "some-version"
expectedCommit = "asdf123"
)
var (
latestPlatformAPI = api.Platform.Latest().String()
buildDir string
)
func TestVersion(t *testing.T) {
var err error
buildDir, err = ioutil.TempDir("", "lifecycle-acceptance")
buildDir, err = os.MkdirTemp("", "lifecycle-acceptance")
h.AssertNil(t, err)
defer func() {
h.AssertNil(t, os.RemoveAll(buildDir))
}()
buildBinaries(t, buildDir, runtime.GOOS)
outDir := filepath.Join(buildDir, fmt.Sprintf("%s-%s", runtime.GOOS, runtime.GOARCH), "lifecycle")
h.AssertNil(t, os.MkdirAll(outDir, 0755))
h.MakeAndCopyLifecycle(t,
runtime.GOOS,
runtime.GOARCH,
outDir,
"LIFECYCLE_VERSION=some-version",
"SCM_COMMIT="+expectedCommit,
)
spec.Run(t, "acceptance", testVersion, spec.Parallel(), spec.Report(report.Terminal{}))
}
type testCase struct {
description string
focus bool
command string
args []string
}
func testVersion(t *testing.T, when spec.G, it spec.S) {
when("All", func() {
when("CNB_PLATFORM_API is set and incompatible", func() {
for _, binary := range []string{
"analyzer",
"builder",
"detector",
"exporter",
"restorer",
"rebaser",
"lifecycle",
} {
binary := binary
it(binary+"/should fail with error message and exit code 11", func() {
cmd := lifecycleCmd(binary)
cmd.Env = append(os.Environ(), "CNB_PLATFORM_API=0.8")
_, exitCode, err := h.RunE(cmd)
h.AssertError(t, err, "the Lifecycle's Platform API version is 0.9 which is incompatible with Platform API version 0.8")
h.AssertEq(t, exitCode, 11)
})
}
})
when("version flag is set", func() {
for _, tc := range []testCase{
{
@ -138,14 +134,19 @@ func testVersion(t *testing.T, when spec.G, it spec.S) {
},
} {
tc := tc
when(tc.description, func() {
w := when
if tc.focus {
w = when.Focus
}
w(tc.description, func() {
it("only prints the version", func() {
cmd := lifecycleCmd(tc.command, tc.args...)
cmd.Env = []string{fmt.Sprintf("CNB_PLATFORM_API=%s", api.Platform.Latest().String())}
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
h.AssertStringContains(t, string(output), "some-version+asdf123")
h.AssertStringContains(t, string(output), expectedVersion+"+"+expectedCommit)
})
})
}
@ -153,27 +154,6 @@ func testVersion(t *testing.T, when spec.G, it spec.S) {
})
}
func lifecycleCmd(binary string, args ...string) *exec.Cmd {
return exec.Command(filepath.Join(buildDir, runtime.GOOS, "lifecycle", binary), args...)
}
func buildBinaries(t *testing.T, dir string, goos string) {
cmd := exec.Command("make", "build-"+runtime.GOOS)
wd, err := os.Getwd()
h.AssertNil(t, err)
cmd.Dir = filepath.Join(wd, "..")
cmd.Env = append(
os.Environ(),
"GOOS="+goos,
"PWD="+cmd.Dir,
"BUILD_DIR="+dir,
"PLATFORM_API=0.9",
"LIFECYCLE_VERSION=some-version",
"SCM_COMMIT=asdf123",
)
t.Log("Building binaries: ", cmd.Args)
if output, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
func lifecycleCmd(phase string, args ...string) *exec.Cmd {
return exec.Command(filepath.Join(buildDir, fmt.Sprintf("%s-%s", runtime.GOOS, runtime.GOARCH), "lifecycle", phase), args...) // #nosec G204
}

541
acceptance/analyzer_test.go Normal file
View File

@ -0,0 +1,541 @@
package acceptance
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
"github.com/buildpacks/lifecycle/cmd"
"github.com/buildpacks/lifecycle/internal/path"
"github.com/buildpacks/lifecycle/platform/files"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var (
analyzeImage string
analyzeRegAuthConfig string
analyzeRegNetwork string
analyzerPath string
analyzeDaemonFixtures *daemonImageFixtures
analyzeRegFixtures *regImageFixtures
analyzeTest *PhaseTest
)
func TestAnalyzer(t *testing.T) {
testImageDockerContext := filepath.Join("testdata", "analyzer")
analyzeTest = NewPhaseTest(t, "analyzer", testImageDockerContext)
analyzeTest.Start(t)
defer analyzeTest.Stop(t)
analyzeImage = analyzeTest.testImageRef
analyzerPath = analyzeTest.containerBinaryPath
analyzeRegAuthConfig = analyzeTest.targetRegistry.authConfig
analyzeRegNetwork = analyzeTest.targetRegistry.network
analyzeDaemonFixtures = analyzeTest.targetDaemon.fixtures
analyzeRegFixtures = analyzeTest.targetRegistry.fixtures
for _, platformAPI := range api.Platform.Supported {
spec.Run(t, "acceptance-analyzer/"+platformAPI.String(), testAnalyzerFunc(platformAPI.String()), spec.Parallel(), spec.Report(report.Terminal{}))
}
}
func testAnalyzerFunc(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
var copyDir, containerName, cacheVolume string
it.Before(func() {
containerName = "test-container-" + h.RandString(10)
var err error
copyDir, err = os.MkdirTemp("", "test-docker-copy-")
h.AssertNil(t, err)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
if h.DockerVolumeExists(t, cacheVolume) {
h.DockerVolumeRemove(t, cacheVolume)
}
os.RemoveAll(copyDir)
})
when("CNB_PLATFORM_API not provided", func() {
it("errors", func() {
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API= ",
analyzeImage,
ctrPath(analyzerPath),
"some-image",
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "please set 'CNB_PLATFORM_API'"
h.AssertStringContains(t, string(output), expected)
})
})
when("called without an app image", func() {
it("errors", func() {
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
analyzeImage,
ctrPath(analyzerPath),
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to parse arguments: received 0 arguments, but expected 1"
h.AssertStringContains(t, string(output), expected)
})
})
when("called with skip layers", func() {
it("writes analyzed.toml and does not restore previous image SBOM", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.9"), "Platform API < 0.9 does not accept a -skip-layers flag")
output := h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
analyzeImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
)...),
h.WithArgs(
ctrPath(analyzerPath),
"-daemon",
"-run-image", analyzeRegFixtures.ReadOnlyRunImage,
"-skip-layers",
analyzeDaemonFixtures.AppImage,
),
)
assertAnalyzedMetadata(t, filepath.Join(copyDir, "layers", "analyzed.toml"))
h.AssertStringDoesNotContain(t, output, "Restoring data for SBOM from previous image")
})
})
when("the provided layers directory isn't writeable", func() {
it("recursively chowns the directory", func() {
analyzeFlags := []string{"-run-image", analyzeRegFixtures.ReadOnlyRunImage}
output := h.DockerRun(t,
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
),
h.WithBash(
fmt.Sprintf("chown -R 9999:9999 /layers; chmod -R 775 /layers; %s %s %s; ls -al /layers",
analyzerPath,
flatPrint(analyzeFlags),
analyzeRegFixtures.SomeAppImage),
),
)
h.AssertMatch(t, output, "2222 3333 .+ \\.")
h.AssertMatch(t, output, "2222 3333 .+ group.toml")
})
})
when("called with analyzed", func() {
it("uses the provided analyzed.toml path", func() {
analyzeFlags := []string{
"-analyzed", ctrPath("/some-dir/some-analyzed.toml"),
"-run-image", analyzeRegFixtures.ReadOnlyRunImage,
}
var execArgs []string
execArgs = append([]string{ctrPath(analyzerPath)}, analyzeFlags...)
execArgs = append(execArgs, analyzeRegFixtures.SomeAppImage)
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/some-dir/some-analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
),
h.WithArgs(execArgs...),
)
assertAnalyzedMetadata(t, filepath.Join(copyDir, "some-analyzed.toml"))
})
})
when("called with run", func() {
it("uses the provided run.toml path", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept -run")
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
analyzeImage,
ctrPath(analyzerPath),
"-run", "/cnb/run.toml",
analyzeRegFixtures.SomeAppImage,
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to find accessible run image"
h.AssertStringContains(t, string(output), expected)
})
})
it("drops privileges", func() {
analyzeArgs := []string{
"-analyzed", "/some-dir/some-analyzed.toml",
"-run-image", analyzeRegFixtures.ReadOnlyRunImage,
}
output := h.DockerRun(t,
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
),
h.WithBash(
fmt.Sprintf("%s %s %s; ls -al /some-dir",
ctrPath(analyzerPath),
flatPrint(analyzeArgs),
analyzeRegFixtures.SomeAppImage,
),
),
)
h.AssertMatch(t, output, "2222 3333 .+ some-analyzed.toml")
})
when("run image", func() {
when("provided", func() {
it("is recorded in analyzed.toml", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
),
h.WithArgs(ctrPath(analyzerPath), "-run-image", analyzeRegFixtures.ReadOnlyRunImage, analyzeRegFixtures.SomeAppImage),
)
analyzedMD := assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
h.AssertStringContains(t, analyzedMD.RunImage.Reference, analyzeRegFixtures.ReadOnlyRunImage+"@sha256:")
})
})
when("not provided", func() {
it("falls back to CNB_RUN_IMAGE", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--env", "CNB_RUN_IMAGE="+analyzeRegFixtures.ReadOnlyRunImage,
"--network", analyzeRegNetwork,
),
h.WithArgs(ctrPath(analyzerPath), analyzeRegFixtures.SomeAppImage),
)
analyzedMD := assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
h.AssertStringContains(t, analyzedMD.RunImage.Reference, analyzeRegFixtures.ReadOnlyRunImage+"@sha256:")
})
})
})
when("daemon case", func() {
it("writes analyzed.toml", func() {
analyzeFlags := []string{
"-daemon",
"-run-image", "some-run-image",
}
var execArgs []string
execArgs = append([]string{ctrPath(analyzerPath)}, analyzeFlags...)
execArgs = append(execArgs, analyzeRegFixtures.ReadOnlyAppImage)
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
)...),
h.WithArgs(execArgs...),
)
assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
})
when("app image exists", func() {
it("does not restore app metadata to the layers directory", func() {
analyzeFlags := []string{"-daemon", "-run-image", "some-run-image"}
var execArgs []string
execArgs = append([]string{ctrPath(analyzerPath)}, analyzeFlags...)
execArgs = append(execArgs, analyzeDaemonFixtures.AppImage)
output := h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
analyzeImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
)...),
h.WithArgs(execArgs...),
)
assertNoRestoreOfAppMetadata(t, copyDir, output)
})
})
})
when("registry case", func() {
it("writes analyzed.toml", func() {
analyzeFlags := []string{"-run-image", analyzeRegFixtures.ReadOnlyRunImage}
var execArgs []string
execArgs = append([]string{ctrPath(analyzerPath)}, analyzeFlags...)
execArgs = append(execArgs, analyzeRegFixtures.SomeAppImage)
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
),
h.WithArgs(execArgs...),
)
assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
})
when("called with previous image", func() {
when("auth registry", func() {
when("the destination image does not exist", func() {
it("writes analyzed.toml with previous image identifier", func() {
analyzeFlags := []string{
"-previous-image", analyzeRegFixtures.ReadWriteAppImage,
"-run-image", analyzeRegFixtures.ReadOnlyRunImage,
}
var execArgs []string
execArgs = append([]string{ctrPath(analyzerPath)}, analyzeFlags...)
execArgs = append(execArgs, analyzeRegFixtures.ReadWriteOtherAppImage)
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
),
h.WithArgs(execArgs...),
)
analyzedMD := assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
h.AssertStringContains(t, analyzedMD.PreviousImageRef(), analyzeRegFixtures.ReadWriteAppImage)
})
})
when("the destination image exists", func() {
it("writes analyzed.toml with previous image identifier", func() {
analyzeFlags := []string{
"-previous-image", analyzeRegFixtures.ReadWriteAppImage,
"-run-image", analyzeRegFixtures.ReadOnlyRunImage,
}
var execArgs []string
execArgs = append([]string{ctrPath(analyzerPath)}, analyzeFlags...)
execArgs = append(execArgs, analyzeRegFixtures.ReadWriteOtherAppImage)
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--network", analyzeRegNetwork,
),
h.WithArgs(execArgs...),
)
analyzedMD := assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
h.AssertStringContains(t, analyzedMD.PreviousImageRef(), analyzeRegFixtures.ReadWriteAppImage)
})
})
})
})
when("called with tag", func() {
when("read/write access to registry", func() {
it("passes read/write validation and writes analyzed.toml", func() {
execArgs := []string{
ctrPath(analyzerPath),
"-tag", analyzeRegFixtures.ReadWriteOtherAppImage,
analyzeRegFixtures.ReadWriteAppImage,
}
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+analyzeRegAuthConfig,
"--env", "CNB_RUN_IMAGE="+analyzeRegFixtures.ReadOnlyRunImage,
"--network", analyzeRegNetwork,
),
h.WithArgs(execArgs...),
)
analyzedMD := assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
h.AssertStringContains(t, analyzedMD.PreviousImageRef(), analyzeRegFixtures.ReadWriteAppImage)
})
})
when("no read/write access to registry", func() {
it("throws read/write error accessing destination tag", func() {
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_RUN_IMAGE="+analyzeRegFixtures.ReadOnlyRunImage,
"--name", containerName,
"--network", analyzeRegNetwork,
analyzeImage,
ctrPath(analyzerPath),
"-tag", analyzeRegFixtures.InaccessibleImage,
analyzeRegFixtures.ReadWriteAppImage,
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "ensure registry read/write access to " + analyzeRegFixtures.InaccessibleImage
h.AssertStringContains(t, string(output), expected)
})
})
})
})
when("layout case", func() {
layoutDir := filepath.Join(path.RootDir, "layout-repo")
when("experimental mode is enabled", func() {
it("writes analyzed.toml", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept a -layout flag")
analyzeFlags := []string{
"-layout",
"-layout-dir", layoutDir,
"-run-image", "busybox",
}
var execArgs []string
execArgs = append([]string{ctrPath(analyzerPath)}, analyzeFlags...)
execArgs = append(execArgs, "my-app")
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers/analyzed.toml"),
analyzeImage,
h.WithFlags(
"--env", "CNB_EXPERIMENTAL_MODE=warn",
"--env", "CNB_PLATFORM_API="+platformAPI,
),
h.WithArgs(execArgs...),
)
analyzer := assertAnalyzedMetadata(t, filepath.Join(copyDir, "analyzed.toml"))
h.AssertNotNil(t, analyzer.RunImage)
analyzedImagePath := filepath.Join(path.RootDir, "layout-repo", "index.docker.io", "library", "busybox", "latest")
reference := fmt.Sprintf("%s@%s", analyzedImagePath, "sha256:f75f3d1a317fc82c793d567de94fc8df2bece37acd5f2bd364a0d91a0d1f3dab")
h.AssertEq(t, analyzer.RunImage.Reference, reference)
})
})
when("experimental mode is not enabled", func() {
it("errors", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept a -layout flag")
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_LAYOUT_DIR="+layoutDir,
analyzeImage,
ctrPath(analyzerPath),
"-layout",
"-run-image", "busybox",
"some-image",
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "experimental features are disabled by CNB_EXPERIMENTAL_MODE=error"
h.AssertStringContains(t, string(output), expected)
})
})
})
}
}
func assertAnalyzedMetadata(t *testing.T, path string) *files.Analyzed {
contents, err := os.ReadFile(path)
h.AssertNil(t, err)
h.AssertEq(t, len(contents) > 0, true)
analyzedMD, err := files.Handler.ReadAnalyzed(path, cmd.DefaultLogger)
h.AssertNil(t, err)
return &analyzedMD
}
func assertNoRestoreOfAppMetadata(t *testing.T, dir, output string) {
layerFilenames := []string{
"launch-build-cache-layer.sha",
"launch-build-cache-layer.toml",
"launch-cache-layer.sha",
"launch-cache-layer.toml",
"launch-layer.sha",
"launch-layer.toml",
"store.toml",
}
for _, filename := range layerFilenames {
h.AssertPathDoesNotExist(t, filepath.Join(dir, "layers", "some-buildpack-id", filename))
}
}
func flatPrint(arr []string) string {
return strings.Join(arr, " ")
}

535
acceptance/builder_test.go Normal file
View File

@ -0,0 +1,535 @@
package acceptance
import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
"github.com/buildpacks/lifecycle/platform/files"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var (
builderDockerContext = filepath.Join("testdata", "builder")
builderBinaryDir = filepath.Join("testdata", "builder", "container", "cnb", "lifecycle")
builderImage = "lifecycle/acceptance/builder"
builderDaemonOS, builderDaemonArch string
)
func TestBuilder(t *testing.T) {
info, err := h.DockerCli(t).Info(context.TODO())
h.AssertNil(t, err)
// These variables are clones of the variables in analyzer_test.go.
// You can find the same variables there without `builder` prefix.
// These lines are added for supporting windows tests.
builderDaemonOS = info.OSType
builderDaemonArch = info.Architecture
if builderDaemonArch == "x86_64" {
builderDaemonArch = "amd64"
} else if builderDaemonArch == "aarch64" {
builderDaemonArch = "arm64"
}
h.MakeAndCopyLifecycle(t, builderDaemonOS, builderDaemonArch, builderBinaryDir)
h.DockerBuild(t,
builderImage,
builderDockerContext,
h.WithArgs("--build-arg", fmt.Sprintf("cnb_platform_api=%s", api.Platform.Latest())),
h.WithFlags(
"-f", filepath.Join(builderDockerContext, dockerfileName),
),
)
defer h.DockerImageRemove(t, builderImage)
spec.Run(t, "acceptance-builder", testBuilder, spec.Parallel(), spec.Report(report.Terminal{}))
}
func testBuilder(t *testing.T, when spec.G, it spec.S) {
var copyDir, containerName, cacheVolume string
it.Before(func() {
containerName = "test-container-" + h.RandString(10)
var err error
copyDir, err = os.MkdirTemp("", "test-docker-copy-")
h.AssertNil(t, err)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
if h.DockerVolumeExists(t, cacheVolume) {
h.DockerVolumeRemove(t, cacheVolume)
}
os.RemoveAll(copyDir)
})
// .../cmd/lifecycle/builder.go#Args
when("called with arguments", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
builderImage,
"some-arg",
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to parse arguments: received unexpected arguments"
h.AssertStringContains(t, string(output), expected)
})
})
// .../cmd/lifecycle/builder.go#Privileges
when("running as a root", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--user",
"root",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to build: refusing to run as root"
h.AssertStringContains(t, string(output), expected)
})
})
when("correct and full group.toml and plan.toml", func() {
it("succeeds", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
),
)
// check builder metadata.toml for success test
_, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers", "config", "metadata.toml"))
h.AssertStringContains(t, md.Buildpacks[0].API, "0.10")
h.AssertStringContains(t, md.Buildpacks[0].ID, "hello_world")
h.AssertStringContains(t, md.Buildpacks[0].Version, "0.0.1")
})
})
when("writing metadata.toml", func() {
it("writes and reads successfully", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
),
)
// check builder metadata.toml for success test
contents, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers", "config", "metadata.toml"))
// prevent regression of inline table serialization
h.AssertStringDoesNotContain(t, contents, "processes =")
h.AssertStringContains(t, md.Buildpacks[0].API, "0.10")
h.AssertStringContains(t, md.Buildpacks[0].ID, "hello_world")
h.AssertStringContains(t, md.Buildpacks[0].Version, "0.0.1")
h.AssertEq(t, len(md.Processes), 1)
h.AssertEq(t, md.Processes[0].Type, "hello")
h.AssertEq(t, len(md.Processes[0].Command.Entries), 1)
h.AssertEq(t, md.Processes[0].Command.Entries[0], "echo world")
h.AssertEq(t, len(md.Processes[0].Args), 1)
h.AssertEq(t, md.Processes[0].Args[0], "arg1")
h.AssertEq(t, md.Processes[0].Direct, true)
h.AssertEq(t, md.Processes[0].WorkingDirectory, "")
h.AssertEq(t, md.Processes[0].Default, false)
})
when("the platform < 0.10", func() {
it("writes and reads successfully", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API=0.9",
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
),
)
// check builder metadata.toml for success test
contents, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers", "config", "metadata.toml"))
// prevent regression of inline table serialization
h.AssertStringDoesNotContain(t, contents, "processes =")
h.AssertStringContains(t, md.Buildpacks[0].API, "0.10")
h.AssertStringContains(t, md.Buildpacks[0].ID, "hello_world")
h.AssertStringContains(t, md.Buildpacks[0].Version, "0.0.1")
h.AssertEq(t, len(md.Processes), 1)
h.AssertEq(t, md.Processes[0].Type, "hello")
h.AssertEq(t, len(md.Processes[0].Command.Entries), 1)
h.AssertEq(t, md.Processes[0].Command.Entries[0], "echo world")
h.AssertEq(t, len(md.Processes[0].Args), 1)
h.AssertEq(t, md.Processes[0].Args[0], "arg1")
h.AssertEq(t, md.Processes[0].Direct, true)
h.AssertEq(t, md.Processes[0].WorkingDirectory, "")
h.AssertEq(t, md.Processes[0].Default, false)
})
})
})
when("-group contains extensions", func() {
it("includes the provided extensions in <layers>/config/metadata.toml", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/group_with_ext.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
),
)
// check builder metadata.toml for success test
_, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers", "config", "metadata.toml"))
h.AssertStringContains(t, md.Buildpacks[0].API, "0.10")
h.AssertStringContains(t, md.Buildpacks[0].ID, "hello_world")
h.AssertStringContains(t, md.Buildpacks[0].Version, "0.0.1")
h.AssertStringContains(t, md.Extensions[0].API, "0.10")
h.AssertStringContains(t, md.Extensions[0].ID, "hello_world")
h.AssertStringContains(t, md.Extensions[0].Version, "0.0.1")
})
})
when("invalid input files", func() {
// .../cmd/lifecycle/builder.go#readData
when("group.toml", func() {
when("not found", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to read group file: open /layers/group.toml: no such file or directory"
h.AssertStringContains(t, string(output), expected)
})
})
when("empty", func() {
it("succeeds", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/empty_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
),
)
// check builder metadata.toml for success test
_, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers", "config", "metadata.toml"))
h.AssertEq(t, len(md.Processes), 0)
})
})
when("invalid", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/wrong_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to read group file: toml: line 1: expected '.' or '=', but got 'a' instead"
h.AssertStringContains(t, string(output), expected)
})
})
// .../cmd/lifecycle/builder.go#Exec
when("invalid builpack api", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/invalid_buildpack_api_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "parse buildpack API '<nil>' for buildpack 'hello_world@0.0.1'"
h.AssertStringContains(t, string(output), expected)
})
})
})
// .../cmd/lifecycle/builder.go#readData
when("plan.toml", func() {
when("not found", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to read plan file: open /layers/plan.toml: no such file or directory"
h.AssertStringContains(t, string(output), expected)
})
})
when("empty", func() {
it("succeeds", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/empty_plan.toml",
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
),
)
// check builder metadata.toml for success test
_, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers", "config", "metadata.toml"))
h.AssertStringContains(t, md.Buildpacks[0].API, "0.10")
h.AssertStringContains(t, md.Buildpacks[0].ID, "hello_world")
h.AssertStringContains(t, md.Buildpacks[0].Version, "0.0.1")
})
})
when("invalid", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/wrong_plan.toml",
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to read plan file: toml: line 1: expected '.' or '=', but got 'a' instead"
h.AssertStringContains(t, string(output), expected)
})
})
})
})
when("determining the location of input files", func() {
// .../cmd/lifecycle/builder.go#Args
when("group.toml path is not specified", func() {
it("will look for group.toml in the provided layers directory", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_LAYERS_DIR=/layers/different_layer_dir_from_env",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan_buildpack_2.toml",
),
)
_, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers/different_layer_dir_from_env/config/metadata.toml"))
h.AssertStringContains(t, md.Buildpacks[0].API, "0.10")
h.AssertStringContains(t, md.Buildpacks[0].ID, "hello_world_2")
h.AssertStringContains(t, md.Buildpacks[0].Version, "0.0.2")
})
})
// .../cmd/lifecycle/builder.go#Args
when("plan.toml path is not specified", func() {
it("will look for plan.toml in the provided layers directory", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
builderImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_LAYERS_DIR=/layers/different_layer_dir_from_env",
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group_buildpack2.toml",
),
)
_, md := getBuilderMetadata(t, filepath.Join(copyDir, "layers/different_layer_dir_from_env/config/metadata.toml"))
h.AssertStringContains(t, md.Buildpacks[0].API, "0.10")
h.AssertStringContains(t, md.Buildpacks[0].ID, "hello_world_2")
h.AssertStringContains(t, md.Buildpacks[0].Version, "0.0.2")
})
})
})
when("CNB_APP_DIR is set", func() {
it("sets the buildpacks' working directory to CNB_APP_DIR", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
"--env", "CNB_APP_DIR=/env_folders/different_cnb_app_dir_from_env",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNil(t, err)
expected := "CNB_APP_DIR: /env_folders/different_cnb_app_dir_from_env"
h.AssertStringContains(t, string(output), expected)
})
})
when("CNB_BUILDPACKS_DIR is set", func() {
it("uses buildpacks from CNB_BUILDPACKS_DIR", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
"--env", "CNB_BUILDPACKS_DIR=/env_folders/different_buildpack_dir_from_env",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNil(t, err)
expected := "CNB_BUILDPACK_DIR: /env_folders/different_buildpack_dir_from_env"
h.AssertStringContains(t, string(output), expected)
})
})
when("CNB_LAYERS_DIR is set", func() {
it("CNB_LAYERS_DIR is a parent of the buildpack layers dir", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
"--env", "CNB_LAYERS_DIR=/layers/different_layer_dir_from_env",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNil(t, err)
expected := "LAYERS_DIR: /layers/different_layer_dir_from_env/hello_world"
h.AssertStringContains(t, string(output), expected)
})
})
when("CNB_PLAN_PATH is set", func() {
it("provides the buildpack a filtered version of the plan found at CNB_PLAN_PATH", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/different_plan_from_env.toml",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNil(t, err)
expected := "name = \"different_plan_from_env.toml_reqires_subset_content\""
h.AssertStringContains(t, string(output), expected)
})
})
when("CNB_PLATFORM_DIR is set", func() {
it("CNB_PLATFORM_DIR is successfully transmitted to build script", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_GROUP_PATH=/cnb/group_tomls/always_detect_group.toml",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan.toml",
"--env", "CNB_PLATFORM_DIR=/env_folders/different_platform_dir_from_env",
builderImage,
)
output, err := command.CombinedOutput()
h.AssertNil(t, err)
expected := "PLATFORM_DIR: /env_folders/different_platform_dir_from_env"
h.AssertStringContains(t, string(output), expected)
})
})
when("It runs", func() {
it("sets CNB_TARGET_* vars", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "CNB_LAYERS_DIR=/layers/03_layer",
"--env", "CNB_PLAN_PATH=/cnb/plan_tomls/always_detect_plan_buildpack_3.toml",
builderImage,
)
output, err := command.CombinedOutput()
fmt.Println(string(output))
h.AssertNil(t, err)
h.AssertStringContains(t, string(output), "CNB_TARGET_ARCH: amd64")
h.AssertStringContains(t, string(output), "CNB_TARGET_ARCH_VARIANT: some-variant")
h.AssertStringContains(t, string(output), "CNB_TARGET_OS: linux")
h.AssertStringContains(t, string(output), "CNB_TARGET_DISTRO_NAME: ubuntu")
h.AssertStringContains(t, string(output), "CNB_TARGET_DISTRO_VERSION: some-cute-version")
})
})
}
func getBuilderMetadata(t *testing.T, path string) (string, *files.BuildMetadata) {
t.Helper()
contents, _ := os.ReadFile(path)
h.AssertEq(t, len(contents) > 0, true)
buildMD, err := files.Handler.ReadBuildMetadata(path, api.MustParse(latestPlatformAPI))
h.AssertNil(t, err)
return string(contents), buildMD
}

445
acceptance/creator_test.go Normal file
View File

@ -0,0 +1,445 @@
//go:build acceptance
package acceptance
import (
"os"
"os/exec"
"path/filepath"
"testing"
"time"
"github.com/buildpacks/lifecycle/internal/path"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var (
createImage string
createRegAuthConfig string
createRegNetwork string
creatorPath string
createDaemonFixtures *daemonImageFixtures
createRegFixtures *regImageFixtures
createTest *PhaseTest
)
func TestCreator(t *testing.T) {
testImageDockerContext := filepath.Join("testdata", "creator")
createTest = NewPhaseTest(t, "creator", testImageDockerContext)
createTest.Start(t)
defer createTest.Stop(t)
createImage = createTest.testImageRef
creatorPath = createTest.containerBinaryPath
createRegAuthConfig = createTest.targetRegistry.authConfig
createRegNetwork = createTest.targetRegistry.network
createDaemonFixtures = createTest.targetDaemon.fixtures
createRegFixtures = createTest.targetRegistry.fixtures
for _, platformAPI := range api.Platform.Supported {
spec.Run(t, "acceptance-creator/"+platformAPI.String(), testCreatorFunc(platformAPI.String()), spec.Parallel(), spec.Report(report.Terminal{}))
}
}
func testCreatorFunc(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
var createdImageName string
when("called with run", func() {
it("uses the provided run.toml path", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept -run")
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+createRegAuthConfig,
"--network", createRegNetwork,
createImage,
ctrPath(creatorPath),
"-run", "/cnb/run.toml",
createRegFixtures.SomeAppImage,
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to resolve inputs: failed to find accessible run image"
h.AssertStringContains(t, string(output), expected)
})
})
when("detected order contains extensions", func() {
it("errors", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.10"), "")
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+createRegAuthConfig,
"--network", createRegNetwork,
createImage,
ctrPath(creatorPath),
"-log-level", "debug",
"-order", "/cnb/order-with-extensions.toml",
"-run-image", createRegFixtures.ReadOnlyRunImage,
createRegFixtures.SomeAppImage,
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "detected order contains extensions which is not supported by the creator"
h.AssertStringContains(t, string(output), expected)
})
})
when("daemon case", func() {
it.After(func() {
h.DockerImageRemove(t, createdImageName)
})
it("creates app", func() {
createFlags := []string{"-daemon"}
createFlags = append(createFlags, []string{"-run-image", createRegFixtures.ReadOnlyRunImage}...)
createArgs := append([]string{ctrPath(creatorPath)}, createFlags...)
createdImageName = "some-created-image-" + h.RandString(10)
createArgs = append(createArgs, createdImageName)
output := h.DockerRun(t,
createImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+createRegAuthConfig,
"--network", createRegNetwork,
)...),
h.WithArgs(createArgs...),
)
h.AssertStringContains(t, output, "Saving "+createdImageName)
assertImageOSAndArch(t, createdImageName, createTest)
output = h.DockerRun(t,
createdImageName,
h.WithFlags(
"--entrypoint", "/cnb/lifecycle/launcher",
),
h.WithArgs("env"),
)
h.AssertStringContains(t, output, "SOME_VAR=some-val") // set by buildpack
})
})
when("registry case", func() {
it.After(func() {
h.DockerImageRemove(t, createdImageName)
})
it("creates app", func() {
var createFlags []string
createFlags = append(createFlags, []string{"-run-image", createRegFixtures.ReadOnlyRunImage}...)
createArgs := append([]string{ctrPath(creatorPath)}, createFlags...)
createdImageName = createTest.RegRepoName("some-created-image-" + h.RandString(10))
createArgs = append(createArgs, createdImageName)
output := h.DockerRun(t,
createImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+createRegAuthConfig,
"--network", createRegNetwork,
),
h.WithArgs(createArgs...),
)
h.AssertStringContains(t, output, "Saving "+createdImageName)
h.Run(t, exec.Command("docker", "pull", createdImageName))
assertImageOSAndArch(t, createdImageName, createTest)
output = h.DockerRun(t,
createdImageName,
h.WithFlags(
"--entrypoint", "/cnb/lifecycle/launcher",
),
h.WithArgs("env"),
)
h.AssertStringContains(t, output, "SOME_VAR=some-val") // set by buildpack
})
})
when("multiple builds", func() {
var (
container1 string
container2 string
container3 string
container4 string
dirBuild1 string
dirBuild2 string
dirCache string
dirLaunchCache string
dirRun1 string
dirRun2 string
imageName string
)
it.Before(func() {
// assign container names
for _, cPtr := range []*string{&container1, &container2, &container3, &container4} {
*cPtr = "test-container-" + h.RandString(10)
}
// create temp dirs
for _, dirPtr := range []*string{&dirCache, &dirLaunchCache, &dirBuild1, &dirRun1, &dirBuild2, &dirRun2} {
dir, err := os.MkdirTemp("", "creator-acceptance")
h.AssertNil(t, err)
h.AssertNil(t, os.Chmod(dir, 0777)) // Override umask
// Resolve temp dir so it can be properly mounted by the Docker daemon.
*dirPtr, err = filepath.EvalSymlinks(dir)
h.AssertNil(t, err)
}
// assign image name
imageName = "some-created-image-" + h.RandString(10)
})
it.After(func() {
// remove containers if needed
for _, container := range []string{container1, container2, container3, container4} {
if h.DockerContainerExists(t, container) {
h.Run(t, exec.Command("docker", "rm", container))
}
}
// remove temp dirs
for _, dir := range []string{dirCache, dirLaunchCache, dirBuild1, dirRun1, dirBuild2, dirRun2} {
_ = os.RemoveAll(dir)
}
// remove image
h.DockerImageRemove(t, imageName)
})
when("multiple builds", func() {
var (
createFlags []string
createArgs []string
duration1, duration2 time.Duration
)
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.8"), "Platform API < 0.8 does not support standardized SBOM")
createFlags = []string{"-daemon"}
createFlags = append(createFlags, []string{
"-run-image", createRegFixtures.ReadOnlyRunImage,
"-cache-dir", ctrPath("/cache"),
"-launch-cache", ctrPath("/launch-cache"),
"-log-level", "debug",
}...)
createArgs = append([]string{ctrPath(creatorPath)}, createFlags...)
createArgs = append(createArgs, imageName)
startTime := time.Now()
// first build
output := h.DockerRunAndCopy(t,
container1,
dirBuild1,
ctrPath("/layers"),
createImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+createRegAuthConfig,
"--network", createRegNetwork,
"--volume", dirCache+":"+ctrPath("/cache"),
"--volume", dirLaunchCache+":"+ctrPath("/launch-cache"),
)...),
h.WithArgs(createArgs...),
)
duration1 = time.Now().Sub(startTime)
t.Logf("First build duration: %s", duration1)
h.AssertStringDoesNotContain(t, output, "restored with content")
h.AssertPathExists(t, filepath.Join(dirBuild1, "layers", "sbom", "build", "samples_hello-world", "sbom.cdx.json"))
h.AssertPathExists(t, filepath.Join(dirBuild1, "layers", "sbom", "build", "samples_hello-world", "some-build-layer", "sbom.cdx.json"))
// first run
output = h.DockerRunAndCopy(t,
container2,
dirRun1,
ctrPath("/layers"),
imageName,
h.WithFlags(
"--entrypoint", "/cnb/lifecycle/launcher",
),
h.WithArgs("env"),
)
h.AssertPathExists(t, filepath.Join(dirRun1, "layers", "sbom", "launch", "samples_hello-world", "sbom.cdx.json"))
h.AssertPathExists(t, filepath.Join(dirRun1, "layers", "sbom", "launch", "samples_hello-world", "some-launch-cache-layer", "sbom.cdx.json"))
h.AssertPathExists(t, filepath.Join(dirRun1, "layers", "sbom", "launch", "samples_hello-world", "some-layer", "sbom.cdx.json"))
h.AssertPathDoesNotExist(t, filepath.Join(dirRun1, "layers", "sbom", "build"))
h.AssertPathDoesNotExist(t, filepath.Join(dirRun1, "layers", "sbom", "cache"))
})
when("rebuild with cache", func() {
it("exports SBOM in the app image", func() {
startTime := time.Now()
// second build
output := h.DockerRunAndCopy(t,
container3,
dirBuild2,
ctrPath("/layers"),
createImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+createRegAuthConfig,
"--network", createRegNetwork,
"--volume", dirCache+":/cache",
"--volume", dirLaunchCache+":"+ctrPath("/launch-cache"),
)...),
h.WithArgs(createArgs...),
)
// check that launch cache was used
duration2 = time.Now().Sub(startTime)
t.Logf("Second build duration: %s", duration2)
if duration2+time.Duration(0.1*float64(time.Second)) >= duration1 {
t.Logf("Second build output: %s", output)
t.Fatalf("Expected second build to complete 0.1s faster than first build; first build took %s, second build took %s", duration1, duration2)
}
h.AssertStringContains(t, output, "some-layer.sbom.cdx.json restored with content: {\"key\": \"some-launch-true-bom-content\"}")
h.AssertStringContains(t, output, "some-cache-layer.sbom.cdx.json restored with content: {\"key\": \"some-cache-true-bom-content\"}")
h.AssertStringContains(t, output, "some-launch-cache-layer.sbom.cdx.json restored with content: {\"key\": \"some-launch-true-cache-true-bom-content\"}")
h.AssertStringContains(t, output, "Reusing layer 'buildpacksio/lifecycle:launch.sbom'")
h.AssertPathExists(t, filepath.Join(dirBuild2, "layers", "sbom", "build", "samples_hello-world", "sbom.cdx.json"))
h.AssertPathExists(t, filepath.Join(dirBuild2, "layers", "sbom", "build", "samples_hello-world", "some-build-layer", "sbom.cdx.json"))
t.Log("restores store.toml")
h.AssertStringContains(t, output, "store.toml restored with content: [metadata]")
// second run
output = h.DockerRunAndCopy(t,
container4,
dirRun2,
ctrPath("/layers"),
imageName,
h.WithFlags(
"--entrypoint", "/cnb/lifecycle/launcher",
),
h.WithArgs("env"),
)
h.AssertPathExists(t, filepath.Join(dirRun1, "layers", "sbom", "launch", "samples_hello-world", "sbom.cdx.json"))
h.AssertPathExists(t, filepath.Join(dirRun1, "layers", "sbom", "launch", "samples_hello-world", "some-launch-cache-layer", "sbom.cdx.json"))
h.AssertPathExists(t, filepath.Join(dirRun1, "layers", "sbom", "launch", "samples_hello-world", "some-layer", "sbom.cdx.json"))
h.AssertPathDoesNotExist(t, filepath.Join(dirRun1, "layers", "sbom", "build"))
h.AssertPathDoesNotExist(t, filepath.Join(dirRun1, "layers", "sbom", "cache"))
})
})
when("rebuild with clear cache", func() {
it("exports SBOM in the app image", func() {
createArgs = append([]string{ctrPath(creatorPath)}, append(createFlags, "-skip-restore")...)
createArgs = append(createArgs, imageName)
// second build
output := h.DockerRunAndCopy(t,
container3,
dirBuild2,
ctrPath("/layers"),
createImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+createRegAuthConfig,
"--network", createRegNetwork,
"--volume", dirCache+":/cache",
"--volume", dirLaunchCache+":"+ctrPath("/launch-cache"),
)...),
h.WithArgs(createArgs...),
)
h.AssertStringDoesNotContain(t, output, "some-layer.sbom.cdx.json restored with content: {\"key\": \"some-launch-true-bom-content\"}")
h.AssertStringDoesNotContain(t, output, "some-cache-layer.sbom.cdx.json restored with content: {\"key\": \"some-cache-true-bom-content\"}")
h.AssertStringDoesNotContain(t, output, "some-launch-cache-layer.sbom.cdx.json restored with content: {\"key\": \"some-launch-true-cache-true-bom-content\"}")
// check that store.toml was restored
if api.MustParse(platformAPI).AtLeast("0.10") {
h.AssertStringContains(t, output, "store.toml restored with content: [metadata]")
} else {
h.AssertStringDoesNotContain(t, output, "store.toml restored with content")
}
})
})
})
})
when("layout case", func() {
var (
containerName string
err error
layoutDir string
tmpDir string
)
when("experimental mode is enabled", func() {
it.Before(func() {
// creates the directory to save all the OCI images on disk
tmpDir, err = os.MkdirTemp("", "layout")
h.AssertNil(t, err)
containerName = "test-container-" + h.RandString(10)
layoutDir = filepath.Join(path.RootDir, "layout-repo")
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
h.DockerImageRemove(t, createdImageName)
// removes all images created
os.RemoveAll(tmpDir)
})
it("creates app", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept a -layout flag")
var createFlags []string
createFlags = append(createFlags, []string{"-layout", "-layout-dir", layoutDir, "-run-image", "busybox"}...)
createArgs := append([]string{ctrPath(creatorPath)}, createFlags...)
createdImageName = "some-created-image-" + h.RandString(10)
createArgs = append(createArgs, createdImageName)
output := h.DockerRunAndCopy(t, containerName, tmpDir, layoutDir, createImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_EXPERIMENTAL_MODE=warn",
),
h.WithArgs(createArgs...))
h.AssertStringContains(t, output, "Saving /layout-repo/index.docker.io/library/"+createdImageName+"/latest")
index := h.ReadIndexManifest(t, filepath.Join(tmpDir, layoutDir, "index.docker.io", "library", createdImageName+"/latest"))
h.AssertEq(t, len(index.Manifests), 1)
})
})
when("experimental mode is not enabled", func() {
it("errors", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept a -layout flag")
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
createImage,
ctrPath(creatorPath),
"-layout",
"-layout-dir", layoutDir,
"-run-image", "busybox",
"some-image",
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "experimental features are disabled by CNB_EXPERIMENTAL_MODE=error"
h.AssertStringContains(t, string(output), expected)
})
})
})
}
}

422
acceptance/detector_test.go Normal file
View File

@ -0,0 +1,422 @@
//go:build acceptance
package acceptance
import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
"github.com/buildpacks/lifecycle/cmd"
"github.com/buildpacks/lifecycle/platform/files"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var (
detectDockerContext = filepath.Join("testdata", "detector")
detectorBinaryDir = filepath.Join("testdata", "detector", "container", "cnb", "lifecycle")
detectImage = "lifecycle/acceptance/detector"
userID = "1234"
detectorDaemonOS, detectorDaemonArch string
)
func TestDetector(t *testing.T) {
info, err := h.DockerCli(t).Info(context.TODO())
h.AssertNil(t, err)
detectorDaemonOS = info.OSType
detectorDaemonArch = info.Architecture
if detectorDaemonArch == "x86_64" {
detectorDaemonArch = "amd64"
}
if detectorDaemonArch == "aarch64" {
detectorDaemonArch = "arm64"
}
h.MakeAndCopyLifecycle(t, detectorDaemonOS, detectorDaemonArch, detectorBinaryDir)
h.DockerBuild(t,
detectImage,
detectDockerContext,
h.WithArgs("--build-arg", fmt.Sprintf("cnb_platform_api=%s", api.Platform.Latest())),
)
defer h.DockerImageRemove(t, detectImage)
for _, platformAPI := range api.Platform.Supported {
if platformAPI.LessThan("0.12") {
continue
}
spec.Run(t, "acceptance-detector/"+platformAPI.String(), testDetectorFunc(platformAPI.String()), spec.Parallel(), spec.Report(report.Terminal{}))
}
}
func testDetectorFunc(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
when("called with arguments", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
detectImage,
"some-arg",
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to parse arguments: received unexpected arguments"
h.AssertStringContains(t, string(output), expected)
})
})
when("running as a root", func() {
it("errors", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--user",
"root",
"--env", "CNB_PLATFORM_API="+platformAPI,
detectImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to detect: refusing to run as root"
h.AssertStringContains(t, string(output), expected)
})
})
when("read buildpack order file failed", func() {
it("errors", func() {
// no order.toml file in the default search locations
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
detectImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to initialize detector: reading order"
h.AssertStringContains(t, string(output), expected)
})
})
when("no buildpack group passed detection", func() {
it("errors and exits with the expected code", func() {
command := exec.Command(
"docker",
"run",
"--rm",
"--env", "CNB_ORDER_PATH=/cnb/orders/fail_detect_order.toml",
"--env", "CNB_PLATFORM_API="+platformAPI,
detectImage,
)
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
failErr, ok := err.(*exec.ExitError)
if !ok {
t.Fatalf("expected an error of type exec.ExitError")
}
h.AssertEq(t, failErr.ExitCode(), 20) // platform code for failed detect
expected1 := `======== Output: fail_detect_buildpack@some_version ========
Opted out of detection
======== Results ========
fail: fail_detect_buildpack@some_version`
h.AssertStringContains(t, string(output), expected1)
expected2 := "No buildpack groups passed detection."
h.AssertStringContains(t, string(output), expected2)
})
})
when("there is a buildpack group that passes detection", func() {
var copyDir, containerName string
it.Before(func() {
containerName = "test-container-" + h.RandString(10)
var err error
copyDir, err = os.MkdirTemp("", "test-docker-copy-")
h.AssertNil(t, err)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
os.RemoveAll(copyDir)
})
it("writes group.toml and plan.toml at the default locations", func() {
output := h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
detectImage,
h.WithFlags("--user", userID,
"--env", "CNB_ORDER_PATH=/cnb/orders/simple_order.toml",
"--env", "CNB_PLATFORM_API="+platformAPI,
),
h.WithArgs(),
)
// check group.toml
foundGroupTOML := filepath.Join(copyDir, "layers", "group.toml")
group, err := files.Handler.ReadGroup(foundGroupTOML)
h.AssertNil(t, err)
h.AssertEq(t, group.Group[0].ID, "simple_buildpack")
h.AssertEq(t, group.Group[0].Version, "simple_buildpack_version")
// check plan.toml
foundPlanTOML := filepath.Join(copyDir, "layers", "plan.toml")
buildPlan, err := files.Handler.ReadPlan(foundPlanTOML)
h.AssertNil(t, err)
h.AssertEq(t, buildPlan.Entries[0].Providers[0].ID, "simple_buildpack")
h.AssertEq(t, buildPlan.Entries[0].Providers[0].Version, "simple_buildpack_version")
h.AssertEq(t, buildPlan.Entries[0].Requires[0].Name, "some_requirement")
h.AssertEq(t, buildPlan.Entries[0].Requires[0].Metadata["some_metadata_key"], "some_metadata_val")
h.AssertEq(t, buildPlan.Entries[0].Requires[0].Metadata["version"], "some_version")
// check output
h.AssertStringContains(t, output, "simple_buildpack simple_buildpack_version")
h.AssertStringDoesNotContain(t, output, "======== Results ========") // log output is info level as detect passed
})
})
when("environment variables are provided for buildpack and app directories and for the output files", func() {
var copyDir, containerName string
it.Before(func() {
containerName = "test-container-" + h.RandString(10)
var err error
copyDir, err = os.MkdirTemp("", "test-docker-copy-")
h.AssertNil(t, err)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
os.RemoveAll(copyDir)
})
it("writes group.toml and plan.toml in the right locations and with the right names", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
detectImage,
h.WithFlags("--user", userID,
"--env", "CNB_ORDER_PATH=/cnb/orders/always_detect_order.toml",
"--env", "CNB_BUILDPACKS_DIR=/cnb/custom_buildpacks",
"--env", "CNB_APP_DIR=/custom_workspace",
"--env", "CNB_GROUP_PATH=./custom_group.toml",
"--env", "CNB_PLAN_PATH=./custom_plan.toml",
"--env", "CNB_PLATFORM_DIR=/custom_platform",
"--env", "CNB_PLATFORM_API="+platformAPI,
),
h.WithArgs("-log-level=debug"),
)
// check group.toml
foundGroupTOML := filepath.Join(copyDir, "layers", "custom_group.toml")
group, err := files.Handler.ReadGroup(foundGroupTOML)
h.AssertNil(t, err)
h.AssertEq(t, group.Group[0].ID, "always_detect_buildpack")
h.AssertEq(t, group.Group[0].Version, "always_detect_buildpack_version")
// check plan.toml - should be empty since we're using always_detect_order.toml so there is no "actual plan"
tempPlanToml := filepath.Join(copyDir, "layers", "custom_plan.toml")
planContents, err := os.ReadFile(tempPlanToml)
h.AssertNil(t, err)
h.AssertEq(t, len(planContents) == 0, true)
// check platform directory
logs := h.Run(t, exec.Command("docker", "logs", containerName))
expectedPlatformPath := "platform_path: /custom_platform"
expectedAppDir := "app_dir: /custom_workspace"
h.AssertStringContains(t, logs, expectedPlatformPath)
h.AssertStringContains(t, logs, expectedAppDir)
})
})
when("-order is provided", func() {
var copyDir, containerName, expectedOrderTOMLPath string
it.Before(func() {
containerName = "test-container-" + h.RandString(10)
var err error
copyDir, err = os.MkdirTemp("", "test-docker-copy-")
h.AssertNil(t, err)
simpleOrderTOML := filepath.Join("testdata", "detector", "container", "cnb", "orders", "simple_order.toml")
expectedOrderTOMLPath, err = filepath.Abs(simpleOrderTOML)
h.AssertNil(t, err)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
os.RemoveAll(copyDir)
})
when("the order.toml exists", func() {
it("processes the provided order.toml", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
detectImage,
h.WithFlags("--user", userID,
"--volume", expectedOrderTOMLPath+":/custom/order.toml",
"--env", "CNB_PLATFORM_API="+platformAPI,
),
h.WithArgs(
"-log-level=debug",
"-order=/custom/order.toml",
),
)
// check group.toml
foundGroupTOML := filepath.Join(copyDir, "layers", "group.toml")
group, err := files.Handler.ReadGroup(foundGroupTOML)
h.AssertNil(t, err)
h.AssertEq(t, group.Group[0].ID, "simple_buildpack")
h.AssertEq(t, group.Group[0].Version, "simple_buildpack_version")
})
})
when("the order.toml does not exist", func() {
it("errors", func() {
command := exec.Command("docker", "run",
"--user", userID,
"--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
detectImage,
"-order=/custom/order.toml")
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to initialize detector: reading order: failed to read order file: open /custom/order.toml: no such file or directory"
h.AssertStringContains(t, string(output), expected)
})
})
when("the order.toml contains a buildpack using an unsupported api", func() {
it("errors", func() {
command := exec.Command("docker", "run",
"--user", userID,
"--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
detectImage,
"-order=/cnb/orders/bad_api.toml")
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
failErr, ok := err.(*exec.ExitError)
if !ok {
t.Fatalf("expected an error of type exec.ExitError")
}
h.AssertEq(t, failErr.ExitCode(), 12) // platform code for buildpack api error
expected := "buildpack API version '0.1' is incompatible with the lifecycle"
h.AssertStringContains(t, string(output), expected)
})
})
})
when("-order contains extensions", func() {
var containerName, copyDir, orderPath string
it.Before(func() {
containerName = "test-container-" + h.RandString(10)
var err error
copyDir, err = os.MkdirTemp("", "test-docker-copy-")
h.AssertNil(t, err)
orderPath, err = filepath.Abs(filepath.Join("testdata", "detector", "container", "cnb", "orders", "order_with_ext.toml"))
h.AssertNil(t, err)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
os.RemoveAll(copyDir)
})
it("processes the provided order.toml", func() {
experimentalMode := "warn"
if api.MustParse(platformAPI).AtLeast("0.13") {
experimentalMode = "error"
}
output := h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
detectImage,
h.WithFlags(
"--user", userID,
"--volume", orderPath+":/layers/order.toml",
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_EXPERIMENTAL_MODE="+experimentalMode,
),
h.WithArgs(
"-analyzed=/layers/analyzed.toml",
"-extensions=/cnb/extensions",
"-generated=/layers/generated",
"-log-level=debug",
"-run=/layers/run.toml", // /cnb/run.toml is the default location of run.toml
),
)
t.Log("runs /bin/detect for buildpacks and extensions")
if api.MustParse(platformAPI).LessThan("0.13") {
h.AssertStringContains(t, output, "Platform requested experimental feature 'Dockerfiles'")
}
h.AssertStringContains(t, output, "FOO=val-from-build-config")
h.AssertStringContains(t, output, "simple_extension: output from /bin/detect")
t.Log("writes group.toml")
foundGroupTOML := filepath.Join(copyDir, "layers", "group.toml")
group, err := files.Handler.ReadGroup(foundGroupTOML)
h.AssertNil(t, err)
h.AssertEq(t, group.GroupExtensions[0].ID, "simple_extension")
h.AssertEq(t, group.GroupExtensions[0].Version, "simple_extension_version")
h.AssertEq(t, group.Group[0].ID, "buildpack_for_ext")
h.AssertEq(t, group.Group[0].Version, "buildpack_for_ext_version")
h.AssertEq(t, group.Group[0].Extension, false)
t.Log("writes plan.toml")
foundPlanTOML := filepath.Join(copyDir, "layers", "plan.toml")
buildPlan, err := files.Handler.ReadPlan(foundPlanTOML)
h.AssertNil(t, err)
h.AssertEq(t, len(buildPlan.Entries), 0) // this shows that the plan was filtered to remove `requires` provided by extensions
t.Log("runs /bin/generate for extensions")
h.AssertStringContains(t, output, "simple_extension: output from /bin/generate")
var dockerfilePath string
if api.MustParse(platformAPI).LessThan("0.13") {
t.Log("copies the generated Dockerfiles to the output directory")
dockerfilePath = filepath.Join(copyDir, "layers", "generated", "run", "simple_extension", "Dockerfile")
} else {
dockerfilePath = filepath.Join(copyDir, "layers", "generated", "simple_extension", "run.Dockerfile")
}
h.AssertPathExists(t, dockerfilePath)
contents, err := os.ReadFile(dockerfilePath)
h.AssertEq(t, string(contents), "FROM some-run-image-from-extension\n")
t.Log("records the new run image in analyzed.toml")
foundAnalyzedTOML := filepath.Join(copyDir, "layers", "analyzed.toml")
analyzedMD, err := files.Handler.ReadAnalyzed(foundAnalyzedTOML, cmd.DefaultLogger)
h.AssertNil(t, err)
h.AssertEq(t, analyzedMD.RunImage.Image, "some-run-image-from-extension")
})
})
}
}

677
acceptance/exporter_test.go Normal file
View File

@ -0,0 +1,677 @@
//go:build acceptance
package acceptance
import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"time"
"github.com/buildpacks/imgutil"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/pkg/errors"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
"github.com/buildpacks/lifecycle/auth"
"github.com/buildpacks/lifecycle/cache"
"github.com/buildpacks/lifecycle/cmd"
"github.com/buildpacks/lifecycle/internal/fsutil"
"github.com/buildpacks/lifecycle/internal/path"
"github.com/buildpacks/lifecycle/platform/files"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var (
exportImage string
exportRegAuthConfig string
exportRegNetwork string
exporterPath string
exportDaemonFixtures *daemonImageFixtures
exportRegFixtures *regImageFixtures
exportTest *PhaseTest
)
func TestExporter(t *testing.T) {
testImageDockerContext := filepath.Join("testdata", "exporter")
exportTest = NewPhaseTest(t, "exporter", testImageDockerContext)
exportTest.Start(t, updateTOMLFixturesWithTestRegistry)
defer exportTest.Stop(t)
exportImage = exportTest.testImageRef
exporterPath = exportTest.containerBinaryPath
exportRegAuthConfig = exportTest.targetRegistry.authConfig
exportRegNetwork = exportTest.targetRegistry.network
exportDaemonFixtures = exportTest.targetDaemon.fixtures
exportRegFixtures = exportTest.targetRegistry.fixtures
for _, platformAPI := range api.Platform.Supported {
spec.Run(t, "acceptance-exporter/"+platformAPI.String(), testExporterFunc(platformAPI.String()), spec.Parallel(), spec.Report(report.Terminal{}))
}
}
func testExporterFunc(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
when("daemon case", func() {
var exportedImageName string
it.After(func() {
_, _, _ = h.RunE(exec.Command("docker", "rmi", exportedImageName)) // #nosec G204
})
it("app is created", func() {
exportFlags := []string{"-daemon", "-log-level", "debug"}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = "some-exported-image-" + h.RandString(10)
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
)...),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
if api.MustParse(platformAPI).AtLeast("0.11") {
extensions := []string{"sbom.cdx.json", "sbom.spdx.json", "sbom.syft.json"}
for _, extension := range extensions {
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)))
}
} else {
h.AssertStringDoesNotContain(t, output, "Copying SBOM")
}
if api.MustParse(platformAPI).AtLeast("0.12") {
expectedHistory := []string{
"Buildpacks Launcher Config",
"Buildpacks Application Launcher",
"Application Layer",
"Software Bill-of-Materials",
"Layer: 'corrupted-layer', Created by buildpack: corrupted_buildpack@corrupted_v1",
"Layer: 'launch-layer', Created by buildpack: cacher_buildpack@cacher_v1",
"", // run image layer
}
assertDaemonImageHasHistory(t, exportedImageName, expectedHistory)
} else {
assertDaemonImageDoesNotHaveHistory(t, exportedImageName)
}
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, imgutil.NormalizedDateTime)
})
when("using extensions", func() {
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "")
})
it("app is created from the extended run image", func() {
exportFlags := []string{
"-analyzed", "/layers/run-image-extended-analyzed.toml", // though the run image is a registry image, it also exists in the daemon with the same tag
"-daemon",
"-extended", "/layers/some-extended-dir",
"-log-level", "debug",
"-run", "/cnb/run.toml", // though the run image is a registry image, it also exists in the daemon with the same tag
}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = "some-exported-image-" + h.RandString(10)
exportArgs = append(exportArgs, exportedImageName)
// get run image top layer
inspect, _, err := h.DockerCli(t).ImageInspectWithRaw(context.TODO(), exportTest.targetRegistry.fixtures.ReadOnlyRunImage)
h.AssertNil(t, err)
layers := inspect.RootFS.Layers
runImageFixtureTopLayerSHA := layers[len(layers)-1]
runImageFixtureSHA := inspect.ID
experimentalMode := "warn"
if api.MustParse(platformAPI).AtLeast("0.13") {
experimentalMode = "error"
}
output := h.DockerRun(t,
exportImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_EXPERIMENTAL_MODE="+experimentalMode,
"--env", "CNB_PLATFORM_API="+platformAPI,
)...),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, imgutil.NormalizedDateTime)
expectedHistory := []string{
"Buildpacks Launcher Config",
"Buildpacks Application Launcher",
"Application Layer",
"Software Bill-of-Materials",
"Layer: 'corrupted-layer', Created by buildpack: corrupted_buildpack@corrupted_v1",
"Layer: 'launch-layer', Created by buildpack: cacher_buildpack@cacher_v1",
"Layer: 'RUN mkdir /some-other-dir && echo some-data > /some-other-dir/some-file && echo some-data > /some-other-file', Created by extension: second-extension",
"Layer: 'RUN mkdir /some-dir && echo some-data > /some-dir/some-file && echo some-data > /some-file', Created by extension: first-extension",
"", // run image layer
}
assertDaemonImageHasHistory(t, exportedImageName, expectedHistory)
t.Log("bases the exported image on the extended run image")
inspect, _, err = h.DockerCli(t).ImageInspectWithRaw(context.TODO(), exportedImageName)
h.AssertNil(t, err)
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")
type testCase struct {
expectedDiffID string
layerIndex int
}
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
layerIndex: 2,
},
}
for _, tc := range testCases {
h.AssertEq(t, inspect.RootFS.Layers[tc.layerIndex], tc.expectedDiffID)
}
t.Log("sets the layers metadata label according to the new spec")
var lmd files.LayersMetadata
lmdJSON := inspect.Config.Labels["io.buildpacks.lifecycle.metadata"]
h.AssertNil(t, json.Unmarshal([]byte(lmdJSON), &lmd))
h.AssertEq(t, lmd.RunImage.Image, exportTest.targetRegistry.fixtures.ReadOnlyRunImage) // from analyzed.toml
h.AssertEq(t, lmd.RunImage.Mirrors, []string{"mirror1", "mirror2"}) // from run.toml
h.AssertEq(t, lmd.RunImage.TopLayer, runImageFixtureTopLayerSHA)
h.AssertEq(t, lmd.RunImage.Reference, strings.TrimPrefix(runImageFixtureSHA, "sha256:"))
})
})
when("SOURCE_DATE_EPOCH is set", func() {
it("app is created with config CreatedAt set to SOURCE_DATE_EPOCH", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.9"), "SOURCE_DATE_EPOCH support added in 0.9")
expectedTime := time.Date(2022, 1, 5, 5, 5, 5, 0, time.UTC)
exportFlags := []string{"-daemon"}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = "some-exported-image-" + h.RandString(10)
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--env", "SOURCE_DATE_EPOCH="+fmt.Sprintf("%d", expectedTime.Unix()),
"--network", exportRegNetwork,
)...),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, expectedTime)
})
})
})
when("registry case", func() {
var exportedImageName string
it.After(func() {
_, _, _ = h.RunE(exec.Command("docker", "rmi", exportedImageName)) // #nosec G204
})
it("app is created", func() {
var exportFlags []string
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--network", exportRegNetwork,
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
h.Run(t, exec.Command("docker", "pull", exportedImageName))
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, imgutil.NormalizedDateTime)
})
when("registry is insecure", func() {
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "")
})
it("uses http protocol", func() {
var exportFlags []string
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-insecure-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
insecureRegistry := "host.docker.internal/bar"
insecureAnalyzed := "/layers/analyzed_insecure.toml"
_, _, err := h.DockerRunWithError(t,
exportImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_INSECURE_REGISTRIES="+insecureRegistry,
"--env", "CNB_ANALYZED_PATH="+insecureAnalyzed,
"--network", exportRegNetwork,
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, err.Error(), "http://host.docker.internal")
})
})
when("SOURCE_DATE_EPOCH is set", func() {
it("app is created with config CreatedAt set to SOURCE_DATE_EPOCH", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.9"), "SOURCE_DATE_EPOCH support added in 0.9")
expectedTime := time.Date(2022, 1, 5, 5, 5, 5, 0, time.UTC)
var exportFlags []string
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--env", "SOURCE_DATE_EPOCH="+fmt.Sprintf("%d", expectedTime.Unix()),
"--network", exportRegNetwork,
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
h.Run(t, exec.Command("docker", "pull", exportedImageName))
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, expectedTime)
})
})
// FIXME: move this out of the registry block
when("cache", func() {
when("image case", func() {
it("cache is created", func() {
cacheImageName := exportTest.RegRepoName("some-cache-image-" + h.RandString(10))
exportFlags := []string{"-cache-image", cacheImageName}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--network", exportRegNetwork,
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
// To detect whether the export of cacheImage and exportedImage is successful
h.Run(t, exec.Command("docker", "pull", exportedImageName))
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, imgutil.NormalizedDateTime)
h.Run(t, exec.Command("docker", "pull", cacheImageName))
})
when("parallel export is enabled", func() {
it("cache is created", func() {
cacheImageName := exportTest.RegRepoName("some-cache-image-" + h.RandString(10))
exportFlags := []string{"-cache-image", cacheImageName, "-parallel"}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--network", exportRegNetwork,
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
h.Run(t, exec.Command("docker", "pull", exportedImageName))
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, imgutil.NormalizedDateTime)
h.Run(t, exec.Command("docker", "pull", cacheImageName))
})
})
when("cache is provided but no data was cached", func() {
it("cache is created with an empty layer", func() {
cacheImageName := exportTest.RegRepoName("some-empty-cache-image-" + h.RandString(10))
exportFlags := []string{"-cache-image", cacheImageName, "-layers", "/other_layers"}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--network", exportRegNetwork,
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
testEmptyLayerSHA := calculateEmptyLayerSha(t)
// Retrieve the cache image from the ephemeral registry
h.Run(t, exec.Command("docker", "pull", cacheImageName))
logger := cmd.DefaultLogger
subject, err := cache.NewImageCacheFromName(cacheImageName, authn.DefaultKeychain, logger, cache.NewImageDeleter(cache.NewImageComparer(), logger, api.MustParse(platformAPI).LessThan("0.13")))
h.AssertNil(t, err)
//Assert the cache image was created with an empty layer
layer, err := subject.RetrieveLayer(testEmptyLayerSHA)
h.AssertNil(t, err)
defer layer.Close()
})
})
})
when("directory case", func() {
when("original cache was corrupted", func() {
var cacheDir string
it.Before(func() {
var err error
cacheDir, err = os.MkdirTemp("", "cache")
h.AssertNil(t, err)
h.AssertNil(t, os.Chmod(cacheDir, 0777)) // Override umask
cacheFixtureDir := filepath.Join("testdata", "exporter", "cache-dir")
h.AssertNil(t, fsutil.Copy(cacheFixtureDir, cacheDir))
// We have to pre-create the tar files so that their digests do not change due to timestamps
// But, ':' in the filepath on Windows is not allowed
h.AssertNil(t, os.Rename(
filepath.Join(cacheDir, "committed", "sha256_258dfa0cc987efebc17559694866ebc91139e7c0e574f60d1d4092f53d7dff59.tar"),
filepath.Join(cacheDir, "committed", "sha256:258dfa0cc987efebc17559694866ebc91139e7c0e574f60d1d4092f53d7dff59.tar"),
))
})
it.After(func() {
_ = os.RemoveAll(cacheDir)
})
it("overwrites the original layer", func() {
exportFlags := []string{
"-cache-dir", "/cache",
"-log-level", "debug",
}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRun(t,
exportImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--network", exportRegNetwork,
"--volume", fmt.Sprintf("%s:/cache", cacheDir),
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Skipping reuse for layer corrupted_buildpack:corrupted-layer: expected layer contents to have SHA 'sha256:258dfa0cc987efebc17559694866ebc91139e7c0e574f60d1d4092f53d7dff59'; found 'sha256:9e0b77ed599eafdab8611f7eeefef084077f91f02f1da0a3870c7ff20a08bee8'")
h.AssertStringContains(t, output, "Saving "+exportedImageName)
h.Run(t, exec.Command("docker", "pull", exportedImageName))
defer h.Run(t, exec.Command("docker", "image", "rm", exportedImageName))
// Verify the app has the correct sha for the layer
inspect, _, err := h.DockerCli(t).ImageInspectWithRaw(context.TODO(), exportedImageName)
h.AssertNil(t, err)
var lmd files.LayersMetadata
lmdJSON := inspect.Config.Labels["io.buildpacks.lifecycle.metadata"]
h.AssertNil(t, json.Unmarshal([]byte(lmdJSON), &lmd))
h.AssertEq(t, lmd.Buildpacks[2].Layers["corrupted-layer"].SHA, "sha256:258dfa0cc987efebc17559694866ebc91139e7c0e574f60d1d4092f53d7dff59")
// Verify the cache has correct contents now
foundDiffID, err := func() (string, error) {
layerPath := filepath.Join(cacheDir, "committed", "sha256:258dfa0cc987efebc17559694866ebc91139e7c0e574f60d1d4092f53d7dff59.tar")
layerRC, err := os.Open(layerPath)
if err != nil {
return "", err
}
defer func() {
_ = layerRC.Close()
}()
hasher := sha256.New()
if _, err = io.Copy(hasher, layerRC); err != nil {
return "", errors.Wrap(err, "hashing layer")
}
foundDiffID := "sha256:" + hex.EncodeToString(hasher.Sum(make([]byte, 0, hasher.Size())))
return foundDiffID, nil
}()
h.AssertNil(t, err)
h.AssertEq(t, foundDiffID, "sha256:258dfa0cc987efebc17559694866ebc91139e7c0e574f60d1d4092f53d7dff59")
})
})
})
})
when("using extensions", func() {
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "")
})
it("app is created from the extended run image", func() {
exportFlags := []string{
"-analyzed", "/layers/run-image-extended-analyzed.toml",
"-extended", "/layers/some-extended-dir",
"-log-level", "debug",
"-run", "/cnb/run.toml",
}
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportedImageName = exportTest.RegRepoName("some-exported-image-" + h.RandString(10))
exportArgs = append(exportArgs, exportedImageName)
// get run image SHA & top layer
ref, imageAuth, err := auth.ReferenceForRepoName(authn.DefaultKeychain, exportTest.targetRegistry.fixtures.ReadOnlyRunImage)
h.AssertNil(t, err)
remoteImage, err := remote.Image(ref, remote.WithAuth(imageAuth))
h.AssertNil(t, err)
layers, err := remoteImage.Layers()
h.AssertNil(t, err)
runImageFixtureTopLayerSHA, err := layers[len(layers)-1].DiffID()
h.AssertNil(t, err)
runImageFixtureSHA, err := remoteImage.Digest()
h.AssertNil(t, err)
experimentalMode := "warn"
if api.MustParse(platformAPI).AtLeast("0.13") {
experimentalMode = "error"
}
output := h.DockerRun(t,
exportImage,
h.WithFlags(
"--env", "CNB_EXPERIMENTAL_MODE="+experimentalMode,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_REGISTRY_AUTH="+exportRegAuthConfig,
"--network", exportRegNetwork,
),
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)
h.Run(t, exec.Command("docker", "pull", exportedImageName))
assertImageOSAndArchAndCreatedAt(t, exportedImageName, exportTest, imgutil.NormalizedDateTime)
t.Log("bases the exported image on the extended run image")
ref, imageAuth, err = auth.ReferenceForRepoName(authn.DefaultKeychain, exportedImageName)
h.AssertNil(t, err)
remoteImage, err = remote.Image(ref, remote.WithAuth(imageAuth))
h.AssertNil(t, err)
configFile, err := remoteImage.ConfigFile()
h.AssertNil(t, err)
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)
type testCase struct {
expectedDigest string
layerIndex int
}
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 := range testCases {
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")
var lmd files.LayersMetadata
lmdJSON := configFile.Config.Labels["io.buildpacks.lifecycle.metadata"]
h.AssertNil(t, json.Unmarshal([]byte(lmdJSON), &lmd))
h.AssertEq(t, lmd.RunImage.Image, exportTest.targetRegistry.fixtures.ReadOnlyRunImage) // from analyzed.toml
h.AssertEq(t, lmd.RunImage.Mirrors, []string{"mirror1", "mirror2"}) // from run.toml
h.AssertEq(t, lmd.RunImage.TopLayer, runImageFixtureTopLayerSHA.String())
h.AssertEq(t, lmd.RunImage.Reference, fmt.Sprintf("%s@%s", exportTest.targetRegistry.fixtures.ReadOnlyRunImage, runImageFixtureSHA.String()))
})
})
})
when("layout case", func() {
var (
containerName string
err error
layoutDir string
tmpDir string
exportedImageName string
)
when("experimental mode is enabled", func() {
it.Before(func() {
// create the directory to save all OCI images on disk
tmpDir, err = os.MkdirTemp("", "layout")
h.AssertNil(t, err)
containerName = "test-container-" + h.RandString(10)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
// removes all images created
os.RemoveAll(tmpDir)
})
when("using a custom layout directory", func() {
it.Before(func() {
exportedImageName = "my-custom-layout-app"
layoutDir = filepath.Join(path.RootDir, "my-layout-dir")
})
it("app is created", func() {
var exportFlags []string
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept a -layout flag")
exportFlags = append(exportFlags, []string{"-layout", "-layout-dir", layoutDir, "-analyzed", "/layers/layout-analyzed.toml"}...)
exportArgs := append([]string{ctrPath(exporterPath)}, exportFlags...)
exportArgs = append(exportArgs, exportedImageName)
output := h.DockerRunAndCopy(t, containerName, tmpDir, layoutDir, exportImage,
h.WithFlags(
"--env", "CNB_EXPERIMENTAL_MODE=warn",
"--env", "CNB_PLATFORM_API="+platformAPI,
),
h.WithArgs(exportArgs...))
h.AssertStringContains(t, output, "Saving /my-layout-dir/index.docker.io/library/my-custom-layout-app/latest")
// assert the image was saved on disk in OCI layout format
index := h.ReadIndexManifest(t, filepath.Join(tmpDir, layoutDir, "index.docker.io", "library", exportedImageName, "latest"))
h.AssertEq(t, len(index.Manifests), 1)
})
})
})
when("experimental mode is not enabled", func() {
it.Before(func() {
layoutDir = filepath.Join(path.RootDir, "layout-dir")
})
it("errors", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not accept a -layout flag")
cmd := exec.Command(
"docker", "run", "--rm",
"--env", "CNB_PLATFORM_API="+platformAPI,
exportImage,
ctrPath(exporterPath),
"-layout",
"-layout-dir", layoutDir,
"some-image",
) // #nosec G204
output, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
expected := "experimental features are disabled by CNB_EXPERIMENTAL_MODE=error"
h.AssertStringContains(t, string(output), expected)
})
})
})
}
}
func assertDaemonImageDoesNotHaveHistory(t *testing.T, repoName string) {
history, err := h.DockerCli(t).ImageHistory(context.TODO(), repoName)
h.AssertNil(t, err)
for _, hs := range history {
h.AssertEq(t, hs.Created, imgutil.NormalizedDateTime.Unix())
h.AssertEq(t, hs.CreatedBy, "")
}
}
func assertDaemonImageHasHistory(t *testing.T, repoName string, expectedHistory []string) {
history, err := h.DockerCli(t).ImageHistory(context.TODO(), repoName)
h.AssertNil(t, err)
h.AssertEq(t, len(history), len(expectedHistory))
for idx, hs := range history {
h.AssertEq(t, hs.Created, imgutil.NormalizedDateTime.Unix())
h.AssertEq(t, hs.CreatedBy, expectedHistory[idx])
}
}
func calculateEmptyLayerSha(t *testing.T) string {
tmpDir, err := os.MkdirTemp("", "")
h.AssertNil(t, err)
testLayerEmptyPath := filepath.Join(tmpDir, "empty.tar")
h.AssertNil(t, os.WriteFile(testLayerEmptyPath, []byte{}, 0600))
return "sha256:" + h.ComputeSHA256ForFile(t, testLayerEmptyPath)
}

288
acceptance/extender_test.go Normal file
View File

@ -0,0 +1,288 @@
//go:build acceptance
package acceptance
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/buildpacks/imgutil/layout/sparse"
"github.com/google/go-containerregistry/pkg/authn"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/layout"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
"github.com/buildpacks/lifecycle/auth"
"github.com/buildpacks/lifecycle/cmd"
"github.com/buildpacks/lifecycle/platform/files"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var (
extendImage string
extendRegAuthConfig string
extendRegNetwork string
extenderPath string
extendDaemonFixtures *daemonImageFixtures
extendRegFixtures *regImageFixtures
extendTest *PhaseTest
)
const (
// Log message emitted by kaniko;
// if we provide cache directory as an option, kaniko looks there for the base image as a tarball;
// however the base image is in OCI layout format, so we fail to initialize the base image;
// we manage to provide the base image because we override image.RetrieveRemoteImage,
// but the log message could be confusing to end users, hence we check that it is not printed.
msgErrRetrievingImageFromCache = "Error while retrieving image from cache"
)
func TestExtender(t *testing.T) {
testImageDockerContext := filepath.Join("testdata", "extender")
extendTest = NewPhaseTest(t, "extender", testImageDockerContext)
extendTest.Start(t)
defer extendTest.Stop(t)
extendImage = extendTest.testImageRef
extenderPath = extendTest.containerBinaryPath
extendRegAuthConfig = extendTest.targetRegistry.authConfig
extendRegNetwork = extendTest.targetRegistry.network
extendDaemonFixtures = extendTest.targetDaemon.fixtures
extendRegFixtures = extendTest.targetRegistry.fixtures
for _, platformAPI := range api.Platform.Supported {
if platformAPI.LessThan("0.10") {
continue
}
spec.Run(t, "acceptance-extender/"+platformAPI.String(), testExtenderFunc(platformAPI.String()), spec.Parallel(), spec.Report(report.Terminal{}))
}
}
func testExtenderFunc(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
var generatedDir = "/layers/generated"
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.10"), "")
if api.MustParse(platformAPI).AtLeast("0.13") {
generatedDir = "/layers/generated-with-contexts"
}
})
when("kaniko case", func() {
var extendedDir, kanikoDir, analyzedPath string
it.Before(func() {
var err error
extendedDir, err = os.MkdirTemp("", "lifecycle-acceptance")
h.AssertNil(t, err)
kanikoDir, err = os.MkdirTemp("", "lifecycle-acceptance")
h.AssertNil(t, err)
// push base image to test registry
h.Run(t, exec.Command("docker", "tag", extendImage, extendTest.RegRepoName(extendImage)))
h.AssertNil(t, h.PushImage(h.DockerCli(t), extendTest.RegRepoName(extendImage), extendTest.targetRegistry.registry.EncodedLabeledAuth()))
// mimic what the restorer would have done in the previous phase:
// warm kaniko cache
// get remote image
os.Setenv("DOCKER_CONFIG", extendTest.targetRegistry.dockerConfigDir)
ref, auth, err := auth.ReferenceForRepoName(authn.DefaultKeychain, extendTest.RegRepoName(extendImage))
h.AssertNil(t, err)
remoteImage, err := remote.Image(ref, remote.WithAuth(auth))
h.AssertNil(t, err)
baseImageHash, err := remoteImage.Digest()
h.AssertNil(t, err)
baseImageDigest := baseImageHash.String()
baseCacheDir := filepath.Join(kanikoDir, "cache", "base")
h.AssertNil(t, os.MkdirAll(baseCacheDir, 0755))
// write sparse image
layoutImage, err := sparse.NewImage(filepath.Join(baseCacheDir, baseImageDigest), remoteImage)
h.AssertNil(t, err)
h.AssertNil(t, layoutImage.Save())
// write image reference in analyzed.toml
analyzedMD := files.Analyzed{
BuildImage: &files.ImageIdentifier{
Reference: fmt.Sprintf("%s@%s", extendTest.RegRepoName(extendImage), baseImageDigest),
},
RunImage: &files.RunImage{
Reference: fmt.Sprintf("%s@%s", extendTest.RegRepoName(extendImage), baseImageDigest),
Extend: true,
},
}
analyzedPath = h.TempFile(t, "", "analyzed.toml")
h.AssertNil(t, files.Handler.WriteAnalyzed(analyzedPath, &analyzedMD, cmd.DefaultLogger))
})
it.After(func() {
_ = os.RemoveAll(kanikoDir)
_ = os.RemoveAll(extendedDir)
})
when("extending the build image", func() {
it("succeeds", func() {
extendArgs := []string{
ctrPath(extenderPath),
"-analyzed", "/layers/analyzed.toml",
"-generated", generatedDir,
"-log-level", "debug",
"-gid", "1000",
"-uid", "1234",
}
extendFlags := []string{
"--env", "CNB_PLATFORM_API=" + platformAPI,
"--volume", fmt.Sprintf("%s:/layers/analyzed.toml", analyzedPath),
"--volume", fmt.Sprintf("%s:/kaniko", kanikoDir),
}
t.Log("first build extends the build image by running Dockerfile commands")
firstOutput := h.DockerRunWithCombinedOutput(t,
extendImage,
h.WithFlags(extendFlags...),
h.WithArgs(extendArgs...),
)
h.AssertStringDoesNotContain(t, firstOutput, msgErrRetrievingImageFromCache)
h.AssertStringContains(t, firstOutput, "ca-certificates")
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")
h.AssertStringContains(t, firstOutput, "CNB_STACK_ID for buildpack: stack-id-from-ext-tree")
h.AssertStringContains(t, firstOutput, "HOME for buildpack: /home/cnb")
t.Log("cleans the kaniko directory")
fis, err := os.ReadDir(kanikoDir)
h.AssertNil(t, err)
h.AssertEq(t, len(fis), 1) // 1: /kaniko/cache
t.Log("second build extends the build image by pulling from the cache directory")
secondOutput := h.DockerRunWithCombinedOutput(t,
extendImage,
h.WithFlags(extendFlags...),
h.WithArgs(extendArgs...),
)
h.AssertStringDoesNotContain(t, secondOutput, msgErrRetrievingImageFromCache)
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")
})
it("succeeds", func() {
extendArgs := []string{
ctrPath(extenderPath),
"-analyzed", "/layers/analyzed.toml",
"-extended", "/layers/extended",
"-generated", generatedDir,
"-kind", "run",
"-log-level", "debug",
"-gid", "1000",
"-uid", "1234",
}
extendFlags := []string{
"--env", "CNB_PLATFORM_API=" + platformAPI,
"--volume", fmt.Sprintf("%s:/layers/analyzed.toml", analyzedPath),
"--volume", fmt.Sprintf("%s:/layers/extended", extendedDir),
"--volume", fmt.Sprintf("%s:/kaniko", kanikoDir),
}
t.Log("first build extends the run image by running Dockerfile commands")
firstOutput := h.DockerRunWithCombinedOutput(t,
extendImage,
h.WithFlags(extendFlags...),
h.WithArgs(extendArgs...),
)
h.AssertStringDoesNotContain(t, firstOutput, msgErrRetrievingImageFromCache)
h.AssertStringContains(t, firstOutput, "ca-certificates")
h.AssertStringContains(t, firstOutput, "No cached layer found for cmd RUN apt-get update && apt-get install -y tree")
t.Log("does not run the build phase")
h.AssertStringDoesNotContain(t, firstOutput, "Hello Extensions buildpack\ncurl")
t.Log("outputs extended image layers to the extended directory")
images, err := os.ReadDir(filepath.Join(extendedDir, "run"))
h.AssertNil(t, err)
h.AssertEq(t, len(images), 1) // sha256:<extended image digest>
assertExpectedImage(t, filepath.Join(extendedDir, "run", images[0].Name()), platformAPI)
t.Log("cleans the kaniko directory")
caches, err := os.ReadDir(kanikoDir)
h.AssertNil(t, err)
h.AssertEq(t, len(caches), 1) // 1: /kaniko/cache
t.Log("second build extends the build image by pulling from the cache directory")
secondOutput := h.DockerRunWithCombinedOutput(t,
extendImage,
h.WithFlags(extendFlags...),
h.WithArgs(extendArgs...),
)
h.AssertStringDoesNotContain(t, secondOutput, msgErrRetrievingImageFromCache)
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
t.Log("does not run the build phase")
h.AssertStringDoesNotContain(t, secondOutput, "Hello Extensions buildpack\ncurl")
t.Log("outputs extended image layers to the extended directory")
images, err = os.ReadDir(filepath.Join(extendedDir, "run"))
h.AssertNil(t, err)
h.AssertEq(t, len(images), 1) // sha256:<first extended image digest>
assertExpectedImage(t, filepath.Join(extendedDir, "run", images[0].Name()), platformAPI)
t.Log("cleans the kaniko directory")
caches, err = os.ReadDir(kanikoDir)
h.AssertNil(t, err)
h.AssertEq(t, len(caches), 1) // 1: /kaniko/cache
})
})
})
}
}
func assertExpectedImage(t *testing.T, imagePath, platformAPI string) {
image, err := readOCI(imagePath)
h.AssertNil(t, err)
configFile, err := image.ConfigFile()
h.AssertNil(t, err)
h.AssertEq(t, configFile.Config.Labels["io.buildpacks.rebasable"], "false")
layers, err := image.Layers()
h.AssertNil(t, err)
history := configFile.History
h.AssertEq(t, len(history), len(configFile.RootFS.DiffIDs))
if api.MustParse(platformAPI).AtLeast("0.13") {
h.AssertEq(t, len(layers), 7) // base (3), curl (2), tree (2)
h.AssertEq(t, history[3].CreatedBy, "Layer: 'RUN apt-get update && apt-get install -y curl', Created by extension: curl")
h.AssertEq(t, history[4].CreatedBy, "Layer: 'COPY run-file /', Created by extension: curl")
h.AssertEq(t, history[5].CreatedBy, "Layer: 'RUN apt-get update && apt-get install -y tree', Created by extension: tree")
h.AssertEq(t, history[6].CreatedBy, "Layer: 'COPY shared-file /shared-run', Created by extension: tree")
} else {
h.AssertEq(t, len(layers), 5) // base (3), curl (1), tree (1)
h.AssertEq(t, history[3].CreatedBy, "Layer: 'RUN apt-get update && apt-get install -y curl', Created by extension: curl")
h.AssertEq(t, history[4].CreatedBy, "Layer: 'RUN apt-get update && apt-get install -y tree', Created by extension: tree")
}
}
func readOCI(fromPath string) (v1.Image, error) {
layoutPath, err := layout.FromPath(fromPath)
if err != nil {
return nil, fmt.Errorf("getting layout from path: %w", err)
}
hash, err := v1.NewHash(filepath.Base(fromPath))
if err != nil {
return nil, fmt.Errorf("getting hash from reference '%s': %w", fromPath, err)
}
v1Image, err := layoutPath.Image(hash)
if err != nil {
return nil, fmt.Errorf("getting image from hash '%s': %w", hash.String(), err)
}
return v1Image, nil
}

View File

@ -1,7 +1,7 @@
package acceptance
import (
"os"
"fmt"
"os/exec"
"path/filepath"
"strings"
@ -14,166 +14,202 @@ import (
)
var (
launchDockerContext = filepath.Join("testdata", "launcher")
launcherBinaryDir = filepath.Join("acceptance", "testdata", "launcher", "container", "cnb", "lifecycle")
launchImage = "lifecycle/acceptance/launcher"
launchImage string
launcherPath string
launchTest *PhaseTest
)
func TestLauncher(t *testing.T) {
buildLauncher(t)
buildLaunchImage(t)
defer removeLaunchImage(t)
testImageDockerContext := filepath.Join("testdata", "launcher")
launchTest = NewPhaseTest(t, "launcher", testImageDockerContext, withoutDaemonFixtures, withoutRegistry)
containerBinaryDir := filepath.Join("testdata", "launcher", "linux", "container", "cnb", "lifecycle")
withCustomContainerBinaryDir := func(_ *testing.T, phaseTest *PhaseTest) {
phaseTest.containerBinaryDir = containerBinaryDir
}
launchTest.Start(t, withCustomContainerBinaryDir)
defer launchTest.Stop(t)
launchImage = launchTest.testImageRef
launcherPath = launchTest.containerBinaryPath
spec.Run(t, "acceptance", testLauncher, spec.Parallel(), spec.Report(report.Terminal{}))
}
func testLauncher(t *testing.T, when spec.G, it spec.S) {
when("there is no CMD provided", func() {
when("CNB_PROCESS_TYPE is NOT set", func() {
it("web is the default process-type", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage)
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "Executing web process-type"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute web:\n\t got: %s\n\t want: %s", output, expected)
}
})
})
when("exec.d", func() {
it("executes the binaries and modifies env before running profiles", func() {
cmd := exec.Command("docker", "run", "--rm", //nolint
"--env=CNB_PLATFORM_API=0.7",
"--entrypoint=exec.d-checker"+exe,
"--env=VAR_FROM_EXEC_D=orig-val",
launchImage)
when("CNB_PROCESS_TYPE is set", func() {
it("the value of CNB_PROCESS_TYPE is the default process-type", func() {
cmd := exec.Command("docker", "run", "--rm", "--env", "CNB_PROCESS_TYPE=other-process", launchImage)
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "Executing other-process process-type"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute other-process:\n\t got: %s\n\t want: %s", output, expected)
}
})
helper := "helper" + exe
execDHelper := ctrPath("/layers", execDBpDir, "some_layer/exec.d", helper)
execDCheckerHelper := ctrPath("/layers", execDBpDir, "some_layer/exec.d/exec.d-checker", helper)
workDir := ctrPath("/workspace")
expected := fmt.Sprintf("%s was executed\n", execDHelper)
expected += fmt.Sprintf("Exec.d Working Dir: %s\n", workDir)
expected += fmt.Sprintf("%s was executed\n", execDCheckerHelper)
expected += fmt.Sprintf("Exec.d Working Dir: %s\n", workDir)
expected += "sourced bp profile\n"
expected += "sourced app profile\n"
expected += "VAR_FROM_EXEC_D: orig-val:val-from-exec.d:val-from-exec.d-for-process-type-exec.d-checker"
assertOutput(t, cmd, expected)
})
})
when("process-type provided in CMD", func() {
it("launches that process-type", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage, "other-process")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "Executing other-process process-type"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute other-process:\n\t got: %s\n\t want: %s", output, expected)
}
when("entrypoint is a process", func() {
it("launches that process", func() {
cmd := exec.Command("docker", "run", "--rm", //nolint
"--entrypoint=web",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage)
assertOutput(t, cmd, "Executing web process-type")
})
when("process contains a period", func() {
it("launches that process", func() {
cmd := exec.Command("docker", "run", "--rm",
"--entrypoint=process.with.period"+exe,
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage)
assertOutput(t, cmd, "Executing process.with.period process-type")
})
})
it("appends any args to the process args", func() {
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--entrypoint=web",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage, "with user provided args",
)
assertOutput(t, cmd, "Executing web process-type with user provided args")
})
})
it("respects CNB_APP_DIR and CNB_LAYERS_DIR environment variables", func() {
cmd := exec.Command("docker", "run", "--rm",
"--env", "CNB_APP_DIR=/other-app",
"--env", "CNB_LAYERS_DIR=/other-layers",
launchImage)
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "sourced other app profile\nExecuting other-layers web process-type"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute web:\n\t got: %s\n\t want: %s", output, expected)
}
when("entrypoint is a not a process", func() {
it("builds a process from the arguments", func() {
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--entrypoint=launcher",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage, "--",
"env",
)
assertOutput(t, cmd,
"SOME_VAR=some-bp-val",
"OTHER_VAR=other-bp-val",
)
})
})
when("CNB_PROCESS_TYPE is set", func() {
it("should warn", func() {
cmd := exec.Command("docker", "run", "--rm",
"--env=CNB_PROCESS_TYPE=direct-process",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
"--env=CNB_NO_COLOR=true",
launchImage,
)
out, err := cmd.CombinedOutput()
h.AssertNotNil(t, err)
h.AssertStringContains(t, string(out), "Warning: CNB_PROCESS_TYPE is not supported in Platform API "+latestPlatformAPI)
h.AssertStringContains(t, string(out), `Warning: Run with ENTRYPOINT 'direct-process' to invoke the 'direct-process' process type`)
h.AssertStringContains(t, string(out), "ERROR: failed to launch: determine start command: when there is no default process a command is required")
})
})
when("provided CMD is not a process-type", func() {
it("sources profiles and executes the command in a shell", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage, "echo something")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "sourced bp profile\nsourced app profile\nsomething"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, expected)
}
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage,
"echo", "something",
)
assertOutput(t, cmd, "sourced bp profile\nsourced app profile\nsomething")
})
it("sets env vars from layers", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage, "echo $SOME_VAR $OTHER_VAR")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "sourced bp profile\nsourced app profile\nsome-bp-val other-bp-val"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, expected)
}
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage,
"echo", "$SOME_VAR", "$OTHER_VAR", "$WORKER_VAR",
)
assertOutput(t, cmd, "sourced bp profile\nsourced app profile\nsome-bp-val other-bp-val worker-no-process-val")
})
it("passes through env vars from user, excluding blacklist", func() {
cmd := exec.Command("docker", "run", "--rm",
"--env", "CNB_APP_DIR=/workspace",
"--env", "SOME_USER_VAR=some-user-val",
"--env", "OTHER_VAR=other-user-val",
launchImage,
"echo $SOME_USER_VAR $CNB_APP_DIR $OTHER_VAR")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
// bp appends other-bp-val with delimeter '**'
expected := "sourced bp profile\nsourced app profile\nsome-user-val other-user-val**other-bp-val"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, expected)
}
it("passes through env vars from user, excluding excluded vars", func() {
args := []string{"echo", "$SOME_USER_VAR, $CNB_APP_DIR, $OTHER_VAR"}
cmd := exec.Command("docker",
append(
[]string{
"run", "--rm",
"--env", "CNB_APP_DIR=" + ctrPath("/workspace"),
"--env=CNB_PLATFORM_API=" + latestPlatformAPI,
"--env", "SOME_USER_VAR=some-user-val",
"--env", "OTHER_VAR=other-user-val",
launchImage,
},
args...)...,
) // #nosec G204
assertOutput(t, cmd, "sourced bp profile\nsourced app profile\nsome-user-val, , other-user-val**other-bp-val")
})
it("adds buildpack bin dirs to the path", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage, "bp-executable")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "bp executable"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, expected)
}
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage,
"bp-executable",
)
assertOutput(t, cmd, "bp executable")
})
})
when("CMD provided starts with --", func() {
it("launches command directly", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage, "--", "echo", "something")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "something"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, expected)
}
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage, "--",
"echo", "something",
)
assertOutput(t, cmd, "something")
})
it("sets env vars from layers", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage, "--", "env")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
if !strings.Contains(string(output), "SOME_VAR=some-bp-val") {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, "SOME_VAR=some-bp-val")
}
if !strings.Contains(string(output), "OTHER_VAR=other-bp-val") {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, "OTHER_VAR=other-bp-val")
}
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage, "--",
"env",
)
assertOutput(t, cmd,
"SOME_VAR=some-bp-val",
"OTHER_VAR=other-bp-val",
)
})
it("passes through env vars from user, excluding blacklist", func() {
cmd := exec.Command("docker", "run", "--rm",
it("passes through env vars from user, excluding excluded vars", func() {
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--env", "CNB_APP_DIR=/workspace",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
"--env", "SOME_USER_VAR=some-user-val",
launchImage, "--", "env")
launchImage, "--",
"env",
)
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
@ -189,49 +225,26 @@ func testLauncher(t *testing.T, when spec.G, it spec.S) {
})
it("adds buildpack bin dirs to the path before looking up command", func() {
cmd := exec.Command("docker", "run", "--rm", launchImage, "--", "bp-executable")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
expected := "bp executable"
if !strings.Contains(string(output), expected) {
t.Fatalf("failed to execute provided CMD:\n\t got: %s\n\t want: %s", output, expected)
}
cmd := exec.Command( //nolint
"docker", "run", "--rm",
"--env=CNB_PLATFORM_API="+latestPlatformAPI,
launchImage, "--",
"bp-executable",
)
assertOutput(t, cmd, "bp executable")
})
})
}
func buildLaunchImage(t *testing.T) {
cmd := exec.Command("docker", "build", "-t", launchImage, launchDockerContext)
if output, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, string(output), err)
}
}
func removeLaunchImage(t *testing.T) {
cmd := exec.Command("docker", "rmi", launchImage)
if output, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, string(output), err)
}
}
func buildLauncher(t *testing.T) {
cmd := exec.Command("make", "clean", "build-linux-launcher")
wd, err := os.Getwd()
h.AssertNil(t, err)
cmd.Dir = filepath.Join(wd, "..")
cmd.Env = append(
os.Environ(),
"PWD="+cmd.Dir,
"OUT_DIR="+launcherBinaryDir,
"LIFECYCLE_VERSION=some-version",
"SCM_COMMIT=asdf123",
)
t.Log("Building binaries: ", cmd.Args)
func assertOutput(t *testing.T, cmd *exec.Cmd, expected ...string) {
t.Helper()
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to run %v\n OUTPUT: %s\n ERROR: %s\n", cmd.Args, output, err)
}
for _, ex := range expected {
if !strings.Contains(strings.ReplaceAll(string(output), "\r\n", "\n"), ex) {
t.Fatalf("failed:\n\t output: %s\n\t should include: %s", output, ex)
}
}
}

522
acceptance/phase_test.go Normal file
View File

@ -0,0 +1,522 @@
package acceptance
import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"log"
"os"
"os/exec"
"path/filepath"
"reflect"
"runtime"
"strings"
"testing"
"time"
"github.com/docker/docker/api/types/image"
ih "github.com/buildpacks/imgutil/testhelpers"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/registry"
"github.com/buildpacks/lifecycle/auth"
"github.com/buildpacks/lifecycle/cmd"
"github.com/buildpacks/lifecycle/internal/encoding"
"github.com/buildpacks/lifecycle/platform"
"github.com/buildpacks/lifecycle/platform/files"
h "github.com/buildpacks/lifecycle/testhelpers"
)
type PhaseTest struct {
containerBinaryDir string // The path to copy lifecycle binaries to before building the test image.
containerBinaryPath string // The path to invoke when running the test container.
phaseName string // The phase name, such as detect, analyze, restore, build, export, or create.
testImageDockerContext string // The directory containing the Dockerfile for the test image.
testImageRef string // The test image to run.
targetDaemon *targetDaemon
targetRegistry *targetRegistry // The target registry to use. Remove by passing `withoutRegistry` to the constructor.
}
type targetDaemon struct {
os string
arch string
fixtures *daemonImageFixtures
}
type daemonImageFixtures struct {
AppImage string
CacheImage string
RunImage string
}
type targetRegistry struct {
authConfig string
dockerConfigDir string
network string
fixtures *regImageFixtures
registry *ih.DockerRegistry
}
type regImageFixtures struct {
InaccessibleImage string
ReadOnlyAppImage string
ReadOnlyCacheImage string
ReadOnlyRunImage string
ReadWriteAppImage string
ReadWriteCacheImage string
ReadWriteOtherAppImage string
SomeAppImage string
SomeCacheImage string
}
func NewPhaseTest(t *testing.T, phaseName, testImageDockerContext string, phaseOp ...func(*PhaseTest)) *PhaseTest {
phaseTest := &PhaseTest{
containerBinaryDir: filepath.Join(testImageDockerContext, "container", "cnb", "lifecycle"),
containerBinaryPath: "/cnb/lifecycle/" + phaseName,
phaseName: phaseName,
targetDaemon: newTargetDaemon(t),
targetRegistry: &targetRegistry{},
testImageDockerContext: testImageDockerContext,
testImageRef: "lifecycle/acceptance/" + phaseName,
}
for _, op := range phaseOp {
op(phaseTest)
}
return phaseTest
}
func newTargetDaemon(t *testing.T) *targetDaemon {
info, err := h.DockerCli(t).Info(context.TODO())
h.AssertNil(t, err)
arch := info.Architecture
if arch == "x86_64" {
arch = "amd64"
}
if arch == "aarch64" {
arch = "arm64"
}
return &targetDaemon{
os: info.OSType,
arch: arch,
fixtures: nil,
}
}
func (p *PhaseTest) RegRepoName(repoName string) string {
return p.targetRegistry.registry.RepoName(repoName)
}
func (p *PhaseTest) Start(t *testing.T, phaseOp ...func(*testing.T, *PhaseTest)) {
p.targetDaemon.createFixtures(t)
if p.targetRegistry != nil {
p.targetRegistry.start(t)
containerDockerConfigDir := filepath.Join(p.testImageDockerContext, "container", "docker-config")
h.AssertNil(t, os.RemoveAll(containerDockerConfigDir))
h.AssertNil(t, os.MkdirAll(containerDockerConfigDir, 0755))
h.RecursiveCopy(t, p.targetRegistry.dockerConfigDir, containerDockerConfigDir)
}
for _, op := range phaseOp {
op(t, p)
}
h.MakeAndCopyLifecycle(t, p.targetDaemon.os, p.targetDaemon.arch, p.containerBinaryDir)
// calculate lifecycle digest
hasher := sha256.New()
f, err := os.Open(filepath.Join(p.containerBinaryDir, "lifecycle"+exe)) //#nosec G304
h.AssertNil(t, err)
_, err = io.Copy(hasher, f)
h.AssertNil(t, err)
t.Logf("Built lifecycle binary with digest: %s", hex.EncodeToString(hasher.Sum(nil)))
copyFakeSboms(t)
h.DockerBuild(
t,
p.testImageRef,
p.testImageDockerContext,
h.WithArgs("-f", filepath.Join(p.testImageDockerContext, dockerfileName)),
)
t.Logf("Using image %s with lifecycle version %s",
p.testImageRef,
h.DockerRun(
t,
p.testImageRef,
h.WithFlags("--env", "CNB_PLATFORM_API="+latestPlatformAPI, "--entrypoint", ctrPath("/cnb/lifecycle/lifecycle"+exe)),
h.WithArgs("-version"),
))
}
func (p *PhaseTest) Stop(t *testing.T) {
p.targetDaemon.removeFixtures(t)
if p.targetRegistry != nil {
p.targetRegistry.stop(t)
// remove images that were built locally before being pushed to test registry
cleanupDaemonFixtures(t, *p.targetRegistry.fixtures)
}
h.DockerImageRemove(t, p.testImageRef)
}
func (d *targetDaemon) createFixtures(t *testing.T) {
if d.fixtures != nil {
return
}
var fixtures daemonImageFixtures
appMeta := minifyMetadata(t, filepath.Join("testdata", "app_image_metadata.json"), files.LayersMetadata{})
cacheMeta := minifyMetadata(t, filepath.Join("testdata", "cache_image_metadata.json"), platform.CacheMetadata{})
fixtures.AppImage = "some-app-image-" + h.RandString(10)
cmd := exec.Command(
"docker",
"build",
"-t", fixtures.AppImage,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+appMeta,
filepath.Join("testdata", "app-image"),
) // #nosec G204
h.Run(t, cmd)
fixtures.CacheImage = "some-cache-image-" + h.RandString(10)
cmd = exec.Command(
"docker",
"build",
"-t", fixtures.CacheImage,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+cacheMeta,
filepath.Join("testdata", "cache-image"),
) // #nosec G204
h.Run(t, cmd)
fixtures.RunImage = "some-run-image-" + h.RandString(10)
cmd = exec.Command(
"docker",
"build",
"-t", fixtures.RunImage,
"--build-arg", "fromImage="+containerBaseImage,
filepath.Join("testdata", "cache-image"),
) // #nosec G204
h.Run(t, cmd)
d.fixtures = &fixtures
}
func (d *targetDaemon) removeFixtures(t *testing.T) {
cleanupDaemonFixtures(t, *d.fixtures)
}
func (r *targetRegistry) start(t *testing.T) {
var err error
r.dockerConfigDir, err = os.MkdirTemp("", "test.docker.config.dir")
h.AssertNil(t, err)
sharedRegHandler := registry.New(registry.Logger(log.New(io.Discard, "", log.Lshortfile)))
r.registry = ih.NewDockerRegistry(
ih.WithAuth(r.dockerConfigDir),
ih.WithSharedHandler(sharedRegHandler),
ih.WithImagePrivileges(),
)
r.registry.Start(t)
// if registry is listening on localhost, use host networking to allow containers to reach it
r.network = "default"
if r.registry.Host == "localhost" {
r.network = "host"
}
// Save auth config
os.Setenv("DOCKER_CONFIG", r.dockerConfigDir)
r.authConfig, err = auth.BuildEnvVar(authn.DefaultKeychain, r.registry.RepoName("some-repo")) // repo name doesn't matter
h.AssertNil(t, err)
r.createFixtures(t)
}
func (r *targetRegistry) createFixtures(t *testing.T) {
var fixtures regImageFixtures
appMeta := minifyMetadata(t, filepath.Join("testdata", "app_image_metadata.json"), files.LayersMetadata{})
cacheMeta := minifyMetadata(t, filepath.Join("testdata", "cache_image_metadata.json"), platform.CacheMetadata{})
// With Permissions
fixtures.InaccessibleImage = r.registry.SetInaccessible("inaccessible-image")
someReadOnlyAppName := "some-read-only-app-image-" + h.RandString(10)
fixtures.ReadOnlyAppImage = buildRegistryImage(
t,
someReadOnlyAppName,
filepath.Join("testdata", "app-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+appMeta,
)
r.registry.SetReadOnly(someReadOnlyAppName)
someReadOnlyCacheImage := "some-read-only-cache-image-" + h.RandString(10)
fixtures.ReadOnlyCacheImage = buildRegistryImage(
t,
someReadOnlyCacheImage,
filepath.Join("testdata", "cache-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+cacheMeta,
)
r.registry.SetReadOnly(someReadOnlyCacheImage)
someRunImageName := "some-read-only-run-image-" + h.RandString(10)
buildRegistryImage(
t,
someRunImageName,
filepath.Join("testdata", "cache-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImageFull,
)
fixtures.ReadOnlyRunImage = r.registry.SetReadOnly(someRunImageName)
readWriteAppName := "some-read-write-app-image-" + h.RandString(10)
fixtures.ReadWriteAppImage = buildRegistryImage(
t,
readWriteAppName,
filepath.Join("testdata", "app-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+appMeta,
)
r.registry.SetReadWrite(readWriteAppName)
someReadWriteCacheName := "some-read-write-cache-image-" + h.RandString(10)
fixtures.ReadWriteCacheImage = buildRegistryImage(
t,
someReadWriteCacheName,
filepath.Join("testdata", "cache-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+cacheMeta,
)
r.registry.SetReadWrite(someReadWriteCacheName)
readWriteOtherAppName := "some-other-read-write-app-image-" + h.RandString(10)
fixtures.ReadWriteOtherAppImage = buildRegistryImage(
t,
readWriteOtherAppName,
filepath.Join("testdata", "app-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+appMeta,
)
r.registry.SetReadWrite(readWriteOtherAppName)
// Without Permissions
fixtures.SomeAppImage = buildRegistryImage(
t,
"some-app-image-"+h.RandString(10),
filepath.Join("testdata", "app-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+appMeta,
)
fixtures.SomeCacheImage = buildRegistryImage(
t,
"some-cache-image-"+h.RandString(10),
filepath.Join("testdata", "cache-image"),
r.registry,
"--build-arg", "fromImage="+containerBaseImage,
"--build-arg", "metadata="+cacheMeta,
)
r.fixtures = &fixtures
}
func (r *targetRegistry) stop(t *testing.T) {
r.registry.Stop(t)
os.Unsetenv("DOCKER_CONFIG")
os.RemoveAll(r.dockerConfigDir)
}
func buildRegistryImage(t *testing.T, repoName, context string, registry *ih.DockerRegistry, buildArgs ...string) string {
// Build image
regRepoName := registry.RepoName(repoName)
h.DockerBuild(t, regRepoName, context, h.WithArgs(buildArgs...))
// Push image
h.AssertNil(t, h.PushImage(h.DockerCli(t), regRepoName, registry.EncodedLabeledAuth()))
// Return registry repo name
return regRepoName
}
func cleanupDaemonFixtures(t *testing.T, fixtures interface{}) {
v := reflect.ValueOf(fixtures)
for i := 0; i < v.NumField(); i++ {
imageName := fmt.Sprintf("%v", v.Field(i).Interface())
if imageName == "" {
continue
}
if strings.Contains(imageName, "inaccessible") {
continue
}
h.DockerImageRemove(t, imageName)
}
}
func minifyMetadata(t *testing.T, path string, metadataStruct interface{}) string {
metadata, err := os.ReadFile(path)
h.AssertNil(t, err)
// Unmarshal and marshal to strip unnecessary whitespace
h.AssertNil(t, json.Unmarshal(metadata, &metadataStruct))
flatMetadata, err := json.Marshal(metadataStruct)
h.AssertNil(t, err)
return string(flatMetadata)
}
func withoutDaemonFixtures(phaseTest *PhaseTest) {
phaseTest.targetDaemon.fixtures = &daemonImageFixtures{}
}
func withoutRegistry(phaseTest *PhaseTest) {
phaseTest.targetRegistry = nil
}
func copyFakeSboms(t *testing.T) {
goos := runtime.GOOS
// Check Target Daemon != runtime.GOOS
if goos == "darwin" {
goos = "linux"
}
buildLifecycleDir, err := filepath.Abs(filepath.Join("..", "out", fmt.Sprintf("%s-%s", goos, runtime.GOARCH), "lifecycle"))
if err != nil {
t.Log("Fail to locate lifecycle directory")
}
extensions := SBOMExtensions()
components := SBOMComponents()
for _, component := range components {
for _, extension := range extensions {
if err := encoding.WriteJSON(filepath.Join(buildLifecycleDir, component+extension), "fake data"); err != nil {
t.Log("Fail to write:" + component + extension)
}
}
}
}
func SBOMExtensions() []string {
return []string{".sbom.cdx.json", ".sbom.spdx.json", ".sbom.syft.json"}
}
func SBOMComponents() []string {
return []string{"lifecycle", "launcher"}
}
func assertImageOSAndArch(t *testing.T, imageName string, phaseTest *PhaseTest) { //nolint - these functions are in fact used, i promise
inspect, err := h.DockerCli(t).ImageInspect(context.TODO(), imageName)
h.AssertNil(t, err)
h.AssertEq(t, inspect.Os, phaseTest.targetDaemon.os)
h.AssertEq(t, inspect.Architecture, phaseTest.targetDaemon.arch)
}
func assertImageOSAndArchAndCreatedAt(t *testing.T, imageName string, phaseTest *PhaseTest, expectedCreatedAt time.Time) { //nolint
inspect, err := h.DockerCli(t).ImageInspect(context.TODO(), imageName)
if err != nil {
list, _ := h.DockerCli(t).ImageList(context.TODO(), image.ListOptions{})
fmt.Println("Error encountered running ImageInspectWithRaw. imageName: ", imageName)
fmt.Println(err)
for _, value := range list {
fmt.Println("Image Name: ", value)
}
if strings.Contains(err.Error(), "No such image") {
t.Log("Image not found, retrying...")
time.Sleep(1 * time.Second)
inspect, err = h.DockerCli(t).ImageInspect(context.TODO(), imageName)
}
}
h.AssertNil(t, err)
h.AssertEq(t, inspect.Os, phaseTest.targetDaemon.os)
h.AssertEq(t, inspect.Architecture, phaseTest.targetDaemon.arch)
h.AssertEq(t, inspect.Created, expectedCreatedAt.Format(time.RFC3339))
}
func assertRunMetadata(t *testing.T, path string) *files.Run { //nolint
contents, err := os.ReadFile(path)
h.AssertNil(t, err)
h.AssertEq(t, len(contents) > 0, true)
runMD, err := files.Handler.ReadRun(path, cmd.DefaultLogger)
h.AssertNil(t, err)
return &runMD
}
func updateTOMLFixturesWithTestRegistry(t *testing.T, phaseTest *PhaseTest) { //nolint
analyzedTOMLPlaceholders := []string{
filepath.Join(phaseTest.testImageDockerContext, "container", "layers", "analyzed.toml.placeholder"),
filepath.Join(phaseTest.testImageDockerContext, "container", "layers", "run-image-extended-analyzed.toml.placeholder"),
filepath.Join(phaseTest.testImageDockerContext, "container", "layers", "some-analyzed.toml.placeholder"),
filepath.Join(phaseTest.testImageDockerContext, "container", "layers", "some-extend-false-analyzed.toml.placeholder"),
filepath.Join(phaseTest.testImageDockerContext, "container", "layers", "some-extend-true-analyzed.toml.placeholder"),
filepath.Join(phaseTest.testImageDockerContext, "container", "other_layers", "analyzed.toml.placeholder"),
}
runTOMLPlaceholders := []string{
filepath.Join(phaseTest.testImageDockerContext, "container", "cnb", "run.toml.placeholder"),
}
layoutPlaceholders := []string{
filepath.Join(phaseTest.testImageDockerContext, "container", "layers", "layout-analyzed.toml.placeholder"),
}
for _, pPath := range analyzedTOMLPlaceholders {
if _, err := os.Stat(pPath); os.IsNotExist(err) {
continue
}
analyzedMD := assertAnalyzedMetadata(t, pPath)
if analyzedMD.RunImage != nil {
analyzedMD.RunImage.Reference = phaseTest.targetRegistry.fixtures.ReadOnlyRunImage // don't override extend
if analyzedMD.RunImage.Image == "REPLACE" {
analyzedMD.RunImage.Image = phaseTest.targetRegistry.fixtures.ReadOnlyRunImage
}
}
h.AssertNil(t, encoding.WriteTOML(strings.TrimSuffix(pPath, ".placeholder"), analyzedMD))
}
for _, pPath := range runTOMLPlaceholders {
if _, err := os.Stat(pPath); os.IsNotExist(err) {
continue
}
runMD := assertRunMetadata(t, pPath)
for idx, image := range runMD.Images {
image.Image = phaseTest.targetRegistry.fixtures.ReadOnlyRunImage
runMD.Images[idx] = image
}
h.AssertNil(t, encoding.WriteTOML(strings.TrimSuffix(pPath, ".placeholder"), runMD))
}
for _, pPath := range layoutPlaceholders {
if _, err := os.Stat(pPath); os.IsNotExist(err) {
continue
}
analyzedMD := assertAnalyzedMetadata(t, pPath)
if analyzedMD.RunImage != nil {
// Values from image acceptance/testdata/exporter/container/layout-repo in OCI layout format
analyzedMD.RunImage = &files.RunImage{Reference: "/layout-repo/index.docker.io/library/busybox/latest@sha256:445c45cc89fdeb64b915b77f042e74ab580559b8d0d5ef6950be1c0265834c33"}
}
h.AssertNil(t, encoding.WriteTOML(strings.TrimSuffix(pPath, ".placeholder"), analyzedMD))
}
}

View File

@ -0,0 +1,58 @@
//go:build acceptance
package acceptance
import (
"path/filepath"
"testing"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
h "github.com/buildpacks/lifecycle/testhelpers"
)
var (
rebaserTest *PhaseTest
rebaserPath string
rebaserImage string
)
func TestRebaser(t *testing.T) {
testImageDockerContextFolder := filepath.Join("testdata", "rebaser")
rebaserTest = NewPhaseTest(t, "rebaser", testImageDockerContextFolder)
rebaserTest.Start(t, updateTOMLFixturesWithTestRegistry)
defer rebaserTest.Stop(t)
rebaserImage = rebaserTest.testImageRef
rebaserPath = rebaserTest.containerBinaryPath
for _, platformAPI := range api.Platform.Supported {
spec.Run(t, "acceptance-rebaser/"+platformAPI.String(), testRebaser(platformAPI.String()), spec.Sequential(), spec.Report(report.Terminal{}))
}
}
func testRebaser(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
when("called with insecure registry flag", func() {
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "")
})
it("should do an http request", func() {
insecureRegistry := "host.docker.internal"
rebaserOutputImageName := insecureRegistry + "/bar"
_, _, err := h.DockerRunWithError(t,
rebaserImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_INSECURE_REGISTRIES="+insecureRegistry,
),
h.WithArgs(ctrPath(rebaserPath), rebaserOutputImageName),
)
h.AssertStringContains(t, err.Error(), "http://host.docker.internal")
})
})
}
}

338
acceptance/restorer_test.go Normal file
View File

@ -0,0 +1,338 @@
//go:build acceptance
package acceptance
import (
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/google/go-containerregistry/pkg/name"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"github.com/buildpacks/lifecycle/api"
"github.com/buildpacks/lifecycle/cmd"
"github.com/buildpacks/lifecycle/platform/files"
h "github.com/buildpacks/lifecycle/testhelpers"
)
const emptyImageSHA = "03cbce912ef1a8a658f73c660ab9c539d67188622f00b15c4f15b89b884f0e10"
var (
restoreImage string
restoreRegAuthConfig string
restoreRegNetwork string
restorerPath string
restoreDaemonFixtures *daemonImageFixtures
restoreRegFixtures *regImageFixtures
restoreTest *PhaseTest
)
func TestRestorer(t *testing.T) {
testImageDockerContext := filepath.Join("testdata", "restorer")
restoreTest = NewPhaseTest(t, "restorer", testImageDockerContext)
restoreTest.Start(t, updateTOMLFixturesWithTestRegistry)
defer restoreTest.Stop(t)
restoreImage = restoreTest.testImageRef
restorerPath = restoreTest.containerBinaryPath
restoreRegAuthConfig = restoreTest.targetRegistry.authConfig
restoreRegNetwork = restoreTest.targetRegistry.network
restoreDaemonFixtures = restoreTest.targetDaemon.fixtures
restoreRegFixtures = restoreTest.targetRegistry.fixtures
for _, platformAPI := range api.Platform.Supported {
spec.Run(t, "acceptance-restorer/"+platformAPI.String(), testRestorerFunc(platformAPI.String()), spec.Parallel(), spec.Report(report.Terminal{}))
}
}
func testRestorerFunc(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
var copyDir, containerName string
it.Before(func() {
containerName = "test-container-" + h.RandString(10)
var err error
copyDir, err = os.MkdirTemp("", "test-docker-copy-")
h.AssertNil(t, err)
})
it.After(func() {
if h.DockerContainerExists(t, containerName) {
h.Run(t, exec.Command("docker", "rm", containerName))
}
_ = os.RemoveAll(copyDir)
})
when("called with arguments", func() {
it("errors", func() {
command := exec.Command("docker", "run", "--rm", "--env", "CNB_PLATFORM_API="+platformAPI, restoreImage, "some-arg")
output, err := command.CombinedOutput()
h.AssertNotNil(t, err)
expected := "failed to parse arguments: received unexpected Args"
h.AssertStringContains(t, string(output), expected)
})
})
when("called without any cache flag", func() {
it("outputs it will not restore cache layer data", func() {
command := exec.Command("docker", "run", "--rm", "--env", "CNB_PLATFORM_API="+platformAPI, restoreImage)
output, err := command.CombinedOutput()
h.AssertNil(t, err)
expected := "No cached data will be used, no cache specified"
h.AssertStringContains(t, string(output), expected)
})
})
when("analyzed.toml exists with app metadata", func() {
it("restores app metadata", func() {
output := h.DockerRunAndCopy(t,
containerName,
copyDir,
ctrPath("/layers"),
restoreImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
)...),
h.WithArgs(),
)
h.AssertStringContains(t, output, "Restoring metadata for \"some-buildpack-id:launch-layer\"")
})
when("restores app metadata using an insecure registry", func() {
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "")
})
it("does an http request ", func() {
insecureRegistry := "host.docker.internal"
_, _, err := h.DockerRunWithError(t,
restoreImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "CNB_INSECURE_REGISTRIES="+insecureRegistry,
"--env", "CNB_BUILD_IMAGE="+insecureRegistry+"/bar",
)...),
)
h.AssertStringContains(t, err.Error(), "http://host.docker.internal")
})
})
})
when("using cache-dir", func() {
when("there is cache present from a previous build", func() {
it("restores cached layer data", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
restoreImage,
h.WithFlags("--env", "CNB_PLATFORM_API="+platformAPI),
h.WithArgs("-cache-dir", "/cache"),
)
// check restored cache file is present
cachedFile := filepath.Join(copyDir, "layers", "cacher_buildpack", "cached-layer", "data")
h.AssertPathExists(t, cachedFile)
// check restored cache file content is correct
contents, err := os.ReadFile(cachedFile)
h.AssertNil(t, err)
h.AssertEq(t, string(contents), "cached-data\n")
})
it("does not restore cache=true layers not in cache", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
restoreImage,
h.WithFlags("--env", "CNB_PLATFORM_API="+platformAPI),
h.WithArgs("-cache-dir", "/cache"),
)
// check uncached layer is not restored
uncachedFile := filepath.Join(copyDir, "layers", "cacher_buildpack", "uncached-layer")
h.AssertPathDoesNotExist(t, uncachedFile)
})
it("does not restore layer data from unused buildpacks", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
restoreImage,
h.WithFlags("--env", "CNB_PLATFORM_API="+platformAPI),
h.WithArgs("-cache-dir", "/cache"),
)
// check no content is not present from unused buildpack
unusedBpLayer := filepath.Join(copyDir, "layers", "unused_buildpack")
h.AssertPathDoesNotExist(t, unusedBpLayer)
})
it("does not restore corrupted layer data", func() {
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/layers",
restoreImage,
h.WithFlags("--env", "CNB_PLATFORM_API="+platformAPI),
h.WithArgs("-cache-dir", "/cache"),
)
// check corrupted layer is not restored
corruptedFile := filepath.Join(copyDir, "layers", "corrupted_buildpack", "corrupted-layer")
h.AssertPathDoesNotExist(t, corruptedFile)
})
})
})
when("restoring builder image metadata for extensions", func() {
it("accepts -build-image and saves the metadata to /kaniko/cache", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.10"), "Platform API < 0.10 does not restore builder image metadata")
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/",
restoreImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "DOCKER_CONFIG=/docker-config",
"--network", restoreRegNetwork,
),
h.WithArgs("-build-image", restoreRegFixtures.SomeCacheImage), // some-cache-image simulates a builder image in a registry
)
t.Log("records builder image digest in analyzed.toml")
analyzedMD, err := files.Handler.ReadAnalyzed(filepath.Join(copyDir, "layers", "analyzed.toml"), cmd.DefaultLogger)
h.AssertNil(t, err)
h.AssertStringContains(t, analyzedMD.BuildImage.Reference, restoreRegFixtures.SomeCacheImage+"@sha256:")
t.Log("writes builder manifest and config to the kaniko cache")
ref, err := name.ParseReference(analyzedMD.BuildImage.Reference)
h.AssertNil(t, err)
fis, err := os.ReadDir(filepath.Join(copyDir, "kaniko", "cache", "base"))
h.AssertNil(t, err)
h.AssertEq(t, len(fis), 1)
h.AssertPathExists(t, filepath.Join(copyDir, "kaniko", "cache", "base", ref.Identifier(), "oci-layout"))
})
})
when("restoring run image metadata for extensions", func() {
it("saves metadata to /kaniko/cache", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not restore run image metadata")
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/",
restoreImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "DOCKER_CONFIG=/docker-config",
"--network", restoreRegNetwork,
),
h.WithArgs(
"-analyzed", "/layers/some-extend-true-analyzed.toml",
"-log-level", "debug",
),
)
t.Log("updates run image reference in analyzed.toml to include digest and target data")
analyzedMD, err := files.Handler.ReadAnalyzed(filepath.Join(copyDir, "layers", "some-extend-true-analyzed.toml"), cmd.DefaultLogger)
h.AssertNil(t, err)
h.AssertStringContains(t, analyzedMD.RunImage.Reference, restoreRegFixtures.ReadOnlyRunImage+"@sha256:")
h.AssertEq(t, analyzedMD.RunImage.Image, restoreRegFixtures.ReadOnlyRunImage)
h.AssertEq(t, analyzedMD.RunImage.TargetMetadata.OS, "linux")
t.Log("does not return the digest for an empty image")
h.AssertStringDoesNotContain(t, analyzedMD.RunImage.Reference, restoreRegFixtures.ReadOnlyRunImage+"@sha256:"+emptyImageSHA)
t.Log("writes run image manifest and config to the kaniko cache")
ref, err := name.ParseReference(analyzedMD.RunImage.Reference)
h.AssertNil(t, err)
fis, err := os.ReadDir(filepath.Join(copyDir, "kaniko", "cache", "base"))
h.AssertNil(t, err)
h.AssertEq(t, len(fis), 1)
h.AssertPathExists(t, filepath.Join(copyDir, "kaniko", "cache", "base", ref.Identifier(), "oci-layout"))
})
})
when("target data", func() {
it("updates run image reference in analyzed.toml to include digest and target data on newer platforms", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.10"), "")
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/",
restoreImage,
h.WithFlags(
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "DOCKER_CONFIG=/docker-config",
"--network", restoreRegNetwork,
),
h.WithArgs(
"-analyzed", "/layers/some-extend-false-analyzed.toml",
"-log-level", "debug",
),
)
if api.MustParse(platformAPI).AtLeast("0.12") {
t.Log("updates run image reference in analyzed.toml to include digest and target data")
analyzedMD, err := files.Handler.ReadAnalyzed(filepath.Join(copyDir, "layers", "some-extend-false-analyzed.toml"), cmd.DefaultLogger)
h.AssertNil(t, err)
h.AssertStringContains(t, analyzedMD.RunImage.Reference, restoreRegFixtures.ReadOnlyRunImage+"@sha256:")
h.AssertEq(t, analyzedMD.RunImage.Image, restoreRegFixtures.ReadOnlyRunImage)
h.AssertEq(t, analyzedMD.RunImage.TargetMetadata.OS, "linux")
t.Log("does not return the digest for an empty image")
h.AssertStringDoesNotContain(t, analyzedMD.RunImage.Reference, restoreRegFixtures.ReadOnlyRunImage+"@sha256:"+emptyImageSHA)
t.Log("does not write run image manifest and config to the kaniko cache")
fis, err := os.ReadDir(filepath.Join(copyDir, "kaniko"))
h.AssertNil(t, err)
h.AssertEq(t, len(fis), 1) // .gitkeep
} else {
t.Log("updates run image reference in analyzed.toml to include digest only")
analyzedMD, err := files.Handler.ReadAnalyzed(filepath.Join(copyDir, "layers", "some-extend-false-analyzed.toml"), cmd.DefaultLogger)
h.AssertNil(t, err)
h.AssertStringContains(t, analyzedMD.RunImage.Reference, restoreRegFixtures.ReadOnlyRunImage+"@sha256:")
h.AssertEq(t, analyzedMD.RunImage.Image, restoreRegFixtures.ReadOnlyRunImage)
h.AssertNil(t, analyzedMD.RunImage.TargetMetadata)
t.Log("does not return the digest for an empty image")
h.AssertStringDoesNotContain(t, analyzedMD.RunImage.Reference, restoreRegFixtures.ReadOnlyRunImage+"@sha256:"+emptyImageSHA)
}
})
when("-daemon", func() {
it("updates run image reference in analyzed.toml to include digest and target data on newer platforms", func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "Platform API < 0.12 does not support -daemon flag")
h.DockerRunAndCopy(t,
containerName,
copyDir,
"/",
restoreImage,
h.WithFlags(append(
dockerSocketMount,
"--env", "CNB_PLATFORM_API="+platformAPI,
"--env", "DOCKER_CONFIG=/docker-config",
"--network", restoreRegNetwork,
)...),
h.WithArgs(
"-analyzed", "/layers/some-extend-false-analyzed.toml",
"-daemon",
"-log-level", "debug",
),
)
t.Log("updates run image reference in analyzed.toml to include digest and target data")
analyzedMD, err := files.Handler.ReadAnalyzed(filepath.Join(copyDir, "layers", "some-extend-false-analyzed.toml"), cmd.DefaultLogger)
h.AssertNil(t, err)
h.AssertStringDoesNotContain(t, analyzedMD.RunImage.Reference, "@sha256:") // daemon image ID
h.AssertEq(t, analyzedMD.RunImage.Image, restoreRegFixtures.ReadOnlyRunImage)
h.AssertEq(t, analyzedMD.RunImage.TargetMetadata.OS, "linux")
t.Log("does not write run image manifest and config to the kaniko cache")
fis, err := os.ReadDir(filepath.Join(copyDir, "kaniko"))
h.AssertNil(t, err)
h.AssertEq(t, len(fis), 1) // .gitkeep
})
})
})
}
}

21
acceptance/testdata/analyzer/Dockerfile vendored Normal file
View File

@ -0,0 +1,21 @@
FROM ubuntu:bionic
RUN apt-get update && apt-get install -y ca-certificates
COPY container /
WORKDIR /layers
ENV CNB_USER_ID=2222
ENV CNB_GROUP_ID=3333
ARG cnb_platform_api
ENV CNB_PLATFORM_API=${cnb_platform_api}
RUN chown -R $CNB_USER_ID:$CNB_GROUP_ID /some-dir
RUN chown -R $CNB_USER_ID:$CNB_GROUP_ID /layers
# ensure docker config directory is root owned and NOT world readable
RUN chown -R root /docker-config; chmod -R 700 /docker-config

View File

@ -0,0 +1,5 @@
[[order]]
[[order.group]]
id = "simple_buildpack"
version = "simple_buildpack_version"

View File

@ -0,0 +1,2 @@
[run-image]
image = "some-run-image"

View File

@ -0,0 +1,5 @@
[[images]]
image = "some-run-image-from-run-toml"
[[images]]
image = "some-other-run-image"

View File

@ -0,0 +1,4 @@
[[group]]
id = "some-buildpack-id"
version = "some-buildpack-version"
api = "0.10"

View File

@ -0,0 +1,4 @@
[[group]]
id = "some-other-buildpack-id"
version = "some-other-buildpack-version"
api = "0.10"

View File

@ -0,0 +1,4 @@
[[group]]
id = "some-other-buildpack-id"
version = "some-other-buildpack-version"
api = "0.1"

View File

@ -0,0 +1 @@
{"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sh"],"Image":"sha256:688db7a53b2e8d0358c0e1f309856290bb25ce7acabbf9938f580582e921833f","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"container":"65aaed1d1f89cd3cd5aac9137c4786831e99a845ad823496c6008a22a725c780","container_config":{"Hostname":"65aaed1d1f89","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"sh\"]"],"Image":"sha256:688db7a53b2e8d0358c0e1f309856290bb25ce7acabbf9938f580582e921833f","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"created":"2022-11-18T01:19:29.442257773Z","docker_version":"20.10.12","history":[{"created":"2022-11-18T01:19:29.321465538Z","created_by":"/bin/sh -c #(nop) ADD file:36d9f497f679d56737ac1379d93f7b6a2e4c814e38e868a5a8e719c4b226ef6e in / "},{"created":"2022-11-18T01:19:29.442257773Z","created_by":"/bin/sh -c #(nop) CMD [\"sh\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:40cf597a9181e86497f4121c604f9f0ab208950a98ca21db883f26b0a548a2eb"]}}

View File

@ -0,0 +1,16 @@
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 1457,
"digest": "sha256:9d5226e6ce3fb6aee2822206a5ef85f38c303d2b37bfc894b419fca2c0501269"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 772999,
"digest": "sha256:405fecb6a2fa4f29683f977e7e3b852bf6f8975a2aba647d234d2371894943da"
}
]
}

View File

@ -0,0 +1,14 @@
{
"schemaVersion": 2,
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 527,
"digest": "sha256:f75f3d1a317fc82c793d567de94fc8df2bece37acd5f2bd364a0d91a0d1f3dab",
"platform": {
"architecture": "amd64",
"os": "linux"
}
}
]
}

View File

@ -0,0 +1,3 @@
{
"imageLayoutVersion": "1.0.0"
}

View File

@ -0,0 +1,4 @@
[[group]]
id = "another-buildpack-id"
version = "another-buildpack-version"
api = "0.10"

View File

@ -0,0 +1,7 @@
ARG fromImage
FROM $fromImage
ARG metadata
LABEL io.buildpacks.lifecycle.metadata=$metadata

View File

@ -0,0 +1,54 @@
{
"buildpacks": [
{
"key": "some-buildpack-id",
"layers": {
"launch-layer": {
"data": {
"launch-key": "launch-value"
},
"launch": true,
"sha": "launch-sha"
},
"launch-build-layer": {
"build": true,
"data": {
"launch-build-key": "launch-build-value"
},
"launch": true,
"sha": "launch-build-sha"
},
"launch-build-cache-layer": {
"build": true,
"cache": true,
"data": {
"launch-build-cache-key": "launch-build-cache-value"
},
"launch": true,
"sha": "launch-build-cache-sha"
},
"launch-cache-layer": {
"cache": true,
"data": {
"launch-cache-key": "launch-cache-value"
},
"launch": true,
"sha": "launch-cache-sha"
},
"launch-false-layer": {
"data": {
"launch-false-key": "launch-false-value"
},
"sha": "launch-false-sha"
}
},
"store": {
"metadata": {
"metadata-buildpack-store-data": {
"store-key": "store-val"
}
}
}
}
]
}

17
acceptance/testdata/builder/Dockerfile vendored Normal file
View File

@ -0,0 +1,17 @@
FROM ubuntu:bionic
ARG cnb_uid=1234
ARG cnb_gid=1000
COPY ./container/ /
ENTRYPOINT ["/cnb/lifecycle/builder"]
RUN groupadd cnb --gid ${cnb_gid} && \
useradd --uid ${cnb_uid} --gid ${cnb_gid} -m -s /bin/bash cnb
RUN chown -R "${cnb_uid}:${cnb_gid}" "/layers"
WORKDIR /layers
USER ${cnb_uid}:${cnb_gid}

View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -eo pipefail
echo "---> Hello World buildpack"
# INPUT ARGUMENTS
platform_dir=$2
env_dir=${platform_dir}/env
layers_dir=$1
plan_path=$3
# CNB_APP_DIR
echo "CNB_APP_DIR: ${PWD}"
# PLATFORM DIR
echo "PLATFORM_DIR: ${platform_dir}"
# LAYERS
echo "LAYERS_DIR: ${layers_dir}"
# PLAN
echo "PLAN_PATH: ${plan_path}"
echo "plan contents:"
cat ${plan_path}
echo
# Set default start command
cat > "${layers_dir}/launch.toml" << EOL
[[processes]]
type = "hello"
command = ["echo world"]
args = ["arg1"]
EOL
echo "---> Done"

View File

@ -0,0 +1,7 @@
# Buildpack API version
api = "0.10"
# Buildpack ID and metadata
[buildpack]
id = "hello_world"
version = "0.0.1"

View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -eo pipefail
echo "---> Hello World 2 buildpack"
# INPUT ARGUMENTS
platform_dir=$2
env_dir=${platform_dir}/env
layers_dir=$1
plan_path=$3
# CNB_APP_DIR
echo "CNB_APP_DIR: ${PWD}"
# PLATFORM DIR
echo "PLATFORM_DIR: ${platform_dir}"
# LAYERS
echo "LAYERS_DIR: ${layers_dir}"
# PLAN
echo "PLAN_PATH: ${plan_path}"
echo "plan contents:"
cat ${plan_path}
echo
echo "---> Done"

View File

@ -0,0 +1,7 @@
# Buildpack API version
api = "0.10"
# Buildpack ID and metadata
[buildpack]
id = "hello_world_2"
version = "0.0.2"

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eo pipefail
echo "---> Hello World 3 buildpack"
# INPUT ARGUMENTS
platform_dir=$2
env_dir=${platform_dir}/env
layers_dir=$1
plan_path=$3
# CNB_APP_DIR
echo "CNB_APP_DIR: ${PWD}"
# PLATFORM DIR
echo "PLATFORM_DIR: ${platform_dir}"
# LAYERS
echo "LAYERS_DIR: ${layers_dir}"
# PLAN
echo "PLAN_PATH: ${plan_path}"
echo "plan contents:"
cat ${plan_path}
echo
echo "CNB_TARGET_ARCH:" `printenv CNB_TARGET_ARCH`
echo "CNB_TARGET_ARCH_VARIANT:" `printenv CNB_TARGET_ARCH_VARIANT`
echo "CNB_TARGET_OS:" `printenv CNB_TARGET_OS`
echo "CNB_TARGET_DISTRO_NAME:" `printenv CNB_TARGET_DISTRO_NAME`
echo "CNB_TARGET_DISTRO_VERSION:" `printenv CNB_TARGET_DISTRO_VERSION`
echo "---> Done"

View File

@ -0,0 +1,7 @@
# Buildpack API version
api = "0.10"
# Buildpack ID and metadata
[buildpack]
id = "hello_world_3"
version = "0.0.3"

View File

@ -0,0 +1,4 @@
[[group]]
api = "0.10"
id = "hello_world"
version = "0.0.1"

View File

@ -0,0 +1,4 @@
[[group]]
api = "0.10"
id = "hello_world_2"
version = "0.0.2"

View File

@ -0,0 +1,9 @@
[[group]]
api = "0.10"
id = "hello_world"
version = "0.0.1"
[[group-extensions]]
api = "0.10"
id = "hello_world"
version = "0.0.1"

View File

@ -0,0 +1,5 @@
[[group]]
api = "0.2wrongapiblabla"
id = "hello_world"
version = "0.0.1"

View File

@ -0,0 +1,3 @@
I am a group.toml file which not correct as context and syntax.
For more info please look at https://github.com/buildpacks/spec/blob/main/platform.md#grouptoml-toml

View File

@ -0,0 +1,10 @@
[[entries]]
[[entries.providers]]
id = "hello_world"
version = "0.0.1"
[[entries.requires]]
name = "different_plan_from_env.toml_reqires_subset_content"
[entries.requires.metadata]
# arbitrary data describing the required dependency

View File

@ -0,0 +1,10 @@
[[entries]]
[[entries.providers]]
id = "hello_world_2"
version = "0.0.2"
[[entries.requires]]
name = "different_plan_from_env.toml_reqires_subset_content"
[entries.requires.metadata]
# arbitrary data describing the required dependency

View File

@ -0,0 +1,10 @@
[[entries]]
[[entries.providers]]
id = "hello_world_3"
version = "0.0.3"
[[entries.requires]]
name = "03_plan.toml_requires_subset_content_idk"
[entries.requires.metadata]
# arbitrary data describing the required dependency

View File

@ -0,0 +1,11 @@
[[entries]]
[[entries.providers]]
id = "hello_world"
version = "0.0.1"
[[entries.requires]]
name = "different_plan_from_env.toml_reqires_subset_content"
[entries.requires.metadata]
# arbitrary data describing the required dependency

View File

@ -0,0 +1,3 @@
I am a plan.toml file which not correct as context and syntax.
For more info please look at https://github.com/buildpacks/spec/blob/main/platform.md#plantoml-toml

View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eo pipefail
echo "---> Hello World buildpack"
# INPUT ARGUMENTS
platform_dir=$2
env_dir=${platform_dir}/env
layers_dir=$1
plan_path=$3
# acceptance test
echo "CNB_BUILDPACK_DIR: ${CNB_BUILDPACK_DIR}"

View File

@ -0,0 +1,7 @@
# Buildpack API version
api = "0.10"
# Buildpack ID and metadata
[buildpack]
id = "hello_world"
version = "0.0.1"

View File

@ -0,0 +1,9 @@
[run-image.target]
id = "my id"
os = "linux"
arch = "amd64"
arch-variant = "some-variant"
[run-image.target.distro]
name = "ubuntu"
version = "some-cute-version"

View File

@ -0,0 +1,4 @@
[[group]]
api = "0.10"
id = "hello_world_3"
version = "0.0.3"

View File

@ -0,0 +1,6 @@
[[entries]]
[[entries.providers]]
id = "hello_world_3"
version = "0.0.3"

View File

@ -0,0 +1,6 @@
[run-image]
[target]
id = "software"
os = "linux"
arch = "amd64"

View File

@ -0,0 +1,4 @@
[[group]]
api = "0.10"
id = "hello_world_2"
version = "0.0.2"

View File

@ -0,0 +1,6 @@
[[entries]]
[[entries.providers]]
id = "hello_world_2"
version = "0.0.2"

View File

@ -0,0 +1,40 @@
{
"buildpacks": [
{
"key": "some-buildpack-id",
"layers": {
"some-layer": {
"cache": true,
"data": {
"some-layer-key": "some-layer-value"
},
"sha": "some-layer-sha"
}
}
},
{
"key": "some-other-buildpack-id",
"layers": {
"some-layer": {
"cache": true,
"data": {
"some-layer-key": "some-layer-value"
},
"sha": "some-layer-sha"
}
}
},
{
"key": "another-buildpack-id",
"layers": {
"some-layer": {
"cache": true,
"data": {
"some-layer-key": "some-layer-value"
},
"sha": "some-layer-sha"
}
}
}
]
}

View File

@ -0,0 +1,7 @@
ARG fromImage
FROM $fromImage
ARG metadata
LABEL io.buildpacks.lifecycle.cache.metadata=$metadata

View File

@ -0,0 +1,16 @@
{
"buildpacks": [
{
"key": "some-buildpack-id",
"layers": {
"some-layer": {
"cache": true,
"data": {
"some-layer-key": "some-layer-value"
},
"sha": "some-layer-sha"
}
}
}
]
}

20
acceptance/testdata/creator/Dockerfile vendored Normal file
View File

@ -0,0 +1,20 @@
FROM ubuntu:bionic
ARG cnb_uid=1234
ARG cnb_gid=1000
ENV CNB_USER_ID=${cnb_uid}
ENV CNB_GROUP_ID=${cnb_gid}
COPY ./container/ /
RUN groupadd cnb --gid ${cnb_gid} && \
useradd --uid ${cnb_uid} --gid ${cnb_gid} -m -s /bin/bash cnb
# chown the directories so the tests do not have to run as root
RUN chown -R "${cnb_uid}:${cnb_gid}" "/layers"
RUN chown -R "${cnb_uid}:${cnb_gid}" "/layout-repo"
WORKDIR /layers
USER ${cnb_uid}:${cnb_gid}

View File

@ -0,0 +1,106 @@
#!/usr/bin/env bash
set -eo pipefail
echo "---> Hello World buildpack"
# INPUT ARGUMENTS
platform_dir=$2
env_dir=${platform_dir}/env
layers_dir=$1
plan_path=$3
if test -d /layers/sbom; then
echo "/layers/sbom should not exist during buildpack builds"
exit 1
fi
# LAYERS
echo " layers_dir: ${layers_dir}"
# launch=true layer
mkdir -p ${layers_dir}/some-layer/env
echo -n "some-val" > ${layers_dir}/some-layer/env/SOME_VAR
if test -f ${layers_dir}/some-layer.sbom.cdx.json; then
echo "${layers_dir}/some-layer.sbom.cdx.json restored with content: $(cat ${layers_dir}/some-layer.sbom.cdx.json)"
fi
echo -n "{\"key\": \"some-launch-true-bom-content\"}" > ${layers_dir}/some-layer.sbom.cdx.json
if test -f ${layers_dir}/some-layer.toml; then
# mimic not downloading new content
echo "nop"
else
# mimic downloading new content
sleep 1
fi
cat <<EOF > ${layers_dir}/some-layer.toml
[types]
launch = true
EOF
# cache=true layer
mkdir -p ${layers_dir}/some-cache-layer
if test -f ${layers_dir}/some-cache-layer.sbom.cdx.json; then
echo "${layers_dir}/some-cache-layer.sbom.cdx.json restored with content: $(cat ${layers_dir}/some-cache-layer.sbom.cdx.json)"
fi
echo -n "{\"key\": \"some-cache-true-bom-content\"}" > ${layers_dir}/some-cache-layer.sbom.cdx.json
cat <<EOF > ${layers_dir}/some-cache-layer.toml
[types]
cache = true
EOF
# launch=true cache=true layer
mkdir -p ${layers_dir}/some-launch-cache-layer
if test -f ${layers_dir}/some-launch-cache-layer.sbom.cdx.json; then
echo "${layers_dir}/some-launch-cache-layer.sbom.cdx.json restored with content: $(cat ${layers_dir}/some-launch-cache-layer.sbom.cdx.json)"
fi
echo -n "{\"key\": \"some-launch-true-cache-true-bom-content\"}" > ${layers_dir}/some-launch-cache-layer.sbom.cdx.json
cat <<EOF > ${layers_dir}/some-launch-cache-layer.toml
[types]
launch = true
cache = true
EOF
# build=true layer
mkdir -p ${layers_dir}/some-build-layer
if test -f ${layers_dir}/some-build-layer.sbom.cdx.json; then
echo "${layers_dir}/some-build-layer.sbom.cdx.json" should never be restored
exit 1
fi
echo -n "{\"key\": \"some-bom-content\"}" > ${layers_dir}/some-build-layer.sbom.cdx.json
cat <<EOF > ${layers_dir}/some-build-layer.toml
[types]
build = true
EOF
# launch bom
if test -f ${layers_dir}/launch.sbom.cdx.json; then
echo "${layers_dir}/launch.sbom.cdx.json should never be restored"
exit 1
fi
echo -n "{\"key\": \"some-bom-content\"}" > ${layers_dir}/launch.sbom.cdx.json
# build bom
if test -f ${layers_dir}/build.sbom.cdx.json; then
echo "${layers_dir}/build.sbom.cdx.json should never be restored"
exit 1
fi
echo -n "{\"key\": \"some-bom-content\"}" > ${layers_dir}/build.sbom.cdx.json
# store.toml
if test -f ${layers_dir}/store.toml; then
echo "${layers_dir}/store.toml restored with content: $(cat ${layers_dir}/store.toml)"
fi
printf "[metadata]\n\"some-key\" = \"some-value\"" > ${layers_dir}/store.toml

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail
# 1. GET ARGS
plan_path=$2
exit 0

View File

@ -0,0 +1,13 @@
# Buildpack API version
api = "0.7"
# Buildpack ID and metadata
[buildpack]
id = "samples/hello-world"
version = "0.0.1"
name = "Hello World Buildpack"
sbom-formats = ["application/vnd.cyclonedx+json"]
# Stacks that the buildpack will work with
[[stacks]]
id = "*"

View File

@ -0,0 +1,8 @@
# Buildpack API version
api = "0.9"
# Extension ID and metadata
[extension]
id = "samples/hello-world"
version = "0.0.1"
name = "Hello World Extension"

View File

@ -0,0 +1,9 @@
[[order]]
[[order.group]]
id = "samples/hello-world"
version = "0.0.1"
[[order-extensions]]
[[order-extensions.group]]
id = "samples/hello-world"
version = "0.0.1"

View File

@ -0,0 +1,4 @@
[[order]]
[[order.group]]
id = "samples/hello-world"
version = "0.0.1"

View File

@ -0,0 +1,5 @@
[[images]]
image = "some-run-image-from-run-toml"
[[images]]
image = "some-other-run-image"

View File

View File

View File

@ -0,0 +1 @@
{"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sh"],"Image":"sha256:688db7a53b2e8d0358c0e1f309856290bb25ce7acabbf9938f580582e921833f","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"container":"65aaed1d1f89cd3cd5aac9137c4786831e99a845ad823496c6008a22a725c780","container_config":{"Hostname":"65aaed1d1f89","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"sh\"]"],"Image":"sha256:688db7a53b2e8d0358c0e1f309856290bb25ce7acabbf9938f580582e921833f","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"created":"2022-11-18T01:19:29.442257773Z","docker_version":"20.10.12","history":[{"created":"2022-11-18T01:19:29.321465538Z","created_by":"/bin/sh -c #(nop) ADD file:36d9f497f679d56737ac1379d93f7b6a2e4c814e38e868a5a8e719c4b226ef6e in / "},{"created":"2022-11-18T01:19:29.442257773Z","created_by":"/bin/sh -c #(nop) CMD [\"sh\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:40cf597a9181e86497f4121c604f9f0ab208950a98ca21db883f26b0a548a2eb"]}}

Some files were not shown because too many files have changed in this diff Show More