From f7e5575501ba1c3592d90c0289a23b695ad2429b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 22:19:56 +0000 Subject: [PATCH 01/86] build(deps): bump github.com/docker/cli Bumps [github.com/docker/cli](https://github.com/docker/cli) from 24.0.2+incompatible to 24.0.4+incompatible. - [Commits](https://github.com/docker/cli/compare/v24.0.2...v24.0.4) --- updated-dependencies: - dependency-name: github.com/docker/cli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a14a30713..fe9b91703 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c github.com/buildpacks/lifecycle v0.17.0-rc.3 - github.com/docker/cli v24.0.2+incompatible + github.com/docker/cli v24.0.4+incompatible github.com/docker/docker v24.0.2+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 diff --git a/go.sum b/go.sum index 4d55f1f13..569a98959 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= -github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v24.0.4+incompatible h1:Y3bYF9ekNTm2VFz5U/0BlMdJy73D+Y1iAAZ8l63Ydzw= +github.com/docker/cli v24.0.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= From c91b4e6c7d1e8e84c1677732dfba4efbab12c456 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 22:20:05 +0000 Subject: [PATCH 02/86] build(deps): bump github.com/opencontainers/image-spec Bumps [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec) from 1.1.0-rc3 to 1.1.0-rc4. - [Release notes](https://github.com/opencontainers/image-spec/releases) - [Changelog](https://github.com/opencontainers/image-spec/blob/main/RELEASES.md) - [Commits](https://github.com/opencontainers/image-spec/compare/v1.1.0-rc3...v1.1.0-rc4) --- updated-dependencies: - dependency-name: github.com/opencontainers/image-spec dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a14a30713..614751a76 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/heroku/color v0.0.6 github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e github.com/onsi/gomega v1.27.8 - github.com/opencontainers/image-spec v1.1.0-rc3 + github.com/opencontainers/image-spec v1.1.0-rc4 github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8 diff --git a/go.sum b/go.sum index 4d55f1f13..03144bf86 100644 --- a/go.sum +++ b/go.sum @@ -261,8 +261,8 @@ github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8= -github.com/opencontainers/image-spec v1.1.0-rc3/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0= +github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= From a799a8560a80c522884ff2c7abbd4b04175f0ab0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 22:20:16 +0000 Subject: [PATCH 03/86] build(deps): bump golang.org/x/oauth2 from 0.9.0 to 0.10.0 Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.9.0 to 0.10.0. - [Commits](https://github.com/golang/oauth2/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/oauth2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index a14a30713..e97506227 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/spf13/cobra v1.7.0 golang.org/x/crypto v0.11.0 golang.org/x/mod v0.12.0 - golang.org/x/oauth2 v0.9.0 + golang.org/x/oauth2 v0.10.0 golang.org/x/sync v0.3.0 golang.org/x/term v0.10.0 golang.org/x/text v0.11.0 @@ -114,11 +114,11 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/net v0.11.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/tools v0.9.1 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gotest.tools/v3 v3.4.0 // indirect diff --git a/go.sum b/go.sum index 4d55f1f13..8f60f98e2 100644 --- a/go.sum +++ b/go.sum @@ -367,11 +367,11 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= -golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -447,8 +447,8 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6 google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From 4036860f600b3a605d3080c46f0d7af070b4290c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 22:20:30 +0000 Subject: [PATCH 04/86] build(deps): bump github.com/docker/docker Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.2+incompatible to 24.0.4+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v24.0.2...v24.0.4) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a14a30713..8efd3f616 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c github.com/buildpacks/lifecycle v0.17.0-rc.3 github.com/docker/cli v24.0.2+incompatible - github.com/docker/docker v24.0.2+incompatible + github.com/docker/docker v24.0.4+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 github.com/gdamore/tcell/v2 v2.6.0 diff --git a/go.sum b/go.sum index 4d55f1f13..4606290aa 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRX github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.4+incompatible h1:s/LVDftw9hjblvqIeTiGYXBCD95nOEEl7qRsRrIOuQI= +github.com/docker/docker v24.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= From a7945beec7abb4c769197c10ef37b6ad3718b615 Mon Sep 17 00:00:00 2001 From: Aidan Delaney Date: Tue, 11 Jul 2023 08:30:51 +0100 Subject: [PATCH 05/86] Release to Ubuntu Lunar PPA Generate a release for Ubuntu Lunar Lobster Signed-off-by: Aidan Delaney --- .github/workflows/delivery-ubuntu.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/delivery-ubuntu.yml b/.github/workflows/delivery-ubuntu.yml index af39a5fda..56258c2fc 100644 --- a/.github/workflows/delivery-ubuntu.yml +++ b/.github/workflows/delivery-ubuntu.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - target: [bionic, focal, jammy] + target: [bionic, focal, jammy, lunar] runs-on: ubuntu-20.04 steps: - name: Checkout code @@ -102,3 +102,15 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} PACKAGE_VERSION: ${{ steps.version.outputs.result }} + + - name: Deliver lunar + if: matrix.target == 'lunar' + uses: docker://ubuntu:lunar + with: + entrypoint: .github/workflows/delivery/ubuntu/deliver.sh + env: + DEBIAN_FRONTEND: "noninteractive" + GO_DEP_PACKAGE_NAME: golang + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} + PACKAGE_VERSION: ${{ steps.version.outputs.result }} From 9e17e7681eccd6ec6bc8b815e6981240e96e1a41 Mon Sep 17 00:00:00 2001 From: Aidan Delaney Date: Wed, 12 Jul 2023 15:14:41 +0100 Subject: [PATCH 06/86] Update the summary of `yank` Do not summarise the `yank` subcommand using the term "yank". Instead describe the effect of the operation. Signed-off-by: Aidan Delaney --- internal/commands/buildpack_yank.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/commands/buildpack_yank.go b/internal/commands/buildpack_yank.go index ee2e11849..e17ecac7a 100644 --- a/internal/commands/buildpack_yank.go +++ b/internal/commands/buildpack_yank.go @@ -23,7 +23,7 @@ func BuildpackYank(logger logging.Logger, cfg config.Config, pack PackClient) *c cmd := &cobra.Command{ Use: "yank ", Args: cobra.ExactArgs(1), - Short: "Yank a buildpack from a registry", + Short: "Mark a buildpack on a Buildpack registry as unusable", Example: "pack yank my-buildpack@0.0.1", RunE: logError(logger, func(cmd *cobra.Command, args []string) error { buildpackIDVersion := args[0] From 22c47a7bc097d0eaa30fd57cabd5ac3b07952d10 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Thu, 20 Jul 2023 14:35:19 +0200 Subject: [PATCH 07/86] Fixed version of the linter 1.51.1 Signed-off-by: Domenico Luciani --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a7e17a5be..e7321aef8 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ install-goimports: ## install-golangci-lint: Install golangci-lint dependency install-golangci-lint: @echo "=====> Installing golangci-lint..." - cd tools && $(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint + cd tools && $(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1 ## mod-tidy: Tidy Go modules mod-tidy: From 30fe8b07e1e28eb71022b4fe1536f25ae32c9baf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:56:21 +0000 Subject: [PATCH 08/86] build(deps): bump github.com/docker/docker Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.2+incompatible to 24.0.5+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v24.0.2...v24.0.5) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a14a30713..44ec922ca 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c github.com/buildpacks/lifecycle v0.17.0-rc.3 github.com/docker/cli v24.0.2+incompatible - github.com/docker/docker v24.0.2+incompatible + github.com/docker/docker v24.0.5+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 github.com/gdamore/tcell/v2 v2.6.0 diff --git a/go.sum b/go.sum index 4d55f1f13..b4ed77848 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRX github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= +github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= From c424b73bf9ca2a2e75c769457e32b7a277fed2b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:27:01 +0000 Subject: [PATCH 09/86] build(deps): bump github.com/docker/cli Bumps [github.com/docker/cli](https://github.com/docker/cli) from 24.0.2+incompatible to 24.0.5+incompatible. - [Commits](https://github.com/docker/cli/compare/v24.0.2...v24.0.5) --- updated-dependencies: - dependency-name: github.com/docker/cli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 44ec922ca..dde33ee4f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c github.com/buildpacks/lifecycle v0.17.0-rc.3 - github.com/docker/cli v24.0.2+incompatible + github.com/docker/cli v24.0.5+incompatible github.com/docker/docker v24.0.5+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 diff --git a/go.sum b/go.sum index b4ed77848..52e22b06c 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= -github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v24.0.5+incompatible h1:WeBimjvS0eKdH4Ygx+ihVq1Q++xg36M/rMi4aXAvodc= +github.com/docker/cli v24.0.5+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= From 0f99c7e5d7d8e793c23e67ce78f909cbdd32aea0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:27:43 +0000 Subject: [PATCH 10/86] build(deps): bump github.com/go-git/go-git/v5 from 5.7.0 to 5.8.0 Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.7.0 to 5.8.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.7.0...v5.8.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 44ec922ca..365c37a03 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/gdamore/tcell/v2 v2.6.0 github.com/ghodss/yaml v1.0.0 - github.com/go-git/go-git/v5 v5.7.0 + github.com/go-git/go-git/v5 v5.8.0 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.5.9 github.com/google/go-containerregistry v0.15.2 diff --git a/go.sum b/go.sum index b4ed77848..a44691116 100644 --- a/go.sum +++ b/go.sum @@ -151,8 +151,8 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmS github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git/v5 v5.7.0 h1:t9AudWVLmqzlo+4bqdf7GY+46SUuRsx59SboFxkq2aE= -github.com/go-git/go-git/v5 v5.7.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= +github.com/go-git/go-git/v5 v5.8.0 h1:Rc543s6Tyq+YcyPwZRvU4jzZGM8rB/wWu94TnTIYALQ= +github.com/go-git/go-git/v5 v5.8.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= From 02ab9ecac52c4ba3266002ae08e3f9011cb6dec4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 22:12:07 +0000 Subject: [PATCH 11/86] build(deps): bump github.com/onsi/gomega from 1.27.8 to 1.27.10 Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.8 to 1.27.10. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/gomega/compare/v1.27.8...v1.27.10) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 44ec922ca..e4afaa563 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 github.com/heroku/color v0.0.6 github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e - github.com/onsi/gomega v1.27.8 + github.com/onsi/gomega v1.27.10 github.com/opencontainers/image-spec v1.1.0-rc3 github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 @@ -114,9 +114,9 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/net v0.11.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.10.0 // indirect - golang.org/x/tools v0.9.1 // indirect + golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index b4ed77848..5d37d12b5 100644 --- a/go.sum +++ b/go.sum @@ -255,10 +255,10 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss= +github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8= @@ -367,8 +367,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= @@ -436,8 +436,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= +golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 4d9b0bed51fc9329ed8c32cf1a5f7eaf1ca04ca9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Jul 2023 22:39:35 +0000 Subject: [PATCH 12/86] build(deps): bump github.com/go-git/go-git/v5 from 5.8.0 to 5.8.1 Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.8.0 to 5.8.1. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.8.0...v5.8.1) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 9 ++++----- go.sum | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 1bf7d35e2..7edc11f96 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/gdamore/tcell/v2 v2.6.0 github.com/ghodss/yaml v1.0.0 - github.com/go-git/go-git/v5 v5.8.0 + github.com/go-git/go-git/v5 v5.8.1 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.5.9 github.com/google/go-containerregistry v0.15.2 @@ -39,6 +39,7 @@ require ( ) require ( + dario.cat/mergo v1.0.0 // indirect github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect @@ -49,7 +50,7 @@ require ( github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/aws/aws-sdk-go-v2 v1.18.1 // indirect @@ -86,13 +87,11 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/imdario/mergo v0.3.15 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/klauspost/compress v1.16.5 // indirect - github.com/kr/pretty v0.3.1 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect @@ -110,7 +109,7 @@ require ( github.com/rivo/uniseg v0.4.3 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/skeema/knownhosts v1.1.1 // indirect + github.com/skeema/knownhosts v1.2.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect diff --git a/go.sum b/go.sum index dd036f575..e134c4bbe 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 h1:EKPd1INOIyr5hWOWhvpmQpY6tKjeG0hT1s3AMC/9fic= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= @@ -35,8 +37,8 @@ github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.10.0-rc.8 h1:YSZVvlIIDD1UxQpJp0h+dnpLUw+TrY0cx8obKsp3bek= -github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 h1:ZK3C5DtzV2nVAQTx5S5jQvMeDqWtD1By5mOoyY/xJek= -github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= @@ -97,10 +99,9 @@ github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c h1:HlRuSz+JGAzu github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c/go.mod h1:mBG5M3GJW5nknCEOOqtmMHyPYnSpw/5GEiciuYU/COw= github.com/buildpacks/lifecycle v0.17.0-rc.3 h1:GAo6Gv2hFbhjf0JX7M2khS8jd6vU8I9oCkheIhHQwxg= github.com/buildpacks/lifecycle v0.17.0-rc.3/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 h1:krfRl01rzPzxSxyLyrChD+U+MzsBXbm0OwYYB67uF+4= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589/go.mod h1:OuDyvmLnMCwa2ep4Jkm6nyA0ocJuZlGyk2gGseVzERM= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/containerd/containerd v1.7.2 h1:UF2gdONnxO8I6byZXDi5sXWiWvlW3D/sci7dTQimEJo= @@ -151,8 +152,8 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmS github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git/v5 v5.8.0 h1:Rc543s6Tyq+YcyPwZRvU4jzZGM8rB/wWu94TnTIYALQ= -github.com/go-git/go-git/v5 v5.8.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= +github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A= +github.com/go-git/go-git/v5 v5.8.1/go.mod h1:FHFuoD6yGz5OSKEBK+aWN9Oah0q54Jxl0abmj6GnqAo= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= @@ -193,8 +194,6 @@ github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95/go.mod h1:QiyDdbZLa github.com/heroku/color v0.0.6 h1:UTFFMrmMLFcL3OweqP1lAdp8i1y/9oHqkeHjQ/b/Ny0= github.com/heroku/color v0.0.6/go.mod h1:ZBvOcx7cTF2QKOv4LbmoBtNl5uB17qWxGuzZrsi1wLU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= -github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -216,7 +215,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -271,7 +269,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -284,7 +281,6 @@ github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= @@ -297,8 +293,8 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE= -github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= +github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= +github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs= @@ -343,6 +339,7 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= @@ -365,6 +362,7 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= @@ -398,13 +396,13 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220906165534-d0df966e6959/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -414,6 +412,7 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= @@ -423,6 +422,7 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= From 8b15b33377445fbc874c7bef9e6c41bc986140c7 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Tue, 18 Jul 2023 15:36:28 -0300 Subject: [PATCH 13/86] Apply package config from meta-buildpack folder in pack build Signed-off-by: Colin Casey --- acceptance/acceptance_test.go | 35 +++++++++++++++++++ acceptance/buildpacks/folder_buildpack.go | 2 ++ .../0.2/meta-buildpack-dependency/bin/build | 3 ++ .../meta-buildpack-dependency/bin/build.bat | 3 ++ .../0.2/meta-buildpack-dependency/bin/detect | 3 ++ .../meta-buildpack-dependency/bin/detect.bat | 2 ++ .../meta-buildpack-dependency/buildpack.toml | 9 +++++ .../0.2/meta-buildpack/buildpack.toml | 11 ++++++ .../0.2/meta-buildpack/package.toml | 5 +++ pkg/client/build.go | 25 +++++++++++++ 10 files changed, 98 insertions(+) create mode 100755 acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build create mode 100644 acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build.bat create mode 100755 acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect create mode 100644 acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect.bat create mode 100644 acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/buildpack.toml create mode 100644 acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/buildpack.toml create mode 100644 acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/package.toml diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 837b95036..4bd3e0a97 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -1452,6 +1452,41 @@ func testAcceptance( }) }) + when("the argument is meta-buildpack directory", func() { + var tmpDir string + + it.Before(func() { + var err error + tmpDir, err = os.MkdirTemp("", "folder-buildpack-tests-") + assert.Nil(err) + }) + + it.After(func() { + _ = os.RemoveAll(tmpDir) + }) + + it("adds the buildpacks to the builder and runs it", func() { + h.SkipIf(t, runtime.GOOS == "windows", "buildpack directories not supported on windows") + + buildpackManager.PrepareBuildModules(tmpDir, buildpacks.MetaBpFolder) + buildpackManager.PrepareBuildModules(tmpDir, buildpacks.MetaBpDependency) + + output := pack.RunSuccessfully( + "build", repoName, + "-p", filepath.Join("testdata", "mock_app"), + "--buildpack", buildpacks.MetaBpFolder.FullPathIn(tmpDir), + ) + + assertOutput := assertions.NewOutputAssertionManager(t, output) + assertOutput.ReportsAddingBuildpack("local/meta-bp", "local-meta-bp-version") + assertOutput.ReportsAddingBuildpack("local/meta-bp-dep", "local-meta-bp-version") + assertOutput.ReportsSuccessfulImageBuild(repoName) + + assertBuildpackOutput := assertions.NewTestBuildpackOutputAssertionManager(t, output) + assertBuildpackOutput.ReportsBuildStep("Local Meta-Buildpack Dependency") + }) + }) + when("the argument is a buildpackage image", func() { var ( tmpDir string diff --git a/acceptance/buildpacks/folder_buildpack.go b/acceptance/buildpacks/folder_buildpack.go index d892ec03e..7da935d84 100644 --- a/acceptance/buildpacks/folder_buildpack.go +++ b/acceptance/buildpacks/folder_buildpack.go @@ -45,4 +45,6 @@ var ( BpFolderSimpleLayersParent = folderBuildModule{name: "simple-layers-parent-buildpack"} BpFolderSimpleLayers = folderBuildModule{name: "simple-layers-buildpack"} ExtFolderSimpleLayers = folderBuildModule{name: "simple-layers-extension"} + MetaBpFolder = folderBuildModule{name: "meta-buildpack"} + MetaBpDependency = folderBuildModule{name: "meta-buildpack-dependency"} ) diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build new file mode 100755 index 000000000..5cc97b99d --- /dev/null +++ b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "---> Build: Local Meta-Buildpack Dependency" diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build.bat b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build.bat new file mode 100644 index 000000000..3d7df6529 --- /dev/null +++ b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build.bat @@ -0,0 +1,3 @@ +@echo off + +echo ---- Build: Local Meta-Buildpack Dependency diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect new file mode 100755 index 000000000..e4cffa69d --- /dev/null +++ b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +## always detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect.bat b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect.bat new file mode 100644 index 000000000..15823e73f --- /dev/null +++ b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect.bat @@ -0,0 +1,2 @@ +@echo off +:: always detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/buildpack.toml b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/buildpack.toml new file mode 100644 index 000000000..668299eab --- /dev/null +++ b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/buildpack.toml @@ -0,0 +1,9 @@ +api = "0.2" + +[buildpack] + id = "local/meta-bp-dep" + version = "local-meta-bp-version" + name = "Local Meta-Buildpack Dependency" + +[[stacks]] + id = "pack.test.stack" \ No newline at end of file diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/buildpack.toml new file mode 100644 index 000000000..799806eeb --- /dev/null +++ b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/buildpack.toml @@ -0,0 +1,11 @@ +api = "0.2" + +[buildpack] + id = "local/meta-bp" + version = "local-meta-bp-version" + name = "Local Meta-Buildpack" + +[[order]] +[[order.group]] +id = "local/meta-bp-dep" +version = "local-meta-bp-version" \ No newline at end of file diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/package.toml b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/package.toml new file mode 100644 index 000000000..ced1549d9 --- /dev/null +++ b/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/package.toml @@ -0,0 +1,5 @@ +[buildpack] +uri = "." + +[[dependencies]] +uri = "../meta-buildpack-dependency" \ No newline at end of file diff --git a/pkg/client/build.go b/pkg/client/build.go index 9e5c3f295..577af7329 100644 --- a/pkg/client/build.go +++ b/pkg/client/build.go @@ -24,6 +24,7 @@ import ( "github.com/pkg/errors" ignore "github.com/sabhiram/go-gitignore" + "github.com/buildpacks/pack/buildpackage" "github.com/buildpacks/pack/internal/build" "github.com/buildpacks/pack/internal/builder" internalConfig "github.com/buildpacks/pack/internal/config" @@ -1042,6 +1043,30 @@ func (c *Client) fetchBuildpack(ctx context.Context, bp string, relativeBaseDir fetchedBPs = append(append(fetchedBPs, mainBP), depBPs...) mainBPInfo := mainBP.Descriptor().Info() moduleInfo = &mainBPInfo + + packageCfgPath := filepath.Join(bp, "package.toml") + _, err = os.Stat(packageCfgPath) + if err == nil { + packageReader := buildpackage.NewConfigReader() + packageCfg, err := packageReader.Read(packageCfgPath) + if err == nil { + for _, dep := range packageCfg.Dependencies { + mainBP, deps, err := c.buildpackDownloader.Download(ctx, dep.URI, buildpack.DownloadOptions{ + RegistryName: registry, + ImageOS: imageOS, + RelativeBaseDir: filepath.Join(bp, packageCfg.Buildpack.URI), + Daemon: !publish, + PullPolicy: pullPolicy, + }) + + if err != nil { + return nil, nil, errors.Wrapf(err, "fetching dependencies (uri=%s,image=%s)", style.Symbol(dep.URI), style.Symbol(dep.ImageName)) + } + + fetchedBPs = append(append(fetchedBPs, mainBP), deps...) + } + } + } } return fetchedBPs, moduleInfo, nil } From 654d20ae4a9223aa52625809ec532a8ff978b4ae Mon Sep 17 00:00:00 2001 From: Aidan Delaney Date: Tue, 11 Jul 2023 08:30:51 +0100 Subject: [PATCH 14/86] Release to Ubuntu Lunar PPA Generate a release for Ubuntu Lunar Lobster Signed-off-by: Aidan Delaney Signed-off-by: Colin Casey --- .github/workflows/delivery-ubuntu.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/delivery-ubuntu.yml b/.github/workflows/delivery-ubuntu.yml index af39a5fda..56258c2fc 100644 --- a/.github/workflows/delivery-ubuntu.yml +++ b/.github/workflows/delivery-ubuntu.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - target: [bionic, focal, jammy] + target: [bionic, focal, jammy, lunar] runs-on: ubuntu-20.04 steps: - name: Checkout code @@ -102,3 +102,15 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} PACKAGE_VERSION: ${{ steps.version.outputs.result }} + + - name: Deliver lunar + if: matrix.target == 'lunar' + uses: docker://ubuntu:lunar + with: + entrypoint: .github/workflows/delivery/ubuntu/deliver.sh + env: + DEBIAN_FRONTEND: "noninteractive" + GO_DEP_PACKAGE_NAME: golang + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} + PACKAGE_VERSION: ${{ steps.version.outputs.result }} From 4a52694ff2040996073e5ede9dd3a29e9b6d183a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:56:21 +0000 Subject: [PATCH 15/86] build(deps): bump github.com/docker/docker Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.2+incompatible to 24.0.5+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v24.0.2...v24.0.5) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: Colin Casey --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a14a30713..44ec922ca 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c github.com/buildpacks/lifecycle v0.17.0-rc.3 github.com/docker/cli v24.0.2+incompatible - github.com/docker/docker v24.0.2+incompatible + github.com/docker/docker v24.0.5+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 github.com/gdamore/tcell/v2 v2.6.0 diff --git a/go.sum b/go.sum index 4d55f1f13..b4ed77848 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRX github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= +github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= From 6dd09f686c1297121d368c6fba7184da526ffeb6 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 27 Jul 2023 13:08:48 -0300 Subject: [PATCH 16/86] Added feature flag to acceptance test to skip if pack < 0.30 Signed-off-by: Colin Casey --- acceptance/acceptance_test.go | 2 ++ acceptance/invoke/pack.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 4bd3e0a97..e103c1e0a 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -1467,6 +1467,8 @@ func testAcceptance( it("adds the buildpacks to the builder and runs it", func() { h.SkipIf(t, runtime.GOOS == "windows", "buildpack directories not supported on windows") + // This only works if pack is new, therefore skip if pack is old + h.SkipIf(t, !pack.SupportsFeature(invoke.MetaBuildpackFolder), "") buildpackManager.PrepareBuildModules(tmpDir, buildpacks.MetaBpFolder) buildpackManager.PrepareBuildModules(tmpDir, buildpacks.MetaBpDependency) diff --git a/acceptance/invoke/pack.go b/acceptance/invoke/pack.go index fbb50a260..35bd58f5b 100644 --- a/acceptance/invoke/pack.go +++ b/acceptance/invoke/pack.go @@ -234,6 +234,7 @@ const ( StackValidation ForceRebase BuildpackFlatten + MetaBuildpackFolder ) var featureTests = map[Feature]func(i *PackInvoker) bool{ @@ -258,6 +259,9 @@ var featureTests = map[Feature]func(i *PackInvoker) bool{ BuildpackFlatten: func(i *PackInvoker) bool { return i.atLeast("v0.30.0") }, + MetaBuildpackFolder: func(i *PackInvoker) bool { + return i.atLeast("v0.30.0") + }, } func (i *PackInvoker) SupportsFeature(f Feature) bool { From b6440b820cef34b22c0c867e72f63d55535b7182 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 27 Jul 2023 15:15:53 -0300 Subject: [PATCH 17/86] Added unit test Signed-off-by: Colin Casey --- pkg/client/build_test.go | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/pkg/client/build_test.go b/pkg/client/build_test.go index 0fff061f4..58191836a 100644 --- a/pkg/client/build_test.go +++ b/pkg/client/build_test.go @@ -10,6 +10,7 @@ import ( "io" "net/http" "os" + "path" "path/filepath" "runtime" "strings" @@ -988,6 +989,77 @@ func testBuild(t *testing.T, when spec.G, it spec.S) { }) }) + when("meta-buildpack folder is used", func() { + it.Focus("resolves buildpack", func() { + metaBuildpackFolder := path.Join(tmpDir, "meta-buildpack") + err := os.Mkdir(metaBuildpackFolder, os.ModePerm) + h.AssertNil(t, err) + + err = os.WriteFile(path.Join(metaBuildpackFolder, "buildpack.toml"), []byte(` +api = "0.2" + +[buildpack] + id = "local/meta-bp" + version = "local-meta-bp-version" + name = "Local Meta-Buildpack" + +[[order]] +[[order.group]] +id = "local/meta-bp-dep" +version = "local-meta-bp-version" + `), 0644) + h.AssertNil(t, err) + + err = os.WriteFile(path.Join(metaBuildpackFolder, "package.toml"), []byte(` +[buildpack] +uri = "." + +[[dependencies]] +uri = "../meta-buildpack-dependency" + `), 0644) + h.AssertNil(t, err) + + metaBuildpackDependencyFolder := path.Join(tmpDir, "meta-buildpack-dependency") + err = os.Mkdir(metaBuildpackDependencyFolder, os.ModePerm) + h.AssertNil(t, err) + + err = os.WriteFile(path.Join(metaBuildpackDependencyFolder, "buildpack.toml"), []byte(` +api = "0.2" + +[buildpack] + id = "local/meta-bp-dep" + version = "local-meta-bp-version" + name = "Local Meta-Buildpack Dependency" + +[[stacks]] + id = "*" + `), 0644) + h.AssertNil(t, err) + + err = subject.Build(context.TODO(), BuildOptions{ + Image: "some/app", + Builder: defaultBuilderName, + ClearCache: true, + Buildpacks: []string{metaBuildpackFolder}, + }) + + h.AssertNil(t, err) + h.AssertEq(t, fakeLifecycle.Opts.Builder.Name(), defaultBuilderImage.Name()) + bldr, err := builder.FromImage(defaultBuilderImage) + + buildpack1Info := dist.ModuleInfo{ID: "buildpack.1.id", Version: "buildpack.1.version"} + buildpack2Info := dist.ModuleInfo{ID: "buildpack.2.id", Version: "buildpack.2.version"} + metaBuildpackInfo := dist.ModuleInfo{ID: "local/meta-bp", Version: "local-meta-bp-version", Name: "Local Meta-Buildpack"} + metaBuildpackDependencyInfo := dist.ModuleInfo{ID: "local/meta-bp-dep", Version: "local-meta-bp-version", Name: "Local Meta-Buildpack Dependency"} + h.AssertEq(t, bldr.Buildpacks(), []dist.ModuleInfo{ + buildpack1Info, + buildpack2Info, + metaBuildpackInfo, + metaBuildpackDependencyInfo, + }) + }) + }) + when("buildpackage image is used", func() { var fakePackage *fakes.Image From 5e5c9c0adfaf442329280a2b8fb71b4930c09343 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 27 Jul 2023 15:19:51 -0300 Subject: [PATCH 18/86] Fixed lint Signed-off-by: Colin Casey --- pkg/client/build_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/client/build_test.go b/pkg/client/build_test.go index 58191836a..a191b1722 100644 --- a/pkg/client/build_test.go +++ b/pkg/client/build_test.go @@ -990,7 +990,7 @@ func testBuild(t *testing.T, when spec.G, it spec.S) { }) when("meta-buildpack folder is used", func() { - it.Focus("resolves buildpack", func() { + it("resolves buildpack", func() { metaBuildpackFolder := path.Join(tmpDir, "meta-buildpack") err := os.Mkdir(metaBuildpackFolder, os.ModePerm) h.AssertNil(t, err) @@ -1045,7 +1045,9 @@ api = "0.2" h.AssertNil(t, err) h.AssertEq(t, fakeLifecycle.Opts.Builder.Name(), defaultBuilderImage.Name()) + bldr, err := builder.FromImage(defaultBuilderImage) + h.AssertNil(t, err) buildpack1Info := dist.ModuleInfo{ID: "buildpack.1.id", Version: "buildpack.1.version"} buildpack2Info := dist.ModuleInfo{ID: "buildpack.2.id", Version: "buildpack.2.version"} From 86897464d58cbc12f01a8ed74f98da87577e8d91 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 31 Jul 2023 10:59:35 -0400 Subject: [PATCH 19/86] Add -daemon to restorer for newer platform Signed-off-by: Natalie Arellano --- internal/build/lifecycle_execution.go | 11 +++++++++-- internal/build/lifecycle_execution_test.go | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/internal/build/lifecycle_execution.go b/internal/build/lifecycle_execution.go index 812b079b4..3f8a6f084 100644 --- a/internal/build/lifecycle_execution.go +++ b/internal/build/lifecycle_execution.go @@ -492,6 +492,12 @@ func (l *LifecycleExecution) Restore(ctx context.Context, buildCache Cache, kani registryOp = WithRegistryAccess(authConfig) } + dockerOp := NullOp() + if !l.opts.Publish && l.platformAPI.AtLeast("0.12") { + dockerOp = WithDaemonAccess(l.opts.DockerHost) + flags = append(flags, "-daemon") + } + flagsOp := WithFlags(flags...) configProvider := NewPhaseConfigProvider( @@ -507,10 +513,11 @@ func (l *LifecycleExecution) Restore(ctx context.Context, buildCache Cache, kani WithNetwork(l.opts.Network), If(l.hasExtensionsForRun(), WithPostContainerRunOperations( CopyOutToMaybe(l.mountPaths.cnbDir(), l.tmpDir))), // FIXME: this is hacky; we should get the lifecycle binaries from the lifecycle image - flagsOp, cacheBindOp, - registryOp, + dockerOp, + flagsOp, kanikoCacheBindOp, + registryOp, ) restore := phaseFactory.New(configProvider) diff --git a/internal/build/lifecycle_execution_test.go b/internal/build/lifecycle_execution_test.go index b5ae55c23..a920889b0 100644 --- a/internal/build/lifecycle_execution_test.go +++ b/internal/build/lifecycle_execution_test.go @@ -1838,6 +1838,24 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { }) }) }) + + when("publish is false", func() { + when("platform >= 0.12", func() { + platformAPI = api.MustParse("0.12") + + it("configures the phase with daemon access", func() { + h.AssertEq(t, configProvider.ContainerConfig().User, "root") + h.AssertSliceContains(t, configProvider.HostConfig().Binds, "/var/run/docker.sock:/var/run/docker.sock") + }) + + it("configures the phase with the expected arguments", func() { + h.AssertIncludeAllExpectedPatterns(t, + configProvider.ContainerConfig().Cmd, + []string{"-daemon"}, + ) + }) + }) + }) }) when("#Build", func() { From c8ae18e9dc4d20c282f3c1afd637a4789207b574 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 1 Aug 2023 11:02:32 -0400 Subject: [PATCH 20/86] Add acceptance test and ensure that we pull the run image before restore Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 63 ++++++++++++------- .../0.2/read-env-extension/bin/generate | 9 +++ internal/build/lifecycle_execution.go | 14 ++--- pkg/client/build.go | 2 +- 4 files changed, 59 insertions(+), 29 deletions(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 837b95036..02da784dc 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -865,33 +865,54 @@ func testAcceptance( }) when("there are run image extensions", func() { - it.Before(func() { - h.SkipIf(t, !pack.SupportsFeature(invoke.RunImageExtensions), "") - h.SkipIf(t, !lifecycle.SupportsFeature(config.RunImageExtensions), "") + when("switching the run image", func() { + it.Before(func() { + h.SkipIf(t, !pack.SupportsFeature(invoke.RunImageExtensions), "") + h.SkipIf(t, !lifecycle.SupportsFeature(config.RunImageExtensions), "") + }) + + it("uses the 5 phases, and tries to pull the new run image before restore", func() { + output, _ := pack.Run( + "build", repoName, + "-p", filepath.Join("testdata", "mock_app"), + "--network", "host", + "-B", builderName, + "--env", "EXT_RUN_SWITCH=1", + ) + h.AssertContains(t, output, "ERROR: failed to build: executing lifecycle: image 'some-not-exist-run-image' does not exist on the daemon: not found") + h.AssertNotContains(t, output, "RESTORING") + }) }) - it("uses the 5 phases, and runs the extender (run)", func() { - output := pack.RunSuccessfully( - "build", repoName, - "-p", filepath.Join("testdata", "mock_app"), - "--network", "host", // export target is the daemon, but we need to be able to reach the registry where the builder image and run image are saved - "-B", builderName, - "--env", "EXT_RUN=1", - ) + when("extending the run image", func() { + it.Before(func() { + h.SkipIf(t, !pack.SupportsFeature(invoke.RunImageExtensions), "") + h.SkipIf(t, !lifecycle.SupportsFeature(config.RunImageExtensions), "") + }) - assertions.NewOutputAssertionManager(t, output).ReportsSuccessfulImageBuild(repoName) + it("uses the 5 phases, and runs the extender (run)", func() { + output := pack.RunSuccessfully( + "build", repoName, + "-p", filepath.Join("testdata", "mock_app"), + "--network", "host", // export target is the daemon, but we need to be able to reach the registry where the builder image and run image are saved + "-B", builderName, + "--env", "EXT_RUN=1", + ) - assertOutput := assertions.NewLifecycleOutputAssertionManager(t, output) - assertOutput.IncludesLifecycleImageTag(lifecycle.Image()) - assertOutput.IncludesSeparatePhasesWithRunExtension() + assertions.NewOutputAssertionManager(t, output).ReportsSuccessfulImageBuild(repoName) - t.Log("inspecting image") - inspectCmd := "inspect" - if !pack.Supports("inspect") { - inspectCmd = "inspect-image" - } + assertOutput := assertions.NewLifecycleOutputAssertionManager(t, output) + assertOutput.IncludesLifecycleImageTag(lifecycle.Image()) + assertOutput.IncludesSeparatePhasesWithRunExtension() - output = pack.RunSuccessfully(inspectCmd, repoName) + t.Log("inspecting image") + inspectCmd := "inspect" + if !pack.Supports("inspect") { + inspectCmd = "inspect-image" + } + + output = pack.RunSuccessfully(inspectCmd, repoName) + }) }) }) }) diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate b/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate index 842147395..80b268847 100755 --- a/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate +++ b/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate @@ -29,3 +29,12 @@ ARG user_id USER \${user_id} EOL fi + +if [[ -z "$EXT_RUN_SWITCH" ]]; then + echo "Skipping run image switch, not requested..." +else + echo "Generating run.Dockerfile for run image switch..." + cat >>"${output_dir}/run.Dockerfile" < 0 { + if len(bldr.OrderExtensions()) > 0 || len(ephemeralBuilder.OrderExtensions()) > 0 { if !c.experimental { return fmt.Errorf("experimental features must be enabled when builder contains image extensions") } From 60117d5de33427b036ede8840722ff8101767cd2 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Wed, 2 Aug 2023 14:47:50 -0400 Subject: [PATCH 21/86] Silence noisy log messages Signed-off-by: Natalie Arellano --- internal/build/lifecycle_execution.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/build/lifecycle_execution.go b/internal/build/lifecycle_execution.go index ac1d0b7ee..fd5b16b95 100644 --- a/internal/build/lifecycle_execution.go +++ b/internal/build/lifecycle_execution.go @@ -842,6 +842,9 @@ func (l *LifecycleExecution) hasExtensions() bool { } func (l *LifecycleExecution) hasExtensionsForBuild() bool { + if !l.hasExtensions() { + return false + } // the directory is /generated/build inside the build container, but `CopyOutTo` only copies the directory fis, err := os.ReadDir(filepath.Join(l.tmpDir, "build")) if err != nil { @@ -851,6 +854,9 @@ func (l *LifecycleExecution) hasExtensionsForBuild() bool { } func (l *LifecycleExecution) hasExtensionsForRun() bool { + if !l.hasExtensions() { + return false + } var amd files.Analyzed if _, err := toml.DecodeFile(filepath.Join(l.tmpDir, "analyzed.toml"), &amd); err != nil { l.logger.Warnf("failed to parse analyzed.toml file, assuming no run image extensions: %s", err) @@ -865,6 +871,9 @@ func (l *LifecycleExecution) hasExtensionsForRun() bool { } func (l *LifecycleExecution) runImageAfterExtensions() string { + if !l.hasExtensions() { + return l.opts.RunImage + } var amd files.Analyzed if _, err := toml.DecodeFile(filepath.Join(l.tmpDir, "analyzed.toml"), &amd); err != nil { l.logger.Warnf("failed to parse analyzed.toml file, assuming run image did not change: %s", err) From 0ad7c0a42d5037249e172ada337be497c0b384ea Mon Sep 17 00:00:00 2001 From: Jerico Pena Date: Thu, 3 Aug 2023 01:10:49 -0400 Subject: [PATCH 22/86] Update docker-delivery workflow to create multi-arch images Signed-off-by: Jerico Pena --- .github/workflows/delivery-docker.yml | 21 ++++++++++++--------- Dockerfile | 13 +++++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 Dockerfile diff --git a/.github/workflows/delivery-docker.yml b/.github/workflows/delivery-docker.yml index 9998fe512..18fbad1cd 100644 --- a/.github/workflows/delivery-docker.yml +++ b/.github/workflows/delivery-docker.yml @@ -59,15 +59,18 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Pack Build/Publish - uses: dfreilich/pack-action@v2.1.1 - env: - BP_GO_BUILD_LDFLAGS: "-s -w -X 'github.com/buildpacks/pack.Version=${{ steps.version.outputs.result }}'" - with: - args: 'build ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} --builder ${{ env.BUILDER }} --env BP_GO_BUILD_LDFLAGS --publish' + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + - uses: buildpacks/github-actions/setup-tools@v5.3.0 + - name: Buildx Build/Publish + run: | + docker buildx build . \ + --tag ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} \ + --platform linux/amd64,linux/arm64 \ + --build-arg pack_version=${{ steps.version.outputs.result }} \ + --provenance=false \ + --push - name: Tag Image as Latest if: ${{ github.event.release != '' || github.event.inputs.tag_latest }} run: | - docker pull ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} - docker tag ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} ${{ env.IMG_NAME }}:latest - docker push ${{ env.IMG_NAME }}:latest + crane copy ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} ${{ env.IMG_NAME }}:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..b3666449d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.20-alpine as builder +ARG pack_version +ENV PACK_VERSION=$pack_version +WORKDIR /app +COPY . . +RUN apk update && apk upgrade && apk add --no-cache make ca-certificates +RUN update-ca-certificates +RUN make build + +FROM scratch +COPY --from=builder /app/out/pack /usr/local/bin/pack +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +ENTRYPOINT [ "/usr/local/bin/pack" ] From 6eeae0b8a5f0a502383adacc3a8e3bbee3fe7f49 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 3 Aug 2023 16:24:25 -0300 Subject: [PATCH 23/86] Addressing PR review comments - extracted the fetching of buildpacks from package.toml into its own function - added test to cover error scenario Signed-off-by: Colin Casey --- pkg/client/build.go | 50 +++++++++++++++++++++------------- pkg/client/build_test.go | 59 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 19 deletions(-) diff --git a/pkg/client/build.go b/pkg/client/build.go index 577af7329..f470f11f8 100644 --- a/pkg/client/build.go +++ b/pkg/client/build.go @@ -12,6 +12,8 @@ import ( "strings" "time" + "github.com/buildpacks/pack/buildpackage" + "github.com/Masterminds/semver" "github.com/buildpacks/imgutil" "github.com/buildpacks/imgutil/layout" @@ -24,7 +26,6 @@ import ( "github.com/pkg/errors" ignore "github.com/sabhiram/go-gitignore" - "github.com/buildpacks/pack/buildpackage" "github.com/buildpacks/pack/internal/build" "github.com/buildpacks/pack/internal/builder" internalConfig "github.com/buildpacks/pack/internal/config" @@ -1047,30 +1048,41 @@ func (c *Client) fetchBuildpack(ctx context.Context, bp string, relativeBaseDir packageCfgPath := filepath.Join(bp, "package.toml") _, err = os.Stat(packageCfgPath) if err == nil { - packageReader := buildpackage.NewConfigReader() - packageCfg, err := packageReader.Read(packageCfgPath) - if err == nil { - for _, dep := range packageCfg.Dependencies { - mainBP, deps, err := c.buildpackDownloader.Download(ctx, dep.URI, buildpack.DownloadOptions{ - RegistryName: registry, - ImageOS: imageOS, - RelativeBaseDir: filepath.Join(bp, packageCfg.Buildpack.URI), - Daemon: !publish, - PullPolicy: pullPolicy, - }) - - if err != nil { - return nil, nil, errors.Wrapf(err, "fetching dependencies (uri=%s,image=%s)", style.Symbol(dep.URI), style.Symbol(dep.ImageName)) - } - - fetchedBPs = append(append(fetchedBPs, mainBP), deps...) - } + fetchedDeps, err := c.fetchBuildpackDependencies(ctx, bp, packageCfgPath, downloadOptions) + if err != nil { + return nil, nil, errors.Wrapf(err, "fetching package.toml dependencies (path=%s)", style.Symbol(packageCfgPath)) } + fetchedBPs = append(fetchedBPs, fetchedDeps...) } } return fetchedBPs, moduleInfo, nil } +func (c *Client) fetchBuildpackDependencies(ctx context.Context, bp string, packageCfgPath string, downloadOptions buildpack.DownloadOptions) ([]buildpack.BuildModule, error) { + packageReader := buildpackage.NewConfigReader() + packageCfg, err := packageReader.Read(packageCfgPath) + if err == nil { + fetchedBPs := []buildpack.BuildModule{} + for _, dep := range packageCfg.Dependencies { + mainBP, deps, err := c.buildpackDownloader.Download(ctx, dep.URI, buildpack.DownloadOptions{ + RegistryName: downloadOptions.RegistryName, + ImageOS: downloadOptions.ImageOS, + Daemon: downloadOptions.Daemon, + PullPolicy: downloadOptions.PullPolicy, + RelativeBaseDir: filepath.Join(bp, packageCfg.Buildpack.URI), + }) + + if err != nil { + return nil, errors.Wrapf(err, "fetching dependencies (uri=%s,image=%s)", style.Symbol(dep.URI), style.Symbol(dep.ImageName)) + } + + fetchedBPs = append(append(fetchedBPs, mainBP), deps...) + } + return fetchedBPs, nil + } + return nil, err +} + func getBuildpackLocator(bp projectTypes.Buildpack, stackID string) (string, error) { switch { case bp.ID != "" && bp.Script.Inline != "" && bp.URI == "": diff --git a/pkg/client/build_test.go b/pkg/client/build_test.go index a191b1722..13bcc9113 100644 --- a/pkg/client/build_test.go +++ b/pkg/client/build_test.go @@ -1060,6 +1060,65 @@ api = "0.2" metaBuildpackDependencyInfo, }) }) + + it("fails if buildpack dependency could not be fetched", func() { + metaBuildpackFolder := path.Join(tmpDir, "meta-buildpack") + err := os.Mkdir(metaBuildpackFolder, os.ModePerm) + h.AssertNil(t, err) + + err = os.WriteFile(path.Join(metaBuildpackFolder, "buildpack.toml"), []byte(` +api = "0.2" + +[buildpack] + id = "local/meta-bp" + version = "local-meta-bp-version" + name = "Local Meta-Buildpack" + +[[order]] +[[order.group]] +id = "local/meta-bp-dep" +version = "local-meta-bp-version" + `), 0644) + h.AssertNil(t, err) + + err = os.WriteFile(path.Join(metaBuildpackFolder, "package.toml"), []byte(` +[buildpack] +uri = "." + +[[dependencies]] +uri = "../meta-buildpack-dependency" + +[[dependencies]] +uri = "../not-a-valid-dependency" + `), 0644) + h.AssertNil(t, err) + + metaBuildpackDependencyFolder := path.Join(tmpDir, "meta-buildpack-dependency") + err = os.Mkdir(metaBuildpackDependencyFolder, os.ModePerm) + h.AssertNil(t, err) + + err = os.WriteFile(path.Join(metaBuildpackDependencyFolder, "buildpack.toml"), []byte(` +api = "0.2" + +[buildpack] + id = "local/meta-bp-dep" + version = "local-meta-bp-version" + name = "Local Meta-Buildpack Dependency" + +[[stacks]] + id = "*" + `), 0644) + h.AssertNil(t, err) + + err = subject.Build(context.TODO(), BuildOptions{ + Image: "some/app", + Builder: defaultBuilderName, + ClearCache: true, + Buildpacks: []string{metaBuildpackFolder}, + }) + h.AssertError(t, err, fmt.Sprintf("fetching package.toml dependencies (path='%s')", path.Join(metaBuildpackFolder, "package.toml"))) + h.AssertError(t, err, "fetching dependencies (uri='../not-a-valid-dependency',image='')") + }) }) when("buildpackage image is used", func() { From 78476348da68c9ffe213581e734248962cb31dbc Mon Sep 17 00:00:00 2001 From: Jerico Pena Date: Thu, 3 Aug 2023 21:31:41 -0400 Subject: [PATCH 24/86] Use golang:1.20 as the base image instead of alpine Signed-off-by: Jerico Pena --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b3666449d..98c9fb078 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,8 @@ -FROM golang:1.20-alpine as builder +FROM golang:1.20 as builder ARG pack_version ENV PACK_VERSION=$pack_version WORKDIR /app COPY . . -RUN apk update && apk upgrade && apk add --no-cache make ca-certificates -RUN update-ca-certificates RUN make build FROM scratch From e739ca6450a9cc68864ef4637679311db20a1157 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Fri, 4 Aug 2023 11:02:37 -0300 Subject: [PATCH 25/86] Use `filepath` instead of `path` in tests Signed-off-by: Colin Casey --- pkg/client/build_test.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkg/client/build_test.go b/pkg/client/build_test.go index 13bcc9113..31616e6d1 100644 --- a/pkg/client/build_test.go +++ b/pkg/client/build_test.go @@ -10,7 +10,6 @@ import ( "io" "net/http" "os" - "path" "path/filepath" "runtime" "strings" @@ -991,11 +990,11 @@ func testBuild(t *testing.T, when spec.G, it spec.S) { when("meta-buildpack folder is used", func() { it("resolves buildpack", func() { - metaBuildpackFolder := path.Join(tmpDir, "meta-buildpack") + metaBuildpackFolder := filepath.Join(tmpDir, "meta-buildpack") err := os.Mkdir(metaBuildpackFolder, os.ModePerm) h.AssertNil(t, err) - err = os.WriteFile(path.Join(metaBuildpackFolder, "buildpack.toml"), []byte(` + err = os.WriteFile(filepath.Join(metaBuildpackFolder, "buildpack.toml"), []byte(` api = "0.2" [buildpack] @@ -1010,7 +1009,7 @@ version = "local-meta-bp-version" `), 0644) h.AssertNil(t, err) - err = os.WriteFile(path.Join(metaBuildpackFolder, "package.toml"), []byte(` + err = os.WriteFile(filepath.Join(metaBuildpackFolder, "package.toml"), []byte(` [buildpack] uri = "." @@ -1019,11 +1018,11 @@ uri = "../meta-buildpack-dependency" `), 0644) h.AssertNil(t, err) - metaBuildpackDependencyFolder := path.Join(tmpDir, "meta-buildpack-dependency") + metaBuildpackDependencyFolder := filepath.Join(tmpDir, "meta-buildpack-dependency") err = os.Mkdir(metaBuildpackDependencyFolder, os.ModePerm) h.AssertNil(t, err) - err = os.WriteFile(path.Join(metaBuildpackDependencyFolder, "buildpack.toml"), []byte(` + err = os.WriteFile(filepath.Join(metaBuildpackDependencyFolder, "buildpack.toml"), []byte(` api = "0.2" [buildpack] @@ -1062,11 +1061,11 @@ api = "0.2" }) it("fails if buildpack dependency could not be fetched", func() { - metaBuildpackFolder := path.Join(tmpDir, "meta-buildpack") + metaBuildpackFolder := filepath.Join(tmpDir, "meta-buildpack") err := os.Mkdir(metaBuildpackFolder, os.ModePerm) h.AssertNil(t, err) - err = os.WriteFile(path.Join(metaBuildpackFolder, "buildpack.toml"), []byte(` + err = os.WriteFile(filepath.Join(metaBuildpackFolder, "buildpack.toml"), []byte(` api = "0.2" [buildpack] @@ -1081,7 +1080,7 @@ version = "local-meta-bp-version" `), 0644) h.AssertNil(t, err) - err = os.WriteFile(path.Join(metaBuildpackFolder, "package.toml"), []byte(` + err = os.WriteFile(filepath.Join(metaBuildpackFolder, "package.toml"), []byte(` [buildpack] uri = "." @@ -1093,11 +1092,11 @@ uri = "../not-a-valid-dependency" `), 0644) h.AssertNil(t, err) - metaBuildpackDependencyFolder := path.Join(tmpDir, "meta-buildpack-dependency") + metaBuildpackDependencyFolder := filepath.Join(tmpDir, "meta-buildpack-dependency") err = os.Mkdir(metaBuildpackDependencyFolder, os.ModePerm) h.AssertNil(t, err) - err = os.WriteFile(path.Join(metaBuildpackDependencyFolder, "buildpack.toml"), []byte(` + err = os.WriteFile(filepath.Join(metaBuildpackDependencyFolder, "buildpack.toml"), []byte(` api = "0.2" [buildpack] @@ -1116,7 +1115,7 @@ api = "0.2" ClearCache: true, Buildpacks: []string{metaBuildpackFolder}, }) - h.AssertError(t, err, fmt.Sprintf("fetching package.toml dependencies (path='%s')", path.Join(metaBuildpackFolder, "package.toml"))) + h.AssertError(t, err, fmt.Sprintf("fetching package.toml dependencies (path='%s')", filepath.Join(metaBuildpackFolder, "package.toml"))) h.AssertError(t, err, "fetching dependencies (uri='../not-a-valid-dependency',image='')") }) }) From 272b5a3476f5ee80b97193d75f04dec5349a7cb4 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 4 Aug 2023 10:10:26 -0400 Subject: [PATCH 26/86] Update ext fixture SHA Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 02da784dc..0607c8458 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -797,7 +797,7 @@ func testAcceptance( it("creates builder", func() { // Linux containers (including Linux containers on Windows) extSimpleLayersDiffID := "sha256:b9e4a0ddfb650c7aa71d1e6aceea1665365e409b3078bfdc1e51c2b07ab2b423" - extReadEnvDiffID := "sha256:6801a0398d023ff06a43c4fd03ef325a45daaa4540fc3ee140e2fb22bf5143a7" + extReadEnvDiffID := "sha256:fe14f708b4bfa119269dc019b0732c4989a4428f2f6c1bb032795aa8d99628f3" bpSimpleLayersDiffID := "sha256:285ff6683c99e5ae19805f6a62168fb40dca64d813c53b782604c9652d745c70" bpReadEnvDiffID := "sha256:dd1e0efcbf3f08b014ef6eff9cfe7a9eac1cf20bd9b6a71a946f0a74575aa56f" if imageManager.HostOS() == "windows" { // Windows containers on Windows From c5d52ad415539c5034bf6b9de2a5251692285cef Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 4 Aug 2023 10:19:19 -0400 Subject: [PATCH 27/86] Fix acceptance test to have invalid ref, so that it doesn't actually try to pull 'some-not-exist-run-image' Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 2 +- .../mock_buildpacks/0.2/read-env-extension/bin/generate | 2 +- acceptance/testdata/pack_fixtures/report_output.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 0607c8458..ae24c3528 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -879,7 +879,7 @@ func testAcceptance( "-B", builderName, "--env", "EXT_RUN_SWITCH=1", ) - h.AssertContains(t, output, "ERROR: failed to build: executing lifecycle: image 'some-not-exist-run-image' does not exist on the daemon: not found") + h.AssertContains(t, output, "ERROR: failed to build: executing lifecycle: resolve auth for ref some-not-exist-run-image!") h.AssertNotContains(t, output, "RESTORING") }) }) diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate b/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate index 80b268847..3adee97db 100755 --- a/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate +++ b/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate @@ -35,6 +35,6 @@ if [[ -z "$EXT_RUN_SWITCH" ]]; then else echo "Generating run.Dockerfile for run image switch..." cat >>"${output_dir}/run.Dockerfile" < Date: Fri, 4 Aug 2023 10:19:54 -0400 Subject: [PATCH 28/86] Bump lifecycle version Signed-off-by: Natalie Arellano --- go.mod | 2 +- go.sum | 4 ++-- internal/builder/builder.go | 4 ++-- internal/builder/lifecycle.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 7edc11f96..651010705 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Microsoft/go-winio v0.6.1 github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c - github.com/buildpacks/lifecycle v0.17.0-rc.3 + github.com/buildpacks/lifecycle v0.17.0-rc.4 github.com/docker/cli v24.0.5+incompatible github.com/docker/docker v24.0.5+incompatible github.com/docker/go-connections v0.4.0 diff --git a/go.sum b/go.sum index e134c4bbe..9690b3a65 100644 --- a/go.sum +++ b/go.sum @@ -97,8 +97,8 @@ github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001- github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c h1:HlRuSz+JGAzudNtNCfHIzXe0AEuHX6Vx8uZgmjvX02o= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c/go.mod h1:mBG5M3GJW5nknCEOOqtmMHyPYnSpw/5GEiciuYU/COw= -github.com/buildpacks/lifecycle v0.17.0-rc.3 h1:GAo6Gv2hFbhjf0JX7M2khS8jd6vU8I9oCkheIhHQwxg= -github.com/buildpacks/lifecycle v0.17.0-rc.3/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= +github.com/buildpacks/lifecycle v0.17.0-rc.4 h1:0mCWV9RAWLYRj8BtdEJdAX5uk8EFE8YOvdfjYIHu0Tw= +github.com/buildpacks/lifecycle v0.17.0-rc.4/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 h1:krfRl01rzPzxSxyLyrChD+U+MzsBXbm0OwYYB67uF+4= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589/go.mod h1:OuDyvmLnMCwa2ep4Jkm6nyA0ocJuZlGyk2gGseVzERM= diff --git a/internal/builder/builder.go b/internal/builder/builder.go index 33e6e40aa..51b5a4a00 100644 --- a/internal/builder/builder.go +++ b/internal/builder/builder.go @@ -783,11 +783,11 @@ func (b *Builder) validateBuildpacks() error { if err != nil { return err } - buildDistroName, err := b.Image().Label(lifecycleplatform.OSDistributionNameLabel) + buildDistroName, err := b.Image().Label(lifecycleplatform.OSDistroNameLabel) if err != nil { return err } - buildDistroVersion, err := b.Image().Label(lifecycleplatform.OSDistributionVersionLabel) + buildDistroVersion, err := b.Image().Label(lifecycleplatform.OSDistroVersionLabel) if err != nil { return err } diff --git a/internal/builder/lifecycle.go b/internal/builder/lifecycle.go index 1bc2c1e3c..7e76c2a9c 100644 --- a/internal/builder/lifecycle.go +++ b/internal/builder/lifecycle.go @@ -14,7 +14,7 @@ import ( // A snapshot of the latest tested lifecycle version values const ( - DefaultLifecycleVersion = "0.17.0-rc.3" + DefaultLifecycleVersion = "0.17.0-rc.4" DefaultBuildpackAPIVersion = "0.2" ) From 77d3afcd855d9009800842b15107482565f3849b Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 4 Aug 2023 10:28:55 -0400 Subject: [PATCH 29/86] Fix unit tests by forcing `hasExtensions()` to return true when we are testing extensions Signed-off-by: Natalie Arellano --- internal/build/lifecycle_execution_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/build/lifecycle_execution_test.go b/internal/build/lifecycle_execution_test.go index a920889b0..8dc2d4904 100644 --- a/internal/build/lifecycle_execution_test.go +++ b/internal/build/lifecycle_execution_test.go @@ -553,6 +553,7 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { when("extensions", func() { providedUseCreator = false + providedOrderExt = dist.Order{dist.OrderEntry{Group: []dist.ModuleRef{ /* don't care */ }}} when("for build", func() { when("present /generated/build", func() { @@ -1703,6 +1704,7 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { when("there are extensions", func() { platformAPI = api.MustParse("0.12") + providedOrderExt = dist.Order{dist.OrderEntry{Group: []dist.ModuleRef{ /* don't care */ }}} when("for build", func() { extensionsForBuild = true @@ -1772,6 +1774,8 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { }) when("extensions", func() { + providedOrderExt = dist.Order{dist.OrderEntry{Group: []dist.ModuleRef{ /* don't care */ }}} + when("for build", func() { when("present in /generated/build", func() { extensionsForBuild = true @@ -1956,6 +1960,7 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { when("extensions change the run image", func() { extensionsRunImage = "some-new-run-image" + providedOrderExt = dist.Order{dist.OrderEntry{Group: []dist.ModuleRef{ /* don't care */ }}} it("runs the phase with the new run image", func() { h.AssertEq(t, configProvider.ContainerConfig().Image, "some-new-run-image") @@ -2030,6 +2035,8 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { }) when("there are extensions", func() { + providedOrderExt = dist.Order{dist.OrderEntry{Group: []dist.ModuleRef{ /* don't care */ }}} + when("for run", func() { extensionsForRun = true From 7c3818f94bc017365969797a923c7198a3cfe199 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Fri, 4 Aug 2023 11:32:36 -0300 Subject: [PATCH 30/86] Re-run actions Signed-off-by: Colin Casey From f0d8f7767c6bfa9b805cc382f5aca527e5f77b4c Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 4 Aug 2023 10:37:54 -0400 Subject: [PATCH 31/86] Update ext fixture SHA again Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index ae24c3528..ed0bd6d23 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -797,7 +797,7 @@ func testAcceptance( it("creates builder", func() { // Linux containers (including Linux containers on Windows) extSimpleLayersDiffID := "sha256:b9e4a0ddfb650c7aa71d1e6aceea1665365e409b3078bfdc1e51c2b07ab2b423" - extReadEnvDiffID := "sha256:fe14f708b4bfa119269dc019b0732c4989a4428f2f6c1bb032795aa8d99628f3" + extReadEnvDiffID := "sha256:4490d78f2b056cdb99ad9cd3892f3c0617c5a485fb300dd90c572ce375ee45b2" bpSimpleLayersDiffID := "sha256:285ff6683c99e5ae19805f6a62168fb40dca64d813c53b782604c9652d745c70" bpReadEnvDiffID := "sha256:dd1e0efcbf3f08b014ef6eff9cfe7a9eac1cf20bd9b6a71a946f0a74575aa56f" if imageManager.HostOS() == "windows" { // Windows containers on Windows From 6f85f8822f9b8345e1b3556e9a364427d9bdf55a Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 4 Aug 2023 11:10:32 -0400 Subject: [PATCH 32/86] Update ext fixture SHA for Windows Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index ed0bd6d23..a3c42c5a9 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -802,7 +802,7 @@ func testAcceptance( bpReadEnvDiffID := "sha256:dd1e0efcbf3f08b014ef6eff9cfe7a9eac1cf20bd9b6a71a946f0a74575aa56f" if imageManager.HostOS() == "windows" { // Windows containers on Windows extSimpleLayersDiffID = "sha256:a063cf949b9c267133e451ac8cd95b4e77571bb7c629dd817461dca769170810" - extReadEnvDiffID = "sha256:4c37e22595762315d28805f32e1f5fd48b4ddfc293ef7b41e0e609a4241b8479" + extReadEnvDiffID = "sha256:ae9520eef7d84f69da6adf2597266660ce3fa5fd8ddac716cbfbecb67ded50e5" bpSimpleLayersDiffID = "sha256:ccd1234cc5685e8a412b70c5f9a8e7b584b8e4f2a20c987ec242c9055de3e45e" bpReadEnvDiffID = "sha256:8b22a7742ffdfbdd978787c6937456b68afb27c3585a3903048be7434d251e3f" } From 26535882a448c82e2ce489e617c2d643167a0cf5 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Fri, 16 Jun 2023 08:45:15 +0200 Subject: [PATCH 33/86] Introduces the rebasable label into the human readable output for local rebasable images Signed-off-by: Domenico Luciani --- internal/inspectimage/info_display.go | 2 + .../inspectimage/writer/human_readable.go | 14 ++- .../writer/human_readable_test.go | 111 +++++++++++++++++- pkg/client/inspect_image.go | 3 + 4 files changed, 126 insertions(+), 4 deletions(-) diff --git a/internal/inspectimage/info_display.go b/internal/inspectimage/info_display.go index f7b1e4056..db842812d 100644 --- a/internal/inspectimage/info_display.go +++ b/internal/inspectimage/info_display.go @@ -46,6 +46,7 @@ type InfoDisplay struct { Buildpacks []dist.ModuleInfo `json:"buildpacks" yaml:"buildpacks" toml:"buildpacks"` Extensions []dist.ModuleInfo `json:"extensions" yaml:"extensions" toml:"extensions"` Processes []ProcessDisplay `json:"processes" yaml:"processes" toml:"processes"` + Rebasable bool `json:"rebasable" yaml:"rebasable" toml:"rebasable"` } type InspectOutput struct { @@ -74,6 +75,7 @@ func NewInfoDisplay(info *client.ImageInfo, generalInfo GeneralInfo) *InfoDispla RunImageMirrors: displayMirrors(info, generalInfo), Buildpacks: displayBuildpacks(info.Buildpacks), Processes: displayProcesses(info.Processes), + Rebasable: info.Rebasable, } } diff --git a/internal/inspectimage/writer/human_readable.go b/internal/inspectimage/writer/human_readable.go index 3883b2501..4215a06d3 100644 --- a/internal/inspectimage/writer/human_readable.go +++ b/internal/inspectimage/writer/human_readable.go @@ -58,13 +58,15 @@ func writeImageInfo( Funcs(template.FuncMap{"StringsJoin": strings.Join}). Funcs(template.FuncMap{"StringsValueOrDefault": strs.ValueOrDefault}). Parse(runImagesTemplate)) - imgTpl = template.Must(imgTpl.New("buildpacks"). - Parse(buildpacksTemplate)) + imgTpl = template.Must(imgTpl.New("buildpacks").Parse(buildpacksTemplate)) if info != nil && info.Extensions != nil { imgTpl = template.Must(imgTpl.New("extensions").Parse(extensionsTemplate)) } imgTpl = template.Must(imgTpl.New("processes"). Parse(processesTemplate)) + + imgTpl = template.Must(imgTpl.New("rebasable").Parse(rebasableTemplate)) + if info != nil && info.Extensions != nil { imgTpl = template.Must(imgTpl.New("image"). Parse(imageWithExtensionTemplate)) @@ -72,6 +74,7 @@ func writeImageInfo( imgTpl = template.Must(imgTpl.New("image"). Parse(imageTemplate)) } + if err != nil { logger.Errorf("%s\n", err) return nil @@ -158,6 +161,12 @@ Processes: {{- end }} {{- end }}` +var rebasableTemplate = ` +{{- if .Info.Rebasable -}} +{{- "\n\n" -}} +Rebasable: true +{{- end -}}` + var imageTemplate = ` Stack: {{ .Info.StackID }} @@ -167,6 +176,7 @@ Base Image: {{- end}} Top Layer: {{ .Info.Base.TopLayer }} {{ template "runImages" . }} +{{- template "rebasable" . }} {{ template "buildpacks" . }}{{ template "processes" . }}` var imageWithExtensionTemplate = ` diff --git a/internal/inspectimage/writer/human_readable_test.go b/internal/inspectimage/writer/human_readable_test.go index 54369b79d..5624035c4 100644 --- a/internal/inspectimage/writer/human_readable_test.go +++ b/internal/inspectimage/writer/human_readable_test.go @@ -32,8 +32,9 @@ func testHumanReadable(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - localInfo *client.ImageInfo + remoteInfo *client.ImageInfo + localInfo *client.ImageInfo + localInfoWithRebasable *client.ImageInfo remoteWithExtensionInfo *client.ImageInfo localWithExtensionInfo *client.ImageInfo @@ -77,6 +78,33 @@ Run Images: some-local-mirror other-local-mirror +Buildpacks: + ID VERSION HOMEPAGE + test.bp.one.local 1.0.0 https://some-homepage-one + test.bp.two.local 2.0.0 https://some-homepage-two + test.bp.three.local 3.0.0 - + +Processes: + TYPE SHELL COMMAND ARGS WORK DIR + some-local-type (default) bash /some/local command some local args /some-test-work-dir + other-local-type /other/local/command other local args /other-test-work-dir` + + expectedLocalOutputWithRebasable = `LOCAL: + +Stack: test.stack.id.local + +Base Image: + Reference: some-local-run-image-reference + Top Layer: some-local-top-layer + +Run Images: + user-configured-mirror-for-local (user-configured) + some-local-run-image + some-local-mirror + other-local-mirror + +Rebasable: true + Buildpacks: ID VERSION HOMEPAGE test.bp.one.local 1.0.0 https://some-homepage-one @@ -270,6 +298,57 @@ Processes: }, } + localInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.local", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + {ID: "test.bp.three.local", Version: "3.0.0"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-local-top-layer", + Reference: "some-local-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-local-run-image", + Mirrors: []string{"some-local-mirror", "other-local-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "LocalData": someData{ + Bool: false, + Int: 456, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-local-type", + Command: launch.RawCommand{Entries: []string{"/some/local command"}}, + Args: []string{"some", "local", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-local-type", + Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, + Args: []string{"other", "local", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } + remoteWithExtensionInfo = &client.ImageInfo{ StackID: "test.stack.id.remote", Buildpacks: []buildpack.GroupElement{ @@ -480,6 +559,34 @@ Processes: assert.Contains(outBuf.String(), expectedLocalOutput) assert.NotContains(outBuf.String(), expectedRemoteOutput) }) + it("prints local rebasable image info in a human readable format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + humanReadableWriter := writer.NewHumanReadable() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := humanReadableWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + assert.Nil(err) + + assert.Contains(outBuf.String(), expectedLocalOutputWithRebasable) + assert.NotContains(outBuf.String(), expectedRemoteOutput) + }) }) when("only localWithExtension image exists", func() { diff --git a/pkg/client/inspect_image.go b/pkg/client/inspect_image.go index e56ef4b6b..abd3df128 100644 --- a/pkg/client/inspect_image.go +++ b/pkg/client/inspect_image.go @@ -55,6 +55,9 @@ type ImageInfo struct { // Processes lists all processes contributed by buildpacks. Processes ProcessDetails + + // If the image can be rebased + Rebasable bool } // ProcessDetails is a collection of all start command metadata From 83bbe1f754ec858818763629288f1230f83c0506 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Fri, 16 Jun 2023 09:57:23 +0200 Subject: [PATCH 34/86] Adds test for the remote rebasable image Signed-off-by: Domenico Luciani --- .../writer/human_readable_test.go | 119 +++++++++++++++++- 1 file changed, 116 insertions(+), 3 deletions(-) diff --git a/internal/inspectimage/writer/human_readable_test.go b/internal/inspectimage/writer/human_readable_test.go index 5624035c4..4ffd0b259 100644 --- a/internal/inspectimage/writer/human_readable_test.go +++ b/internal/inspectimage/writer/human_readable_test.go @@ -32,9 +32,10 @@ func testHumanReadable(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - localInfo *client.ImageInfo - localInfoWithRebasable *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoWithRebasable *client.ImageInfo + localInfo *client.ImageInfo + localInfoWithRebasable *client.ImageInfo remoteWithExtensionInfo *client.ImageInfo localWithExtensionInfo *client.ImageInfo @@ -53,6 +54,33 @@ Run Images: some-remote-mirror other-remote-mirror +Buildpacks: + ID VERSION HOMEPAGE + test.bp.one.remote 1.0.0 https://some-homepage-one + test.bp.two.remote 2.0.0 https://some-homepage-two + test.bp.three.remote 3.0.0 - + +Processes: + TYPE SHELL COMMAND ARGS WORK DIR + some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir + other-remote-type /other/remote/command other remote args /other-test-work-dir` + + expectedRemoteOutputWithRebasable = `REMOTE: + +Stack: test.stack.id.remote + +Base Image: + Reference: some-remote-run-image-reference + Top Layer: some-remote-top-layer + +Run Images: + user-configured-mirror-for-remote (user-configured) + some-remote-run-image + some-remote-mirror + other-remote-mirror + +Rebasable: true + Buildpacks: ID VERSION HOMEPAGE test.bp.one.remote 1.0.0 https://some-homepage-one @@ -248,6 +276,63 @@ Processes: }, } + remoteInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.remote", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + {ID: "test.bp.three.remote", Version: "3.0.0"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-remote-top-layer", + Reference: "some-remote-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-remote-run-image", + Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "RemoteData": someData{ + String: "aString", + Bool: true, + Int: 123, + Nested: struct { + String string + }{ + String: "anotherString", + }, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-remote-type", + Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, + Args: []string{"some", "remote", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-remote-type", + Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, + Args: []string{"other", "remote", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } + localInfo = &client.ImageInfo{ StackID: "test.stack.id.local", Buildpacks: []buildpack.GroupElement{ @@ -649,6 +734,34 @@ Processes: assert.NotContains(outBuf.String(), expectedLocalOutput) assert.Contains(outBuf.String(), expectedRemoteOutput) }) + it("prints remote rebasable image info in a human readable format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + humanReadableWriter := writer.NewHumanReadable() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := humanReadableWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) + assert.Nil(err) + + assert.Contains(outBuf.String(), expectedRemoteOutputWithRebasable) + assert.NotContains(outBuf.String(), expectedLocalOutput) + }) when("buildpack metadata is missing", func() { it.Before(func() { From 23174d127f061ff397c5aa37f095d451138f5a4b Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Fri, 16 Jun 2023 10:00:52 +0200 Subject: [PATCH 35/86] Fixs toml tests and adds tests fort the local and remote rebasable images Signed-off-by: Domenico Luciani --- internal/inspectimage/writer/toml_test.go | 284 +++++++++++++++++++++- 1 file changed, 282 insertions(+), 2 deletions(-) diff --git a/internal/inspectimage/writer/toml_test.go b/internal/inspectimage/writer/toml_test.go index 0e1406df6..bae26d643 100644 --- a/internal/inspectimage/writer/toml_test.go +++ b/internal/inspectimage/writer/toml_test.go @@ -30,11 +30,70 @@ func testTOML(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - localInfo *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoWithRebasable *client.ImageInfo + localInfo *client.ImageInfo + localInfoWithRebasable *client.ImageInfo expectedLocalOutput = `[local_info] stack = 'test.stack.id.local' +rebasable = false + +[local_info.base_image] +top_layer = 'some-local-top-layer' +reference = 'some-local-run-image-reference' + +[[local_info.run_images]] +name = 'user-configured-mirror-for-local' +user_configured = true + +[[local_info.run_images]] +name = 'some-local-run-image' + +[[local_info.run_images]] +name = 'some-local-mirror' + +[[local_info.run_images]] +name = 'other-local-mirror' + +[[local_info.buildpacks]] +id = 'test.bp.one.local' +version = '1.0.0' +homepage = 'https://some-homepage-one' + +[[local_info.buildpacks]] +id = 'test.bp.two.local' +version = '2.0.0' +homepage = 'https://some-homepage-two' + +[[local_info.processes]] +type = 'some-local-type' +shell = 'bash' +command = '/some/local command' +default = true +args = [ + 'some', + 'local', + 'args', +] +working-dir = "/some-test-work-dir" + +[[local_info.processes]] +type = 'other-local-type' +shell = '' +command = '/other/local/command' +default = false +args = [ + 'other', + 'local', + 'args', +] +working-dir = "/other-test-work-dir" +` + + expectedLocalOutputWithRebasable = `[local_info] +stack = 'test.stack.id.local' +rebasable = true [local_info.base_image] top_layer = 'some-local-top-layer' @@ -91,6 +150,64 @@ working-dir = "/other-test-work-dir" expectedRemoteOutput = ` [remote_info] stack = 'test.stack.id.remote' +rebasable = false + +[remote_info.base_image] +top_layer = 'some-remote-top-layer' +reference = 'some-remote-run-image-reference' + +[[remote_info.run_images]] +name = 'user-configured-mirror-for-remote' +user_configured = true + +[[remote_info.run_images]] +name = 'some-remote-run-image' + +[[remote_info.run_images]] +name = 'some-remote-mirror' + +[[remote_info.run_images]] +name = 'other-remote-mirror' + +[[remote_info.buildpacks]] +id = 'test.bp.one.remote' +version = '1.0.0' +homepage = 'https://some-homepage-one' + +[[remote_info.buildpacks]] +id = 'test.bp.two.remote' +version = '2.0.0' +homepage = 'https://some-homepage-two' + +[[remote_info.processes]] +type = 'some-remote-type' +shell = 'bash' +command = '/some/remote command' +default = true +args = [ + 'some', + 'remote', + 'args', +] +working-dir = "/some-test-work-dir" + +[[remote_info.processes]] +type = 'other-remote-type' +shell = '' +command = '/other/remote/command' +default = false +args = [ + 'other', + 'remote', + 'args', +] +working-dir = "/other-test-work-dir" +` + + expectedRemoteOutputWithRebasable = ` +[remote_info] +stack = 'test.stack.id.remote' +rebasable = true [remote_info.base_image] top_layer = 'some-remote-top-layer' @@ -210,6 +327,61 @@ working-dir = "/other-test-work-dir" }, }, } + remoteInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.remote", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-remote-top-layer", + Reference: "some-remote-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-remote-run-image", + Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "RemoteData": someData{ + String: "aString", + Bool: true, + Int: 123, + Nested: struct { + String string + }{ + String: "anotherString", + }, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-remote-type", + Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, + Args: []string{"some", "remote", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-remote-type", + Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, + Args: []string{"other", "remote", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } localInfo = &client.ImageInfo{ StackID: "test.stack.id.local", @@ -260,6 +432,56 @@ working-dir = "/other-test-work-dir" }, } + localInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.local", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-local-top-layer", + Reference: "some-local-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-local-run-image", + Mirrors: []string{"some-local-mirror", "other-local-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "LocalData": someData{ + Bool: false, + Int: 456, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-local-type", + Command: launch.RawCommand{Entries: []string{"/some/local command"}}, + Args: []string{"some", "local", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-local-type", + Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, + Args: []string{"other", "local", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } + outBuf = bytes.Buffer{} }) @@ -325,6 +547,35 @@ working-dir = "/other-test-work-dir" assert.NotContains(outBuf.String(), "test.stack.id.remote") assert.ContainsTOML(outBuf.String(), expectedLocalOutput) }) + it("prints local rebasable image info in TOML format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + tomlWriter := writer.NewTOML() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := tomlWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + assert.Nil(err) + + assert.ContainsTOML(outBuf.String(), `image_name = "test-image"`) + assert.NotContains(outBuf.String(), "test.stack.id.remote") + assert.ContainsTOML(outBuf.String(), expectedLocalOutputWithRebasable) + }) }) when("only remote image exists", func() { @@ -357,6 +608,35 @@ working-dir = "/other-test-work-dir" assert.NotContains(outBuf.String(), "test.stack.id.local") assert.ContainsTOML(outBuf.String(), expectedRemoteOutput) }) + it("prints remote rebasable image info in TOML format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + tomlWriter := writer.NewTOML() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := tomlWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) + assert.Nil(err) + + assert.ContainsTOML(outBuf.String(), `image_name = "test-image"`) + assert.NotContains(outBuf.String(), "test.stack.id.local") + assert.ContainsTOML(outBuf.String(), expectedRemoteOutputWithRebasable) + }) }) }) } From 56566db5a4deb266c1eda741950f5a0eefb040cb Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Fri, 16 Jun 2023 11:54:15 +0200 Subject: [PATCH 36/86] Fixs yaml tests and adds test for local and remote the rebasable images Signed-off-by: Domenico Luciani --- internal/inspectimage/writer/yaml_test.go | 254 +++++++++++++++++++++- 1 file changed, 251 insertions(+), 3 deletions(-) diff --git a/internal/inspectimage/writer/yaml_test.go b/internal/inspectimage/writer/yaml_test.go index 3a422eb52..13d676c96 100644 --- a/internal/inspectimage/writer/yaml_test.go +++ b/internal/inspectimage/writer/yaml_test.go @@ -30,12 +30,56 @@ func testYAML(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - localInfo *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoWithRebasable *client.ImageInfo + localInfo *client.ImageInfo + localInfoWithRebasable *client.ImageInfo expectedLocalOutput = `--- local_info: stack: test.stack.id.local + rebasable: false + base_image: + top_layer: some-local-top-layer + reference: some-local-run-image-reference + run_images: + - name: user-configured-mirror-for-local + user_configured: true + - name: some-local-run-image + - name: some-local-mirror + - name: other-local-mirror + buildpacks: + - homepage: https://some-homepage-one + id: test.bp.one.local + version: 1.0.0 + - homepage: https://some-homepage-two + id: test.bp.two.local + version: 2.0.0 + extensions: [] + processes: + - type: some-local-type + shell: bash + command: "/some/local command" + default: true + args: + - some + - local + - args + working-dir: /some-test-work-dir + - type: other-local-type + shell: '' + command: "/other/local/command" + default: false + args: + - other + - local + - args + working-dir: /other-test-work-dir +` + expectedLocalOutputWithRebasable = `--- +local_info: + stack: test.stack.id.local + rebasable: true base_image: top_layer: some-local-top-layer reference: some-local-run-image-reference @@ -76,6 +120,48 @@ local_info: expectedRemoteOutput = `--- remote_info: stack: test.stack.id.remote + rebasable: false + base_image: + top_layer: some-remote-top-layer + reference: some-remote-run-image-reference + run_images: + - name: user-configured-mirror-for-remote + user_configured: true + - name: some-remote-run-image + - name: some-remote-mirror + - name: other-remote-mirror + buildpacks: + - homepage: https://some-homepage-one + id: test.bp.one.remote + version: 1.0.0 + - homepage: https://some-homepage-two + id: test.bp.two.remote + version: 2.0.0 + extensions: [] + processes: + - type: some-remote-type + shell: bash + command: "/some/remote command" + default: true + args: + - some + - remote + - args + working-dir: /some-test-work-dir + - type: other-remote-type + shell: '' + command: "/other/remote/command" + default: false + args: + - other + - remote + - args + working-dir: /other-test-work-dir +` + expectedRemoteOutputWithRebasable = `--- +remote_info: + stack: test.stack.id.remote + rebasable: true base_image: top_layer: some-remote-top-layer reference: some-remote-run-image-reference @@ -181,6 +267,62 @@ remote_info: }, } + remoteInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.remote", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-remote-top-layer", + Reference: "some-remote-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-remote-run-image", + Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "RemoteData": someData{ + String: "aString", + Bool: true, + Int: 123, + Nested: struct { + String string + }{ + String: "anotherString", + }, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-remote-type", + Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, + Args: []string{"some", "remote", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-remote-type", + Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, + Args: []string{"other", "remote", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } + localInfo = &client.ImageInfo{ StackID: "test.stack.id.local", Buildpacks: []buildpack.GroupElement{ @@ -230,6 +372,56 @@ remote_info: }, } + localInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.local", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-local-top-layer", + Reference: "some-local-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-local-run-image", + Mirrors: []string{"some-local-mirror", "other-local-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "LocalData": someData{ + Bool: false, + Int: 456, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-local-type", + Command: launch.RawCommand{Entries: []string{"/some/local command"}}, + Args: []string{"some", "local", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-local-type", + Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, + Args: []string{"other", "local", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } + outBuf = bytes.Buffer{} }) @@ -293,9 +485,36 @@ remote_info: assert.ContainsYAML(outBuf.String(), `"image_name": "test-image"`) assert.ContainsYAML(outBuf.String(), expectedLocalOutput) + assert.NotContains(outBuf.String(), "test.stack.id.remote") + }) + it("prints local rebasable image info in YAML format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + yamlWriter := writer.NewYAML() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := yamlWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + assert.Nil(err) + assert.ContainsYAML(outBuf.String(), `"image_name": "test-image"`) + assert.ContainsYAML(outBuf.String(), expectedLocalOutputWithRebasable) assert.NotContains(outBuf.String(), "test.stack.id.remote") - assert.ContainsYAML(outBuf.String(), expectedLocalOutput) }) }) @@ -329,6 +548,35 @@ remote_info: assert.NotContains(outBuf.String(), "test.stack.id.local") assert.ContainsYAML(outBuf.String(), expectedRemoteOutput) }) + it("prints remote rebasable image info in YAML format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + yamlWriter := writer.NewYAML() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := yamlWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) + assert.Nil(err) + + assert.ContainsYAML(outBuf.String(), `"image_name": "test-image"`) + assert.ContainsYAML(outBuf.String(), expectedRemoteOutputWithRebasable) + assert.NotContains(outBuf.String(), "test.stack.id.local") + }) }) }) } From 88272d813f796ca2031832a6fd57fedcfed8a697 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Fri, 16 Jun 2023 11:58:33 +0200 Subject: [PATCH 37/86] Fixs json tests and adds tests for local and remote the rebasable images Signed-off-by: Domenico Luciani --- internal/inspectimage/writer/json_test.go | 300 +++++++++++++++++++++- 1 file changed, 298 insertions(+), 2 deletions(-) diff --git a/internal/inspectimage/writer/json_test.go b/internal/inspectimage/writer/json_test.go index b08e1a108..519a8609c 100644 --- a/internal/inspectimage/writer/json_test.go +++ b/internal/inspectimage/writer/json_test.go @@ -30,12 +30,79 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - localInfo *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoWithRebasable *client.ImageInfo + localInfo *client.ImageInfo + localInfoWithRebasable *client.ImageInfo expectedLocalOutput = `{ "local_info": { "stack": "test.stack.id.local", + "rebasable": false, + "base_image": { + "top_layer": "some-local-top-layer", + "reference": "some-local-run-image-reference" + }, + "run_images": [ + { + "name": "user-configured-mirror-for-local", + "user_configured": true + }, + { + "name": "some-local-run-image" + }, + { + "name": "some-local-mirror" + }, + { + "name": "other-local-mirror" + } + ], + "buildpacks": [ + { + "homepage": "https://some-homepage-one", + "id": "test.bp.one.local", + "version": "1.0.0" + }, + { + "homepage": "https://some-homepage-two", + "id": "test.bp.two.local", + "version": "2.0.0" + } + ], + "extensions": null, + "processes": [ + { + "type": "some-local-type", + "shell": "bash", + "command": "/some/local command", + "default": true, + "args": [ + "some", + "local", + "args" + ], + "working-dir": "/some-test-work-dir" + }, + { + "type": "other-local-type", + "shell": "", + "command": "/other/local/command", + "default": false, + "args": [ + "other", + "local", + "args" + ], + "working-dir": "/other-test-work-dir" + } + ] + } +}` + expectedLocalOutputWithRebasable = `{ + "local_info": { + "stack": "test.stack.id.local", + "rebasable": true, "base_image": { "top_layer": "some-local-top-layer", "reference": "some-local-run-image-reference" @@ -99,6 +166,71 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { expectedRemoteOutput = `{ "remote_info": { "stack": "test.stack.id.remote", + "rebasable": false, + "base_image": { + "top_layer": "some-remote-top-layer", + "reference": "some-remote-run-image-reference" + }, + "run_images": [ + { + "name": "user-configured-mirror-for-remote", + "user_configured": true + }, + { + "name": "some-remote-run-image" + }, + { + "name": "some-remote-mirror" + }, + { + "name": "other-remote-mirror" + } + ], + "buildpacks": [ + { + "id": "test.bp.one.remote", + "version": "1.0.0", + "homepage": "https://some-homepage-one" + }, + { + "id": "test.bp.two.remote", + "version": "2.0.0", + "homepage": "https://some-homepage-two" + } + ], + "extensions": null, + "processes": [ + { + "type": "some-remote-type", + "shell": "bash", + "command": "/some/remote command", + "default": true, + "args": [ + "some", + "remote", + "args" + ], + "working-dir": "/some-test-work-dir" + }, + { + "type": "other-remote-type", + "shell": "", + "command": "/other/remote/command", + "default": false, + "args": [ + "other", + "remote", + "args" + ], + "working-dir": "/other-test-work-dir" + } + ] + } +}` + expectedRemoteOutputWithRebasable = `{ + "remote_info": { + "stack": "test.stack.id.remote", + "rebasable": true, "base_image": { "top_layer": "some-remote-top-layer", "reference": "some-remote-run-image-reference" @@ -227,6 +359,62 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { }, } + remoteInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.remote", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-remote-top-layer", + Reference: "some-remote-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-remote-run-image", + Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "RemoteData": someData{ + String: "aString", + Bool: true, + Int: 123, + Nested: struct { + String string + }{ + String: "anotherString", + }, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-remote-type", + Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, + Args: []string{"some", "remote", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-remote-type", + Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, + Args: []string{"other", "remote", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } + localInfo = &client.ImageInfo{ StackID: "test.stack.id.local", Buildpacks: []buildpack.GroupElement{ @@ -276,6 +464,56 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { }, } + localInfoWithRebasable = &client.ImageInfo{ + StackID: "test.stack.id.local", + Buildpacks: []buildpack.GroupElement{ + {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + }, + Base: platform.RunImageForRebase{ + TopLayer: "some-local-top-layer", + Reference: "some-local-run-image-reference", + }, + Stack: platform.StackMetadata{ + RunImage: platform.RunImageForExport{ + Image: "some-local-run-image", + Mirrors: []string{"some-local-mirror", "other-local-mirror"}, + }, + }, + BOM: []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: map[string]interface{}{ + "LocalData": someData{ + Bool: false, + Int: 456, + }, + }, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + }}, + Processes: client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-local-type", + Command: launch.RawCommand{Entries: []string{"/some/local command"}}, + Args: []string{"some", "local", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-local-type", + Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, + Args: []string{"other", "local", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + }, + Rebasable: true, + } + outBuf = bytes.Buffer{} }) @@ -343,6 +581,35 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { assert.NotContains(outBuf.String(), "test.stack.id.remote") assert.ContainsJSON(outBuf.String(), expectedLocalOutput) }) + it("prints local rebasable image info in JSON format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + jsonWriter := writer.NewJSON() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := jsonWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + assert.Nil(err) + + assert.ContainsJSON(outBuf.String(), `{ "image_name": "test-image" }`) + assert.ContainsJSON(outBuf.String(), expectedLocalOutputWithRebasable) + assert.NotContains(outBuf.String(), "test.stack.id.remote") + }) }) when("only remote image exists", func() { @@ -375,6 +642,35 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { assert.NotContains(outBuf.String(), "test.stack.id.local") assert.ContainsJSON(outBuf.String(), expectedRemoteOutput) }) + it("prints remote rebasable image info in JSON format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + jsonWriter := writer.NewJSON() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := jsonWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) + assert.Nil(err) + + assert.ContainsJSON(outBuf.String(), `{ "image_name": "test-image" }`) + assert.NotContains(outBuf.String(), "test.stack.id.local") + assert.ContainsJSON(outBuf.String(), expectedRemoteOutputWithRebasable) + }) }) }) } From 22de7ccae1bf1343bf232f4862b84a81368c1d8b Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Fri, 16 Jun 2023 18:06:25 +0200 Subject: [PATCH 38/86] Fixs acceptance tests and implements rebasable on the inspect command Signed-off-by: Domenico Luciani --- acceptance/acceptance_test.go | 2 + .../inspect_image_local_output.json | 1 + .../inspect_image_local_output.toml | 1 + .../inspect_image_local_output.yaml | 1 + .../inspect_image_published_output.json | 1 + .../inspect_image_published_output.toml | 1 + .../inspect_image_published_output.yaml | 1 + pkg/client/inspect_image.go | 7 + pkg/client/inspect_image_test.go | 170 ++++++++++++++++-- 9 files changed, 174 insertions(+), 11 deletions(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 837b95036..8bcb686df 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -1153,6 +1153,7 @@ func testAcceptance( "hello_args": helloArgs, "hello_args_prefix": helloArgsPrefix, "image_workdir": imageWorkdir, + "rebasable": false, }, ) @@ -1826,6 +1827,7 @@ func testAcceptance( "hello_args": helloArgs, "hello_args_prefix": helloArgsPrefix, "image_workdir": imageWorkdir, + "rebasable": false, }, ) diff --git a/acceptance/testdata/pack_fixtures/inspect_image_local_output.json b/acceptance/testdata/pack_fixtures/inspect_image_local_output.json index 94fb3afc8..08bee028c 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_local_output.json +++ b/acceptance/testdata/pack_fixtures/inspect_image_local_output.json @@ -3,6 +3,7 @@ "remote_info": null, "local_info": { "stack": "pack.test.stack", + "rebasable": false, "base_image": { "top_layer": "{{.base_image_top_layer}}", "reference": "{{.base_image_id}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml b/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml index 97be50630..4a2f816db 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml +++ b/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml @@ -2,6 +2,7 @@ image_name = "{{.image_name}}" [local_info] stack = "pack.test.stack" +rebasable = false [local_info.base_image] top_layer = "{{.base_image_top_layer}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml b/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml index 05e8135e5..b3d8b757f 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml +++ b/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml @@ -3,6 +3,7 @@ image_name: "{{.image_name}}" remote_info: local_info: stack: pack.test.stack + rebasable: false base_image: top_layer: "{{.base_image_top_layer}}" reference: "{{.base_image_id}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_published_output.json b/acceptance/testdata/pack_fixtures/inspect_image_published_output.json index 38d2cc07a..4945e2f81 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_published_output.json +++ b/acceptance/testdata/pack_fixtures/inspect_image_published_output.json @@ -3,6 +3,7 @@ "local_info": null, "remote_info": { "stack": "pack.test.stack", + "rebasable": false, "base_image": { "top_layer": "{{.base_image_top_layer}}", "reference": "{{.base_image_ref}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml b/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml index 734eaad21..4d86d0d8f 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml +++ b/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml @@ -2,6 +2,7 @@ image_name = "{{.image_name}}" [remote_info] stack = "pack.test.stack" +rebasable = false [remote_info.base_image] top_layer = "{{.base_image_top_layer}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml b/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml index 290f7a6bb..cbcdb3e6e 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml +++ b/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml @@ -3,6 +3,7 @@ image_name: "{{.image_name}}" local_info: null remote_info: stack: pack.test.stack + rebasable: false base_image: top_layer: "{{.base_image_top_layer}}" reference: "{{.base_image_ref}}" diff --git a/pkg/client/inspect_image.go b/pkg/client/inspect_image.go index abd3df128..dbb227f34 100644 --- a/pkg/client/inspect_image.go +++ b/pkg/client/inspect_image.go @@ -123,6 +123,11 @@ func (c *Client) InspectImage(name string, daemon bool) (*ImageInfo, error) { return nil, err } + var rebasable bool + if _, err := dist.GetLabel(img, platform.RebaseableLabel, &rebasable); err != nil { + return nil, err + } + platformAPI, err := img.Env(platformAPIEnv) if err != nil { return nil, errors.Wrap(err, "reading platform api") @@ -196,6 +201,7 @@ func (c *Client) InspectImage(name string, daemon bool) (*ImageInfo, error) { Buildpacks: buildMD.Buildpacks, Extensions: buildMD.Extensions, Processes: processDetails, + Rebasable: rebasable, }, nil } @@ -206,5 +212,6 @@ func (c *Client) InspectImage(name string, daemon bool) (*ImageInfo, error) { BOM: buildMD.BOM, Buildpacks: buildMD.Buildpacks, Processes: processDetails, + Rebasable: rebasable, }, nil } diff --git a/pkg/client/inspect_image_test.go b/pkg/client/inspect_image_test.go index fe71947aa..ee786043a 100644 --- a/pkg/client/inspect_image_test.go +++ b/pkg/client/inspect_image_test.go @@ -37,13 +37,15 @@ var ignorePlatformAPI = []cmp.Option{ func testInspectImage(t *testing.T, when spec.G, it spec.S) { var ( - subject *Client - mockImageFetcher *testmocks.MockImageFetcher - mockDockerClient *testmocks.MockCommonAPIClient - mockController *gomock.Controller - mockImage *testmocks.MockImage - mockImageWithExtension *testmocks.MockImage - out bytes.Buffer + subject *Client + mockImageFetcher *testmocks.MockImageFetcher + mockDockerClient *testmocks.MockCommonAPIClient + mockController *gomock.Controller + mockImage *testmocks.MockImage + mockRebasableImage *testmocks.MockImage + mockImageWithExtension *testmocks.MockImage + mockRebasableImageWithExtension *testmocks.MockImage + out bytes.Buffer ) it.Before(func() { @@ -114,6 +116,66 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { }`, )) + mockRebasableImage = testmocks.NewImage("some/rebasableImage", "", nil) + h.AssertNil(t, mockRebasableImage.SetWorkingDir("/test-workdir")) + h.AssertNil(t, mockRebasableImage.SetLabel("io.buildpacks.stack.id", "test.stack.id")) + h.AssertNil(t, mockRebasableImage.SetLabel( + "io.buildpacks.lifecycle.metadata", + `{ + "stack": { + "runImage": { + "image": "some-run-image", + "mirrors": [ + "some-mirror", + "other-mirror" + ] + } + }, + "runImage": { + "topLayer": "some-top-layer", + "reference": "some-run-image-reference" + } +}`, + )) + h.AssertNil(t, mockRebasableImage.SetLabel( + "io.buildpacks.build.metadata", + `{ + "bom": [ + { + "name": "some-bom-element" + } + ], + "buildpacks": [ + { + "id": "some-buildpack", + "version": "some-version" + }, + { + "id": "other-buildpack", + "version": "other-version" + } + ], + "processes": [ + { + "type": "other-process", + "command": "/other/process", + "args": ["opt", "1"], + "direct": true + }, + { + "type": "web", + "command": "/start/web-process", + "args": ["-p", "1234"], + "direct": false + } + ], + "launcher": { + "version": "0.5.0" + } +}`, + )) + h.AssertNil(t, mockRebasableImage.SetLabel("io.buildpacks.rebasable", "true")) + mockImageWithExtension = testmocks.NewImage("some/imageWithExtension", "", nil) h.AssertNil(t, mockImageWithExtension.SetWorkingDir("/test-workdir")) h.AssertNil(t, mockImageWithExtension.SetLabel("io.buildpacks.stack.id", "test.stack.id")) @@ -182,6 +244,76 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { } }`, )) + + mockRebasableImageWithExtension = testmocks.NewImage("some/rebasableImageWithExtension", "", nil) + h.AssertNil(t, mockRebasableImageWithExtension.SetWorkingDir("/test-workdir")) + h.AssertNil(t, mockRebasableImageWithExtension.SetLabel("io.buildpacks.stack.id", "test.stack.id")) + h.AssertNil(t, mockRebasableImageWithExtension.SetLabel( + "io.buildpacks.lifecycle.metadata", + `{ + "stack": { + "runImage": { + "image": "some-run-image", + "mirrors": [ + "some-mirror", + "other-mirror" + ] + } + }, + "runImage": { + "topLayer": "some-top-layer", + "reference": "some-run-image-reference" + } +}`, + )) + h.AssertNil(t, mockRebasableImageWithExtension.SetLabel( + "io.buildpacks.build.metadata", + `{ + "bom": [ + { + "name": "some-bom-element" + } + ], + "buildpacks": [ + { + "id": "some-buildpack", + "version": "some-version" + }, + { + "id": "other-buildpack", + "version": "other-version" + } + ], + "extensions": [ + { + "id": "some-extension", + "version": "some-version" + }, + { + "id": "other-extension", + "version": "other-version" + } + ], + "processes": [ + { + "type": "other-process", + "command": "/other/process", + "args": ["opt", "1"], + "direct": true + }, + { + "type": "web", + "command": "/start/web-process", + "args": ["-p", "1234"], + "direct": false + } + ], + "launcher": { + "version": "0.5.0" + } +}`, + )) + h.AssertNil(t, mockRebasableImageWithExtension.SetLabel("io.buildpacks.rebasable", "true")) }) it.After(func() { @@ -195,10 +327,14 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { it.Before(func() { if useDaemon { mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/image", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImage, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImage", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockRebasableImage, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageWithExtension", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImageWithExtension, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImageWithExtension", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockRebasableImageWithExtension, nil).AnyTimes() } else { mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/image", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImage, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImage", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockRebasableImage, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageWithExtension", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImageWithExtension, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImageWithExtension", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockRebasableImageWithExtension, nil).AnyTimes() } }) @@ -208,7 +344,7 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { h.AssertEq(t, info.StackID, "test.stack.id") }) - it("returns the stack ID", func() { + it("returns the stack ID with extension", func() { infoWithExtension, err := subject.InspectImage("some/imageWithExtension", useDaemon) h.AssertNil(t, err) h.AssertEq(t, infoWithExtension.StackID, "test.stack.id") @@ -247,7 +383,7 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { ) }) - it("returns the stack", func() { + it("returns the stack with extension", func() { infoWithExtension, err := subject.InspectImage("some/imageWithExtension", useDaemon) h.AssertNil(t, err) h.AssertEq(t, infoWithExtension.Stack, @@ -274,7 +410,7 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { ) }) - it("returns the base image", func() { + it("returns the base image with extension", func() { infoWithExtension, err := subject.InspectImage("some/imageWithExtension", useDaemon) h.AssertNil(t, err) h.AssertEq(t, infoWithExtension.Base, @@ -285,6 +421,18 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { ) }) + it("returns the rebasable image", func() { + info, err := subject.InspectImage("some/rebasableImage", useDaemon) + h.AssertNil(t, err) + h.AssertEq(t, info.Rebasable, true) + }) + + it("returns the rebasable image with Extension", func() { + infoRebasableWithExtension, err := subject.InspectImage("some/rebasableImageWithExtension", useDaemon) + h.AssertNil(t, err) + h.AssertEq(t, infoRebasableWithExtension.Rebasable, true) + }) + it("returns the BOM", func() { info, err := subject.InspectImage("some/image", useDaemon) h.AssertNil(t, err) @@ -314,7 +462,7 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { h.AssertEq(t, info.Buildpacks[1].Version, "other-version") }) - it("returns the buildpacks", func() { + it("returns the buildpacks with extension", func() { infoWithExtension, err := subject.InspectImage("some/imageWithExtension", useDaemon) h.AssertNil(t, err) From fe6051a50de540e2a873da2240acc3f609020016 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Mon, 19 Jun 2023 11:24:22 +0200 Subject: [PATCH 39/86] Refactors the Print method improving the readibility and separation of concerns Signed-off-by: Domenico Luciani --- .../inspectimage/writer/human_readable.go | 110 ++++++++++++------ 1 file changed, 75 insertions(+), 35 deletions(-) diff --git a/internal/inspectimage/writer/human_readable.go b/internal/inspectimage/writer/human_readable.go index 4215a06d3..1f41e64fd 100644 --- a/internal/inspectimage/writer/human_readable.go +++ b/internal/inspectimage/writer/human_readable.go @@ -30,18 +30,39 @@ func (h *HumanReadable) Print( if local == nil && remote == nil { return fmt.Errorf("unable to find image '%s' locally or remotely", generalInfo.Name) } - localDisplay := inspectimage.NewInfoDisplay(local, generalInfo) - remoteDisplay := inspectimage.NewInfoDisplay(remote, generalInfo) logger.Infof("Inspecting image: %s\n", style.Symbol(generalInfo.Name)) - logger.Info("\nREMOTE:\n") - err := writeImageInfo(logger, remoteDisplay, remoteErr) - if err != nil { - return fmt.Errorf("writing remote builder info: %w", err) + if err := writeRemoteImageInfo(logger, generalInfo, remote, remoteErr); err != nil { + return err } + + if err := writeLocalImageInfo(logger, generalInfo, local, localErr); err != nil { + return err + } + + return nil +} + +func writeLocalImageInfo( + logger logging.Logger, + generalInfo inspectimage.GeneralInfo, + local *client.ImageInfo, + localErr error) error { logger.Info("\nLOCAL:\n") - err = writeImageInfo(logger, localDisplay, localErr) + + if localErr != nil { + logger.Errorf("%s\n", localErr) + return nil + } + + localDisplay := inspectimage.NewInfoDisplay(local, generalInfo) + if localDisplay == nil { + logger.Info("(not present)\n") + return nil + } + + err := writeImageInfo(logger, localDisplay) if err != nil { return fmt.Errorf("writing local builder info: %w", err) } @@ -49,51 +70,70 @@ func (h *HumanReadable) Print( return nil } +func writeRemoteImageInfo( + logger logging.Logger, + generalInfo inspectimage.GeneralInfo, + remote *client.ImageInfo, + remoteErr error) error { + logger.Info("\nREMOTE:\n") + + if remoteErr != nil { + logger.Errorf("%s\n", remoteErr) + return nil + } + + remoteDisplay := inspectimage.NewInfoDisplay(remote, generalInfo) + if remoteDisplay == nil { + logger.Info("(not present)\n") + return nil + } + + err := writeImageInfo(logger, remoteDisplay) + if err != nil { + return fmt.Errorf("writing remote builder info: %w", err) + } + + return nil +} + func writeImageInfo( logger logging.Logger, info *inspectimage.InfoDisplay, - err error, ) error { + imgTpl := getImageTemplate(info) + remoteOutput, err := getInspectImageOutput(imgTpl, info) + if err != nil { + logger.Error(err.Error()) + return err + } else { + logger.Info(remoteOutput.String()) + return nil + } +} + +func getImageTemplate(info *inspectimage.InfoDisplay) *template.Template { imgTpl := template.Must(template.New("runImages"). Funcs(template.FuncMap{"StringsJoin": strings.Join}). Funcs(template.FuncMap{"StringsValueOrDefault": strs.ValueOrDefault}). Parse(runImagesTemplate)) imgTpl = template.Must(imgTpl.New("buildpacks").Parse(buildpacksTemplate)) - if info != nil && info.Extensions != nil { - imgTpl = template.Must(imgTpl.New("extensions").Parse(extensionsTemplate)) - } - imgTpl = template.Must(imgTpl.New("processes"). - Parse(processesTemplate)) + + imgTpl = template.Must(imgTpl.New("processes").Parse(processesTemplate)) imgTpl = template.Must(imgTpl.New("rebasable").Parse(rebasableTemplate)) if info != nil && info.Extensions != nil { - imgTpl = template.Must(imgTpl.New("image"). - Parse(imageWithExtensionTemplate)) - } else { - imgTpl = template.Must(imgTpl.New("image"). - Parse(imageTemplate)) - } - - if err != nil { - logger.Errorf("%s\n", err) - return nil - } - - if info == nil { - logger.Info("(not present)\n") - return nil - } - remoteOutput, err := inspectImageOutput(info, imgTpl) - if err != nil { - logger.Error(err.Error()) + imgTpl = template.Must(imgTpl.New("extensions").Parse(extensionsTemplate)) + imgTpl = template.Must(imgTpl.New("image").Parse(imageWithExtensionTemplate)) } else { - logger.Info(remoteOutput.String()) + imgTpl = template.Must(imgTpl.New("image").Parse(imageTemplate)) } - return nil + return imgTpl } -func inspectImageOutput(info *inspectimage.InfoDisplay, tpl *template.Template) (*bytes.Buffer, error) { +func getInspectImageOutput( + tpl *template.Template, + info *inspectimage.InfoDisplay) (*bytes.Buffer, error) { if info == nil { return bytes.NewBuffer([]byte("(not present)")), nil } From ded989475b28d4b7aa68b8b4946d68b4ca418479 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Mon, 19 Jun 2023 17:01:55 +0200 Subject: [PATCH 40/86] Extracts mocked image generators into helper functions Signed-off-by: Domenico Luciani --- .../writer/human_readable_test.go | 578 ++++++++---------- 1 file changed, 240 insertions(+), 338 deletions(-) diff --git a/internal/inspectimage/writer/human_readable_test.go b/internal/inspectimage/writer/human_readable_test.go index 4ffd0b259..16a3b0172 100644 --- a/internal/inspectimage/writer/human_readable_test.go +++ b/internal/inspectimage/writer/human_readable_test.go @@ -211,344 +211,14 @@ Processes: when("Print", func() { it.Before(func() { - type someData struct { - String string - Bool bool - Int int - Nested struct { - String string - } - } - - remoteInfo = &client.ImageInfo{ - StackID: "test.stack.id.remote", - Buildpacks: []buildpack.GroupElement{ - {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.remote", Version: "3.0.0"}, - }, - Base: files.RunImageForRebase{ - TopLayer: "some-remote-top-layer", - Reference: "some-remote-run-image-reference", - }, - Stack: files.Stack{ - RunImage: files.RunImageForExport{ - Image: "some-remote-run-image", - Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, - }, - }, - BOM: []buildpack.BOMEntry{{ - Require: buildpack.Require{ - Name: "name-1", - Version: "version-1", - Metadata: map[string]interface{}{ - "RemoteData": someData{ - String: "aString", - Bool: true, - Int: 123, - Nested: struct { - String string - }{ - String: "anotherString", - }, - }, - }, - }, - Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, - }}, - Processes: client.ProcessDetails{ - DefaultProcess: &launch.Process{ - Type: "some-remote-type", - Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, - Args: []string{"some", "remote", "args"}, - Direct: false, - WorkingDirectory: "/some-test-work-dir", - }, - OtherProcesses: []launch.Process{ - { - Type: "other-remote-type", - Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, - Args: []string{"other", "remote", "args"}, - Direct: true, - WorkingDirectory: "/other-test-work-dir", - }, - }, - }, - } - - remoteInfoWithRebasable = &client.ImageInfo{ - StackID: "test.stack.id.remote", - Buildpacks: []buildpack.GroupElement{ - {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.remote", Version: "3.0.0"}, - }, - Base: platform.RunImageForRebase{ - TopLayer: "some-remote-top-layer", - Reference: "some-remote-run-image-reference", - }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ - Image: "some-remote-run-image", - Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, - }, - }, - BOM: []buildpack.BOMEntry{{ - Require: buildpack.Require{ - Name: "name-1", - Version: "version-1", - Metadata: map[string]interface{}{ - "RemoteData": someData{ - String: "aString", - Bool: true, - Int: 123, - Nested: struct { - String string - }{ - String: "anotherString", - }, - }, - }, - }, - Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, - }}, - Processes: client.ProcessDetails{ - DefaultProcess: &launch.Process{ - Type: "some-remote-type", - Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, - Args: []string{"some", "remote", "args"}, - Direct: false, - WorkingDirectory: "/some-test-work-dir", - }, - OtherProcesses: []launch.Process{ - { - Type: "other-remote-type", - Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, - Args: []string{"other", "remote", "args"}, - Direct: true, - WorkingDirectory: "/other-test-work-dir", - }, - }, - }, - Rebasable: true, - } - - localInfo = &client.ImageInfo{ - StackID: "test.stack.id.local", - Buildpacks: []buildpack.GroupElement{ - {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.local", Version: "3.0.0"}, - }, - Base: files.RunImageForRebase{ - TopLayer: "some-local-top-layer", - Reference: "some-local-run-image-reference", - }, - Stack: files.Stack{ - RunImage: files.RunImageForExport{ - Image: "some-local-run-image", - Mirrors: []string{"some-local-mirror", "other-local-mirror"}, - }, - }, - BOM: []buildpack.BOMEntry{{ - Require: buildpack.Require{ - Name: "name-1", - Version: "version-1", - Metadata: map[string]interface{}{ - "LocalData": someData{ - Bool: false, - Int: 456, - }, - }, - }, - Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, - }}, - Processes: client.ProcessDetails{ - DefaultProcess: &launch.Process{ - Type: "some-local-type", - Command: launch.RawCommand{Entries: []string{"/some/local command"}}, - Args: []string{"some", "local", "args"}, - Direct: false, - WorkingDirectory: "/some-test-work-dir", - }, - OtherProcesses: []launch.Process{ - { - Type: "other-local-type", - Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, - Args: []string{"other", "local", "args"}, - Direct: true, - WorkingDirectory: "/other-test-work-dir", - }, - }, - }, - } - - localInfoWithRebasable = &client.ImageInfo{ - StackID: "test.stack.id.local", - Buildpacks: []buildpack.GroupElement{ - {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.local", Version: "3.0.0"}, - }, - Base: platform.RunImageForRebase{ - TopLayer: "some-local-top-layer", - Reference: "some-local-run-image-reference", - }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ - Image: "some-local-run-image", - Mirrors: []string{"some-local-mirror", "other-local-mirror"}, - }, - }, - BOM: []buildpack.BOMEntry{{ - Require: buildpack.Require{ - Name: "name-1", - Version: "version-1", - Metadata: map[string]interface{}{ - "LocalData": someData{ - Bool: false, - Int: 456, - }, - }, - }, - Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, - }}, - Processes: client.ProcessDetails{ - DefaultProcess: &launch.Process{ - Type: "some-local-type", - Command: launch.RawCommand{Entries: []string{"/some/local command"}}, - Args: []string{"some", "local", "args"}, - Direct: false, - WorkingDirectory: "/some-test-work-dir", - }, - OtherProcesses: []launch.Process{ - { - Type: "other-local-type", - Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, - Args: []string{"other", "local", "args"}, - Direct: true, - WorkingDirectory: "/other-test-work-dir", - }, - }, - }, - Rebasable: true, - } - - remoteWithExtensionInfo = &client.ImageInfo{ - StackID: "test.stack.id.remote", - Buildpacks: []buildpack.GroupElement{ - {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.remote", Version: "3.0.0"}, - }, - Extensions: []buildpack.GroupElement{ - {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.remote", Version: "3.0.0"}, - }, - Base: files.RunImageForRebase{ - TopLayer: "some-remote-top-layer", - Reference: "some-remote-run-image-reference", - }, - Stack: files.Stack{ - RunImage: files.RunImageForExport{ - Image: "some-remote-run-image", - Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, - }, - }, - BOM: []buildpack.BOMEntry{{ - Require: buildpack.Require{ - Name: "name-1", - Version: "version-1", - Metadata: map[string]interface{}{ - "RemoteData": someData{ - String: "aString", - Bool: true, - Int: 123, - Nested: struct { - String string - }{ - String: "anotherString", - }, - }, - }, - }, - Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, - }}, - Processes: client.ProcessDetails{ - DefaultProcess: &launch.Process{ - Type: "some-remote-type", - Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, - Args: []string{"some", "remote", "args"}, - Direct: false, - WorkingDirectory: "/some-test-work-dir", - }, - OtherProcesses: []launch.Process{ - { - Type: "other-remote-type", - Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, - Args: []string{"other", "remote", "args"}, - Direct: true, - WorkingDirectory: "/other-test-work-dir", - }, - }, - }, - } - - localWithExtensionInfo = &client.ImageInfo{ - StackID: "test.stack.id.local", - Buildpacks: []buildpack.GroupElement{ - {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.local", Version: "3.0.0"}, - }, - Extensions: []buildpack.GroupElement{ - {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, - {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, - {ID: "test.bp.three.local", Version: "3.0.0"}, - }, - Base: files.RunImageForRebase{ - TopLayer: "some-local-top-layer", - Reference: "some-local-run-image-reference", - }, - Stack: files.Stack{ - RunImage: files.RunImageForExport{ - Image: "some-local-run-image", - Mirrors: []string{"some-local-mirror", "other-local-mirror"}, - }, - }, - BOM: []buildpack.BOMEntry{{ - Require: buildpack.Require{ - Name: "name-1", - Version: "version-1", - Metadata: map[string]interface{}{ - "LocalData": someData{ - Bool: false, - Int: 456, - }, - }, - }, - Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, - }}, - Processes: client.ProcessDetails{ - DefaultProcess: &launch.Process{ - Type: "some-local-type", - Command: launch.RawCommand{Entries: []string{"/some/local command"}}, - Args: []string{"some", "local", "args"}, - Direct: false, - WorkingDirectory: "/some-test-work-dir", - }, - OtherProcesses: []launch.Process{ - { - Type: "other-local-type", - Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, - Args: []string{"other", "local", "args"}, - Direct: true, - WorkingDirectory: "/other-test-work-dir", - }, - }, - }, - } + + remoteInfo = getRemoteBasicImageInfo() + remoteInfoWithRebasable = getRemoteImageInfoWithRebasable() + remoteWithExtensionInfo = getRemoteImageInfoWithExtension() + + localInfo = getBasicLocalImageInfo() + localInfoWithRebasable = getLocalImageInfoWithRebasable() + localWithExtensionInfo = getLocalImageInfoWithExtension() outBuf = bytes.Buffer{} }) @@ -1032,3 +702,235 @@ Processes: }) }) } + +func getRemoteBasicImageInfo() *client.ImageInfo { + return getRemoteImageInfo(false, false) +} +func getRemoteImageInfoWithExtension() *client.ImageInfo { + return getRemoteImageInfo(true, false) +} + +func getRemoteImageInfoWithRebasable() *client.ImageInfo { + return getRemoteImageInfo(false, true) +} + +func getRemoteImageInfo(extension bool, rebasable bool) *client.ImageInfo { + mockedStackID := "test.stack.id.remote" + + mockedBuildpacks := []buildpack.GroupElement{ + {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + {ID: "test.bp.three.remote", Version: "3.0.0"}, + } + + mockedBase := files.RunImageForRebase{ + TopLayer: "some-remote-top-layer", + Reference: "some-remote-run-image-reference", + } + + mockedStack := files.Stack{ + RunImage: files.RunImageForExport{ + Image: "some-remote-run-image", + Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, + }, + } + + type someData struct { + String string + Bool bool + Int int + Nested struct { + String string + } + } + mockedMetadata := map[string]interface{}{ + "RemoteData": someData{ + String: "aString", + Bool: true, + Int: 123, + Nested: struct { + String string + }{ + String: "anotherString", + }, + }, + } + + mockedBOM := []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Metadata: mockedMetadata, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, + }} + + mockedProcesses := client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-remote-type", + Command: launch.RawCommand{Entries: []string{"/some/remote command"}}, + Args: []string{"some", "remote", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-remote-type", + Command: launch.RawCommand{Entries: []string{"/other/remote/command"}}, + Args: []string{"other", "remote", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + } + + mockedExtension := []buildpack.GroupElement{ + {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + {ID: "test.bp.three.remote", Version: "3.0.0"}, + } + + if extension { + return &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedStack, + BOM: mockedBOM, + Processes: mockedProcesses, + Extensions: mockedExtension, + } + } else if rebasable { + return &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedStack, + BOM: mockedBOM, + Processes: mockedProcesses, + Rebasable: true, + } + } else { + return &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedStack, + BOM: mockedBOM, + Processes: mockedProcesses, + } + } +} + +func getBasicLocalImageInfo() *client.ImageInfo { + return getLocalImageInfo(false, false) +} + +func getLocalImageInfoWithExtension() *client.ImageInfo { + return getLocalImageInfo(true, false) +} + +func getLocalImageInfoWithRebasable() *client.ImageInfo { + return getLocalImageInfo(false, true) +} + +func getLocalImageInfo(extension bool, rebasable bool) *client.ImageInfo { + mockedStackID := "test.stack.id.local" + + mockedBuildpacks := []buildpack.GroupElement{ + {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + {ID: "test.bp.three.local", Version: "3.0.0"}, + } + + mockedBase := files.RunImageForRebase{ + TopLayer: "some-local-top-layer", + Reference: "some-local-run-image-reference", + } + + mockedPlatform := files.Stack{ + RunImage: files.RunImageForExport{ + Image: "some-local-run-image", + Mirrors: []string{"some-local-mirror", "other-local-mirror"}, + }, + } + + type someData struct { + String string + Bool bool + Int int + Nested struct { + String string + } + } + mockedMetadata := map[string]interface{}{ + "LocalData": someData{ + Bool: false, + Int: 456, + }, + } + + mockedBOM := []buildpack.BOMEntry{{ + Require: buildpack.Require{ + Name: "name-1", + Version: "version-1", + Metadata: mockedMetadata, + }, + Buildpack: buildpack.GroupElement{ID: "test.bp.one.remote", Version: "1.0.0"}, + }} + + mockedProcesses := client.ProcessDetails{ + DefaultProcess: &launch.Process{ + Type: "some-local-type", + Command: launch.RawCommand{Entries: []string{"/some/local command"}}, + Args: []string{"some", "local", "args"}, + Direct: false, + WorkingDirectory: "/some-test-work-dir", + }, + OtherProcesses: []launch.Process{ + { + Type: "other-local-type", + Command: launch.RawCommand{Entries: []string{"/other/local/command"}}, + Args: []string{"other", "local", "args"}, + Direct: true, + WorkingDirectory: "/other-test-work-dir", + }, + }, + } + + mockedExtension := []buildpack.GroupElement{ + {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, + {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, + {ID: "test.bp.three.local", Version: "3.0.0"}, + } + + if extension { + return &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedPlatform, + BOM: mockedBOM, + Processes: mockedProcesses, + Extensions: mockedExtension, + } + } else if rebasable { + return &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedPlatform, + BOM: mockedBOM, + Processes: mockedProcesses, + Rebasable: true, + } + } else { + return &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedPlatform, + BOM: mockedBOM, + Processes: mockedProcesses, + } + } +} From 0a22bf2168845b940b23ac51a2f1d2cf15039b33 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Mon, 19 Jun 2023 17:42:10 +0200 Subject: [PATCH 41/86] Adds implementation for extension and rebasable Signed-off-by: Domenico Luciani --- internal/inspectimage/info_display.go | 1 + .../inspectimage/writer/human_readable.go | 1 + .../writer/human_readable_test.go | 277 ++++++++++++------ 3 files changed, 196 insertions(+), 83 deletions(-) diff --git a/internal/inspectimage/info_display.go b/internal/inspectimage/info_display.go index db842812d..141ce3395 100644 --- a/internal/inspectimage/info_display.go +++ b/internal/inspectimage/info_display.go @@ -67,6 +67,7 @@ func NewInfoDisplay(info *client.ImageInfo, generalInfo GeneralInfo) *InfoDispla Buildpacks: displayBuildpacks(info.Buildpacks), Extensions: displayExtensions(info.Extensions), Processes: displayProcesses(info.Processes), + Rebasable: info.Rebasable, } } return &InfoDisplay{ diff --git a/internal/inspectimage/writer/human_readable.go b/internal/inspectimage/writer/human_readable.go index 1f41e64fd..0f0431878 100644 --- a/internal/inspectimage/writer/human_readable.go +++ b/internal/inspectimage/writer/human_readable.go @@ -228,6 +228,7 @@ Base Image: {{- end}} Top Layer: {{ .Info.Base.TopLayer }} {{ template "runImages" . }} +{{- template "rebasable" . }} {{ template "buildpacks" . }} {{ template "extensions" . }} {{ template "processes" . }}` diff --git a/internal/inspectimage/writer/human_readable_test.go b/internal/inspectimage/writer/human_readable_test.go index 16a3b0172..6f79b3355 100644 --- a/internal/inspectimage/writer/human_readable_test.go +++ b/internal/inspectimage/writer/human_readable_test.go @@ -32,13 +32,15 @@ func testHumanReadable(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - remoteInfoWithRebasable *client.ImageInfo - localInfo *client.ImageInfo - localInfoWithRebasable *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoWithRebasable *client.ImageInfo + remoteWithExtensionInfo *client.ImageInfo + remoteWithExtensionAndRebasableInfo *client.ImageInfo - remoteWithExtensionInfo *client.ImageInfo - localWithExtensionInfo *client.ImageInfo + localInfo *client.ImageInfo + localInfoWithRebasable *client.ImageInfo + localWithExtensionInfo *client.ImageInfo + localWithExtensionAndRebasableInfo *client.ImageInfo expectedRemoteOutput = `REMOTE: @@ -87,6 +89,72 @@ Buildpacks: test.bp.two.remote 2.0.0 https://some-homepage-two test.bp.three.remote 3.0.0 - +Processes: + TYPE SHELL COMMAND ARGS WORK DIR + some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir + other-remote-type /other/remote/command other remote args /other-test-work-dir` + + expectedRemoteWithExtensionOutput = `REMOTE: + +Stack: test.stack.id.remote + +Base Image: + Reference: some-remote-run-image-reference + Top Layer: some-remote-top-layer + +Run Images: + user-configured-mirror-for-remote (user-configured) + some-remote-run-image + some-remote-mirror + other-remote-mirror + +Buildpacks: + ID VERSION HOMEPAGE + test.bp.one.remote 1.0.0 https://some-homepage-one + test.bp.two.remote 2.0.0 https://some-homepage-two + test.bp.three.remote 3.0.0 - + +Extensions: + ID VERSION HOMEPAGE + test.bp.one.remote 1.0.0 https://some-homepage-one + test.bp.two.remote 2.0.0 https://some-homepage-two + test.bp.three.remote 3.0.0 - + + +Processes: + TYPE SHELL COMMAND ARGS WORK DIR + some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir + other-remote-type /other/remote/command other remote args /other-test-work-dir` + + expectedRemoteWithExtensionAndRebasableOutput = `REMOTE: + +Stack: test.stack.id.remote + +Base Image: + Reference: some-remote-run-image-reference + Top Layer: some-remote-top-layer + +Run Images: + user-configured-mirror-for-remote (user-configured) + some-remote-run-image + some-remote-mirror + other-remote-mirror + +Rebasable: true + +Buildpacks: + ID VERSION HOMEPAGE + test.bp.one.remote 1.0.0 https://some-homepage-one + test.bp.two.remote 2.0.0 https://some-homepage-two + test.bp.three.remote 3.0.0 - + +Extensions: + ID VERSION HOMEPAGE + test.bp.one.remote 1.0.0 https://some-homepage-one + test.bp.two.remote 2.0.0 https://some-homepage-two + test.bp.three.remote 3.0.0 - + + Processes: TYPE SHELL COMMAND ARGS WORK DIR some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir @@ -144,39 +212,39 @@ Processes: some-local-type (default) bash /some/local command some local args /some-test-work-dir other-local-type /other/local/command other local args /other-test-work-dir` - expectedRemoteWithExtensionOutput = `REMOTE: + expectedLocalWithExtensionOutput = `LOCAL: -Stack: test.stack.id.remote +Stack: test.stack.id.local Base Image: - Reference: some-remote-run-image-reference - Top Layer: some-remote-top-layer + Reference: some-local-run-image-reference + Top Layer: some-local-top-layer Run Images: - user-configured-mirror-for-remote (user-configured) - some-remote-run-image - some-remote-mirror - other-remote-mirror + user-configured-mirror-for-local (user-configured) + some-local-run-image + some-local-mirror + other-local-mirror Buildpacks: - ID VERSION HOMEPAGE - test.bp.one.remote 1.0.0 https://some-homepage-one - test.bp.two.remote 2.0.0 https://some-homepage-two - test.bp.three.remote 3.0.0 - + ID VERSION HOMEPAGE + test.bp.one.local 1.0.0 https://some-homepage-one + test.bp.two.local 2.0.0 https://some-homepage-two + test.bp.three.local 3.0.0 - Extensions: - ID VERSION HOMEPAGE - test.bp.one.remote 1.0.0 https://some-homepage-one - test.bp.two.remote 2.0.0 https://some-homepage-two - test.bp.three.remote 3.0.0 - + ID VERSION HOMEPAGE + test.bp.one.local 1.0.0 https://some-homepage-one + test.bp.two.local 2.0.0 https://some-homepage-two + test.bp.three.local 3.0.0 - Processes: - TYPE SHELL COMMAND ARGS WORK DIR - some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir - other-remote-type /other/remote/command other remote args /other-test-work-dir` + TYPE SHELL COMMAND ARGS WORK DIR + some-local-type (default) bash /some/local command some local args /some-test-work-dir + other-local-type /other/local/command other local args /other-test-work-dir` - expectedLocalWithExtensionOutput = `LOCAL: + expectedLocalWithExtensionAndRebasableOutput = `LOCAL: Stack: test.stack.id.local @@ -190,6 +258,8 @@ Run Images: some-local-mirror other-local-mirror +Rebasable: true + Buildpacks: ID VERSION HOMEPAGE test.bp.one.local 1.0.0 https://some-homepage-one @@ -211,14 +281,15 @@ Processes: when("Print", func() { it.Before(func() { - remoteInfo = getRemoteBasicImageInfo() remoteInfoWithRebasable = getRemoteImageInfoWithRebasable() remoteWithExtensionInfo = getRemoteImageInfoWithExtension() + remoteWithExtensionAndRebasableInfo = getRemoteImageInfoWithExtensionAndRebasable() localInfo = getBasicLocalImageInfo() localInfoWithRebasable = getLocalImageInfoWithRebasable() localWithExtensionInfo = getLocalImageInfoWithExtension() + localWithExtensionAndRebasableInfo = getLocalImageInfoWithExtensionAndRebasable() outBuf = bytes.Buffer{} }) @@ -373,6 +444,34 @@ Processes: assert.Contains(outBuf.String(), expectedLocalWithExtensionOutput) assert.NotContains(outBuf.String(), expectedRemoteWithExtensionOutput) }) + it("prints localWithExtension and localWithRebasable image info in a human readable format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + humanReadableWriter := writer.NewHumanReadable() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := humanReadableWriter.Print(logger, sharedImageInfo, localWithExtensionAndRebasableInfo, nil, nil, nil) + assert.Nil(err) + + assert.Contains(outBuf.String(), expectedLocalWithExtensionAndRebasableOutput) + assert.NotContains(outBuf.String(), expectedRemoteWithExtensionOutput) + }) }) when("only remote image exists", func() { @@ -503,6 +602,34 @@ Processes: assert.NotContains(outBuf.String(), expectedLocalWithExtensionOutput) assert.Contains(outBuf.String(), expectedRemoteWithExtensionOutput) }) + it("prints remoteWithExtension and remoteWithRebasable image info in a human readable format", func() { + runImageMirrors := []config.RunImage{ + { + Image: "un-used-run-image", + Mirrors: []string{"un-used"}, + }, + { + Image: "some-local-run-image", + Mirrors: []string{"user-configured-mirror-for-local"}, + }, + { + Image: "some-remote-run-image", + Mirrors: []string{"user-configured-mirror-for-remote"}, + }, + } + sharedImageInfo := inspectimage.GeneralInfo{ + Name: "test-image", + RunImageMirrors: runImageMirrors, + } + humanReadableWriter := writer.NewHumanReadable() + + logger := logging.NewLogWithWriters(&outBuf, &outBuf) + err := humanReadableWriter.Print(logger, sharedImageInfo, nil, remoteWithExtensionAndRebasableInfo, nil, nil) + assert.Nil(err) + + assert.NotContains(outBuf.String(), expectedLocalOutput) + assert.Contains(outBuf.String(), expectedRemoteWithExtensionAndRebasableOutput) + }) when("buildpack metadata is missing", func() { it.Before(func() { @@ -714,6 +841,10 @@ func getRemoteImageInfoWithRebasable() *client.ImageInfo { return getRemoteImageInfo(false, true) } +func getRemoteImageInfoWithExtensionAndRebasable() *client.ImageInfo { + return getRemoteImageInfo(true, true) +} + func getRemoteImageInfo(extension bool, rebasable bool) *client.ImageInfo { mockedStackID := "test.stack.id.remote" @@ -789,36 +920,24 @@ func getRemoteImageInfo(extension bool, rebasable bool) *client.ImageInfo { {ID: "test.bp.three.remote", Version: "3.0.0"}, } + imageInfo := &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedStack, + BOM: mockedBOM, + Processes: mockedProcesses, + } + if extension { - return &client.ImageInfo{ - StackID: mockedStackID, - Buildpacks: mockedBuildpacks, - Base: mockedBase, - Stack: mockedStack, - BOM: mockedBOM, - Processes: mockedProcesses, - Extensions: mockedExtension, - } - } else if rebasable { - return &client.ImageInfo{ - StackID: mockedStackID, - Buildpacks: mockedBuildpacks, - Base: mockedBase, - Stack: mockedStack, - BOM: mockedBOM, - Processes: mockedProcesses, - Rebasable: true, - } - } else { - return &client.ImageInfo{ - StackID: mockedStackID, - Buildpacks: mockedBuildpacks, - Base: mockedBase, - Stack: mockedStack, - BOM: mockedBOM, - Processes: mockedProcesses, - } + imageInfo.Extensions = mockedExtension + } + + if rebasable { + imageInfo.Rebasable = true } + + return imageInfo } func getBasicLocalImageInfo() *client.ImageInfo { @@ -833,6 +952,10 @@ func getLocalImageInfoWithRebasable() *client.ImageInfo { return getLocalImageInfo(false, true) } +func getLocalImageInfoWithExtensionAndRebasable() *client.ImageInfo { + return getLocalImageInfo(true, true) +} + func getLocalImageInfo(extension bool, rebasable bool) *client.ImageInfo { mockedStackID := "test.stack.id.local" @@ -903,34 +1026,22 @@ func getLocalImageInfo(extension bool, rebasable bool) *client.ImageInfo { {ID: "test.bp.three.local", Version: "3.0.0"}, } + imageInfo := &client.ImageInfo{ + StackID: mockedStackID, + Buildpacks: mockedBuildpacks, + Base: mockedBase, + Stack: mockedPlatform, + BOM: mockedBOM, + Processes: mockedProcesses, + } + if extension { - return &client.ImageInfo{ - StackID: mockedStackID, - Buildpacks: mockedBuildpacks, - Base: mockedBase, - Stack: mockedPlatform, - BOM: mockedBOM, - Processes: mockedProcesses, - Extensions: mockedExtension, - } - } else if rebasable { - return &client.ImageInfo{ - StackID: mockedStackID, - Buildpacks: mockedBuildpacks, - Base: mockedBase, - Stack: mockedPlatform, - BOM: mockedBOM, - Processes: mockedProcesses, - Rebasable: true, - } - } else { - return &client.ImageInfo{ - StackID: mockedStackID, - Buildpacks: mockedBuildpacks, - Base: mockedBase, - Stack: mockedPlatform, - BOM: mockedBOM, - Processes: mockedProcesses, - } + imageInfo.Extensions = mockedExtension } + + if rebasable { + imageInfo.Rebasable = true + } + + return imageInfo } From 64e2364c9ba4614c1768be0251b7234081a6cabd Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Wed, 21 Jun 2023 14:01:58 +0200 Subject: [PATCH 42/86] Now the rebasable label value changes depending on the image rebasability which until now was always set as a true Signed-off-by: Domenico Luciani --- internal/inspectimage/writer/human_readable.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/inspectimage/writer/human_readable.go b/internal/inspectimage/writer/human_readable.go index 0f0431878..b3ad6f8d2 100644 --- a/internal/inspectimage/writer/human_readable.go +++ b/internal/inspectimage/writer/human_readable.go @@ -204,7 +204,7 @@ Processes: var rebasableTemplate = ` {{- if .Info.Rebasable -}} {{- "\n\n" -}} -Rebasable: true +Rebasable: {{ .Info.Rebasable }} {{- end -}}` var imageTemplate = ` From fe499fb5ca5f4a7fe91b35412708a984b3913cb6 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Wed, 21 Jun 2023 15:31:55 +0200 Subject: [PATCH 43/86] Change the tests and the implementation of the template to follow the assumption that the rebasable is true when true or not set, false otherwise Signed-off-by: Domenico Luciani --- acceptance/acceptance_test.go | 4 +- .../inspectimage/writer/human_readable.go | 11 +- .../writer/human_readable_test.go | 228 ++++-------------- internal/inspectimage/writer/json_test.go | 97 +++----- internal/inspectimage/writer/toml_test.go | 94 +++----- internal/inspectimage/writer/yaml_test.go | 93 +++---- pkg/client/inspect_image.go | 2 +- pkg/client/inspect_image_test.go | 119 +++------ 8 files changed, 184 insertions(+), 464 deletions(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 8bcb686df..a92035260 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -1153,7 +1153,7 @@ func testAcceptance( "hello_args": helloArgs, "hello_args_prefix": helloArgsPrefix, "image_workdir": imageWorkdir, - "rebasable": false, + "rebasable": true, }, ) @@ -1827,7 +1827,7 @@ func testAcceptance( "hello_args": helloArgs, "hello_args_prefix": helloArgsPrefix, "image_workdir": imageWorkdir, - "rebasable": false, + "rebasable": true, }, ) diff --git a/internal/inspectimage/writer/human_readable.go b/internal/inspectimage/writer/human_readable.go index b3ad6f8d2..d9b58ee82 100644 --- a/internal/inspectimage/writer/human_readable.go +++ b/internal/inspectimage/writer/human_readable.go @@ -202,10 +202,11 @@ Processes: {{- end }}` var rebasableTemplate = ` -{{- if .Info.Rebasable -}} -{{- "\n\n" -}} -Rebasable: {{ .Info.Rebasable }} -{{- end -}}` + +Rebasable: +{{- if or .Info.Rebasable (eq .Info.Rebasable true) }} true +{{- else }} false +{{- end }}` var imageTemplate = ` Stack: {{ .Info.StackID }} @@ -230,5 +231,5 @@ Base Image: {{ template "runImages" . }} {{- template "rebasable" . }} {{ template "buildpacks" . }} -{{ template "extensions" . }} +{{ template "extensions" . -}} {{ template "processes" . }}` diff --git a/internal/inspectimage/writer/human_readable_test.go b/internal/inspectimage/writer/human_readable_test.go index 6f79b3355..e77cec639 100644 --- a/internal/inspectimage/writer/human_readable_test.go +++ b/internal/inspectimage/writer/human_readable_test.go @@ -32,45 +32,18 @@ func testHumanReadable(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - remoteInfoWithRebasable *client.ImageInfo - remoteWithExtensionInfo *client.ImageInfo - remoteWithExtensionAndRebasableInfo *client.ImageInfo + remoteInfo *client.ImageInfo + remoteWithExtensionInfo *client.ImageInfo + remoteInfoNoRebasable *client.ImageInfo - localInfo *client.ImageInfo - localInfoWithRebasable *client.ImageInfo - localWithExtensionInfo *client.ImageInfo - localWithExtensionAndRebasableInfo *client.ImageInfo + localInfo *client.ImageInfo + localWithExtensionInfo *client.ImageInfo + localInfoNoRebasable *client.ImageInfo expectedRemoteOutput = `REMOTE: Stack: test.stack.id.remote -Base Image: - Reference: some-remote-run-image-reference - Top Layer: some-remote-top-layer - -Run Images: - user-configured-mirror-for-remote (user-configured) - some-remote-run-image - some-remote-mirror - other-remote-mirror - -Buildpacks: - ID VERSION HOMEPAGE - test.bp.one.remote 1.0.0 https://some-homepage-one - test.bp.two.remote 2.0.0 https://some-homepage-two - test.bp.three.remote 3.0.0 - - -Processes: - TYPE SHELL COMMAND ARGS WORK DIR - some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir - other-remote-type /other/remote/command other remote args /other-test-work-dir` - - expectedRemoteOutputWithRebasable = `REMOTE: - -Stack: test.stack.id.remote - Base Image: Reference: some-remote-run-image-reference Top Layer: some-remote-top-layer @@ -93,8 +66,7 @@ Processes: TYPE SHELL COMMAND ARGS WORK DIR some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir other-remote-type /other/remote/command other remote args /other-test-work-dir` - - expectedRemoteWithExtensionOutput = `REMOTE: + expectedRemoteNoRebasableOutput = `REMOTE: Stack: test.stack.id.remote @@ -108,25 +80,20 @@ Run Images: some-remote-mirror other-remote-mirror -Buildpacks: - ID VERSION HOMEPAGE - test.bp.one.remote 1.0.0 https://some-homepage-one - test.bp.two.remote 2.0.0 https://some-homepage-two - test.bp.three.remote 3.0.0 - +Rebasable: false -Extensions: +Buildpacks: ID VERSION HOMEPAGE test.bp.one.remote 1.0.0 https://some-homepage-one test.bp.two.remote 2.0.0 https://some-homepage-two test.bp.three.remote 3.0.0 - - Processes: TYPE SHELL COMMAND ARGS WORK DIR some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir other-remote-type /other/remote/command other remote args /other-test-work-dir` - expectedRemoteWithExtensionAndRebasableOutput = `REMOTE: + expectedRemoteWithExtensionOutput = `REMOTE: Stack: test.stack.id.remote @@ -154,7 +121,6 @@ Extensions: test.bp.two.remote 2.0.0 https://some-homepage-two test.bp.three.remote 3.0.0 - - Processes: TYPE SHELL COMMAND ARGS WORK DIR some-remote-type (default) bash /some/remote command some remote args /some-test-work-dir @@ -164,31 +130,6 @@ Processes: Stack: test.stack.id.local -Base Image: - Reference: some-local-run-image-reference - Top Layer: some-local-top-layer - -Run Images: - user-configured-mirror-for-local (user-configured) - some-local-run-image - some-local-mirror - other-local-mirror - -Buildpacks: - ID VERSION HOMEPAGE - test.bp.one.local 1.0.0 https://some-homepage-one - test.bp.two.local 2.0.0 https://some-homepage-two - test.bp.three.local 3.0.0 - - -Processes: - TYPE SHELL COMMAND ARGS WORK DIR - some-local-type (default) bash /some/local command some local args /some-test-work-dir - other-local-type /other/local/command other local args /other-test-work-dir` - - expectedLocalOutputWithRebasable = `LOCAL: - -Stack: test.stack.id.local - Base Image: Reference: some-local-run-image-reference Top Layer: some-local-top-layer @@ -211,8 +152,7 @@ Processes: TYPE SHELL COMMAND ARGS WORK DIR some-local-type (default) bash /some/local command some local args /some-test-work-dir other-local-type /other/local/command other local args /other-test-work-dir` - - expectedLocalWithExtensionOutput = `LOCAL: + expectedLocalNoRebasableOutput = `LOCAL: Stack: test.stack.id.local @@ -226,25 +166,20 @@ Run Images: some-local-mirror other-local-mirror -Buildpacks: - ID VERSION HOMEPAGE - test.bp.one.local 1.0.0 https://some-homepage-one - test.bp.two.local 2.0.0 https://some-homepage-two - test.bp.three.local 3.0.0 - +Rebasable: false -Extensions: +Buildpacks: ID VERSION HOMEPAGE test.bp.one.local 1.0.0 https://some-homepage-one test.bp.two.local 2.0.0 https://some-homepage-two test.bp.three.local 3.0.0 - - Processes: TYPE SHELL COMMAND ARGS WORK DIR some-local-type (default) bash /some/local command some local args /some-test-work-dir other-local-type /other/local/command other local args /other-test-work-dir` - expectedLocalWithExtensionAndRebasableOutput = `LOCAL: + expectedLocalWithExtensionOutput = `LOCAL: Stack: test.stack.id.local @@ -272,7 +207,6 @@ Extensions: test.bp.two.local 2.0.0 https://some-homepage-two test.bp.three.local 3.0.0 - - Processes: TYPE SHELL COMMAND ARGS WORK DIR some-local-type (default) bash /some/local command some local args /some-test-work-dir @@ -281,15 +215,13 @@ Processes: when("Print", func() { it.Before(func() { - remoteInfo = getRemoteBasicImageInfo() - remoteInfoWithRebasable = getRemoteImageInfoWithRebasable() - remoteWithExtensionInfo = getRemoteImageInfoWithExtension() - remoteWithExtensionAndRebasableInfo = getRemoteImageInfoWithExtensionAndRebasable() + remoteInfo = getRemoteBasicImageInfo(t) + remoteWithExtensionInfo = getRemoteImageInfoWithExtension(t) + remoteInfoNoRebasable = getRemoteImageInfoNoRebasable(t) - localInfo = getBasicLocalImageInfo() - localInfoWithRebasable = getLocalImageInfoWithRebasable() - localWithExtensionInfo = getLocalImageInfoWithExtension() - localWithExtensionAndRebasableInfo = getLocalImageInfoWithExtensionAndRebasable() + localInfo = getBasicLocalImageInfo(t) + localWithExtensionInfo = getLocalImageInfoWithExtension(t) + localInfoNoRebasable = getLocalImageInfoNoRebasable(t) outBuf = bytes.Buffer{} }) @@ -385,7 +317,7 @@ Processes: assert.Contains(outBuf.String(), expectedLocalOutput) assert.NotContains(outBuf.String(), expectedRemoteOutput) }) - it("prints local rebasable image info in a human readable format", func() { + it("prints local no rebasable image info in a human readable format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -407,10 +339,10 @@ Processes: humanReadableWriter := writer.NewHumanReadable() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := humanReadableWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + err := humanReadableWriter.Print(logger, sharedImageInfo, localInfoNoRebasable, nil, nil, nil) assert.Nil(err) - assert.Contains(outBuf.String(), expectedLocalOutputWithRebasable) + assert.Contains(outBuf.String(), expectedLocalNoRebasableOutput) assert.NotContains(outBuf.String(), expectedRemoteOutput) }) }) @@ -444,34 +376,6 @@ Processes: assert.Contains(outBuf.String(), expectedLocalWithExtensionOutput) assert.NotContains(outBuf.String(), expectedRemoteWithExtensionOutput) }) - it("prints localWithExtension and localWithRebasable image info in a human readable format", func() { - runImageMirrors := []config.RunImage{ - { - Image: "un-used-run-image", - Mirrors: []string{"un-used"}, - }, - { - Image: "some-local-run-image", - Mirrors: []string{"user-configured-mirror-for-local"}, - }, - { - Image: "some-remote-run-image", - Mirrors: []string{"user-configured-mirror-for-remote"}, - }, - } - sharedImageInfo := inspectimage.GeneralInfo{ - Name: "test-image", - RunImageMirrors: runImageMirrors, - } - humanReadableWriter := writer.NewHumanReadable() - - logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := humanReadableWriter.Print(logger, sharedImageInfo, localWithExtensionAndRebasableInfo, nil, nil, nil) - assert.Nil(err) - - assert.Contains(outBuf.String(), expectedLocalWithExtensionAndRebasableOutput) - assert.NotContains(outBuf.String(), expectedRemoteWithExtensionOutput) - }) }) when("only remote image exists", func() { @@ -503,7 +407,7 @@ Processes: assert.NotContains(outBuf.String(), expectedLocalOutput) assert.Contains(outBuf.String(), expectedRemoteOutput) }) - it("prints remote rebasable image info in a human readable format", func() { + it("prints remote no rebasable image info in a human readable format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -525,11 +429,11 @@ Processes: humanReadableWriter := writer.NewHumanReadable() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := humanReadableWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) + err := humanReadableWriter.Print(logger, sharedImageInfo, nil, remoteInfoNoRebasable, nil, nil) assert.Nil(err) - assert.Contains(outBuf.String(), expectedRemoteOutputWithRebasable) assert.NotContains(outBuf.String(), expectedLocalOutput) + assert.Contains(outBuf.String(), expectedRemoteNoRebasableOutput) }) when("buildpack metadata is missing", func() { @@ -602,34 +506,6 @@ Processes: assert.NotContains(outBuf.String(), expectedLocalWithExtensionOutput) assert.Contains(outBuf.String(), expectedRemoteWithExtensionOutput) }) - it("prints remoteWithExtension and remoteWithRebasable image info in a human readable format", func() { - runImageMirrors := []config.RunImage{ - { - Image: "un-used-run-image", - Mirrors: []string{"un-used"}, - }, - { - Image: "some-local-run-image", - Mirrors: []string{"user-configured-mirror-for-local"}, - }, - { - Image: "some-remote-run-image", - Mirrors: []string{"user-configured-mirror-for-remote"}, - }, - } - sharedImageInfo := inspectimage.GeneralInfo{ - Name: "test-image", - RunImageMirrors: runImageMirrors, - } - humanReadableWriter := writer.NewHumanReadable() - - logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := humanReadableWriter.Print(logger, sharedImageInfo, nil, remoteWithExtensionAndRebasableInfo, nil, nil) - assert.Nil(err) - - assert.NotContains(outBuf.String(), expectedLocalOutput) - assert.Contains(outBuf.String(), expectedRemoteWithExtensionAndRebasableOutput) - }) when("buildpack metadata is missing", func() { it.Before(func() { @@ -830,22 +706,23 @@ Processes: }) } -func getRemoteBasicImageInfo() *client.ImageInfo { - return getRemoteImageInfo(false, false) +func getRemoteBasicImageInfo(t testing.TB) *client.ImageInfo { + t.Helper() + return getRemoteImageInfo(t, false, true) } -func getRemoteImageInfoWithExtension() *client.ImageInfo { - return getRemoteImageInfo(true, false) +func getRemoteImageInfoWithExtension(t testing.TB) *client.ImageInfo { + t.Helper() + return getRemoteImageInfo(t, true, true) } -func getRemoteImageInfoWithRebasable() *client.ImageInfo { - return getRemoteImageInfo(false, true) +func getRemoteImageInfoNoRebasable(t testing.TB) *client.ImageInfo { + t.Helper() + return getRemoteImageInfo(t, false, false) } -func getRemoteImageInfoWithExtensionAndRebasable() *client.ImageInfo { - return getRemoteImageInfo(true, true) -} +func getRemoteImageInfo(t testing.TB, extension bool, rebasable bool) *client.ImageInfo { + t.Helper() -func getRemoteImageInfo(extension bool, rebasable bool) *client.ImageInfo { mockedStackID := "test.stack.id.remote" mockedBuildpacks := []buildpack.GroupElement{ @@ -927,36 +804,34 @@ func getRemoteImageInfo(extension bool, rebasable bool) *client.ImageInfo { Stack: mockedStack, BOM: mockedBOM, Processes: mockedProcesses, + Rebasable: rebasable, } if extension { imageInfo.Extensions = mockedExtension } - if rebasable { - imageInfo.Rebasable = true - } - return imageInfo } -func getBasicLocalImageInfo() *client.ImageInfo { - return getLocalImageInfo(false, false) +func getBasicLocalImageInfo(t testing.TB) *client.ImageInfo { + t.Helper() + return getLocalImageInfo(t, false, true) } -func getLocalImageInfoWithExtension() *client.ImageInfo { - return getLocalImageInfo(true, false) +func getLocalImageInfoWithExtension(t testing.TB) *client.ImageInfo { + t.Helper() + return getLocalImageInfo(t, true, true) } -func getLocalImageInfoWithRebasable() *client.ImageInfo { - return getLocalImageInfo(false, true) +func getLocalImageInfoNoRebasable(t testing.TB) *client.ImageInfo { + t.Helper() + return getLocalImageInfo(t, false, false) } -func getLocalImageInfoWithExtensionAndRebasable() *client.ImageInfo { - return getLocalImageInfo(true, true) -} +func getLocalImageInfo(t testing.TB, extension bool, rebasable bool) *client.ImageInfo { + t.Helper() -func getLocalImageInfo(extension bool, rebasable bool) *client.ImageInfo { mockedStackID := "test.stack.id.local" mockedBuildpacks := []buildpack.GroupElement{ @@ -1033,15 +908,12 @@ func getLocalImageInfo(extension bool, rebasable bool) *client.ImageInfo { Stack: mockedPlatform, BOM: mockedBOM, Processes: mockedProcesses, + Rebasable: rebasable, } if extension { imageInfo.Extensions = mockedExtension } - if rebasable { - imageInfo.Rebasable = true - } - return imageInfo } diff --git a/internal/inspectimage/writer/json_test.go b/internal/inspectimage/writer/json_test.go index 519a8609c..fa61c3f18 100644 --- a/internal/inspectimage/writer/json_test.go +++ b/internal/inspectimage/writer/json_test.go @@ -30,15 +30,15 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - remoteInfoWithRebasable *client.ImageInfo - localInfo *client.ImageInfo - localInfoWithRebasable *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoNoRebasable *client.ImageInfo + localInfo *client.ImageInfo + localInfoNoRebasable *client.ImageInfo expectedLocalOutput = `{ "local_info": { "stack": "test.stack.id.local", - "rebasable": false, + "rebasable": true, "base_image": { "top_layer": "some-local-top-layer", "reference": "some-local-run-image-reference" @@ -99,10 +99,10 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { ] } }` - expectedLocalOutputWithRebasable = `{ + expectedLocalNoRebasableOutput = `{ "local_info": { "stack": "test.stack.id.local", - "rebasable": true, + "rebasable": false, "base_image": { "top_layer": "some-local-top-layer", "reference": "some-local-run-image-reference" @@ -166,7 +166,7 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { expectedRemoteOutput = `{ "remote_info": { "stack": "test.stack.id.remote", - "rebasable": false, + "rebasable": true, "base_image": { "top_layer": "some-remote-top-layer", "reference": "some-remote-run-image-reference" @@ -227,10 +227,10 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { ] } }` - expectedRemoteOutputWithRebasable = `{ + expectedRemoteNoRebasableOutput = `{ "remote_info": { "stack": "test.stack.id.remote", - "rebasable": true, + "rebasable": false, "base_image": { "top_layer": "some-remote-top-layer", "reference": "some-remote-run-image-reference" @@ -357,20 +357,20 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { }, }, }, + Rebasable: true, } - - remoteInfoWithRebasable = &client.ImageInfo{ + remoteInfoNoRebasable = &client.ImageInfo{ StackID: "test.stack.id.remote", Buildpacks: []buildpack.GroupElement{ {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, }, - Base: platform.RunImageForRebase{ + Base: files.RunImageForRebase{ TopLayer: "some-remote-top-layer", Reference: "some-remote-run-image-reference", }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ + Stack: files.Stack{ + RunImage: files.RunImageForExport{ Image: "some-remote-run-image", Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, }, @@ -412,7 +412,7 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { }, }, }, - Rebasable: true, + Rebasable: false, } localInfo = &client.ImageInfo{ @@ -462,20 +462,20 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { }, }, }, + Rebasable: true, } - - localInfoWithRebasable = &client.ImageInfo{ + localInfoNoRebasable = &client.ImageInfo{ StackID: "test.stack.id.local", Buildpacks: []buildpack.GroupElement{ {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, }, - Base: platform.RunImageForRebase{ + Base: files.RunImageForRebase{ TopLayer: "some-local-top-layer", Reference: "some-local-run-image-reference", }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ + Stack: files.Stack{ + RunImage: files.RunImageForExport{ Image: "some-local-run-image", Mirrors: []string{"some-local-mirror", "other-local-mirror"}, }, @@ -511,7 +511,7 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { }, }, }, - Rebasable: true, + Rebasable: false, } outBuf = bytes.Buffer{} @@ -547,10 +547,7 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { assert.ContainsJSON(outBuf.String(), expectedLocalOutput) assert.ContainsJSON(outBuf.String(), expectedRemoteOutput) }) - }) - - when("only local image exists", func() { - it("prints local image info in JSON format", func() { + it("prints both local and remote no rebasable images info in a JSON format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -572,16 +569,17 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { jsonWriter := writer.NewJSON() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := jsonWriter.Print(logger, sharedImageInfo, localInfo, nil, nil, nil) + err := jsonWriter.Print(logger, sharedImageInfo, localInfoNoRebasable, remoteInfoNoRebasable, nil, nil) assert.Nil(err) assert.ContainsJSON(outBuf.String(), `{ "image_name": "test-image" }`) - assert.ContainsJSON(outBuf.String(), expectedLocalOutput) - - assert.NotContains(outBuf.String(), "test.stack.id.remote") - assert.ContainsJSON(outBuf.String(), expectedLocalOutput) + assert.ContainsJSON(outBuf.String(), expectedLocalNoRebasableOutput) + assert.ContainsJSON(outBuf.String(), expectedRemoteNoRebasableOutput) }) - it("prints local rebasable image info in JSON format", func() { + }) + + when("only local image exists", func() { + it("prints local image info in JSON format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -603,12 +601,14 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { jsonWriter := writer.NewJSON() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := jsonWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + err := jsonWriter.Print(logger, sharedImageInfo, localInfo, nil, nil, nil) assert.Nil(err) assert.ContainsJSON(outBuf.String(), `{ "image_name": "test-image" }`) - assert.ContainsJSON(outBuf.String(), expectedLocalOutputWithRebasable) + assert.ContainsJSON(outBuf.String(), expectedLocalOutput) + assert.NotContains(outBuf.String(), "test.stack.id.remote") + assert.ContainsJSON(outBuf.String(), expectedLocalOutput) }) }) @@ -642,35 +642,6 @@ func testJSON(t *testing.T, when spec.G, it spec.S) { assert.NotContains(outBuf.String(), "test.stack.id.local") assert.ContainsJSON(outBuf.String(), expectedRemoteOutput) }) - it("prints remote rebasable image info in JSON format", func() { - runImageMirrors := []config.RunImage{ - { - Image: "un-used-run-image", - Mirrors: []string{"un-used"}, - }, - { - Image: "some-local-run-image", - Mirrors: []string{"user-configured-mirror-for-local"}, - }, - { - Image: "some-remote-run-image", - Mirrors: []string{"user-configured-mirror-for-remote"}, - }, - } - sharedImageInfo := inspectimage.GeneralInfo{ - Name: "test-image", - RunImageMirrors: runImageMirrors, - } - jsonWriter := writer.NewJSON() - - logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := jsonWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) - assert.Nil(err) - - assert.ContainsJSON(outBuf.String(), `{ "image_name": "test-image" }`) - assert.NotContains(outBuf.String(), "test.stack.id.local") - assert.ContainsJSON(outBuf.String(), expectedRemoteOutputWithRebasable) - }) }) }) } diff --git a/internal/inspectimage/writer/toml_test.go b/internal/inspectimage/writer/toml_test.go index bae26d643..27f92f4de 100644 --- a/internal/inspectimage/writer/toml_test.go +++ b/internal/inspectimage/writer/toml_test.go @@ -30,14 +30,14 @@ func testTOML(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - remoteInfoWithRebasable *client.ImageInfo - localInfo *client.ImageInfo - localInfoWithRebasable *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoNoRebasable *client.ImageInfo + localInfo *client.ImageInfo + localInfoNoRebasable *client.ImageInfo expectedLocalOutput = `[local_info] stack = 'test.stack.id.local' -rebasable = false +rebasable = true [local_info.base_image] top_layer = 'some-local-top-layer' @@ -90,10 +90,9 @@ args = [ ] working-dir = "/other-test-work-dir" ` - - expectedLocalOutputWithRebasable = `[local_info] + expectedLocalNoRebasableOutput = `[local_info] stack = 'test.stack.id.local' -rebasable = true +rebasable = false [local_info.base_image] top_layer = 'some-local-top-layer' @@ -150,7 +149,7 @@ working-dir = "/other-test-work-dir" expectedRemoteOutput = ` [remote_info] stack = 'test.stack.id.remote' -rebasable = false +rebasable = true [remote_info.base_image] top_layer = 'some-remote-top-layer' @@ -203,11 +202,10 @@ args = [ ] working-dir = "/other-test-work-dir" ` - - expectedRemoteOutputWithRebasable = ` + expectedRemoteNoRebasableOutput = ` [remote_info] stack = 'test.stack.id.remote' -rebasable = true +rebasable = false [remote_info.base_image] top_layer = 'some-remote-top-layer' @@ -326,19 +324,20 @@ working-dir = "/other-test-work-dir" }, }, }, + Rebasable: true, } - remoteInfoWithRebasable = &client.ImageInfo{ + remoteInfoNoRebasable = &client.ImageInfo{ StackID: "test.stack.id.remote", Buildpacks: []buildpack.GroupElement{ {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, }, - Base: platform.RunImageForRebase{ + Base: files.RunImageForRebase{ TopLayer: "some-remote-top-layer", Reference: "some-remote-run-image-reference", }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ + Stack: files.Stack{ + RunImage: files.RunImageForExport{ Image: "some-remote-run-image", Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, }, @@ -380,7 +379,7 @@ working-dir = "/other-test-work-dir" }, }, }, - Rebasable: true, + Rebasable: false, } localInfo = &client.ImageInfo{ @@ -430,20 +429,20 @@ working-dir = "/other-test-work-dir" }, }, }, + Rebasable: true, } - - localInfoWithRebasable = &client.ImageInfo{ + localInfoNoRebasable = &client.ImageInfo{ StackID: "test.stack.id.local", Buildpacks: []buildpack.GroupElement{ {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, }, - Base: platform.RunImageForRebase{ + Base: files.RunImageForRebase{ TopLayer: "some-local-top-layer", Reference: "some-local-run-image-reference", }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ + Stack: files.Stack{ + RunImage: files.RunImageForExport{ Image: "some-local-run-image", Mirrors: []string{"some-local-mirror", "other-local-mirror"}, }, @@ -479,7 +478,7 @@ working-dir = "/other-test-work-dir" }, }, }, - Rebasable: true, + Rebasable: false, } outBuf = bytes.Buffer{} @@ -515,10 +514,7 @@ working-dir = "/other-test-work-dir" assert.ContainsTOML(outBuf.String(), expectedLocalOutput) assert.ContainsTOML(outBuf.String(), expectedRemoteOutput) }) - }) - - when("only local image exists", func() { - it("prints local image info in TOML format", func() { + it("prints both local and remote no rebasable images info in a TOML format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -540,14 +536,17 @@ working-dir = "/other-test-work-dir" tomlWriter := writer.NewTOML() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := tomlWriter.Print(logger, sharedImageInfo, localInfo, nil, nil, nil) + err := tomlWriter.Print(logger, sharedImageInfo, localInfoNoRebasable, remoteInfoNoRebasable, nil, nil) assert.Nil(err) assert.ContainsTOML(outBuf.String(), `image_name = "test-image"`) - assert.NotContains(outBuf.String(), "test.stack.id.remote") - assert.ContainsTOML(outBuf.String(), expectedLocalOutput) + assert.ContainsTOML(outBuf.String(), expectedLocalNoRebasableOutput) + assert.ContainsTOML(outBuf.String(), expectedRemoteNoRebasableOutput) }) - it("prints local rebasable image info in TOML format", func() { + }) + + when("only local image exists", func() { + it("prints local image info in TOML format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -569,12 +568,12 @@ working-dir = "/other-test-work-dir" tomlWriter := writer.NewTOML() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := tomlWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + err := tomlWriter.Print(logger, sharedImageInfo, localInfo, nil, nil, nil) assert.Nil(err) assert.ContainsTOML(outBuf.String(), `image_name = "test-image"`) assert.NotContains(outBuf.String(), "test.stack.id.remote") - assert.ContainsTOML(outBuf.String(), expectedLocalOutputWithRebasable) + assert.ContainsTOML(outBuf.String(), expectedLocalOutput) }) }) @@ -608,35 +607,6 @@ working-dir = "/other-test-work-dir" assert.NotContains(outBuf.String(), "test.stack.id.local") assert.ContainsTOML(outBuf.String(), expectedRemoteOutput) }) - it("prints remote rebasable image info in TOML format", func() { - runImageMirrors := []config.RunImage{ - { - Image: "un-used-run-image", - Mirrors: []string{"un-used"}, - }, - { - Image: "some-local-run-image", - Mirrors: []string{"user-configured-mirror-for-local"}, - }, - { - Image: "some-remote-run-image", - Mirrors: []string{"user-configured-mirror-for-remote"}, - }, - } - sharedImageInfo := inspectimage.GeneralInfo{ - Name: "test-image", - RunImageMirrors: runImageMirrors, - } - tomlWriter := writer.NewTOML() - - logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := tomlWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) - assert.Nil(err) - - assert.ContainsTOML(outBuf.String(), `image_name = "test-image"`) - assert.NotContains(outBuf.String(), "test.stack.id.local") - assert.ContainsTOML(outBuf.String(), expectedRemoteOutputWithRebasable) - }) }) }) } diff --git a/internal/inspectimage/writer/yaml_test.go b/internal/inspectimage/writer/yaml_test.go index 13d676c96..ee97ec7a0 100644 --- a/internal/inspectimage/writer/yaml_test.go +++ b/internal/inspectimage/writer/yaml_test.go @@ -30,15 +30,15 @@ func testYAML(t *testing.T, when spec.G, it spec.S) { assert = h.NewAssertionManager(t) outBuf bytes.Buffer - remoteInfo *client.ImageInfo - remoteInfoWithRebasable *client.ImageInfo - localInfo *client.ImageInfo - localInfoWithRebasable *client.ImageInfo + remoteInfo *client.ImageInfo + remoteInfoNoRebasable *client.ImageInfo + localInfo *client.ImageInfo + localInfoNoRebasable *client.ImageInfo expectedLocalOutput = `--- local_info: stack: test.stack.id.local - rebasable: false + rebasable: true base_image: top_layer: some-local-top-layer reference: some-local-run-image-reference @@ -76,10 +76,10 @@ local_info: - args working-dir: /other-test-work-dir ` - expectedLocalOutputWithRebasable = `--- + expectedLocalNoRebasableOutput = `--- local_info: stack: test.stack.id.local - rebasable: true + rebasable: false base_image: top_layer: some-local-top-layer reference: some-local-run-image-reference @@ -120,7 +120,7 @@ local_info: expectedRemoteOutput = `--- remote_info: stack: test.stack.id.remote - rebasable: false + rebasable: true base_image: top_layer: some-remote-top-layer reference: some-remote-run-image-reference @@ -158,10 +158,10 @@ remote_info: - args working-dir: /other-test-work-dir ` - expectedRemoteOutputWithRebasable = `--- + expectedRemoteNoRebasableOutput = `--- remote_info: stack: test.stack.id.remote - rebasable: true + rebasable: false base_image: top_layer: some-remote-top-layer reference: some-remote-run-image-reference @@ -265,20 +265,20 @@ remote_info: }, }, }, + Rebasable: true, } - - remoteInfoWithRebasable = &client.ImageInfo{ + remoteInfoNoRebasable = &client.ImageInfo{ StackID: "test.stack.id.remote", Buildpacks: []buildpack.GroupElement{ {ID: "test.bp.one.remote", Version: "1.0.0", Homepage: "https://some-homepage-one"}, {ID: "test.bp.two.remote", Version: "2.0.0", Homepage: "https://some-homepage-two"}, }, - Base: platform.RunImageForRebase{ + Base: files.RunImageForRebase{ TopLayer: "some-remote-top-layer", Reference: "some-remote-run-image-reference", }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ + Stack: files.Stack{ + RunImage: files.RunImageForExport{ Image: "some-remote-run-image", Mirrors: []string{"some-remote-mirror", "other-remote-mirror"}, }, @@ -320,7 +320,7 @@ remote_info: }, }, }, - Rebasable: true, + Rebasable: false, } localInfo = &client.ImageInfo{ @@ -370,20 +370,20 @@ remote_info: }, }, }, + Rebasable: true, } - - localInfoWithRebasable = &client.ImageInfo{ + localInfoNoRebasable = &client.ImageInfo{ StackID: "test.stack.id.local", Buildpacks: []buildpack.GroupElement{ {ID: "test.bp.one.local", Version: "1.0.0", Homepage: "https://some-homepage-one"}, {ID: "test.bp.two.local", Version: "2.0.0", Homepage: "https://some-homepage-two"}, }, - Base: platform.RunImageForRebase{ + Base: files.RunImageForRebase{ TopLayer: "some-local-top-layer", Reference: "some-local-run-image-reference", }, - Stack: platform.StackMetadata{ - RunImage: platform.RunImageForExport{ + Stack: files.Stack{ + RunImage: files.RunImageForExport{ Image: "some-local-run-image", Mirrors: []string{"some-local-mirror", "other-local-mirror"}, }, @@ -419,7 +419,7 @@ remote_info: }, }, }, - Rebasable: true, + Rebasable: false, } outBuf = bytes.Buffer{} @@ -455,10 +455,7 @@ remote_info: assert.ContainsYAML(outBuf.String(), expectedLocalOutput) assert.ContainsYAML(outBuf.String(), expectedRemoteOutput) }) - }) - - when("only local image exists", func() { - it("prints local image info in YAML format", func() { + it("prints both local and remote no rebasable images info in a YAML format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -480,14 +477,17 @@ remote_info: yamlWriter := writer.NewYAML() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := yamlWriter.Print(logger, sharedImageInfo, localInfo, nil, nil, nil) + err := yamlWriter.Print(logger, sharedImageInfo, localInfoNoRebasable, remoteInfoNoRebasable, nil, nil) assert.Nil(err) assert.ContainsYAML(outBuf.String(), `"image_name": "test-image"`) - assert.ContainsYAML(outBuf.String(), expectedLocalOutput) - assert.NotContains(outBuf.String(), "test.stack.id.remote") + assert.ContainsYAML(outBuf.String(), expectedLocalNoRebasableOutput) + assert.ContainsYAML(outBuf.String(), expectedRemoteNoRebasableOutput) }) - it("prints local rebasable image info in YAML format", func() { + }) + + when("only local image exists", func() { + it("prints local image info in YAML format", func() { runImageMirrors := []config.RunImage{ { Image: "un-used-run-image", @@ -509,11 +509,11 @@ remote_info: yamlWriter := writer.NewYAML() logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := yamlWriter.Print(logger, sharedImageInfo, localInfoWithRebasable, nil, nil, nil) + err := yamlWriter.Print(logger, sharedImageInfo, localInfo, nil, nil, nil) assert.Nil(err) assert.ContainsYAML(outBuf.String(), `"image_name": "test-image"`) - assert.ContainsYAML(outBuf.String(), expectedLocalOutputWithRebasable) + assert.ContainsYAML(outBuf.String(), expectedLocalOutput) assert.NotContains(outBuf.String(), "test.stack.id.remote") }) }) @@ -548,35 +548,6 @@ remote_info: assert.NotContains(outBuf.String(), "test.stack.id.local") assert.ContainsYAML(outBuf.String(), expectedRemoteOutput) }) - it("prints remote rebasable image info in YAML format", func() { - runImageMirrors := []config.RunImage{ - { - Image: "un-used-run-image", - Mirrors: []string{"un-used"}, - }, - { - Image: "some-local-run-image", - Mirrors: []string{"user-configured-mirror-for-local"}, - }, - { - Image: "some-remote-run-image", - Mirrors: []string{"user-configured-mirror-for-remote"}, - }, - } - sharedImageInfo := inspectimage.GeneralInfo{ - Name: "test-image", - RunImageMirrors: runImageMirrors, - } - yamlWriter := writer.NewYAML() - - logger := logging.NewLogWithWriters(&outBuf, &outBuf) - err := yamlWriter.Print(logger, sharedImageInfo, nil, remoteInfoWithRebasable, nil, nil) - assert.Nil(err) - - assert.ContainsYAML(outBuf.String(), `"image_name": "test-image"`) - assert.ContainsYAML(outBuf.String(), expectedRemoteOutputWithRebasable) - assert.NotContains(outBuf.String(), "test.stack.id.local") - }) }) }) } diff --git a/pkg/client/inspect_image.go b/pkg/client/inspect_image.go index dbb227f34..ee5e5a6a8 100644 --- a/pkg/client/inspect_image.go +++ b/pkg/client/inspect_image.go @@ -124,7 +124,7 @@ func (c *Client) InspectImage(name string, daemon bool) (*ImageInfo, error) { } var rebasable bool - if _, err := dist.GetLabel(img, platform.RebaseableLabel, &rebasable); err != nil { + if _, err := dist.GetLabel(img, platform.RebasableLabel, &rebasable); err != nil { return nil, err } diff --git a/pkg/client/inspect_image_test.go b/pkg/client/inspect_image_test.go index ee786043a..124c25902 100644 --- a/pkg/client/inspect_image_test.go +++ b/pkg/client/inspect_image_test.go @@ -37,15 +37,14 @@ var ignorePlatformAPI = []cmp.Option{ func testInspectImage(t *testing.T, when spec.G, it spec.S) { var ( - subject *Client - mockImageFetcher *testmocks.MockImageFetcher - mockDockerClient *testmocks.MockCommonAPIClient - mockController *gomock.Controller - mockImage *testmocks.MockImage - mockRebasableImage *testmocks.MockImage - mockImageWithExtension *testmocks.MockImage - mockRebasableImageWithExtension *testmocks.MockImage - out bytes.Buffer + subject *Client + mockImageFetcher *testmocks.MockImageFetcher + mockDockerClient *testmocks.MockCommonAPIClient + mockController *gomock.Controller + mockImage *testmocks.MockImage + mockImageNoRebasable *testmocks.MockImage + mockImageWithExtension *testmocks.MockImage + out bytes.Buffer ) it.Before(func() { @@ -60,6 +59,7 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { mockImage = testmocks.NewImage("some/image", "", nil) h.AssertNil(t, mockImage.SetWorkingDir("/test-workdir")) h.AssertNil(t, mockImage.SetLabel("io.buildpacks.stack.id", "test.stack.id")) + h.AssertNil(t, mockImage.SetLabel("io.buildpacks.rebasable", "true")) h.AssertNil(t, mockImage.SetLabel( "io.buildpacks.lifecycle.metadata", `{ @@ -116,15 +116,16 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { }`, )) - mockRebasableImage = testmocks.NewImage("some/rebasableImage", "", nil) - h.AssertNil(t, mockRebasableImage.SetWorkingDir("/test-workdir")) - h.AssertNil(t, mockRebasableImage.SetLabel("io.buildpacks.stack.id", "test.stack.id")) - h.AssertNil(t, mockRebasableImage.SetLabel( + mockImageNoRebasable = testmocks.NewImage("some/imageNoRebasable", "", nil) + h.AssertNil(t, mockImageNoRebasable.SetWorkingDir("/test-workdir")) + h.AssertNil(t, mockImageNoRebasable.SetLabel("io.buildpacks.stack.id", "test.stack.id")) + h.AssertNil(t, mockImageNoRebasable.SetLabel("io.buildpacks.rebasable", "false")) + h.AssertNil(t, mockImageNoRebasable.SetLabel( "io.buildpacks.lifecycle.metadata", `{ "stack": { "runImage": { - "image": "some-run-image", + "image": "some-run-image-no-rebasable", "mirrors": [ "some-mirror", "other-mirror" @@ -137,7 +138,7 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { } }`, )) - h.AssertNil(t, mockRebasableImage.SetLabel( + h.AssertNil(t, mockImage.SetLabel( "io.buildpacks.build.metadata", `{ "bom": [ @@ -174,11 +175,11 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { } }`, )) - h.AssertNil(t, mockRebasableImage.SetLabel("io.buildpacks.rebasable", "true")) mockImageWithExtension = testmocks.NewImage("some/imageWithExtension", "", nil) h.AssertNil(t, mockImageWithExtension.SetWorkingDir("/test-workdir")) h.AssertNil(t, mockImageWithExtension.SetLabel("io.buildpacks.stack.id", "test.stack.id")) + h.AssertNil(t, mockImageWithExtension.SetLabel("io.buildpacks.rebasable", "true")) h.AssertNil(t, mockImageWithExtension.SetLabel( "io.buildpacks.lifecycle.metadata", `{ @@ -244,76 +245,6 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { } }`, )) - - mockRebasableImageWithExtension = testmocks.NewImage("some/rebasableImageWithExtension", "", nil) - h.AssertNil(t, mockRebasableImageWithExtension.SetWorkingDir("/test-workdir")) - h.AssertNil(t, mockRebasableImageWithExtension.SetLabel("io.buildpacks.stack.id", "test.stack.id")) - h.AssertNil(t, mockRebasableImageWithExtension.SetLabel( - "io.buildpacks.lifecycle.metadata", - `{ - "stack": { - "runImage": { - "image": "some-run-image", - "mirrors": [ - "some-mirror", - "other-mirror" - ] - } - }, - "runImage": { - "topLayer": "some-top-layer", - "reference": "some-run-image-reference" - } -}`, - )) - h.AssertNil(t, mockRebasableImageWithExtension.SetLabel( - "io.buildpacks.build.metadata", - `{ - "bom": [ - { - "name": "some-bom-element" - } - ], - "buildpacks": [ - { - "id": "some-buildpack", - "version": "some-version" - }, - { - "id": "other-buildpack", - "version": "other-version" - } - ], - "extensions": [ - { - "id": "some-extension", - "version": "some-version" - }, - { - "id": "other-extension", - "version": "other-version" - } - ], - "processes": [ - { - "type": "other-process", - "command": "/other/process", - "args": ["opt", "1"], - "direct": true - }, - { - "type": "web", - "command": "/start/web-process", - "args": ["-p", "1234"], - "direct": false - } - ], - "launcher": { - "version": "0.5.0" - } -}`, - )) - h.AssertNil(t, mockRebasableImageWithExtension.SetLabel("io.buildpacks.rebasable", "true")) }) it.After(func() { @@ -327,14 +258,12 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { it.Before(func() { if useDaemon { mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/image", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImage, nil).AnyTimes() - mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImage", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockRebasableImage, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageNoRebasable", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImageNoRebasable, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageWithExtension", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImageWithExtension, nil).AnyTimes() - mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImageWithExtension", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockRebasableImageWithExtension, nil).AnyTimes() } else { mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/image", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImage, nil).AnyTimes() - mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImage", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockRebasableImage, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageNoRebasable", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImageNoRebasable, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageWithExtension", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImageWithExtension, nil).AnyTimes() - mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/rebasableImageWithExtension", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockRebasableImageWithExtension, nil).AnyTimes() } }) @@ -422,13 +351,19 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { }) it("returns the rebasable image", func() { - info, err := subject.InspectImage("some/rebasableImage", useDaemon) + info, err := subject.InspectImage("some/image", useDaemon) h.AssertNil(t, err) h.AssertEq(t, info.Rebasable, true) }) + it("returns the no rebasable image", func() { + info, err := subject.InspectImage("some/imageNoRebasable", useDaemon) + h.AssertNil(t, err) + h.AssertEq(t, info.Rebasable, false) + }) + it("returns the rebasable image with Extension", func() { - infoRebasableWithExtension, err := subject.InspectImage("some/rebasableImageWithExtension", useDaemon) + infoRebasableWithExtension, err := subject.InspectImage("some/imageWithExtension", useDaemon) h.AssertNil(t, err) h.AssertEq(t, infoRebasableWithExtension.Rebasable, true) }) From 055923dc758ba5497f5265874c801e9649826762 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 19:17:22 +0000 Subject: [PATCH 44/86] build(deps): bump github.com/google/go-containerregistry Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.15.2 to 0.16.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.15.2...v0.16.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] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 651010705..0c50fbabd 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/go-git/go-git/v5 v5.8.1 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.5.9 - github.com/google/go-containerregistry v0.15.2 + github.com/google/go-containerregistry v0.16.1 github.com/google/go-github/v30 v30.1.0 github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 github.com/heroku/color v0.0.6 diff --git a/go.sum b/go.sum index 9690b3a65..dc7debd72 100644 --- a/go.sum +++ b/go.sum @@ -178,8 +178,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-containerregistry v0.15.2 h1:MMkSh+tjSdnmJZO7ljvEqV1DjfekB6VUEAZgy3a+TQE= -github.com/google/go-containerregistry v0.15.2/go.mod h1:wWK+LnOv4jXMM23IT/F1wdYftGWGr47Is8CG+pmHK1Q= +github.com/google/go-containerregistry v0.16.1 h1:rUEt426sR6nyrL3gt+18ibRcvYpKYdpsa5ZW7MA08dQ= +github.com/google/go-containerregistry v0.16.1/go.mod h1:u0qB2l7mvtWVR5kNcbFIhFY1hLbf8eeGapA+vbFDCtQ= github.com/google/go-github/v30 v30.1.0 h1:VLDx+UolQICEOKu2m4uAoMti1SxuEBAl7RSEG16L+Oo= github.com/google/go-github/v30 v30.1.0/go.mod h1:n8jBpHl45a/rlBUtRJMOG4GhNADUQFEufcolZ95JfU8= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= From 4c8cb8b3c0b3c0dbf4caeecd0e2bda8a8c71d9bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:09:09 +0000 Subject: [PATCH 45/86] build(deps): bump buildpacks/github-actions from 5.3.0 to 5.3.1 Bumps [buildpacks/github-actions](https://github.com/buildpacks/github-actions) from 5.3.0 to 5.3.1. - [Release notes](https://github.com/buildpacks/github-actions/releases) - [Commits](https://github.com/buildpacks/github-actions/compare/v5.3.0...v5.3.1) --- updated-dependencies: - dependency-name: buildpacks/github-actions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/delivery-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delivery-docker.yml b/.github/workflows/delivery-docker.yml index 18fbad1cd..6ad0b3262 100644 --- a/.github/workflows/delivery-docker.yml +++ b/.github/workflows/delivery-docker.yml @@ -61,7 +61,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - uses: docker/setup-qemu-action@v2 - uses: docker/setup-buildx-action@v2 - - uses: buildpacks/github-actions/setup-tools@v5.3.0 + - uses: buildpacks/github-actions/setup-tools@v5.3.1 - name: Buildx Build/Publish run: | docker buildx build . \ From abcfb5b68c722eafd410fc214df306bf9f99a4e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:46:41 +0000 Subject: [PATCH 46/86] build(deps): bump golang.org/x/term from 0.10.0 to 0.11.0 Bumps [golang.org/x/term](https://github.com/golang/term) from 0.10.0 to 0.11.0. - [Commits](https://github.com/golang/term/compare/v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: golang.org/x/term dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 0c50fbabd..3e302fd30 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( golang.org/x/mod v0.12.0 golang.org/x/oauth2 v0.10.0 golang.org/x/sync v0.3.0 - golang.org/x/term v0.10.0 + golang.org/x/term v0.11.0 golang.org/x/text v0.11.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -114,7 +114,7 @@ require ( github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/go.sum b/go.sum index dc7debd72..7f7f8ec8f 100644 --- a/go.sum +++ b/go.sum @@ -406,8 +406,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -415,8 +415,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From b0730ab973a56bcc7d1d93ad1cb0b4b5ea309ecc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:46:48 +0000 Subject: [PATCH 47/86] build(deps): bump golang.org/x/crypto from 0.11.0 to 0.12.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.11.0 to 0.12.0. - [Commits](https://github.com/golang/crypto/compare/v0.11.0...v0.12.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 0c50fbabd..18fac317c 100644 --- a/go.mod +++ b/go.mod @@ -29,12 +29,12 @@ require ( github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/sclevine/spec v1.4.0 github.com/spf13/cobra v1.7.0 - golang.org/x/crypto v0.11.0 + golang.org/x/crypto v0.12.0 golang.org/x/mod v0.12.0 golang.org/x/oauth2 v0.10.0 golang.org/x/sync v0.3.0 - golang.org/x/term v0.10.0 - golang.org/x/text v0.11.0 + golang.org/x/term v0.11.0 + golang.org/x/text v0.12.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -114,7 +114,7 @@ require ( github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/go.sum b/go.sum index dc7debd72..8ccd0b3f6 100644 --- a/go.sum +++ b/go.sum @@ -342,8 +342,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -406,8 +406,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -415,8 +415,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -425,8 +425,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= From 7047f9d47035e99cba818e2250a3334872953ba6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:46:55 +0000 Subject: [PATCH 48/86] build(deps): bump golang.org/x/text from 0.11.0 to 0.12.0 Bumps [golang.org/x/text](https://github.com/golang/text) from 0.11.0 to 0.12.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.11.0...v0.12.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0c50fbabd..ad31958c6 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( golang.org/x/oauth2 v0.10.0 golang.org/x/sync v0.3.0 golang.org/x/term v0.10.0 - golang.org/x/text v0.11.0 + golang.org/x/text v0.12.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index dc7debd72..d8008fea2 100644 --- a/go.sum +++ b/go.sum @@ -425,8 +425,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= From d6713fadca35fb0712c6043792ca04989b62d7e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 22:56:18 +0000 Subject: [PATCH 49/86] build(deps): bump golang.org/x/oauth2 from 0.10.0 to 0.11.0 Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.10.0 to 0.11.0. - [Commits](https://github.com/golang/oauth2/compare/v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: golang.org/x/oauth2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 18fac317c..5f62f17fb 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/spf13/cobra v1.7.0 golang.org/x/crypto v0.12.0 golang.org/x/mod v0.12.0 - golang.org/x/oauth2 v0.10.0 + golang.org/x/oauth2 v0.11.0 golang.org/x/sync v0.3.0 golang.org/x/term v0.11.0 golang.org/x/text v0.12.0 @@ -113,7 +113,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.14.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 8ccd0b3f6..09a2ae0e3 100644 --- a/go.sum +++ b/go.sum @@ -365,11 +365,11 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From f56a203422924aa93b23cb1222766650a01ba8c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:58:27 +0000 Subject: [PATCH 50/86] build(deps): bump github.com/buildpacks/lifecycle Bumps [github.com/buildpacks/lifecycle](https://github.com/buildpacks/lifecycle) from 0.17.0-rc.4 to 0.17.0. - [Release notes](https://github.com/buildpacks/lifecycle/releases) - [Changelog](https://github.com/buildpacks/lifecycle/blob/main/RELEASE.md) - [Commits](https://github.com/buildpacks/lifecycle/compare/v0.17.0-rc.4...v0.17.0) --- updated-dependencies: - dependency-name: github.com/buildpacks/lifecycle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 18fac317c..84c739fa5 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Microsoft/go-winio v0.6.1 github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c - github.com/buildpacks/lifecycle v0.17.0-rc.4 + github.com/buildpacks/lifecycle v0.17.0 github.com/docker/cli v24.0.5+incompatible github.com/docker/docker v24.0.5+incompatible github.com/docker/go-connections v0.4.0 diff --git a/go.sum b/go.sum index 8ccd0b3f6..d4b11d433 100644 --- a/go.sum +++ b/go.sum @@ -97,8 +97,8 @@ github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001- github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c h1:HlRuSz+JGAzudNtNCfHIzXe0AEuHX6Vx8uZgmjvX02o= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c/go.mod h1:mBG5M3GJW5nknCEOOqtmMHyPYnSpw/5GEiciuYU/COw= -github.com/buildpacks/lifecycle v0.17.0-rc.4 h1:0mCWV9RAWLYRj8BtdEJdAX5uk8EFE8YOvdfjYIHu0Tw= -github.com/buildpacks/lifecycle v0.17.0-rc.4/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= +github.com/buildpacks/lifecycle v0.17.0 h1:vX/kpQfuh4LZvsIhi1wNkx/zahvwiF72bgc46rQ+3z0= +github.com/buildpacks/lifecycle v0.17.0/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 h1:krfRl01rzPzxSxyLyrChD+U+MzsBXbm0OwYYB67uF+4= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589/go.mod h1:OuDyvmLnMCwa2ep4Jkm6nyA0ocJuZlGyk2gGseVzERM= From fef37315524021c33a705aac57400e20a5ec7aaf Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Wed, 9 Aug 2023 17:50:44 +0200 Subject: [PATCH 51/86] Fix the rebasable flag logic in case of missing label Signed-off-by: Domenico Luciani --- .../inspect_image_local_output.json | 2 +- .../inspect_image_local_output.toml | 2 +- .../inspect_image_local_output.yaml | 2 +- .../inspect_image_published_output.json | 2 +- .../inspect_image_published_output.toml | 2 +- .../inspect_image_published_output.yaml | 2 +- pkg/client/inspect_image.go | 18 +++- pkg/client/inspect_image_test.go | 88 ++++++++++++++++--- pkg/dist/image_test.go | 1 + 9 files changed, 101 insertions(+), 18 deletions(-) create mode 100644 pkg/dist/image_test.go diff --git a/acceptance/testdata/pack_fixtures/inspect_image_local_output.json b/acceptance/testdata/pack_fixtures/inspect_image_local_output.json index 08bee028c..154c1ca12 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_local_output.json +++ b/acceptance/testdata/pack_fixtures/inspect_image_local_output.json @@ -3,7 +3,7 @@ "remote_info": null, "local_info": { "stack": "pack.test.stack", - "rebasable": false, + "rebasable": {{.rebasable}}, "base_image": { "top_layer": "{{.base_image_top_layer}}", "reference": "{{.base_image_id}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml b/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml index 4a2f816db..6798c3115 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml +++ b/acceptance/testdata/pack_fixtures/inspect_image_local_output.toml @@ -2,7 +2,7 @@ image_name = "{{.image_name}}" [local_info] stack = "pack.test.stack" -rebasable = false +rebasable = {{.rebasable}} [local_info.base_image] top_layer = "{{.base_image_top_layer}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml b/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml index b3d8b757f..11bf97dca 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml +++ b/acceptance/testdata/pack_fixtures/inspect_image_local_output.yaml @@ -3,7 +3,7 @@ image_name: "{{.image_name}}" remote_info: local_info: stack: pack.test.stack - rebasable: false + rebasable: {{.rebasable}} base_image: top_layer: "{{.base_image_top_layer}}" reference: "{{.base_image_id}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_published_output.json b/acceptance/testdata/pack_fixtures/inspect_image_published_output.json index 4945e2f81..f03d82df9 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_published_output.json +++ b/acceptance/testdata/pack_fixtures/inspect_image_published_output.json @@ -3,7 +3,7 @@ "local_info": null, "remote_info": { "stack": "pack.test.stack", - "rebasable": false, + "rebasable": {{.rebasable}}, "base_image": { "top_layer": "{{.base_image_top_layer}}", "reference": "{{.base_image_ref}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml b/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml index 4d86d0d8f..a216f5125 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml +++ b/acceptance/testdata/pack_fixtures/inspect_image_published_output.toml @@ -2,7 +2,7 @@ image_name = "{{.image_name}}" [remote_info] stack = "pack.test.stack" -rebasable = false +rebasable = {{.rebasable}} [remote_info.base_image] top_layer = "{{.base_image_top_layer}}" diff --git a/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml b/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml index cbcdb3e6e..b9b745bc2 100644 --- a/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml +++ b/acceptance/testdata/pack_fixtures/inspect_image_published_output.yaml @@ -3,7 +3,7 @@ image_name: "{{.image_name}}" local_info: null remote_info: stack: pack.test.stack - rebasable: false + rebasable: {{.rebasable}} base_image: top_layer: "{{.base_image_top_layer}}" reference: "{{.base_image_ref}}" diff --git a/pkg/client/inspect_image.go b/pkg/client/inspect_image.go index ee5e5a6a8..e60f444a8 100644 --- a/pkg/client/inspect_image.go +++ b/pkg/client/inspect_image.go @@ -123,8 +123,8 @@ func (c *Client) InspectImage(name string, daemon bool) (*ImageInfo, error) { return nil, err } - var rebasable bool - if _, err := dist.GetLabel(img, platform.RebasableLabel, &rebasable); err != nil { + rebasable, err := getRebasableLabel(img) + if err != nil { return nil, err } @@ -215,3 +215,17 @@ func (c *Client) InspectImage(name string, daemon bool) (*ImageInfo, error) { Rebasable: rebasable, }, nil } + +func getRebasableLabel(labeled dist.Labeled) (bool, error) { + var rebasableOutput bool + isPresent, err := dist.GetLabel(labeled, platform.RebasableLabel, &rebasableOutput) + if err != nil { + return false, err + } + + if !isPresent && err == nil { + rebasableOutput = true + } + + return rebasableOutput, nil +} diff --git a/pkg/client/inspect_image_test.go b/pkg/client/inspect_image_test.go index 124c25902..1ab862ae1 100644 --- a/pkg/client/inspect_image_test.go +++ b/pkg/client/inspect_image_test.go @@ -37,14 +37,15 @@ var ignorePlatformAPI = []cmp.Option{ func testInspectImage(t *testing.T, when spec.G, it spec.S) { var ( - subject *Client - mockImageFetcher *testmocks.MockImageFetcher - mockDockerClient *testmocks.MockCommonAPIClient - mockController *gomock.Controller - mockImage *testmocks.MockImage - mockImageNoRebasable *testmocks.MockImage - mockImageWithExtension *testmocks.MockImage - out bytes.Buffer + subject *Client + mockImageFetcher *testmocks.MockImageFetcher + mockDockerClient *testmocks.MockCommonAPIClient + mockController *gomock.Controller + mockImage *testmocks.MockImage + mockImageNoRebasable *testmocks.MockImage + mockImageRebasableWithoutLabel *testmocks.MockImage + mockImageWithExtension *testmocks.MockImage + out bytes.Buffer ) it.Before(func() { @@ -138,7 +139,66 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { } }`, )) - h.AssertNil(t, mockImage.SetLabel( + h.AssertNil(t, mockImageNoRebasable.SetLabel( + "io.buildpacks.build.metadata", + `{ + "bom": [ + { + "name": "some-bom-element" + } + ], + "buildpacks": [ + { + "id": "some-buildpack", + "version": "some-version" + }, + { + "id": "other-buildpack", + "version": "other-version" + } + ], + "processes": [ + { + "type": "other-process", + "command": "/other/process", + "args": ["opt", "1"], + "direct": true + }, + { + "type": "web", + "command": "/start/web-process", + "args": ["-p", "1234"], + "direct": false + } + ], + "launcher": { + "version": "0.5.0" + } +}`, + )) + + mockImageRebasableWithoutLabel = testmocks.NewImage("some/imageRebasableWithoutLabel", "", nil) + h.AssertNil(t, mockImageNoRebasable.SetWorkingDir("/test-workdir")) + h.AssertNil(t, mockImageNoRebasable.SetLabel("io.buildpacks.stack.id", "test.stack.id")) + h.AssertNil(t, mockImageNoRebasable.SetLabel( + "io.buildpacks.lifecycle.metadata", + `{ + "stack": { + "runImage": { + "image": "some-run-image-no-rebasable", + "mirrors": [ + "some-mirror", + "other-mirror" + ] + } + }, + "runImage": { + "topLayer": "some-top-layer", + "reference": "some-run-image-reference" + } +}`, + )) + h.AssertNil(t, mockImageNoRebasable.SetLabel( "io.buildpacks.build.metadata", `{ "bom": [ @@ -259,10 +319,12 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { if useDaemon { mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/image", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImage, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageNoRebasable", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImageNoRebasable, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageRebasableWithoutLabel", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImageRebasableWithoutLabel, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageWithExtension", image.FetchOptions{Daemon: true, PullPolicy: image.PullNever}).Return(mockImageWithExtension, nil).AnyTimes() } else { mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/image", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImage, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageNoRebasable", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImageNoRebasable, nil).AnyTimes() + mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageRebasableWithoutLabel", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImageRebasableWithoutLabel, nil).AnyTimes() mockImageFetcher.EXPECT().Fetch(gomock.Any(), "some/imageWithExtension", image.FetchOptions{Daemon: false, PullPolicy: image.PullNever}).Return(mockImageWithExtension, nil).AnyTimes() } }) @@ -356,6 +418,12 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { h.AssertEq(t, info.Rebasable, true) }) + it("returns the rebasable image true if the label has not been set", func() { + info, err := subject.InspectImage("some/imageRebasableWithoutLabel", useDaemon) + h.AssertNil(t, err) + h.AssertEq(t, info.Rebasable, true) + }) + it("returns the no rebasable image", func() { info, err := subject.InspectImage("some/imageNoRebasable", useDaemon) h.AssertNil(t, err) @@ -894,7 +962,7 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) { Return(fakes.NewImage("missing/labels", "", nil), nil) info, err := subject.InspectImage("missing/labels", true) h.AssertNil(t, err) - h.AssertEq(t, info, &ImageInfo{}, ignorePlatformAPI...) + h.AssertEq(t, info, &ImageInfo{Rebasable: true}, ignorePlatformAPI...) }) }) diff --git a/pkg/dist/image_test.go b/pkg/dist/image_test.go new file mode 100644 index 000000000..e3fff5076 --- /dev/null +++ b/pkg/dist/image_test.go @@ -0,0 +1 @@ +package dist From 623c1982476a6cb7a8af9f7499035101aac06698 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Thu, 10 Aug 2023 10:47:51 +0200 Subject: [PATCH 52/86] Add test for the GetLabel function Signed-off-by: Domenico Luciani --- pkg/dist/image_test.go | 60 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/pkg/dist/image_test.go b/pkg/dist/image_test.go index e3fff5076..a971df7cc 100644 --- a/pkg/dist/image_test.go +++ b/pkg/dist/image_test.go @@ -1 +1,59 @@ -package dist +package dist_test + +import ( + "testing" + + "github.com/heroku/color" + "github.com/pkg/errors" + "github.com/sclevine/spec" + "github.com/sclevine/spec/report" + + "github.com/buildpacks/pack/internal/builder/fakes" + "github.com/buildpacks/pack/pkg/dist" + h "github.com/buildpacks/pack/testhelpers" +) + +func TestImage(t *testing.T) { + color.Disable(true) + defer color.Disable(false) + spec.Run(t, "testImage", testImage, spec.Parallel(), spec.Report(report.Terminal{})) +} + +func testImage(t *testing.T, when spec.G, it spec.S) { + when("A label needs to be get", func() { + it("sets a label successfully", func() { + var outputLabel bool + mockInspectable := fakes.FakeInspectable{ReturnForLabel: "true", ErrorForLabel: nil} + + isPresent, err := dist.GetLabel(&mockInspectable, "random-label", &outputLabel) + + h.AssertNil(t, err) + h.AssertEq(t, isPresent, true) + h.AssertEq(t, outputLabel, true) + }) + + it("returns an error", func() { + var outputLabel bool + mockInspectable := fakes.FakeInspectable{ReturnForLabel: "", ErrorForLabel: errors.New("random-error")} + + isPresent, err := dist.GetLabel(&mockInspectable, "random-label", &outputLabel) + + h.AssertNotNil(t, err) + h.AssertEq(t, isPresent, false) + h.AssertEq(t, outputLabel, false) + }) + }) + + when("Try to get an empty label", func() { + it("returns isPresent but it doesn't set the label", func() { + var outputLabel bool + mockInspectable := fakes.FakeInspectable{ReturnForLabel: "", ErrorForLabel: nil} + + isPresent, err := dist.GetLabel(&mockInspectable, "random-label", &outputLabel) + + h.AssertNil(t, err) + h.AssertEq(t, isPresent, false) + h.AssertEq(t, outputLabel, false) + }) + }) +} From 7bfa5f0adb52b108e25ecd51b3203ba723b9e443 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 10 Aug 2023 16:09:11 -0400 Subject: [PATCH 53/86] Bump lifecycle Signed-off-by: Natalie Arellano --- acceptance/testdata/pack_fixtures/report_output.txt | 2 +- internal/builder/lifecycle.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acceptance/testdata/pack_fixtures/report_output.txt b/acceptance/testdata/pack_fixtures/report_output.txt index 7127c560e..7fe30b632 100644 --- a/acceptance/testdata/pack_fixtures/report_output.txt +++ b/acceptance/testdata/pack_fixtures/report_output.txt @@ -2,7 +2,7 @@ Pack: Version: {{ .Version }} OS/Arch: {{ .OS }}/{{ .Arch }} -Default Lifecycle Version: 0.17.0-rc.4 +Default Lifecycle Version: 0.17.0 Supported Platform APIs: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12 diff --git a/internal/builder/lifecycle.go b/internal/builder/lifecycle.go index 7e76c2a9c..dc187a31f 100644 --- a/internal/builder/lifecycle.go +++ b/internal/builder/lifecycle.go @@ -14,7 +14,7 @@ import ( // A snapshot of the latest tested lifecycle version values const ( - DefaultLifecycleVersion = "0.17.0-rc.4" + DefaultLifecycleVersion = "0.17.0" DefaultBuildpackAPIVersion = "0.2" ) From d413bd433c7f58ecba31a695be5eeaaae63a88fe Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 22 Aug 2023 17:00:48 -0400 Subject: [PATCH 54/86] Improvemnts to --cache help - Add quotes, otherwise the option will be ignored - Remove trailing ; which causes `invalid field '' must be a key=value pair` error - Clarify that cache as image requires --publish Signed-off-by: Natalie Arellano --- internal/commands/build.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/commands/build.go b/internal/commands/build.go index d93a61c1b..3984da850 100644 --- a/internal/commands/build.go +++ b/internal/commands/build.go @@ -226,9 +226,9 @@ func buildCommandFlags(cmd *cobra.Command, buildFlags *BuildFlags, cfg config.Co cmd.Flags().StringVarP(&buildFlags.Builder, "builder", "B", cfg.DefaultBuilder, "Builder image") cmd.Flags().Var(&buildFlags.Cache, "cache", `Cache options used to define cache techniques for build process. -- Cache as bind: type=;format=bind;source=; -- Cache as image: type=;format=image;name=; -- Cache as volume: type=;format=volume;[name=;] +- Cache as bind: 'type=;format=bind;source=' +- Cache as image (requires --publish): 'type=;format=image;name=' +- Cache as volume: 'type=;format=volume;[name=]' - If no name is provided, a random name will be generated. `) cmd.Flags().StringVar(&buildFlags.CacheImage, "cache-image", "", `Cache build layers in remote registry. Requires --publish`) From 21d1460e84fe8d82db44efbb7b6852b7e44adb2c Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Wed, 23 Aug 2023 13:53:13 -0400 Subject: [PATCH 55/86] Provides client keychain to lifecycle instead of the default keychain Fixes https://github.com/buildpacks/pack/issues/1845 Signed-off-by: Natalie Arellano --- internal/build/lifecycle_execution.go | 9 ++++----- internal/build/lifecycle_execution_test.go | 2 ++ internal/build/lifecycle_executor.go | 2 ++ pkg/client/build.go | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/build/lifecycle_execution.go b/internal/build/lifecycle_execution.go index fd5b16b95..092fc9bf1 100644 --- a/internal/build/lifecycle_execution.go +++ b/internal/build/lifecycle_execution.go @@ -12,7 +12,6 @@ import ( "github.com/buildpacks/lifecycle/api" "github.com/buildpacks/lifecycle/auth" "github.com/buildpacks/lifecycle/platform/files" - "github.com/google/go-containerregistry/pkg/authn" "github.com/google/go-containerregistry/pkg/name" "github.com/pkg/errors" "golang.org/x/sync/errgroup" @@ -389,7 +388,7 @@ func (l *LifecycleExecution) Create(ctx context.Context, buildCache, launchCache } if l.opts.Publish || l.opts.Layout { - authConfig, err := auth.BuildEnvVar(authn.DefaultKeychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) + authConfig, err := auth.BuildEnvVar(l.opts.Keychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) if err != nil { return err } @@ -485,7 +484,7 @@ func (l *LifecycleExecution) Restore(ctx context.Context, buildCache Cache, kani // for auths registryOp := NullOp() if len(registryImages) > 0 { - authConfig, err := auth.BuildEnvVar(authn.DefaultKeychain, registryImages...) + authConfig, err := auth.BuildEnvVar(l.opts.Keychain, registryImages...) if err != nil { return err } @@ -609,7 +608,7 @@ func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCach var analyze RunnerCleaner if l.opts.Publish { - authConfig, err := auth.BuildEnvVar(authn.DefaultKeychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) + authConfig, err := auth.BuildEnvVar(l.opts.Keychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) if err != nil { return err } @@ -805,7 +804,7 @@ func (l *LifecycleExecution) Export(ctx context.Context, buildCache, launchCache var export RunnerCleaner if l.opts.Publish { - authConfig, err := auth.BuildEnvVar(authn.DefaultKeychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) + authConfig, err := auth.BuildEnvVar(l.opts.Keychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) if err != nil { return err } diff --git a/internal/build/lifecycle_execution_test.go b/internal/build/lifecycle_execution_test.go index 8dc2d4904..c4af17b24 100644 --- a/internal/build/lifecycle_execution_test.go +++ b/internal/build/lifecycle_execution_test.go @@ -18,6 +18,7 @@ import ( "github.com/buildpacks/lifecycle/platform/files" "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" + "github.com/google/go-containerregistry/pkg/authn" "github.com/google/go-containerregistry/pkg/name" "github.com/heroku/color" "github.com/sclevine/spec" @@ -89,6 +90,7 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { opts.UseCreator = providedUseCreator opts.Volumes = providedVolumes opts.Layout = providedLayout + opts.Keychain = authn.DefaultKeychain targetImageRef, err := name.ParseReference(providedTargetImage) h.AssertNil(t, err) diff --git a/internal/build/lifecycle_executor.go b/internal/build/lifecycle_executor.go index 2f7dce541..e3dd7d00d 100644 --- a/internal/build/lifecycle_executor.go +++ b/internal/build/lifecycle_executor.go @@ -9,6 +9,7 @@ import ( "github.com/buildpacks/imgutil" "github.com/buildpacks/lifecycle/api" "github.com/buildpacks/lifecycle/platform/files" + "github.com/google/go-containerregistry/pkg/authn" "github.com/google/go-containerregistry/pkg/name" "github.com/buildpacks/pack/internal/builder" @@ -98,6 +99,7 @@ type LifecycleOptions struct { ReportDestinationDir string SBOMDestinationDir string CreationTime *time.Time + Keychain authn.Keychain } func NewLifecycleExecutor(logger logging.Logger, docker DockerClient) *LifecycleExecutor { diff --git a/pkg/client/build.go b/pkg/client/build.go index 00283cd05..ba555fd7c 100644 --- a/pkg/client/build.go +++ b/pkg/client/build.go @@ -538,6 +538,7 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error { SBOMDestinationDir: opts.SBOMDestinationDir, CreationTime: opts.CreationTime, Layout: opts.Layout(), + Keychain: c.keychain, } switch { From 3c4307ea1d048fe735320f95f81b705b33d94e2c Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Wed, 23 Aug 2023 14:52:40 -0400 Subject: [PATCH 56/86] When additional buildpack is missing version, try to use the latest one Fixes https://github.com/buildpacks/pack/issues/1862 Signed-off-by: Natalie Arellano --- internal/commands/build_test.go | 2 ++ pkg/client/build.go | 4 +++- pkg/client/build_test.go | 27 ++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/internal/commands/build_test.go b/internal/commands/build_test.go index aeebdbea2..257f83cc6 100644 --- a/internal/commands/build_test.go +++ b/internal/commands/build_test.go @@ -566,6 +566,7 @@ version = "1.0" h.AssertNil(t, command.Execute()) }) }) + when("file has a builder specified", func() { var projectTomlPath string @@ -608,6 +609,7 @@ builder = "my-builder" }) }) }) + when("file is invalid", func() { var projectTomlPath string diff --git a/pkg/client/build.go b/pkg/client/build.go index 00283cd05..26b9980f4 100644 --- a/pkg/client/build.go +++ b/pkg/client/build.go @@ -1099,8 +1099,10 @@ func getBuildpackLocator(bp projectTypes.Buildpack, stackID string) (string, err return bp.URI, nil case bp.ID != "" && bp.Version != "": return fmt.Sprintf("%s@%s", bp.ID, bp.Version), nil + case bp.ID != "" && bp.Version == "": + return bp.ID, nil default: - return "", errors.New("Invalid buildpack defined in project descriptor") + return "", errors.New("Invalid buildpack definition") } } diff --git a/pkg/client/build_test.go b/pkg/client/build_test.go index 31616e6d1..06b215104 100644 --- a/pkg/client/build_test.go +++ b/pkg/client/build_test.go @@ -1284,6 +1284,29 @@ api = "0.2" ) }) + when("from project descriptor", func() { + when("id - no version is provided", func() { + it("resolves version", func() { + h.AssertNil(t, subject.Build(context.TODO(), BuildOptions{ + Image: "some/app", + Builder: defaultBuilderName, + ClearCache: true, + ProjectDescriptor: projectTypes.Descriptor{ + Build: projectTypes.Build{Buildpacks: []projectTypes.Buildpack{{ID: "buildpack.1.id"}}}, + }, + })) + h.AssertEq(t, fakeLifecycle.Opts.Builder.Name(), defaultBuilderImage.Name()) + + assertOrderEquals(`[[order]] + + [[order.group]] + id = "buildpack.1.id" + version = "buildpack.1.version" +`) + }) + }) + }) + when("buildpacks include URIs", func() { var buildpackTgz string @@ -1405,6 +1428,7 @@ api = "0.2" {ID: "some-other-buildpack-id", Version: "some-other-buildpack-version"}, }) }) + it("adds the pre buildpack from the project descriptor", func() { err := subject.Build(context.TODO(), BuildOptions{ Image: "some/app", @@ -1519,6 +1543,7 @@ api = "0.2" {ID: "buildpack.2.id", Version: "buildpack.2.version"}, }) }) + it("not added from the project descriptor", func() { err := subject.Build(context.TODO(), BuildOptions{ Image: "some/app", @@ -1716,7 +1741,7 @@ api = "0.2" ProjectDescriptorBaseDir: tmpDir, }) - h.AssertEq(t, "Invalid buildpack defined in project descriptor", err.Error()) + h.AssertEq(t, "Invalid buildpack definition", err.Error()) }) it("ignores script if there is a URI", func() { From a24f9db29f9c54b0e89df68bce421e4351ec415a Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Thu, 24 Aug 2023 17:10:03 +0200 Subject: [PATCH 57/86] Remove legacy beta release message Signed-off-by: Domenico Luciani --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b73d69f05..23ecff240 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -280,8 +280,6 @@ jobs: prerelease: true files: pack-v${{ env.PACK_VERSION }}-* body: | - > This is a **beta** pre-release of the Cloud Native Buildpack local CLI. This platform implementation should be relatively stable and reliable, but breaking changes in the underlying [specification](https://github.com/buildpack/spec) may be implemented without notice. - ## Prerequisites - A container runtime such as [Docker](https://www.docker.com/get-started) or [podman](https://podman.io/getting-started/) must be available to execute builds. @@ -350,8 +348,6 @@ jobs: draft: true files: pack-v${{ env.PACK_VERSION }}-* body: | - > This is a **beta** release of the Cloud Native Buildpack local CLI. This platform implementation should be relatively stable and reliable, but breaking changes in the underlying [specification](https://github.com/buildpack/spec) may be implemented without notice. - ## Prerequisites - A container runtime such as [Docker](https://www.docker.com/get-started) or [podman](https://podman.io/getting-started/) must be available to execute builds. From cf7aa96d30162a9f3061079d40f9ffb881fd0fa8 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Fri, 25 Aug 2023 14:02:07 -0500 Subject: [PATCH 58/86] fixing error connecting to a remote daemon over ssh Signed-off-by: Juan Bustamante --- cmd/docker_init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/docker_init.go b/cmd/docker_init.go index 51b33527c..124e8e152 100644 --- a/cmd/docker_init.go +++ b/cmd/docker_init.go @@ -52,7 +52,7 @@ func tryInitSSHDockerClient() (dockerClient.CommonAPIClient, error) { dockerClientOpts := []dockerClient.Opt{ dockerClient.WithVersion(client.DockerAPIVersion), dockerClient.WithHTTPClient(httpClient), - dockerClient.WithHost("http://dummy/"), + dockerClient.WithHost("http://dummy"), dockerClient.WithDialContext(dialContext), } From e451393957dbdfa941ae087fd884ef633f6312f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 26 Aug 2023 15:05:47 +0000 Subject: [PATCH 59/86] build(deps): bump buildpacks/github-actions from 5.3.1 to 5.4.0 Bumps [buildpacks/github-actions](https://github.com/buildpacks/github-actions) from 5.3.1 to 5.4.0. - [Release notes](https://github.com/buildpacks/github-actions/releases) - [Commits](https://github.com/buildpacks/github-actions/compare/v5.3.1...v5.4.0) --- updated-dependencies: - dependency-name: buildpacks/github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/delivery-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delivery-docker.yml b/.github/workflows/delivery-docker.yml index 6ad0b3262..dffadcc90 100644 --- a/.github/workflows/delivery-docker.yml +++ b/.github/workflows/delivery-docker.yml @@ -61,7 +61,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - uses: docker/setup-qemu-action@v2 - uses: docker/setup-buildx-action@v2 - - uses: buildpacks/github-actions/setup-tools@v5.3.1 + - uses: buildpacks/github-actions/setup-tools@v5.4.0 - name: Buildx Build/Publish run: | docker buildx build . \ From 945470694ca86236478cc9376f354a3a307ca9fa Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Mon, 28 Aug 2023 11:30:34 -0300 Subject: [PATCH 60/86] Add custom label metadata to packaged buildpacks Introduces a new flag `--label` to the `pack buildpack package` command which: * can be used to add labels one at a time (e.g.; `--label a=1 --label b=2`) * can be used to add multiple labels in CSV format (e.g.; `--label a=1,b=2`) The labels are parsed into a `map[string]string` and added as label metadata to the packaged OCI or `.cnb` file. Signed-off-by: Colin Casey --- internal/commands/buildpack_package.go | 3 ++ internal/commands/buildpack_package_test.go | 14 +++++++ pkg/buildpack/builder.go | 19 ++++++++- pkg/buildpack/builder_test.go | 46 +++++++++++++-------- pkg/client/package_buildpack.go | 7 +++- pkg/client/package_extension.go | 4 +- 6 files changed, 70 insertions(+), 23 deletions(-) diff --git a/internal/commands/buildpack_package.go b/internal/commands/buildpack_package.go index f33107a63..6cac0ad74 100644 --- a/internal/commands/buildpack_package.go +++ b/internal/commands/buildpack_package.go @@ -24,6 +24,7 @@ type BuildpackPackageFlags struct { BuildpackRegistry string Path string FlattenExclude []string + Label map[string]string Publish bool Flatten bool Depth int @@ -111,6 +112,7 @@ func BuildpackPackage(logger logging.Logger, cfg config.Config, packager Buildpa Flatten: flags.Flatten, FlattenExclude: flags.FlattenExclude, Depth: flags.Depth, + Labels: flags.Label, }); err != nil { return err } @@ -138,6 +140,7 @@ func BuildpackPackage(logger logging.Logger, cfg config.Config, packager Buildpa cmd.Flags().BoolVar(&flags.Flatten, "flatten", false, "Flatten the buildpack into a single layer") cmd.Flags().StringSliceVarP(&flags.FlattenExclude, "flatten-exclude", "e", nil, "Buildpacks to exclude from flattening, in the form of '@'") cmd.Flags().IntVar(&flags.Depth, "depth", -1, "Max depth to flatten.\nOmission of this flag or values < 0 will flatten the entire tree.") + cmd.Flags().StringToStringVarP(&flags.Label, "label", "l", nil, "Labels to add to packaged Buildpack, in the form of '='") if !cfg.Experimental { cmd.Flags().MarkHidden("flatten") cmd.Flags().MarkHidden("depth") diff --git a/internal/commands/buildpack_package_test.go b/internal/commands/buildpack_package_test.go index 838c7a6dd..f527c01d0 100644 --- a/internal/commands/buildpack_package_test.go +++ b/internal/commands/buildpack_package_test.go @@ -316,6 +316,20 @@ func testPackageCommand(t *testing.T, when spec.G, it spec.S) { h.AssertError(t, cmd.Execute(), "parsing pull policy") }) }) + + when("--label cannot be parsed", func() { + it("errors with a descriptive message", func() { + cmd := packageCommand() + cmd.SetArgs([]string{ + "some-image-name", "--config", "/path/to/some/file", + "--label", "name+value", + }) + + err := cmd.Execute() + h.AssertNotNil(t, err) + h.AssertError(t, err, "invalid argument \"name+value\" for \"-l, --label\" flag: name+value must be formatted as key=value") + }) + }) }) } diff --git a/pkg/buildpack/builder.go b/pkg/buildpack/builder.go index 222f1e577..93724a3e6 100644 --- a/pkg/buildpack/builder.go +++ b/pkg/buildpack/builder.go @@ -338,7 +338,7 @@ func (b *PackageBuilder) resolvedStacks() []dist.Stack { return stacks } -func (b *PackageBuilder) SaveAsFile(path, imageOS string) error { +func (b *PackageBuilder) SaveAsFile(path, imageOS string, labels map[string]string) error { if err := b.validate(); err != nil { return err } @@ -348,6 +348,13 @@ func (b *PackageBuilder) SaveAsFile(path, imageOS string) error { return errors.Wrap(err, "creating layout image") } + for labelKey, labelValue := range labels { + err = layoutImage.SetLabel(labelKey, labelValue) + if err != nil { + return errors.Wrapf(err, "adding label %s=%s", labelKey, labelValue) + } + } + tempDirName := "" if b.buildpack != nil { tempDirName = "package-buildpack" @@ -430,7 +437,7 @@ func newLayoutImage(imageOS string) (*layoutImage, error) { return &layoutImage{Image: i}, nil } -func (b *PackageBuilder) SaveAsImage(repoName string, publish bool, imageOS string) (imgutil.Image, error) { +func (b *PackageBuilder) SaveAsImage(repoName string, publish bool, imageOS string, labels map[string]string) (imgutil.Image, error) { if err := b.validate(); err != nil { return nil, err } @@ -439,6 +446,14 @@ func (b *PackageBuilder) SaveAsImage(repoName string, publish bool, imageOS stri if err != nil { return nil, errors.Wrapf(err, "creating image") } + + for labelKey, labelValue := range labels { + err = image.SetLabel(labelKey, labelValue) + if err != nil { + return nil, errors.Wrapf(err, "adding label %s=%s", labelKey, labelValue) + } + } + tempDirName := "" if b.buildpack != nil { tempDirName = "package-buildpack" diff --git a/pkg/buildpack/builder_test.go b/pkg/buildpack/builder_test.go index 1f2066c83..2eb4cac06 100644 --- a/pkg/buildpack/builder_test.go +++ b/pkg/buildpack/builder_test.go @@ -76,18 +76,18 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { fn func(*buildpack.PackageBuilder) error }{ {name: "SaveAsImage", expectedImageOS: "linux", fn: func(builder *buildpack.PackageBuilder) error { - _, err := builder.SaveAsImage("some/package", false, "linux") + _, err := builder.SaveAsImage("some/package", false, "linux", map[string]string{}) return err }}, {name: "SaveAsImage", expectedImageOS: "windows", fn: func(builder *buildpack.PackageBuilder) error { - _, err := builder.SaveAsImage("some/package", false, "windows") + _, err := builder.SaveAsImage("some/package", false, "windows", map[string]string{}) return err }}, {name: "SaveAsFile", expectedImageOS: "linux", fn: func(builder *buildpack.PackageBuilder) error { - return builder.SaveAsFile(path.Join(tmpDir, "package.cnb"), "linux") + return builder.SaveAsFile(path.Join(tmpDir, "package.cnb"), "linux", map[string]string{}) }}, {name: "SaveAsFile", expectedImageOS: "windows", fn: func(builder *buildpack.PackageBuilder) error { - return builder.SaveAsFile(path.Join(tmpDir, "package.cnb"), "windows") + return builder.SaveAsFile(path.Join(tmpDir, "package.cnb"), "windows", map[string]string{}) }}, } { // always use copies to avoid stale refs @@ -391,7 +391,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { h.AssertNil(t, err) builder.AddDependency(dependency2) - img, err := builder.SaveAsImage("some/package", false, expectedImageOS) + img, err := builder.SaveAsImage("some/package", false, expectedImageOS, map[string]string{}) h.AssertNil(t, err) metadata := buildpack.Metadata{} @@ -453,7 +453,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { h.AssertNil(t, err) builder.AddDependency(dependency2) - img, err := builder.SaveAsImage("some/package", false, expectedImageOS) + img, err := builder.SaveAsImage("some/package", false, expectedImageOS, map[string]string{}) h.AssertNil(t, err) metadata := buildpack.Metadata{} @@ -518,7 +518,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder.AddDependency(dependencyNestedNested) - img, err := builder.SaveAsImage("some/package", false, expectedImageOS) + img, err := builder.SaveAsImage("some/package", false, expectedImageOS, map[string]string{}) h.AssertNil(t, err) metadata := buildpack.Metadata{} @@ -563,7 +563,9 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder := buildpack.NewBuilder(mockImageFactory("linux")) builder.SetBuildpack(buildpack1) - packageImage, err := builder.SaveAsImage("some/package", false, "linux") + var customLabels = map[string]string{"test.label.one": "1", "test.label.two": "2"} + + packageImage, err := builder.SaveAsImage("some/package", false, "linux", customLabels) h.AssertNil(t, err) labelData, err := packageImage.Label("io.buildpacks.buildpackage.metadata") @@ -586,6 +588,11 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { osVal, err := packageImage.OS() h.AssertNil(t, err) h.AssertEq(t, osVal, "linux") + + imageLabels, err := packageImage.Labels() + h.AssertNil(t, err) + h.AssertEq(t, imageLabels["test.label.one"], "1") + h.AssertEq(t, imageLabels["test.label.two"], "2") }) it("sets extension metadata", func() { @@ -609,7 +616,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { h.AssertNil(t, err) builder := buildpack.NewBuilder(mockImageFactory("linux")) builder.SetExtension(extension1) - packageImage, err := builder.SaveAsImage("some/package", false, "linux") + packageImage, err := builder.SaveAsImage("some/package", false, "linux", map[string]string{}) h.AssertNil(t, err) labelData, err := packageImage.Label("io.buildpacks.buildpackage.metadata") h.AssertNil(t, err) @@ -642,7 +649,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder := buildpack.NewBuilder(mockImageFactory("linux")) builder.SetBuildpack(buildpack1) - packageImage, err := builder.SaveAsImage("some/package", false, "linux") + packageImage, err := builder.SaveAsImage("some/package", false, "linux", map[string]string{}) h.AssertNil(t, err) var bpLayers dist.ModuleLayers @@ -666,7 +673,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder := buildpack.NewBuilder(mockImageFactory("linux")) builder.SetBuildpack(buildpack1) - packageImage, err := builder.SaveAsImage("some/package", false, "linux") + packageImage, err := builder.SaveAsImage("some/package", false, "linux", map[string]string{}) h.AssertNil(t, err) buildpackExists := func(name, version string) { @@ -713,7 +720,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder := buildpack.NewBuilder(mockImageFactory("windows")) builder.SetBuildpack(buildpack1) - _, err = builder.SaveAsImage("some/package", false, "windows") + _, err = builder.SaveAsImage("some/package", false, "windows", map[string]string{}) h.AssertNil(t, err) }) @@ -841,7 +848,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder.AddDependencies(bp1, nil) builder.AddDependencies(compositeBP2, []buildpack.BuildModule{bp21, bp22, compositeBP3, bp31}) - packageImage, err := builder.SaveAsImage("some/package", false, "linux") + packageImage, err := builder.SaveAsImage("some/package", false, "linux", map[string]string{}) h.AssertNil(t, err) fakePackageImage := packageImage.(*fakes.Image) @@ -864,7 +871,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder.AddDependencies(bp1, nil) builder.AddDependencies(compositeBP2, []buildpack.BuildModule{bp21, bp22, compositeBP3, bp31}) - packageImage, err := builder.SaveAsImage("some/package", false, "linux") + packageImage, err := builder.SaveAsImage("some/package", false, "linux", map[string]string{}) h.AssertNil(t, err) fakePackageImage := packageImage.(*fakes.Image) @@ -888,8 +895,10 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder := buildpack.NewBuilder(mockImageFactory("")) builder.SetBuildpack(buildpack1) + var customLabels = map[string]string{"test.label.one": "1", "test.label.two": "2"} + outputFile := filepath.Join(tmpDir, fmt.Sprintf("package-%s.cnb", h.RandString(10))) - h.AssertNil(t, builder.SaveAsFile(outputFile, "linux")) + h.AssertNil(t, builder.SaveAsFile(outputFile, "linux", customLabels)) withContents := func(fn func(data []byte)) h.TarEntryAssertion { return func(t *testing.T, header *tar.Header, data []byte) { @@ -928,6 +937,9 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { h.ContentContains(`"io.buildpacks.buildpack.layers":"{\"bp.1.id\":{\"bp.1.version\":{\"api\":\"0.2\",\"stacks\":[{\"id\":\"stack.id.1\"},{\"id\":\"stack.id.2\"}],\"layerDiffID\":\"sha256:44447e95b06b73496d1891de5afb01936e9999b97ea03dad6337d9f5610807a7\"}}`), // image os h.ContentContains(`"os":"linux"`), + // custom labels + h.ContentContains(`"test.label.one":"1"`), + h.ContentContains(`"test.label.two":"2"`), ) })) })) @@ -946,7 +958,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder.SetBuildpack(buildpack1) outputFile := filepath.Join(tmpDir, fmt.Sprintf("package-%s.cnb", h.RandString(10))) - h.AssertNil(t, builder.SaveAsFile(outputFile, "linux")) + h.AssertNil(t, builder.SaveAsFile(outputFile, "linux", map[string]string{})) h.AssertOnTarEntry(t, outputFile, "/blobs", h.IsDirectory(), @@ -996,7 +1008,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { builder.SetBuildpack(buildpack1) outputFile := filepath.Join(tmpDir, fmt.Sprintf("package-%s.cnb", h.RandString(10))) - h.AssertNil(t, builder.SaveAsFile(outputFile, "windows")) + h.AssertNil(t, builder.SaveAsFile(outputFile, "windows", map[string]string{})) // Windows baselayer content is constant expectedBaseLayerReader, err := layer.WindowsBaseLayer() diff --git a/pkg/client/package_buildpack.go b/pkg/client/package_buildpack.go index 17463007b..502564d2f 100644 --- a/pkg/client/package_buildpack.go +++ b/pkg/client/package_buildpack.go @@ -59,6 +59,9 @@ type PackageBuildpackOptions struct { // List of buildpack images to exclude from the package been flatten. FlattenExclude []string + + // Map of labels to add to the Buildpack + Labels map[string]string } // PackageBuildpack packages buildpack(s) into either an image or file. @@ -124,9 +127,9 @@ func (c *Client) PackageBuildpack(ctx context.Context, opts PackageBuildpackOpti switch opts.Format { case FormatFile: - return packageBuilder.SaveAsFile(opts.Name, opts.Config.Platform.OS) + return packageBuilder.SaveAsFile(opts.Name, opts.Config.Platform.OS, opts.Labels) case FormatImage: - _, err = packageBuilder.SaveAsImage(opts.Name, opts.Publish, opts.Config.Platform.OS) + _, err = packageBuilder.SaveAsImage(opts.Name, opts.Publish, opts.Config.Platform.OS, opts.Labels) return errors.Wrapf(err, "saving image") default: return errors.Errorf("unknown format: %s", style.Symbol(opts.Format)) diff --git a/pkg/client/package_extension.go b/pkg/client/package_extension.go index 93aed9d41..0e2c0e731 100644 --- a/pkg/client/package_extension.go +++ b/pkg/client/package_extension.go @@ -51,9 +51,9 @@ func (c *Client) PackageExtension(ctx context.Context, opts PackageBuildpackOpti switch opts.Format { case FormatFile: - return packageBuilder.SaveAsFile(opts.Name, opts.Config.Platform.OS) + return packageBuilder.SaveAsFile(opts.Name, opts.Config.Platform.OS, map[string]string{}) case FormatImage: - _, err = packageBuilder.SaveAsImage(opts.Name, opts.Publish, opts.Config.Platform.OS) + _, err = packageBuilder.SaveAsImage(opts.Name, opts.Publish, opts.Config.Platform.OS, map[string]string{}) return errors.Wrapf(err, "saving image") default: return errors.Errorf("unknown format: %s", style.Symbol(opts.Format)) From cb6d13b3ff64fe93e86f3b409bc2b39eaa042486 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Mon, 28 Aug 2023 17:40:47 -0500 Subject: [PATCH 61/86] Adding support for reading docker context Signed-off-by: Juan Bustamante --- cmd/cmd.go | 6 + go.mod | 3 +- go.sum | 3 +- internal/docker/context.go | 143 ++++++++++++++ internal/docker/context_test.go | 177 ++++++++++++++++++ .../config.json | 3 + .../meta.json | 8 + .../config.json | 3 + .../meta.json | 8 + .../error-cases/empty-context/config.json | 3 + .../error-cases/invalid-config/config.json | 3 + .../error-cases/invalid-metadata/config.json | 3 + .../meta.json | 8 + .../current-context-not-defined/config.json | 7 + .../happy-cases/custom-context/config.json | 3 + .../meta.json | 8 + .../happy-cases/default-context/config.json | 3 + .../two-endpoints-context/config.json | 3 + .../meta.json | 11 ++ 19 files changed, 404 insertions(+), 2 deletions(-) create mode 100644 internal/docker/context.go create mode 100644 internal/docker/context_test.go create mode 100644 internal/docker/testdata/error-cases/current-context-does-not-match/config.json create mode 100644 internal/docker/testdata/error-cases/current-context-does-not-match/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json create mode 100644 internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/config.json create mode 100644 internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json create mode 100644 internal/docker/testdata/error-cases/empty-context/config.json create mode 100644 internal/docker/testdata/error-cases/invalid-config/config.json create mode 100644 internal/docker/testdata/error-cases/invalid-metadata/config.json create mode 100644 internal/docker/testdata/error-cases/invalid-metadata/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json create mode 100644 internal/docker/testdata/happy-cases/current-context-not-defined/config.json create mode 100644 internal/docker/testdata/happy-cases/custom-context/config.json create mode 100644 internal/docker/testdata/happy-cases/custom-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json create mode 100644 internal/docker/testdata/happy-cases/default-context/config.json create mode 100644 internal/docker/testdata/happy-cases/two-endpoints-context/config.json create mode 100644 internal/docker/testdata/happy-cases/two-endpoints-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json diff --git a/cmd/cmd.go b/cmd/cmd.go index aacebe8a2..ace01f3f2 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -5,6 +5,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" + "github.com/buildpacks/pack/internal/docker" + "github.com/buildpacks/pack/buildpackage" builderwriter "github.com/buildpacks/pack/internal/builder/writer" "github.com/buildpacks/pack/internal/commands" @@ -135,6 +137,10 @@ func initConfig() (config.Config, string, error) { } func initClient(logger logging.Logger, cfg config.Config) (*client.Client, error) { + if err := docker.ProcessDockerContext(logger); err != nil { + return nil, err + } + dc, err := tryInitSSHDockerClient() if err != nil { return nil, err diff --git a/go.mod b/go.mod index 44ffff6e3..2407b96da 100644 --- a/go.mod +++ b/go.mod @@ -22,6 +22,7 @@ require ( github.com/heroku/color v0.0.6 github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e github.com/onsi/gomega v1.27.10 + github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.0-rc4 github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 @@ -102,11 +103,11 @@ require ( github.com/moby/sys/sequential v0.5.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/morikuni/aec v1.0.0 // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/runc v1.1.7 // indirect github.com/opencontainers/selinux v1.11.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/rivo/uniseg v0.4.3 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/skeema/knownhosts v1.2.0 // indirect diff --git a/go.sum b/go.sum index 4cde128b4..d6a66a0cf 100644 --- a/go.sum +++ b/go.sum @@ -280,7 +280,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= diff --git a/internal/docker/context.go b/internal/docker/context.go new file mode 100644 index 000000000..22bb2f960 --- /dev/null +++ b/internal/docker/context.go @@ -0,0 +1,143 @@ +package docker + +import ( + "encoding/json" + "fmt" + "io" + "os" + "path/filepath" + + "github.com/pkg/errors" + + "github.com/opencontainers/go-digest" + + "github.com/buildpacks/pack/pkg/logging" +) + +const ( + dockerHostEnvVar = "DOCKER_HOST" + dockerConfigEnvVar = "DOCKER_CONFIG" + defaultDockerRootConfigDir = ".docker" + defaultDockerConfigFileName = "config.json" + + dockerContextDirName = "contexts" + dockerContextMetaDirName = "meta" + dockerContextMetaFileName = "meta.json" + dockerContextEndpoint = "docker" + defaultDockerContext = "default" +) + +type configFile struct { + CurrentContext string `json:"currentContext,omitempty"` +} + +type endpoint struct { + Host string `json:",omitempty"` +} + +/* + Example Docker context file + { + "Name": "desktop-linux", + "dockerConfigMetadata": { + "Description": "Docker Desktop" + }, + "Endpoints": { + "docker": { + "Host": "unix:///Users/jbustamante/.docker/run/docker.sock", + "SkipTLSVerify": false + } + } + } +*/ +type dockerConfigMetadata struct { + Name string `json:",omitempty"` + Endpoints map[string]endpoint `json:"endpoints,omitempty"` +} + +func ProcessDockerContext(logger logging.Logger) error { + dockerHost := os.Getenv(dockerHostEnvVar) + if dockerHost == "" { + dockerConfigDir, err := configDir() + if err != nil { + return err + } + + logger.Debugf("looking for docker configuration file at: %s", dockerConfigDir) + configuration, err := readConfigFile(dockerConfigDir) + if err != nil { + return errors.Wrapf(err, "reading configuration file at '%s'", dockerConfigDir) + } + + if skip(configuration) { + logger.Debug("docker context is default or empty, skipping it") + return nil + } + + configMetaData, err := readConfigMetadata(dockerConfigDir, configuration.CurrentContext) + if err != nil { + return errors.Wrapf(err, "reading metadata for current context '%s' at '%s'", configuration.CurrentContext, dockerConfigDir) + } + + if dockerEndpoint, ok := configMetaData.Endpoints[dockerContextEndpoint]; ok { + os.Setenv(dockerHostEnvVar, dockerEndpoint.Host) + logger.Debugf("using docker context '%s' with endpoint = '%s'", configuration.CurrentContext, dockerEndpoint.Host) + } else { + logger.Warnf("docker endpoint doesn't exist for context '%s'", configuration.CurrentContext) + } + } else { + logger.Debugf("'%s=%s' environment variable is being used", dockerHostEnvVar, dockerHost) + } + return nil +} + +func configDir() (string, error) { + dir := os.Getenv(dockerConfigEnvVar) + if dir == "" { + home, err := os.UserHomeDir() + if err != nil { + return "", errors.Wrap(err, "determining user home directory") + } + dir = filepath.Join(home, defaultDockerRootConfigDir) + } + return dir, nil +} + +func readConfigFile(configDir string) (*configFile, error) { + filename := filepath.Join(configDir, defaultDockerConfigFileName) + config := &configFile{} + file, err := os.Open(filename) + if err != nil { + return &configFile{}, err + } + defer file.Close() + if err := json.NewDecoder(file).Decode(config); err != nil && !errors.Is(err, io.EOF) { + return &configFile{}, err + } + return config, nil +} + +func readConfigMetadata(configDir string, context string) (dockerConfigMetadata, error) { + dockerContextDir := filepath.Join(configDir, dockerContextDirName) + metaFileName := filepath.Join(dockerContextDir, dockerContextMetaDirName, digest.FromString(context).Encoded(), dockerContextMetaFileName) + bytes, err := os.ReadFile(metaFileName) + if err != nil { + if errors.Is(err, os.ErrNotExist) { + return dockerConfigMetadata{}, fmt.Errorf("docker context '%s' not found", context) + } + return dockerConfigMetadata{}, err + } + var meta dockerConfigMetadata + if err := json.Unmarshal(bytes, &meta); err != nil { + return dockerConfigMetadata{}, fmt.Errorf("parsing %s: %v", metaFileName, err) + } + if meta.Name != context { + return dockerConfigMetadata{}, fmt.Errorf("context '%s' doesn't match metadata name '%s' at '%s'", context, meta.Name, metaFileName) + } + + return meta, nil +} + +func skip(configuration *configFile) bool { + return configuration == nil || configuration.CurrentContext == defaultDockerContext || configuration.CurrentContext == "" +} diff --git a/internal/docker/context_test.go b/internal/docker/context_test.go new file mode 100644 index 000000000..a954a2544 --- /dev/null +++ b/internal/docker/context_test.go @@ -0,0 +1,177 @@ +package docker_test + +import ( + "bytes" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/heroku/color" + "github.com/sclevine/spec" + "github.com/sclevine/spec/report" + + "github.com/buildpacks/pack/internal/docker" + "github.com/buildpacks/pack/pkg/logging" + h "github.com/buildpacks/pack/testhelpers" +) + +func TestProcessDockerContext(t *testing.T) { + color.Disable(true) + defer color.Disable(false) + spec.Run(t, "processDockerContext", testProcessDockerContext, spec.Report(report.Terminal{})) +} + +const ( + happyCase = "happy-cases" + errorCase = "error-cases" +) + +func testProcessDockerContext(t *testing.T, when spec.G, it spec.S) { + var ( + outBuf bytes.Buffer + logger logging.Logger + ) + + it.Before(func() { + logger = logging.NewLogWithWriters(&outBuf, &outBuf, logging.WithVerbose()) + }) + + when("env DOCKER_HOST is set", func() { + it.Before(func() { + os.Setenv("DOCKER_HOST", "some-value") + }) + + it("docker context process is skipped", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, strings.TrimSpace(outBuf.String()), "'DOCKER_HOST=some-value' environment variable is being used") + }) + }) + + when("env DOCKER_HOST is empty", func() { + it.Before(func() { + os.Setenv("DOCKER_HOST", "") + }) + + when("config.json has currentContext", func() { + when("currentContext is default", func() { + it.Before(func() { + setDockerConfig(t, happyCase, "default-context") + }) + + it("docker context process is skip", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, strings.TrimSpace(outBuf.String()), "docker context is default or empty, skipping it") + }) + }) + + when("currentContext is default but config doesn't exist", func() { + it.Before(func() { + setDockerConfig(t, errorCase, "empty-context") + }) + + it("throw an error", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNotNil(t, err) + h.AssertError(t, err, "docker context 'some-bad-context' not found") + }) + }) + + when("currentContext is not default", func() { + when("metadata has one endpoint", func() { + it.Before(func() { + setDockerConfig(t, happyCase, "custom-context") + }) + + it("docker endpoint host is being used", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, outBuf.String(), "using docker context 'desktop-linux' with endpoint = 'unix:///Users/user/.docker/run/docker.sock'") + }) + }) + + when("metadata has more than one endpoint", func() { + it.Before(func() { + setDockerConfig(t, happyCase, "two-endpoints-context") + }) + + it("docker endpoint host is being used", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, outBuf.String(), "using docker context 'desktop-linux' with endpoint = 'unix:///Users/user/.docker/run/docker.sock'") + }) + }) + + when("currentContext doesn't match metadata name", func() { + it.Before(func() { + setDockerConfig(t, errorCase, "current-context-does-not-match") + }) + + it("throw an error", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNotNil(t, err) + h.AssertError(t, err, "context 'desktop-linux' doesn't match metadata name 'bad-name'") + }) + }) + + when("metadata doesn't contain a docker endpoint", func() { + it.Before(func() { + setDockerConfig(t, errorCase, "docker-endpoint-does-not-exist") + }) + + it("writes a warn message into the log", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, outBuf.String(), "docker endpoint doesn't exist for context 'desktop-linux'") + }) + }) + + when("metadata is invalid", func() { + it.Before(func() { + setDockerConfig(t, errorCase, "invalid-metadata") + }) + + it("throw an error", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNotNil(t, err) + h.AssertError(t, err, "reading metadata for current context 'desktop-linux'") + }) + }) + }) + }) + + when("config.json is invalid", func() { + it.Before(func() { + setDockerConfig(t, errorCase, "invalid-config") + }) + + it("throw an error", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNotNil(t, err) + h.AssertError(t, err, "reading configuration file") + }) + }) + + when("config.json doesn't have current context", func() { + it.Before(func() { + setDockerConfig(t, happyCase, "current-context-not-defined") + }) + + it("docker context process is skip", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, strings.TrimSpace(outBuf.String()), "docker context is default or empty, skipping it") + }) + }) + }) +} + +func setDockerConfig(t *testing.T, test, context string) { + t.Helper() + contextDir, err := filepath.Abs(filepath.Join("testdata", test, context)) + h.AssertNil(t, err) + err = os.Setenv("DOCKER_CONFIG", contextDir) + h.AssertNil(t, err) +} diff --git a/internal/docker/testdata/error-cases/current-context-does-not-match/config.json b/internal/docker/testdata/error-cases/current-context-does-not-match/config.json new file mode 100644 index 000000000..b2887794b --- /dev/null +++ b/internal/docker/testdata/error-cases/current-context-does-not-match/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "desktop-linux" +} diff --git a/internal/docker/testdata/error-cases/current-context-does-not-match/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json b/internal/docker/testdata/error-cases/current-context-does-not-match/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json new file mode 100644 index 000000000..e27eab7d7 --- /dev/null +++ b/internal/docker/testdata/error-cases/current-context-does-not-match/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json @@ -0,0 +1,8 @@ +{ + "Name": "bad-name", + "Endpoints": { + "docker": { + "Host": "unix:///Users/user/.docker/run/docker.sock" + } + } +} diff --git a/internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/config.json b/internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/config.json new file mode 100644 index 000000000..b2887794b --- /dev/null +++ b/internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "desktop-linux" +} diff --git a/internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json b/internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json new file mode 100644 index 000000000..9421315ff --- /dev/null +++ b/internal/docker/testdata/error-cases/docker-endpoint-does-not-exist/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json @@ -0,0 +1,8 @@ +{ + "Name": "desktop-linux", + "Endpoints": { + "foo": { + "Host": "unix:///Users/user/.docker/run/docker.sock" + } + } +} diff --git a/internal/docker/testdata/error-cases/empty-context/config.json b/internal/docker/testdata/error-cases/empty-context/config.json new file mode 100644 index 000000000..002beb119 --- /dev/null +++ b/internal/docker/testdata/error-cases/empty-context/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "some-bad-context" +} diff --git a/internal/docker/testdata/error-cases/invalid-config/config.json b/internal/docker/testdata/error-cases/invalid-config/config.json new file mode 100644 index 000000000..9925ab85e --- /dev/null +++ b/internal/docker/testdata/error-cases/invalid-config/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "some-bad-context +} diff --git a/internal/docker/testdata/error-cases/invalid-metadata/config.json b/internal/docker/testdata/error-cases/invalid-metadata/config.json new file mode 100644 index 000000000..b2887794b --- /dev/null +++ b/internal/docker/testdata/error-cases/invalid-metadata/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "desktop-linux" +} diff --git a/internal/docker/testdata/error-cases/invalid-metadata/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json b/internal/docker/testdata/error-cases/invalid-metadata/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json new file mode 100644 index 000000000..24b749b43 --- /dev/null +++ b/internal/docker/testdata/error-cases/invalid-metadata/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json @@ -0,0 +1,8 @@ +{ + "Name": "desktop-linux", + "Endpoints": { + "docker": { + "Host": "unix:///Users/user/.docker/run/docker.sock + } + } +} diff --git a/internal/docker/testdata/happy-cases/current-context-not-defined/config.json b/internal/docker/testdata/happy-cases/current-context-not-defined/config.json new file mode 100644 index 000000000..b7fba5df5 --- /dev/null +++ b/internal/docker/testdata/happy-cases/current-context-not-defined/config.json @@ -0,0 +1,7 @@ +{ + "auths": { + "https://index.docker.io/v1/": {} + }, + "credsStore": "desktop", + "experimental": "disabled" +} diff --git a/internal/docker/testdata/happy-cases/custom-context/config.json b/internal/docker/testdata/happy-cases/custom-context/config.json new file mode 100644 index 000000000..b2887794b --- /dev/null +++ b/internal/docker/testdata/happy-cases/custom-context/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "desktop-linux" +} diff --git a/internal/docker/testdata/happy-cases/custom-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json b/internal/docker/testdata/happy-cases/custom-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json new file mode 100644 index 000000000..7a8aa5ff4 --- /dev/null +++ b/internal/docker/testdata/happy-cases/custom-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json @@ -0,0 +1,8 @@ +{ + "Name": "desktop-linux", + "Endpoints": { + "docker": { + "Host": "unix:///Users/user/.docker/run/docker.sock" + } + } +} diff --git a/internal/docker/testdata/happy-cases/default-context/config.json b/internal/docker/testdata/happy-cases/default-context/config.json new file mode 100644 index 000000000..6eaf50253 --- /dev/null +++ b/internal/docker/testdata/happy-cases/default-context/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "default" +} diff --git a/internal/docker/testdata/happy-cases/two-endpoints-context/config.json b/internal/docker/testdata/happy-cases/two-endpoints-context/config.json new file mode 100644 index 000000000..b2887794b --- /dev/null +++ b/internal/docker/testdata/happy-cases/two-endpoints-context/config.json @@ -0,0 +1,3 @@ +{ + "currentContext": "desktop-linux" +} diff --git a/internal/docker/testdata/happy-cases/two-endpoints-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json b/internal/docker/testdata/happy-cases/two-endpoints-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json new file mode 100644 index 000000000..d2fb55da6 --- /dev/null +++ b/internal/docker/testdata/happy-cases/two-endpoints-context/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json @@ -0,0 +1,11 @@ +{ + "Name": "desktop-linux", + "Endpoints": { + "docker": { + "Host": "unix:///Users/user/.docker/run/docker.sock" + }, + "foo": { + "Host": "something else" + } + } +} From 0320ff1507c0f4e043b9ff2c1fe3949b9569a313 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Wed, 30 Aug 2023 09:24:02 -0500 Subject: [PATCH 62/86] Adding /tmp folder to pack image distribution Signed-off-by: Juan Bustamante --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 98c9fb078..70c75ed45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,5 @@ RUN make build FROM scratch COPY --from=builder /app/out/pack /usr/local/bin/pack COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /tmp /tmp ENTRYPOINT [ "/usr/local/bin/pack" ] From 2214603309e82599d241ca522e5af460ca236a3b Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 31 Aug 2023 09:37:50 -0300 Subject: [PATCH 63/86] Added test for failing image label Signed-off-by: Colin Casey --- pkg/buildpack/builder_test.go | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/pkg/buildpack/builder_test.go b/pkg/buildpack/builder_test.go index 2eb4cac06..9ca2156f1 100644 --- a/pkg/buildpack/builder_test.go +++ b/pkg/buildpack/builder_test.go @@ -6,6 +6,7 @@ import ( "compress/gzip" "encoding/json" "fmt" + "github.com/pkg/errors" "io" "os" "path" @@ -724,6 +725,47 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { h.AssertNil(t, err) }) + it("should report an error when custom label cannot be set", func() { + mockImageFactory = func(expectedImageOS string) *testmocks.MockImageFactory { + var imageWithLabelError = &imageWithLabelError{Image: fakes.NewImage("some/package", "", nil)} + imageFactory := testmocks.NewMockImageFactory(mockController) + imageFactory.EXPECT().NewImage("some/package", true, expectedImageOS).Return(imageWithLabelError, nil).MaxTimes(1) + return imageFactory + } + + buildpack1, err := ifakes.NewFakeBuildpack(dist.BuildpackDescriptor{ + WithAPI: api.MustParse("0.2"), + WithInfo: dist.ModuleInfo{ + ID: "bp.1.id", + Version: "bp.1.version", + Name: "One", + Description: "some description", + Homepage: "https://example.com/homepage", + Keywords: []string{"some-keyword"}, + Licenses: []dist.License{ + { + Type: "MIT", + URI: "https://example.com/license", + }, + }, + }, + WithStacks: []dist.Stack{ + {ID: "stack.id.1"}, + {ID: "stack.id.2"}, + }, + WithOrder: nil, + }, 0644) + h.AssertNil(t, err) + + builder := buildpack.NewBuilder(mockImageFactory("linux")) + builder.SetBuildpack(buildpack1) + + var customLabels = map[string]string{"test.label.fail": "true"} + + _, err = builder.SaveAsImage("some/package", false, "linux", customLabels) + h.AssertError(t, err, "adding label test.label.fail=true") + }) + when("flatten is set", func() { var ( buildpack1 buildpack.BuildModule @@ -1059,3 +1101,11 @@ func computeLayerSHA(reader io.ReadCloser) (string, error) { return digest.Hex, nil } + +type imageWithLabelError struct { + *fakes.Image +} + +func (i *imageWithLabelError) SetLabel(string, string) error { + return errors.New("Label could not be set") +} From 13cb3acf6f22c11129d3a0a50d08b86ed4fb1ab3 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 31 Aug 2023 09:40:26 -0300 Subject: [PATCH 64/86] Run `make tidy` Signed-off-by: Colin Casey --- pkg/buildpack/builder_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/buildpack/builder_test.go b/pkg/buildpack/builder_test.go index 9ca2156f1..7181e08bc 100644 --- a/pkg/buildpack/builder_test.go +++ b/pkg/buildpack/builder_test.go @@ -6,13 +6,14 @@ import ( "compress/gzip" "encoding/json" "fmt" - "github.com/pkg/errors" "io" "os" "path" "path/filepath" "testing" + "github.com/pkg/errors" + "github.com/buildpacks/imgutil/fakes" "github.com/buildpacks/imgutil/layer" "github.com/buildpacks/lifecycle/api" From 31ef21e198d59174d645cee5f83eaceeae959c72 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Mon, 4 Sep 2023 17:16:19 -0500 Subject: [PATCH 65/86] Adding configuration to OCI Layout format when executing phases 1 by 1 Signed-off-by: Juan Bustamante --- internal/build/lifecycle_execution.go | 39 +++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/internal/build/lifecycle_execution.go b/internal/build/lifecycle_execution.go index 092fc9bf1..716317725 100644 --- a/internal/build/lifecycle_execution.go +++ b/internal/build/lifecycle_execution.go @@ -491,8 +491,16 @@ func (l *LifecycleExecution) Restore(ctx context.Context, buildCache Cache, kani registryOp = WithRegistryAccess(authConfig) } + // for export to OCI layout + layoutOp := NullOp() + layoutBindOp := NullOp() + if l.opts.Layout && l.platformAPI.AtLeast("0.12") { + layoutOp = withLayoutOperation() + layoutBindOp = WithBinds(l.opts.Volumes...) + } + dockerOp := NullOp() - if !l.opts.Publish && l.platformAPI.AtLeast("0.12") { + if !l.opts.Publish && !l.opts.Layout && l.platformAPI.AtLeast("0.12") { dockerOp = WithDaemonAccess(l.opts.DockerHost) flags = append(flags, "-daemon") } @@ -517,6 +525,8 @@ func (l *LifecycleExecution) Restore(ctx context.Context, buildCache Cache, kani flagsOp, kanikoCacheBindOp, registryOp, + layoutOp, + layoutBindOp, ) restore := phaseFactory.New(configProvider) @@ -604,10 +614,15 @@ func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCach } } + layoutOp := NullOp() + if l.opts.Layout && l.platformAPI.AtLeast("0.12") { + layoutOp = withLayoutOperation() + } + flagsOp := WithFlags(flags...) var analyze RunnerCleaner - if l.opts.Publish { + if l.opts.Publish || l.opts.Layout { authConfig, err := auth.BuildEnvVar(l.opts.Keychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) if err != nil { return err @@ -627,6 +642,7 @@ func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCach cacheBindOp, stackOp, runOp, + layoutOp, ) analyze = phaseFactory.New(configProvider) @@ -802,8 +818,17 @@ func (l *LifecycleExecution) Export(ctx context.Context, buildCache, launchCache expEnv, } + if l.opts.Layout && l.platformAPI.AtLeast("0.12") { + var err error + opts, err = l.appendLayoutOperations(opts) + if err != nil { + return err + } + opts = append(opts, WithBinds(l.opts.Volumes...)) + } + var export RunnerCleaner - if l.opts.Publish { + if l.opts.Publish || l.opts.Layout { authConfig, err := auth.BuildEnvVar(l.opts.Keychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage) if err != nil { return err @@ -892,11 +917,15 @@ func (l *LifecycleExecution) runImageChanged() bool { } func (l *LifecycleExecution) appendLayoutOperations(opts []PhaseConfigProviderOperation) ([]PhaseConfigProviderOperation, error) { - layoutDir := filepath.Join(paths.RootDir, "layout-repo") - opts = append(opts, WithEnv("CNB_USE_LAYOUT=true", "CNB_LAYOUT_DIR="+layoutDir, "CNB_EXPERIMENTAL_MODE=warn")) + opts = append(opts, withLayoutOperation()) return opts, nil } +func withLayoutOperation() PhaseConfigProviderOperation { + layoutDir := filepath.Join(paths.RootDir, "layout-repo") + return WithEnv("CNB_USE_LAYOUT=true", "CNB_LAYOUT_DIR="+layoutDir, "CNB_EXPERIMENTAL_MODE=warn") +} + func prependArg(arg string, args []string) []string { return append([]string{arg}, args...) } From ac2b645d08222657948ecf910a50d0a9a394f530 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 22:23:48 +0000 Subject: [PATCH 66/86] build(deps): bump actions/checkout from 3 to 4 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] --- .github/workflows/benchmark.yml | 2 +- .github/workflows/build.yml | 6 +++--- .github/workflows/check-latest-release.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/compatibility.yml | 2 +- .github/workflows/delivery-archlinux-git.yml | 2 +- .github/workflows/delivery-archlinux.yml | 4 ++-- .github/workflows/delivery-chocolatey.yml | 2 +- .github/workflows/delivery-docker.yml | 4 ++-- .github/workflows/delivery-homebrew.yml | 4 ++-- .github/workflows/delivery-ubuntu.yml | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5ef2cdea5..ac27aac35 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -13,7 +13,7 @@ jobs: name: Run Go benchmark example runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up go uses: actions/setup-go@v4 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23ecff240..7cdeb81c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf git config --global core.symlinks true - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Derive pack version from branch name Unix if: runner.os != 'Windows' run: | @@ -176,7 +176,7 @@ jobs: needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up go uses: actions/setup-go@v4 with: @@ -197,7 +197,7 @@ jobs: needs: build-additional-archs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Derive pack version from branch name shell: bash run: | diff --git a/.github/workflows/check-latest-release.yml b/.github/workflows/check-latest-release.yml index 967dabff6..36679effd 100644 --- a/.github/workflows/check-latest-release.yml +++ b/.github/workflows/check-latest-release.yml @@ -10,7 +10,7 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version-file: 'go.mod' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 20afb580e..66f191429 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index fc03ca2c1..a1fa6290b 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -42,7 +42,7 @@ jobs: lifecycle_kind: current runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up go uses: actions/setup-go@v4 with: diff --git a/.github/workflows/delivery-archlinux-git.yml b/.github/workflows/delivery-archlinux-git.yml index f0cef734f..7f6360c15 100644 --- a/.github/workflows/delivery-archlinux-git.yml +++ b/.github/workflows/delivery-archlinux-git.yml @@ -12,7 +12,7 @@ jobs: env: PACKAGE_NAME: pack-cli-git steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup working dir diff --git a/.github/workflows/delivery-archlinux.yml b/.github/workflows/delivery-archlinux.yml index d78db5963..fa9a6e695 100644 --- a/.github/workflows/delivery-archlinux.yml +++ b/.github/workflows/delivery-archlinux.yml @@ -16,7 +16,7 @@ jobs: env: PACKAGE_NAME: pack-cli steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Determine version uses: actions/github-script@v6 id: version @@ -74,7 +74,7 @@ jobs: env: PACKAGE_NAME: pack-cli-bin steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Determine version uses: actions/github-script@v6 id: version diff --git a/.github/workflows/delivery-chocolatey.yml b/.github/workflows/delivery-chocolatey.yml index 2376708f3..a95ea6624 100644 --- a/.github/workflows/delivery-chocolatey.yml +++ b/.github/workflows/delivery-chocolatey.yml @@ -21,7 +21,7 @@ jobs: deliver-chocolatey: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Determine version uses: actions/github-script@v6 id: version diff --git a/.github/workflows/delivery-docker.yml b/.github/workflows/delivery-docker.yml index dffadcc90..e3024fb31 100644 --- a/.github/workflows/delivery-docker.yml +++ b/.github/workflows/delivery-docker.yml @@ -39,12 +39,12 @@ jobs: return tag.replace(/^v/, ''); - name: Checkout source at tag - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: v${{ steps.version.outputs.result }} # This has to come after the first checkout, so it isn't clobbered - name: Checkout delivery configuration - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: ./head - name: Setup Working Dir diff --git a/.github/workflows/delivery-homebrew.yml b/.github/workflows/delivery-homebrew.yml index bc61e83ac..77ab19249 100644 --- a/.github/workflows/delivery-homebrew.yml +++ b/.github/workflows/delivery-homebrew.yml @@ -14,9 +14,9 @@ jobs: update-tap: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout tap - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: buildpack/homebrew-tap path: homebrew-tap diff --git a/.github/workflows/delivery-ubuntu.yml b/.github/workflows/delivery-ubuntu.yml index 56258c2fc..6b7d5a87c 100644 --- a/.github/workflows/delivery-ubuntu.yml +++ b/.github/workflows/delivery-ubuntu.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Metadata id: metadata From cc49e298da6829b5f3a987343cd17673f5383b39 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Tue, 5 Sep 2023 11:32:47 -0500 Subject: [PATCH 67/86] adding some unit testing Signed-off-by: Juan Bustamante --- internal/build/lifecycle_execution_test.go | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/internal/build/lifecycle_execution_test.go b/internal/build/lifecycle_execution_test.go index c4af17b24..7902d9ee3 100644 --- a/internal/build/lifecycle_execution_test.go +++ b/internal/build/lifecycle_execution_test.go @@ -1409,6 +1409,17 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { "-stack", ) }) + + when("layout is true", func() { + providedLayout = true + + it("configures the phase with the expected environment variables", func() { + layoutDir := filepath.Join(paths.RootDir, "layout-repo") + h.AssertSliceContains(t, + configProvider.ContainerConfig().Env, "CNB_USE_LAYOUT=true", fmt.Sprintf("CNB_LAYOUT_DIR=%s", layoutDir), + ) + }) + }) }) when("publish", func() { @@ -1862,6 +1873,25 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { }) }) }) + + when("layout is true", func() { + when("platform >= 0.12", func() { + platformAPI = api.MustParse("0.12") + providedLayout = true + + it("it configures the phase with access to provided volumes", func() { + // this is required to read the /layout-repo + h.AssertSliceContains(t, configProvider.HostConfig().Binds, providedVolumes...) + }) + + it("configures the phase with the expected environment variables", func() { + layoutDir := filepath.Join(paths.RootDir, "layout-repo") + h.AssertSliceContains(t, + configProvider.ContainerConfig().Env, "CNB_USE_LAYOUT=true", fmt.Sprintf("CNB_LAYOUT_DIR=%s", layoutDir), + ) + }) + }) + }) }) when("#Build", func() { @@ -2053,6 +2083,22 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { }) }) }) + + when("layout is true", func() { + providedLayout = true + + it("it configures the phase with access to provided volumes", func() { + // this is required to read the /layout-repo + h.AssertSliceContains(t, configProvider.HostConfig().Binds, providedVolumes...) + }) + + it("configures the phase with the expected environment variables", func() { + layoutDir := filepath.Join(paths.RootDir, "layout-repo") + h.AssertSliceContains(t, + configProvider.ContainerConfig().Env, "CNB_USE_LAYOUT=true", fmt.Sprintf("CNB_LAYOUT_DIR=%s", layoutDir), + ) + }) + }) }) when("additional tags are specified", func() { From e0c68c88d8c0571240e6c79417a8d8c505001a39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:46:17 +0000 Subject: [PATCH 68/86] build(deps): bump golang.org/x/text from 0.12.0 to 0.13.0 Bumps [golang.org/x/text](https://github.com/golang/text) from 0.12.0 to 0.13.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2407b96da..646206374 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( golang.org/x/oauth2 v0.11.0 golang.org/x/sync v0.3.0 golang.org/x/term v0.11.0 - golang.org/x/text v0.12.0 + golang.org/x/text v0.13.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index d6a66a0cf..dbf013496 100644 --- a/go.sum +++ b/go.sum @@ -426,8 +426,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= From c110ed0d5a763acde8e3f0a19f0b217c7204bc5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:46:31 +0000 Subject: [PATCH 69/86] build(deps): bump golang.org/x/crypto from 0.12.0 to 0.13.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.12.0 to 0.13.0. - [Commits](https://github.com/golang/crypto/compare/v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 2407b96da..86ca6d92f 100644 --- a/go.mod +++ b/go.mod @@ -30,12 +30,12 @@ require ( github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/sclevine/spec v1.4.0 github.com/spf13/cobra v1.7.0 - golang.org/x/crypto v0.12.0 + golang.org/x/crypto v0.13.0 golang.org/x/mod v0.12.0 golang.org/x/oauth2 v0.11.0 golang.org/x/sync v0.3.0 - golang.org/x/term v0.11.0 - golang.org/x/text v0.12.0 + golang.org/x/term v0.12.0 + golang.org/x/text v0.13.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -115,7 +115,7 @@ require ( github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/net v0.14.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/go.sum b/go.sum index d6a66a0cf..b657d1c49 100644 --- a/go.sum +++ b/go.sum @@ -343,8 +343,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -407,8 +407,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -416,8 +416,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -426,8 +426,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= From 349761e2d563627e82dfd38fb94d627f411402f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:46:59 +0000 Subject: [PATCH 70/86] build(deps): bump golang.org/x/oauth2 from 0.11.0 to 0.12.0 Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.11.0 to 0.12.0. - [Commits](https://github.com/golang/oauth2/compare/v0.11.0...v0.12.0) --- updated-dependencies: - dependency-name: golang.org/x/oauth2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 2407b96da..a78568a03 100644 --- a/go.mod +++ b/go.mod @@ -30,12 +30,12 @@ require ( github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/sclevine/spec v1.4.0 github.com/spf13/cobra v1.7.0 - golang.org/x/crypto v0.12.0 + golang.org/x/crypto v0.13.0 golang.org/x/mod v0.12.0 - golang.org/x/oauth2 v0.11.0 + golang.org/x/oauth2 v0.12.0 golang.org/x/sync v0.3.0 - golang.org/x/term v0.11.0 - golang.org/x/text v0.12.0 + golang.org/x/term v0.12.0 + golang.org/x/text v0.13.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -114,8 +114,8 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/vbatts/tar-split v0.11.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/net v0.14.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/go.sum b/go.sum index d6a66a0cf..7707470d2 100644 --- a/go.sum +++ b/go.sum @@ -343,8 +343,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -366,11 +366,11 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -407,8 +407,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -416,8 +416,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -426,8 +426,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= From 54dcdd848dafb812bd7b147477d9f6d21025e55c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:48:05 +0000 Subject: [PATCH 71/86] build(deps): bump github.com/docker/docker Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.5+incompatible to 24.0.6+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v24.0.5...v24.0.6) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2407b96da..8253f386c 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c github.com/buildpacks/lifecycle v0.17.0 github.com/docker/cli v24.0.5+incompatible - github.com/docker/docker v24.0.5+incompatible + github.com/docker/docker v24.0.6+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 github.com/gdamore/tcell/v2 v2.6.0 diff --git a/go.sum b/go.sum index d6a66a0cf..fde8d929a 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/docker/cli v24.0.5+incompatible h1:WeBimjvS0eKdH4Ygx+ihVq1Q++xg36M/rM github.com/docker/cli v24.0.5+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= -github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.6+incompatible h1:hceabKCtUgDqPu+qm0NgsaXf28Ljf4/pWFL7xjWWDgE= +github.com/docker/docker v24.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= From df681f3c3347276460c996a0ccc43b79cbe56442 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 22:21:25 +0000 Subject: [PATCH 72/86] build(deps): bump github.com/docker/cli Bumps [github.com/docker/cli](https://github.com/docker/cli) from 24.0.5+incompatible to 24.0.6+incompatible. - [Commits](https://github.com/docker/cli/compare/v24.0.5...v24.0.6) --- updated-dependencies: - dependency-name: github.com/docker/cli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 785f551d2..93cc6c915 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c github.com/buildpacks/lifecycle v0.17.0 - github.com/docker/cli v24.0.5+incompatible + github.com/docker/cli v24.0.6+incompatible github.com/docker/docker v24.0.6+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 diff --git a/go.sum b/go.sum index 7992f8349..b409f29da 100644 --- a/go.sum +++ b/go.sum @@ -120,8 +120,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/docker/cli v24.0.5+incompatible h1:WeBimjvS0eKdH4Ygx+ihVq1Q++xg36M/rMi4aXAvodc= -github.com/docker/cli v24.0.5+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWTcc7GAneOY= +github.com/docker/cli v24.0.6+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.6+incompatible h1:hceabKCtUgDqPu+qm0NgsaXf28Ljf4/pWFL7xjWWDgE= From 5566436f390217c129d9736b3ebc41bc4009d267 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Tue, 5 Sep 2023 17:14:01 -0500 Subject: [PATCH 73/86] Fixing out of memory with Usage: Signed-off-by: Juan Bustamante --- pkg/buildpack/buildpack.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/buildpack/buildpack.go b/pkg/buildpack/buildpack.go index a085510a2..182a3c6d0 100644 --- a/pkg/buildpack/buildpack.go +++ b/pkg/buildpack/buildpack.go @@ -446,14 +446,9 @@ func toNLayerTar(origID, origVersion string, firstHeader *tar.Header, tr *tar.Re return fmt.Errorf("failed to write header for '%s': %w", header.Name, err) } - buf, err := io.ReadAll(tr) + _, err = io.Copy(mt.writer, tr) if err != nil { - return fmt.Errorf("failed to read contents of '%s': %w", header.Name, err) - } - - _, err = mt.writer.Write(buf) - if err != nil { - return fmt.Errorf("failed to write contents to '%s': %w", header.Name, err) + return errors.Wrapf(err, "failed to write contents to '%s'", header.Name) } } } From 5fbee86c9e50b756c22d9bf7184cca24c7b33c33 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Thu, 7 Sep 2023 11:02:21 -0500 Subject: [PATCH 74/86] Missing test case when handling docker context Signed-off-by: Juan Bustamante --- internal/docker/context.go | 3 +++ internal/docker/context_test.go | 24 +++++++++++++++++++ .../error-cases/config-does-not-exist/README | 1 + 3 files changed, 28 insertions(+) create mode 100644 internal/docker/testdata/error-cases/config-does-not-exist/README diff --git a/internal/docker/context.go b/internal/docker/context.go index 22bb2f960..680e1f350 100644 --- a/internal/docker/context.go +++ b/internal/docker/context.go @@ -108,6 +108,9 @@ func readConfigFile(configDir string) (*configFile, error) { config := &configFile{} file, err := os.Open(filename) if err != nil { + if os.IsNotExist(err) { + return &configFile{}, nil + } return &configFile{}, err } defer file.Close() diff --git a/internal/docker/context_test.go b/internal/docker/context_test.go index a954a2544..2e21c06c1 100644 --- a/internal/docker/context_test.go +++ b/internal/docker/context_test.go @@ -165,6 +165,30 @@ func testProcessDockerContext(t *testing.T, when spec.G, it spec.S) { h.AssertContains(t, strings.TrimSpace(outBuf.String()), "docker context is default or empty, skipping it") }) }) + + when("docker config folder doesn't exists", func() { + it.Before(func() { + setDockerConfig(t, errorCase, "no-docker-folder") + }) + + it("docker context process is skip", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, strings.TrimSpace(outBuf.String()), "docker context is default or empty, skipping it") + }) + }) + + when("config.json config doesn't exists", func() { + it.Before(func() { + setDockerConfig(t, errorCase, "config-does-not-exist") + }) + + it("docker context process is skip", func() { + err := docker.ProcessDockerContext(logger) + h.AssertNil(t, err) + h.AssertContains(t, strings.TrimSpace(outBuf.String()), "docker context is default or empty, skipping it") + }) + }) }) } diff --git a/internal/docker/testdata/error-cases/config-does-not-exist/README b/internal/docker/testdata/error-cases/config-does-not-exist/README new file mode 100644 index 000000000..155653676 --- /dev/null +++ b/internal/docker/testdata/error-cases/config-does-not-exist/README @@ -0,0 +1 @@ +This folder is intentionally empty to test the scenario when the docker config.json file doesn't exist From bc6c578d43a54b0768e0f8fa8bdd152362aeb67c Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Mon, 11 Sep 2023 13:53:12 -0700 Subject: [PATCH 75/86] Fix target validation when buildpack fails to declare field Optional fields are treated as wildcards when not specified Signed-off-by: Natalie Arellano --- pkg/dist/buildpack_descriptor.go | 2 +- pkg/dist/buildpack_descriptor_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/dist/buildpack_descriptor.go b/pkg/dist/buildpack_descriptor.go index 5714fd0c0..7ac46b97b 100644 --- a/pkg/dist/buildpack_descriptor.go +++ b/pkg/dist/buildpack_descriptor.go @@ -66,7 +66,7 @@ func (b *BuildpackDescriptor) EnsureTargetSupport(os, arch, distroName, distroVe } for _, target := range b.Targets() { if target.OS == os { - if target.Arch == "*" || arch == "" || target.Arch == arch { + if target.Arch == "" || arch == "" || target.Arch == arch { if len(target.Distributions) == 0 || distroName == "" || distroVersion == "" { return nil } diff --git a/pkg/dist/buildpack_descriptor_test.go b/pkg/dist/buildpack_descriptor_test.go index 9edc2772d..1f755edb5 100644 --- a/pkg/dist/buildpack_descriptor_test.go +++ b/pkg/dist/buildpack_descriptor_test.go @@ -262,6 +262,20 @@ func testBuildpackDescriptor(t *testing.T, when spec.G, it spec.S) { h.AssertError(t, bp.EnsureTargetSupport("some-other-os", "fake-arch", "fake-distro", "0.0"), `unable to satisfy target os/arch constraints; build image: {"os":"some-other-os","arch":"fake-arch","distribution":{"name":"fake-distro","version":"0.0"}}, buildpack 'some.buildpack.id@some.buildpack.version': [{"os":"fake-os","arch":"fake-arch","distributions":[{"name":"fake-distro","versions":["0.1"]},{"name":"another-distro","versions":["0.22"]}]}]`) }) + + it("succeeds with missing arch", func() { + bp := dist.BuildpackDescriptor{ + WithInfo: dist.ModuleInfo{ + ID: "some.buildpack.id", + Version: "some.buildpack.version", + }, + WithTargets: []dist.Target{{ + OS: "fake-os", + }}, + } + + h.AssertNil(t, bp.EnsureTargetSupport("fake-os", "fake-arch", "fake-distro", "0.1")) + }) }) when("#Kind", func() { From 20c5b272afd2406414df687552155e40a9b009c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 22:54:41 +0000 Subject: [PATCH 76/86] build(deps): bump crazy-max/ghaction-chocolatey from 2 to 3 Bumps [crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey) from 2 to 3. - [Release notes](https://github.com/crazy-max/ghaction-chocolatey/releases) - [Commits](https://github.com/crazy-max/ghaction-chocolatey/compare/v2...v3) --- updated-dependencies: - dependency-name: crazy-max/ghaction-chocolatey dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yml | 2 +- .github/workflows/delivery-chocolatey.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7cdeb81c8..d9634c277 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -135,7 +135,7 @@ jobs: verbose: true - name: Prepare Codecov if: matrix.os == 'windows' - uses: crazy-max/ghaction-chocolatey@v2 + uses: crazy-max/ghaction-chocolatey@v3 with: args: install codecov -y - name: run Codecov diff --git a/.github/workflows/delivery-chocolatey.yml b/.github/workflows/delivery-chocolatey.yml index a95ea6624..6531d3819 100644 --- a/.github/workflows/delivery-chocolatey.yml +++ b/.github/workflows/delivery-chocolatey.yml @@ -67,7 +67,7 @@ jobs: cp LICENSE $file cat $file - name: build-release - uses: crazy-max/ghaction-chocolatey@v2 + uses: crazy-max/ghaction-chocolatey@v3 with: args: pack ${{ env.CHOCO_PATH }}/pack.nuspec --outputdirectory ${{ env.CHOCO_PATH}} - name: list files @@ -75,12 +75,12 @@ jobs: ls ${{ env.CHOCO_PATH }} ls ${{ env.CHOCO_PATH }}/tools - name: Test Release - uses: crazy-max/ghaction-chocolatey@v2 + uses: crazy-max/ghaction-chocolatey@v3 with: args: install pack -s ${{ env.CHOCO_PATH }}/pack.${{ env.PACK_VERSION }}.nupkg - name: Ensure Pack Installed run: pack help - name: Upload Release - uses: crazy-max/ghaction-chocolatey@v2 + uses: crazy-max/ghaction-chocolatey@v3 with: args: push ${{ env.CHOCO_PATH }}/pack.${{ env.PACK_VERSION }}.nupkg -s https://push.chocolatey.org/ -k ${{ secrets.CHOCO_KEY }} From f2de422f763664a649b54277d433250d6d3cd34b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 22:55:58 +0000 Subject: [PATCH 77/86] build(deps): bump github.com/go-git/go-git/v5 from 5.8.1 to 5.9.0 Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.8.1 to 5.9.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.8.1...v5.9.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 10 +++++----- go.sum | 29 ++++++++++++----------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index 93cc6c915..1d9fb0232 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/gdamore/tcell/v2 v2.6.0 github.com/ghodss/yaml v1.0.0 - github.com/go-git/go-git/v5 v5.8.1 + github.com/go-git/go-git/v5 v5.9.0 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.5.9 github.com/google/go-containerregistry v0.16.1 @@ -51,7 +51,7 @@ require ( github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/aws/aws-sdk-go-v2 v1.18.1 // indirect @@ -74,6 +74,7 @@ require ( github.com/containerd/containerd v1.7.2 // indirect github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect github.com/containerd/typeurl v1.0.2 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect @@ -81,7 +82,7 @@ require ( github.com/emirpasic/gods v1.18.1 // indirect github.com/gdamore/encoding v1.0.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect - github.com/go-git/go-billy/v5 v5.4.1 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -107,7 +108,6 @@ require ( github.com/opencontainers/selinux v1.11.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/rivo/uniseg v0.4.3 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/skeema/knownhosts v1.2.0 // indirect @@ -116,7 +116,7 @@ require ( github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/net v0.15.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/tools v0.9.3 // indirect + golang.org/x/tools v0.13.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index b409f29da..51e1b0334 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.10.0-rc.8 h1:YSZVvlIIDD1UxQpJp0h+dnpLUw+TrY0cx8obKsp3bek= -github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= -github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= @@ -111,9 +111,9 @@ github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNA github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY= github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= -github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -134,7 +134,7 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4 github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -149,11 +149,11 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= -github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A= -github.com/go-git/go-git/v5 v5.8.1/go.mod h1:FHFuoD6yGz5OSKEBK+aWN9Oah0q54Jxl0abmj6GnqAo= +github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= +github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= @@ -213,12 +213,10 @@ github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= @@ -250,7 +248,6 @@ github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= @@ -280,8 +277,7 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= @@ -437,8 +433,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -453,7 +449,6 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= From 8ba3c140e099b4b17c313f1ee153f69463162f1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 22:09:42 +0000 Subject: [PATCH 78/86] build(deps): bump docker/setup-qemu-action from 2 to 3 Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/delivery-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delivery-docker.yml b/.github/workflows/delivery-docker.yml index e3024fb31..6e2895192 100644 --- a/.github/workflows/delivery-docker.yml +++ b/.github/workflows/delivery-docker.yml @@ -59,7 +59,7 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v2 - uses: buildpacks/github-actions/setup-tools@v5.4.0 - name: Buildx Build/Publish From 3f5ca1dec8845ba47cab6bcdef5166607937d399 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 22:09:45 +0000 Subject: [PATCH 79/86] build(deps): bump docker/setup-buildx-action from 2 to 3 Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/delivery-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delivery-docker.yml b/.github/workflows/delivery-docker.yml index 6e2895192..dff9657b5 100644 --- a/.github/workflows/delivery-docker.yml +++ b/.github/workflows/delivery-docker.yml @@ -60,7 +60,7 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v2 + - uses: docker/setup-buildx-action@v3 - uses: buildpacks/github-actions/setup-tools@v5.4.0 - name: Buildx Build/Publish run: | From 3055e62a50729b445c52184129077f26156b8dbf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 22:10:56 +0000 Subject: [PATCH 80/86] build(deps): bump docker/login-action from 2 to 3 Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/delivery-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delivery-docker.yml b/.github/workflows/delivery-docker.yml index dff9657b5..5db2c7e4b 100644 --- a/.github/workflows/delivery-docker.yml +++ b/.github/workflows/delivery-docker.yml @@ -55,7 +55,7 @@ jobs: - name: Determine App Name run: 'echo "IMG_NAME=${{ env.USERNAME }}/${{ env.IMG_NAME }}" >> $GITHUB_ENV' - name: Login to Dockerhub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} From a31ee3b386b8ba25346d73a19fb6f7aa787782df Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Wed, 13 Sep 2023 10:05:19 -0500 Subject: [PATCH 81/86] Updating default lifecycle version to 0.17.1 Signed-off-by: Juan Bustamante --- acceptance/testdata/pack_fixtures/report_output.txt | 2 +- go.mod | 2 +- go.sum | 4 ++-- internal/builder/lifecycle.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/acceptance/testdata/pack_fixtures/report_output.txt b/acceptance/testdata/pack_fixtures/report_output.txt index 7fe30b632..58e3baa5d 100644 --- a/acceptance/testdata/pack_fixtures/report_output.txt +++ b/acceptance/testdata/pack_fixtures/report_output.txt @@ -2,7 +2,7 @@ Pack: Version: {{ .Version }} OS/Arch: {{ .OS }}/{{ .Arch }} -Default Lifecycle Version: 0.17.0 +Default Lifecycle Version: 0.17.1 Supported Platform APIs: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12 diff --git a/go.mod b/go.mod index 1d9fb0232..dd8f2d073 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Microsoft/go-winio v0.6.1 github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c - github.com/buildpacks/lifecycle v0.17.0 + github.com/buildpacks/lifecycle v0.17.1 github.com/docker/cli v24.0.6+incompatible github.com/docker/docker v24.0.6+incompatible github.com/docker/go-connections v0.4.0 diff --git a/go.sum b/go.sum index 51e1b0334..28d6a8e11 100644 --- a/go.sum +++ b/go.sum @@ -97,8 +97,8 @@ github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001- github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c h1:HlRuSz+JGAzudNtNCfHIzXe0AEuHX6Vx8uZgmjvX02o= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c/go.mod h1:mBG5M3GJW5nknCEOOqtmMHyPYnSpw/5GEiciuYU/COw= -github.com/buildpacks/lifecycle v0.17.0 h1:vX/kpQfuh4LZvsIhi1wNkx/zahvwiF72bgc46rQ+3z0= -github.com/buildpacks/lifecycle v0.17.0/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= +github.com/buildpacks/lifecycle v0.17.1 h1:sCNj83TH1YE8Z3+CKHoFx/HK+llCVF1RlQUbj3xdNBQ= +github.com/buildpacks/lifecycle v0.17.1/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 h1:krfRl01rzPzxSxyLyrChD+U+MzsBXbm0OwYYB67uF+4= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589/go.mod h1:OuDyvmLnMCwa2ep4Jkm6nyA0ocJuZlGyk2gGseVzERM= diff --git a/internal/builder/lifecycle.go b/internal/builder/lifecycle.go index dc187a31f..318427902 100644 --- a/internal/builder/lifecycle.go +++ b/internal/builder/lifecycle.go @@ -14,7 +14,7 @@ import ( // A snapshot of the latest tested lifecycle version values const ( - DefaultLifecycleVersion = "0.17.0" + DefaultLifecycleVersion = "0.17.1" DefaultBuildpackAPIVersion = "0.2" ) From dea54075a09b911b912f83522c85643299f4229a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 22:23:19 +0000 Subject: [PATCH 82/86] build(deps): bump github.com/buildpacks/lifecycle from 0.17.0 to 0.17.1 Bumps [github.com/buildpacks/lifecycle](https://github.com/buildpacks/lifecycle) from 0.17.0 to 0.17.1. - [Release notes](https://github.com/buildpacks/lifecycle/releases) - [Changelog](https://github.com/buildpacks/lifecycle/blob/main/RELEASE.md) - [Commits](https://github.com/buildpacks/lifecycle/compare/v0.17.0...v0.17.1) --- updated-dependencies: - dependency-name: github.com/buildpacks/lifecycle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1d9fb0232..dd8f2d073 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Microsoft/go-winio v0.6.1 github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c - github.com/buildpacks/lifecycle v0.17.0 + github.com/buildpacks/lifecycle v0.17.1 github.com/docker/cli v24.0.6+incompatible github.com/docker/docker v24.0.6+incompatible github.com/docker/go-connections v0.4.0 diff --git a/go.sum b/go.sum index 51e1b0334..28d6a8e11 100644 --- a/go.sum +++ b/go.sum @@ -97,8 +97,8 @@ github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001- github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c h1:HlRuSz+JGAzudNtNCfHIzXe0AEuHX6Vx8uZgmjvX02o= github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c/go.mod h1:mBG5M3GJW5nknCEOOqtmMHyPYnSpw/5GEiciuYU/COw= -github.com/buildpacks/lifecycle v0.17.0 h1:vX/kpQfuh4LZvsIhi1wNkx/zahvwiF72bgc46rQ+3z0= -github.com/buildpacks/lifecycle v0.17.0/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= +github.com/buildpacks/lifecycle v0.17.1 h1:sCNj83TH1YE8Z3+CKHoFx/HK+llCVF1RlQUbj3xdNBQ= +github.com/buildpacks/lifecycle v0.17.1/go.mod h1:WFzcNp1WG4bwgHuXtKxMg4tdU3AguL44ZlP3knANeVs= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 h1:krfRl01rzPzxSxyLyrChD+U+MzsBXbm0OwYYB67uF+4= github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589/go.mod h1:OuDyvmLnMCwa2ep4Jkm6nyA0ocJuZlGyk2gGseVzERM= From 6944b162b9348f57e92be53f2a56147cdae564c2 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 19 Sep 2023 11:04:58 -0400 Subject: [PATCH 83/86] Simplifies acceptance tests by moving fixtures up one directory At some point, we might have intended to have different fixtures per Buildpack API version. However, we have only ever had one sub-folder (0.2). With the lifecycle dropping support for Buildpack API versions less than 0.7, we should rename or remove this sub-folder. Opting to remove it, to avoid having to rename it in the future. Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 7 +++---- acceptance/buildpacks/manager.go | 10 +--------- .../{0.2 => }/descriptor-buildpack/bin/build | 0 .../{0.2 => }/descriptor-buildpack/bin/build.bat | 0 .../{0.2 => }/descriptor-buildpack/bin/detect | 0 .../{0.2 => }/descriptor-buildpack/bin/detect.bat | 0 .../{0.2 => }/descriptor-buildpack/buildpack.toml | 0 .../{0.2 => }/internet-capable-buildpack/bin/build | 0 .../{0.2 => }/internet-capable-buildpack/bin/build.bat | 0 .../{0.2 => }/internet-capable-buildpack/bin/detect | 0 .../internet-capable-buildpack/bin/detect.bat | 0 .../internet-capable-buildpack/buildpack.toml | 0 .../{0.2 => }/meta-buildpack-dependency/bin/build | 0 .../{0.2 => }/meta-buildpack-dependency/bin/build.bat | 0 .../{0.2 => }/meta-buildpack-dependency/bin/detect | 0 .../{0.2 => }/meta-buildpack-dependency/bin/detect.bat | 0 .../{0.2 => }/meta-buildpack-dependency/buildpack.toml | 0 .../{0.2 => }/meta-buildpack/buildpack.toml | 0 .../{0.2 => }/meta-buildpack/package.toml | 0 .../{0.2 => }/nested-level-1-buildpack/buildpack.toml | 0 .../{0.2 => }/nested-level-2-buildpack/buildpack.toml | 0 .../{0.2 => }/noop-buildpack-2/bin/build | 0 .../{0.2 => }/noop-buildpack-2/bin/detect | 0 .../{0.2 => }/noop-buildpack-2/buildpack.toml | 0 .../mock_buildpacks/{0.2 => }/noop-buildpack/bin/build | 0 .../{0.2 => }/noop-buildpack/bin/build.bat | 0 .../{0.2 => }/noop-buildpack/bin/detect | 0 .../{0.2 => }/noop-buildpack/bin/detect.bat | 0 .../{0.2 => }/noop-buildpack/buildpack.toml | 0 .../{0.2 => }/not-in-builder-buildpack/bin/build | 0 .../{0.2 => }/not-in-builder-buildpack/bin/build.bat | 0 .../{0.2 => }/not-in-builder-buildpack/bin/detect | 0 .../{0.2 => }/not-in-builder-buildpack/bin/detect.bat | 0 .../{0.2 => }/not-in-builder-buildpack/buildpack.toml | 0 .../{0.2 => }/other-stack-buildpack/bin/build | 0 .../{0.2 => }/other-stack-buildpack/bin/build.bat | 0 .../{0.2 => }/other-stack-buildpack/bin/detect | 0 .../{0.2 => }/other-stack-buildpack/bin/detect.bat | 0 .../{0.2 => }/other-stack-buildpack/buildpack.toml | 0 .../{0.2 => }/read-env-buildpack/bin/build | 0 .../{0.2 => }/read-env-buildpack/bin/build.bat | 0 .../{0.2 => }/read-env-buildpack/bin/detect | 0 .../{0.2 => }/read-env-buildpack/bin/detect.bat | 0 .../{0.2 => }/read-env-buildpack/buildpack.toml | 0 .../{0.2 => }/read-env-extension/bin/detect | 0 .../{0.2 => }/read-env-extension/bin/generate | 0 .../{0.2 => }/read-env-extension/extension.toml | 0 .../{0.2 => }/read-volume-buildpack/bin/build | 0 .../{0.2 => }/read-volume-buildpack/bin/build.bat | 0 .../{0.2 => }/read-volume-buildpack/bin/detect | 0 .../{0.2 => }/read-volume-buildpack/bin/detect.bat | 0 .../{0.2 => }/read-volume-buildpack/buildpack.toml | 0 .../{0.2 => }/read-write-volume-buildpack/bin/build | 0 .../read-write-volume-buildpack/bin/build.bat | 0 .../{0.2 => }/read-write-volume-buildpack/bin/detect | 0 .../read-write-volume-buildpack/bin/detect.bat | 0 .../read-write-volume-buildpack/buildpack.toml | 0 .../simple-layers-buildpack-different-sha/bin/build | 0 .../bin/build.bat | 0 .../simple-layers-buildpack-different-sha/bin/detect | 0 .../bin/detect.bat | 0 .../bin/extra_file.txt | 0 .../buildpack.toml | 0 .../{0.2 => }/simple-layers-buildpack/bin/build | 0 .../{0.2 => }/simple-layers-buildpack/bin/build.bat | 0 .../{0.2 => }/simple-layers-buildpack/bin/detect | 0 .../{0.2 => }/simple-layers-buildpack/bin/detect.bat | 0 .../{0.2 => }/simple-layers-buildpack/buildpack.toml | 0 .../{0.2 => }/simple-layers-extension/bin/detect | 0 .../{0.2 => }/simple-layers-extension/bin/generate | 0 .../{0.2 => }/simple-layers-extension/extension.toml | 0 .../simple-layers-parent-buildpack/buildpack.toml | 0 72 files changed, 4 insertions(+), 13 deletions(-) rename acceptance/testdata/mock_buildpacks/{0.2 => }/descriptor-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/descriptor-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/descriptor-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/descriptor-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/descriptor-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/internet-capable-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/internet-capable-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/internet-capable-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/internet-capable-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/internet-capable-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/meta-buildpack-dependency/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/meta-buildpack-dependency/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/meta-buildpack-dependency/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/meta-buildpack-dependency/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/meta-buildpack-dependency/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/meta-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/meta-buildpack/package.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/nested-level-1-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/nested-level-2-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack-2/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack-2/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack-2/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/noop-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/not-in-builder-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/not-in-builder-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/not-in-builder-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/not-in-builder-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/not-in-builder-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/other-stack-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/other-stack-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/other-stack-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/other-stack-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/other-stack-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-extension/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-extension/bin/generate (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-env-extension/extension.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-volume-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-volume-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-volume-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-volume-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-volume-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-write-volume-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-write-volume-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-write-volume-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-write-volume-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/read-write-volume-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack-different-sha/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack-different-sha/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack-different-sha/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack-different-sha/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack-different-sha/bin/extra_file.txt (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack-different-sha/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack/bin/build (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack/bin/build.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack/bin/detect.bat (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-buildpack/buildpack.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-extension/bin/detect (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-extension/bin/generate (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-extension/extension.toml (100%) rename acceptance/testdata/mock_buildpacks/{0.2 => }/simple-layers-parent-buildpack/buildpack.toml (100%) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 28781794e..38b98e4b8 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -635,7 +635,7 @@ func testAcceptance( var ( pack, createBuilderPack *invoke.PackInvoker buildpackManager buildpacks.BuildModuleManager - bpDir = buildModulesDir(lifecycle.EarliestBuildpackAPIVersion()) + bpDir = buildModulesDir() assert = h.NewAssertionManager(t) ) @@ -649,7 +649,6 @@ func testAcceptance( buildpackManager = buildpacks.NewBuildModuleManager( t, assert, - buildpacks.WithBuildpackAPIVersion(lifecycle.EarliestBuildpackAPIVersion()), ) }) @@ -2898,8 +2897,8 @@ include = [ "*.jar", "media/mountain.jpg", "/media/person.png", ] }) } -func buildModulesDir(bpAPIVersion string) string { - return filepath.Join("testdata", "mock_buildpacks", bpAPIVersion) +func buildModulesDir() string { + return filepath.Join("testdata", "mock_buildpacks") } func createComplexBuilder(t *testing.T, diff --git a/acceptance/buildpacks/manager.go b/acceptance/buildpacks/manager.go index f66d1a6a4..af5b7249c 100644 --- a/acceptance/buildpacks/manager.go +++ b/acceptance/buildpacks/manager.go @@ -7,8 +7,6 @@ import ( "path/filepath" "testing" - "github.com/buildpacks/pack/internal/builder" - "github.com/buildpacks/pack/testhelpers" ) @@ -20,17 +18,11 @@ type BuildModuleManager struct { type BuildModuleManagerModifier func(b *BuildModuleManager) -func WithBuildpackAPIVersion(apiVersion string) func(b *BuildModuleManager) { - return func(b *BuildModuleManager) { - b.sourceDir = filepath.Join("testdata", "mock_buildpacks", apiVersion) - } -} - func NewBuildModuleManager(t *testing.T, assert testhelpers.AssertionManager, modifiers ...BuildModuleManagerModifier) BuildModuleManager { m := BuildModuleManager{ testObject: t, assert: assert, - sourceDir: filepath.Join("testdata", "mock_buildpacks", builder.DefaultBuildpackAPIVersion), + sourceDir: filepath.Join("testdata", "mock_buildpacks"), } for _, mod := range modifiers { diff --git a/acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/descriptor-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/descriptor-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/descriptor-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/descriptor-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/internet-capable-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/internet-capable-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/internet-capable-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build b/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build rename to acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build.bat b/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/build.bat rename to acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect b/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect rename to acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect.bat b/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/buildpack.toml b/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/meta-buildpack-dependency/buildpack.toml rename to acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/meta-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/meta-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/package.toml b/acceptance/testdata/mock_buildpacks/meta-buildpack/package.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/meta-buildpack/package.toml rename to acceptance/testdata/mock_buildpacks/meta-buildpack/package.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/nested-level-1-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/nested-level-1-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/nested-level-1-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/nested-level-1-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/nested-level-2-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/nested-level-2-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/nested-level-2-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/nested-level-2-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack-2/bin/build b/acceptance/testdata/mock_buildpacks/noop-buildpack-2/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack-2/bin/build rename to acceptance/testdata/mock_buildpacks/noop-buildpack-2/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack-2/bin/detect b/acceptance/testdata/mock_buildpacks/noop-buildpack-2/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack-2/bin/detect rename to acceptance/testdata/mock_buildpacks/noop-buildpack-2/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack-2/buildpack.toml b/acceptance/testdata/mock_buildpacks/noop-buildpack-2/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack-2/buildpack.toml rename to acceptance/testdata/mock_buildpacks/noop-buildpack-2/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/noop-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/noop-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/noop-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/noop-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/noop-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/noop-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/noop-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/noop-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/noop-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/noop-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/noop-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/not-in-builder-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/other-stack-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/other-stack-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/other-stack-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/other-stack-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/read-env-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/read-env-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/detect b/acceptance/testdata/mock_buildpacks/read-env-extension/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/detect rename to acceptance/testdata/mock_buildpacks/read-env-extension/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate b/acceptance/testdata/mock_buildpacks/read-env-extension/bin/generate similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-extension/bin/generate rename to acceptance/testdata/mock_buildpacks/read-env-extension/bin/generate diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-env-extension/extension.toml b/acceptance/testdata/mock_buildpacks/read-env-extension/extension.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-env-extension/extension.toml rename to acceptance/testdata/mock_buildpacks/read-env-extension/extension.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/read-volume-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/read-volume-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-volume-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/read-volume-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/read-write-volume-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/build b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/build rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/build.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/build.bat rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/detect b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/detect rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/detect.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/extra_file.txt b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/extra_file.txt similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/bin/extra_file.txt rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/extra_file.txt diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/buildpack.toml b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack-different-sha/buildpack.toml rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/build rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/build.bat rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/detect b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/detect rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/detect.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/detect.bat similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/bin/detect.bat rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/detect.bat diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/simple-layers-buildpack/buildpack.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-extension/bin/detect b/acceptance/testdata/mock_buildpacks/simple-layers-extension/bin/detect similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-extension/bin/detect rename to acceptance/testdata/mock_buildpacks/simple-layers-extension/bin/detect diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-extension/bin/generate b/acceptance/testdata/mock_buildpacks/simple-layers-extension/bin/generate similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-extension/bin/generate rename to acceptance/testdata/mock_buildpacks/simple-layers-extension/bin/generate diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-extension/extension.toml b/acceptance/testdata/mock_buildpacks/simple-layers-extension/extension.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-extension/extension.toml rename to acceptance/testdata/mock_buildpacks/simple-layers-extension/extension.toml diff --git a/acceptance/testdata/mock_buildpacks/0.2/simple-layers-parent-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/simple-layers-parent-buildpack/buildpack.toml similarity index 100% rename from acceptance/testdata/mock_buildpacks/0.2/simple-layers-parent-buildpack/buildpack.toml rename to acceptance/testdata/mock_buildpacks/simple-layers-parent-buildpack/buildpack.toml From 92a601ab521e9458c35bb87466de08387af0fb82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:36:37 +0000 Subject: [PATCH 84/86] build(deps): bump github.com/opencontainers/image-spec Bumps [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec) from 1.1.0-rc4 to 1.1.0-rc5. - [Release notes](https://github.com/opencontainers/image-spec/releases) - [Changelog](https://github.com/opencontainers/image-spec/blob/main/RELEASES.md) - [Commits](https://github.com/opencontainers/image-spec/compare/v1.1.0-rc4...v1.1.0-rc5) --- updated-dependencies: - dependency-name: github.com/opencontainers/image-spec dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index dd8f2d073..2d705b718 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e github.com/onsi/gomega v1.27.10 github.com/opencontainers/go-digest v1.0.0 - github.com/opencontainers/image-spec v1.1.0-rc4 + github.com/opencontainers/image-spec v1.1.0-rc5 github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8 diff --git a/go.sum b/go.sum index 28d6a8e11..04dfd9a66 100644 --- a/go.sum +++ b/go.sum @@ -256,8 +256,8 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0= -github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= From 2002e8447fc21498b3a1e4616ba75e9480363915 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 19 Sep 2023 15:42:27 -0400 Subject: [PATCH 85/86] Update acceptance fixtures to use newer Buildpack API versions Lifecycle 0.18.0 and above will only support Buildpack API versions 0.7 and above Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 29 +++++++++---------- .../descriptor-buildpack/buildpack.toml | 2 +- .../internet-capable-buildpack/buildpack.toml | 2 +- .../meta-buildpack-dependency/buildpack.toml | 2 +- .../meta-buildpack/buildpack.toml | 2 +- .../nested-level-1-buildpack/buildpack.toml | 2 +- .../nested-level-2-buildpack/buildpack.toml | 2 +- .../noop-buildpack-2/buildpack.toml | 2 +- .../noop-buildpack/buildpack.toml | 2 +- .../not-in-builder-buildpack/buildpack.toml | 2 +- .../other-stack-buildpack/buildpack.toml | 2 +- .../read-env-buildpack/bin/build | 6 ++-- .../read-env-buildpack/bin/build.bat | 6 ++-- .../read-env-buildpack/buildpack.toml | 2 +- .../read-volume-buildpack/buildpack.toml | 2 +- .../buildpack.toml | 2 +- .../bin/build | 7 +++-- .../bin/build.bat | 7 +++-- .../buildpack.toml | 2 +- .../simple-layers-buildpack/bin/build | 10 +++++-- .../simple-layers-buildpack/bin/build.bat | 10 +++++-- .../simple-layers-buildpack/buildpack.toml | 2 +- .../simple-layers-extension/extension.toml | 2 +- .../buildpack.toml | 2 +- 24 files changed, 64 insertions(+), 45 deletions(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 38b98e4b8..07e90a79f 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -794,23 +794,20 @@ func testAcceptance( }) it("creates builder", func() { - // Linux containers (including Linux containers on Windows) - extSimpleLayersDiffID := "sha256:b9e4a0ddfb650c7aa71d1e6aceea1665365e409b3078bfdc1e51c2b07ab2b423" - extReadEnvDiffID := "sha256:4490d78f2b056cdb99ad9cd3892f3c0617c5a485fb300dd90c572ce375ee45b2" - bpSimpleLayersDiffID := "sha256:285ff6683c99e5ae19805f6a62168fb40dca64d813c53b782604c9652d745c70" - bpReadEnvDiffID := "sha256:dd1e0efcbf3f08b014ef6eff9cfe7a9eac1cf20bd9b6a71a946f0a74575aa56f" - if imageManager.HostOS() == "windows" { // Windows containers on Windows - extSimpleLayersDiffID = "sha256:a063cf949b9c267133e451ac8cd95b4e77571bb7c629dd817461dca769170810" - extReadEnvDiffID = "sha256:ae9520eef7d84f69da6adf2597266660ce3fa5fd8ddac716cbfbecb67ded50e5" - bpSimpleLayersDiffID = "sha256:ccd1234cc5685e8a412b70c5f9a8e7b584b8e4f2a20c987ec242c9055de3e45e" - bpReadEnvDiffID = "sha256:8b22a7742ffdfbdd978787c6937456b68afb27c3585a3903048be7434d251e3f" + if imageManager.HostOS() != "windows" { + // Linux containers (including Linux containers on Windows) + extSimpleLayersDiffID := "sha256:d24758b8b75b13292746fe7a06666f28a9499da31826a60afe6ee6b8cba29b73" + extReadEnvDiffID := "sha256:4490d78f2b056cdb99ad9cd3892f3c0617c5a485fb300dd90c572ce375ee45b2" + bpSimpleLayersDiffID := "sha256:ff38769b05fb483c8e24dade16476f7153707ef9cdcb3f43cdc8d2d65dbc66ae" + bpReadEnvDiffID := "sha256:b22ad0adcc5f9fb0d2bb358e6483e9f50f4375e659472217ff564cd8d11ea955" + // extensions + assertImage.HasLabelWithData(builderName, "io.buildpacks.extension.layers", `{"read/env":{"read-env-version":{"api":"0.9","layerDiffID":"`+extReadEnvDiffID+`","name":"Read Env Extension"}},"simple/layers":{"simple-layers-version":{"api":"0.7","layerDiffID":"`+extSimpleLayersDiffID+`","name":"Simple Layers Extension"}}}`) + assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order-extensions", `[{"group":[{"id":"read/env","version":"read-env-version"},{"id":"simple/layers","version":"simple-layers-version"}]}]`) + // buildpacks + assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.layers", `{"read/env":{"read-env-version":{"api":"0.7","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpReadEnvDiffID+`","name":"Read Env Buildpack"}},"simple/layers":{"simple-layers-version":{"api":"0.7","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpSimpleLayersDiffID+`","name":"Simple Layers Buildpack"}}}`) + assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order", `[{"group":[{"id":"read/env","version":"read-env-version","optional":true},{"id":"simple/layers","version":"simple-layers-version","optional":true}]}]`) + } - // extensions - assertImage.HasLabelWithData(builderName, "io.buildpacks.extension.layers", `{"read/env":{"read-env-version":{"api":"0.9","layerDiffID":"`+extReadEnvDiffID+`","name":"Read Env Extension"}},"simple/layers":{"simple-layers-version":{"api":"0.2","layerDiffID":"`+extSimpleLayersDiffID+`","name":"Simple Layers Extension"}}}`) - assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order-extensions", `[{"group":[{"id":"read/env","version":"read-env-version"},{"id":"simple/layers","version":"simple-layers-version"}]}]`) - // buildpacks - assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.layers", `{"read/env":{"read-env-version":{"api":"0.2","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpReadEnvDiffID+`","name":"Read Env Buildpack"}},"simple/layers":{"simple-layers-version":{"api":"0.2","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpSimpleLayersDiffID+`","name":"Simple Layers Buildpack"}}}`) - assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order", `[{"group":[{"id":"read/env","version":"read-env-version","optional":true},{"id":"simple/layers","version":"simple-layers-version","optional":true}]}]`) }) when("build", func() { diff --git a/acceptance/testdata/mock_buildpacks/descriptor-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/descriptor-buildpack/buildpack.toml index d25a1e90e..e60c1b61d 100644 --- a/acceptance/testdata/mock_buildpacks/descriptor-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/descriptor-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "descriptor/bp" diff --git a/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/buildpack.toml index f4a886a5a..b3cd45efb 100644 --- a/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/internet-capable-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "internet/bp" diff --git a/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/buildpack.toml b/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/buildpack.toml index 668299eab..179206306 100644 --- a/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/meta-buildpack-dependency/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "local/meta-bp-dep" diff --git a/acceptance/testdata/mock_buildpacks/meta-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/meta-buildpack/buildpack.toml index 799806eeb..3bf66937b 100644 --- a/acceptance/testdata/mock_buildpacks/meta-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/meta-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "local/meta-bp" diff --git a/acceptance/testdata/mock_buildpacks/nested-level-1-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/nested-level-1-buildpack/buildpack.toml index 268e7f8cb..a711b1eb1 100644 --- a/acceptance/testdata/mock_buildpacks/nested-level-1-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/nested-level-1-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "simple/nested-level-1" diff --git a/acceptance/testdata/mock_buildpacks/nested-level-2-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/nested-level-2-buildpack/buildpack.toml index 5e58244fd..4531cb6be 100644 --- a/acceptance/testdata/mock_buildpacks/nested-level-2-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/nested-level-2-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "simple/nested-level-2" diff --git a/acceptance/testdata/mock_buildpacks/noop-buildpack-2/buildpack.toml b/acceptance/testdata/mock_buildpacks/noop-buildpack-2/buildpack.toml index 1fc577bbc..1c0351887 100644 --- a/acceptance/testdata/mock_buildpacks/noop-buildpack-2/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/noop-buildpack-2/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "noop.buildpack" diff --git a/acceptance/testdata/mock_buildpacks/noop-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/noop-buildpack/buildpack.toml index f3460a484..9c6a58712 100644 --- a/acceptance/testdata/mock_buildpacks/noop-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/noop-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "noop.buildpack" diff --git a/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/buildpack.toml index c0f012d55..32ec32b5d 100644 --- a/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/not-in-builder-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "local/bp" diff --git a/acceptance/testdata/mock_buildpacks/other-stack-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/other-stack-buildpack/buildpack.toml index 115ca9547..5cf0da993 100644 --- a/acceptance/testdata/mock_buildpacks/other-stack-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/other-stack-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "other/stack/bp" diff --git a/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build index fc20479ce..c5145bf2b 100755 --- a/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build +++ b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build @@ -16,7 +16,8 @@ if [[ -f "$platform_dir/env/ENV1_CONTENTS" ]]; then contents=$(cat "$platform_dir/env/ENV1_CONTENTS") echo "$contents" > "$launch_dir/env1-launch-layer/env1-launch-dep" ln -snf "$launch_dir/env1-launch-layer" env1-launch-deps - echo "launch = true" > "$launch_dir/env1-launch-layer.toml" + echo "[types]" > "$launch_dir/env1-launch-layer.toml" + echo "launch = true" >> "$launch_dir/env1-launch-layer.toml" fi ## makes a launch layer @@ -26,7 +27,8 @@ if [[ -f "$platform_dir/env/ENV2_CONTENTS" ]]; then contents=$(cat "$platform_dir/env/ENV2_CONTENTS") echo "$contents" > "$launch_dir/env2-launch-layer/env2-launch-dep" ln -snf "$launch_dir/env2-launch-layer" env2-launch-deps - echo "launch = true" > "$launch_dir/env2-launch-layer.toml" + echo "[types]" > "$launch_dir/env2-launch-layer.toml" + echo "launch = true" >> "$launch_dir/env2-launch-layer.toml" fi echo "---> Done" diff --git a/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat index dd5e96d5c..9381683f5 100644 --- a/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat +++ b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat @@ -11,7 +11,8 @@ if exist %platform_dir%\env\ENV1_CONTENTS ( set /p contents=<%platform_dir%\env\ENV1_CONTENTS echo !contents!> %launch_dir%\env1-launch-layer\env1-launch-dep mklink /j env1-launch-deps %launch_dir%\env1-launch-layer - echo launch = true> %launch_dir%\env1-launch-layer.toml + echo "[types]" > %launch_dir%\env1-launch-layer.toml + echo launch = true >> %launch_dir%\env1-launch-layer.toml ) :: makes a launch layer @@ -21,7 +22,8 @@ if exist %platform_dir%\env\ENV2_CONTENTS ( set /p contents=<%platform_dir%\env\ENV2_CONTENTS echo !contents!> %launch_dir%\env2-launch-layer\env2-launch-dep mklink /j env2-launch-deps %launch_dir%\env2-launch-layer - echo launch = true> %launch_dir%\env2-launch-layer.toml + echo "[types]" > %launch_dir%\env2-launch-layer.toml + echo launch = true >> %launch_dir%\env2-launch-layer.toml ) echo --- Done diff --git a/acceptance/testdata/mock_buildpacks/read-env-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/read-env-buildpack/buildpack.toml index 09a0ef246..f6a1b5093 100644 --- a/acceptance/testdata/mock_buildpacks/read-env-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/read-env-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "read/env" diff --git a/acceptance/testdata/mock_buildpacks/read-volume-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/read-volume-buildpack/buildpack.toml index edced5070..e2c6385c0 100644 --- a/acceptance/testdata/mock_buildpacks/read-volume-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/read-volume-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "volume/bp" diff --git a/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/buildpack.toml index a7087c2b4..95a24f3e4 100644 --- a/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/read-write-volume-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "rw-volume/bp" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build index 7b0518eb5..27a83c336 100755 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build @@ -17,7 +17,8 @@ echo "Color: Styled" mkdir "$launch_dir/launch-layer" echo "Launch Dep Contents" > "$launch_dir/launch-layer/launch-dep" ln -snf "$launch_dir/launch-layer" launch-deps -echo "launch = true" > "$launch_dir/launch-layer.toml" +echo "[types]" > "$launch_dir/launch-layer.toml" +echo "launch = true" >> "$launch_dir/launch-layer.toml" ## makes a cached launch layer if [[ ! -f "$launch_dir/cached-launch-layer.toml" ]]; then @@ -25,7 +26,8 @@ if [[ ! -f "$launch_dir/cached-launch-layer.toml" ]]; then mkdir "$launch_dir/cached-launch-layer" echo "Cached Dep Contents" > "$launch_dir/cached-launch-layer/cached-dep" ln -snf "$launch_dir/cached-launch-layer" cached-deps - echo "launch = true" > "$launch_dir/cached-launch-layer.toml" + echo "[types]" > "$launch_dir/cached-launch-layer.toml" + echo "launch = true" >> "$launch_dir/cached-launch-layer.toml" echo "cache = true" >> "$launch_dir/cached-launch-layer.toml" else echo "reusing cached launch layer" @@ -38,6 +40,7 @@ cat < "$launch_dir/launch.toml" type = "web" command = "./run" args = ["8080"] + default = true [[processes]] type = "hello" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat index 01421d77f..37bd44ba7 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat @@ -8,7 +8,8 @@ echo making launch layer %launch_dir%\launch-layer mkdir %launch_dir%\launch-layer echo Launch Dep Contents > "%launch_dir%\launch-layer\launch-dep mklink /j launch-deps %launch_dir%\launch-layer -echo launch = true > %launch_dir%\launch-layer.toml +echo "[types]" > %launch_dir%\launch-layer.toml +echo launch = true >> %launch_dir%\launch-layer.toml :: makes a cached launch layer if not exist %launch_dir%\cached-launch-layer.toml ( @@ -16,7 +17,8 @@ if not exist %launch_dir%\cached-launch-layer.toml ( mkdir %launch_dir%\cached-launch-layer echo Cached Dep Contents > %launch_dir%\cached-launch-layer\cached-dep mklink /j cached-deps %launch_dir%\cached-launch-layer - echo launch = true > %launch_dir%\cached-launch-layer.toml + echo "[types]" > %launch_dir%\cached-launch-layer.toml + echo launch = true >> %launch_dir%\cached-launch-layer.toml echo cache = true >> %launch_dir%\cached-launch-layer.toml ) else ( echo reusing cached launch layer %launch_dir%\cached-launch-layer @@ -29,6 +31,7 @@ echo [[processes]] echo type = "web" echo command = '.\run' echo args = ["8080"] +echo default = true echo. echo [[processes]] echo type = "hello" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/buildpack.toml b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/buildpack.toml index 22b290e57..b772b61ab 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "simple/layers" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build index 01568be0f..e2dce349b 100755 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build @@ -17,7 +17,8 @@ echo "Color: Styled" mkdir "$launch_dir/launch-layer" echo "Launch Dep Contents" > "$launch_dir/launch-layer/launch-dep" ln -snf "$launch_dir/launch-layer" launch-deps -echo "launch = true" > "$launch_dir/launch-layer.toml" +echo "[types]" > "$launch_dir/launch-layer.toml" +echo "launch = true" >> "$launch_dir/launch-layer.toml" ## makes a cached launch layer if [[ ! -f "$launch_dir/cached-launch-layer.toml" ]]; then @@ -25,10 +26,14 @@ if [[ ! -f "$launch_dir/cached-launch-layer.toml" ]]; then mkdir "$launch_dir/cached-launch-layer" echo "Cached Dep Contents" > "$launch_dir/cached-launch-layer/cached-dep" ln -snf "$launch_dir/cached-launch-layer" cached-deps - echo "launch = true" > "$launch_dir/cached-launch-layer.toml" + echo "[types]" > "$launch_dir/cached-launch-layer.toml" + echo "launch = true" >> "$launch_dir/cached-launch-layer.toml" echo "cache = true" >> "$launch_dir/cached-launch-layer.toml" else echo "reusing cached launch layer" + echo "[types]" > "$launch_dir/cached-launch-layer.toml" + echo "launch = true" >> "$launch_dir/cached-launch-layer.toml" + echo "cache = true" >> "$launch_dir/cached-launch-layer.toml" ln -snf "$launch_dir/cached-launch-layer" cached-deps fi @@ -38,6 +43,7 @@ cat < "$launch_dir/launch.toml" type = "web" command = "./run" args = ["8080"] + default = true [[processes]] type = "hello" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat index 2047dc714..dc0b208f4 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat @@ -8,7 +8,8 @@ echo making launch layer %launch_dir%\launch-layer mkdir %launch_dir%\launch-layer echo Launch Dep Contents > "%launch_dir%\launch-layer\launch-dep mklink /j launch-deps %launch_dir%\launch-layer -echo launch = true > %launch_dir%\launch-layer.toml +echo "[types]" > %launch_dir%\launch-layer.toml +echo launch = true >> %launch_dir%\launch-layer.toml :: makes a cached launch layer if not exist %launch_dir%\cached-launch-layer.toml ( @@ -16,10 +17,14 @@ if not exist %launch_dir%\cached-launch-layer.toml ( mkdir %launch_dir%\cached-launch-layer echo Cached Dep Contents > %launch_dir%\cached-launch-layer\cached-dep mklink /j cached-deps %launch_dir%\cached-launch-layer - echo launch = true > %launch_dir%\cached-launch-layer.toml + echo "[types]" > %launch_dir%\cached-launch-layer.toml + echo launch = true >> %launch_dir%\cached-launch-layer.toml echo cache = true >> %launch_dir%\cached-launch-layer.toml ) else ( echo reusing cached launch layer %launch_dir%\cached-launch-layer + echo "[types]" > %launch_dir%\cached-launch-layer.toml + echo launch = true >> %launch_dir%\cached-launch-layer.toml + echo cache = true >> %launch_dir%\cached-launch-layer.toml mklink /j cached-deps %launch_dir%\cached-launch-layer ) @@ -29,6 +34,7 @@ echo [[processes]] echo type = "web" echo command = '.\run' echo args = ["8080"] +echo default = true echo. echo [[processes]] echo type = "hello" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/buildpack.toml index 22b290e57..b772b61ab 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "simple/layers" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-extension/extension.toml b/acceptance/testdata/mock_buildpacks/simple-layers-extension/extension.toml index 1b397a8f7..9b780cd5d 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-extension/extension.toml +++ b/acceptance/testdata/mock_buildpacks/simple-layers-extension/extension.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [extension] id = "simple/layers" diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-parent-buildpack/buildpack.toml b/acceptance/testdata/mock_buildpacks/simple-layers-parent-buildpack/buildpack.toml index 46f3a39ea..a92d2c757 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-parent-buildpack/buildpack.toml +++ b/acceptance/testdata/mock_buildpacks/simple-layers-parent-buildpack/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.2" +api = "0.7" [buildpack] id = "simple/layers/parent" From 175282ab089252a01cbbd9e065b3002f0eedde68 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Tue, 19 Sep 2023 17:41:44 -0400 Subject: [PATCH 86/86] Try to fix Windows Signed-off-by: Natalie Arellano --- acceptance/acceptance_test.go | 5 ++--- .../mock_buildpacks/read-env-buildpack/bin/build.bat | 4 ++-- .../simple-layers-buildpack-different-sha/bin/build.bat | 4 ++-- .../mock_buildpacks/simple-layers-buildpack/bin/build.bat | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 07e90a79f..da19ad6fd 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -798,15 +798,14 @@ func testAcceptance( // Linux containers (including Linux containers on Windows) extSimpleLayersDiffID := "sha256:d24758b8b75b13292746fe7a06666f28a9499da31826a60afe6ee6b8cba29b73" extReadEnvDiffID := "sha256:4490d78f2b056cdb99ad9cd3892f3c0617c5a485fb300dd90c572ce375ee45b2" - bpSimpleLayersDiffID := "sha256:ff38769b05fb483c8e24dade16476f7153707ef9cdcb3f43cdc8d2d65dbc66ae" - bpReadEnvDiffID := "sha256:b22ad0adcc5f9fb0d2bb358e6483e9f50f4375e659472217ff564cd8d11ea955" + bpSimpleLayersDiffID := "sha256:ade9da86859fa4ea50a513757f9b242bf1038667abf92dad3d018974a17f0ea7" + bpReadEnvDiffID := "sha256:db0797077ba8deff7054ab5578133b8f0206b6393de34b5bfd795cf50f6afdbd" // extensions assertImage.HasLabelWithData(builderName, "io.buildpacks.extension.layers", `{"read/env":{"read-env-version":{"api":"0.9","layerDiffID":"`+extReadEnvDiffID+`","name":"Read Env Extension"}},"simple/layers":{"simple-layers-version":{"api":"0.7","layerDiffID":"`+extSimpleLayersDiffID+`","name":"Simple Layers Extension"}}}`) assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order-extensions", `[{"group":[{"id":"read/env","version":"read-env-version"},{"id":"simple/layers","version":"simple-layers-version"}]}]`) // buildpacks assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.layers", `{"read/env":{"read-env-version":{"api":"0.7","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpReadEnvDiffID+`","name":"Read Env Buildpack"}},"simple/layers":{"simple-layers-version":{"api":"0.7","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpSimpleLayersDiffID+`","name":"Simple Layers Buildpack"}}}`) assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order", `[{"group":[{"id":"read/env","version":"read-env-version","optional":true},{"id":"simple/layers","version":"simple-layers-version","optional":true}]}]`) - } }) diff --git a/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat index 9381683f5..e505dc98e 100644 --- a/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat +++ b/acceptance/testdata/mock_buildpacks/read-env-buildpack/bin/build.bat @@ -11,7 +11,7 @@ if exist %platform_dir%\env\ENV1_CONTENTS ( set /p contents=<%platform_dir%\env\ENV1_CONTENTS echo !contents!> %launch_dir%\env1-launch-layer\env1-launch-dep mklink /j env1-launch-deps %launch_dir%\env1-launch-layer - echo "[types]" > %launch_dir%\env1-launch-layer.toml + echo [types] > %launch_dir%\env1-launch-layer.toml echo launch = true >> %launch_dir%\env1-launch-layer.toml ) @@ -22,7 +22,7 @@ if exist %platform_dir%\env\ENV2_CONTENTS ( set /p contents=<%platform_dir%\env\ENV2_CONTENTS echo !contents!> %launch_dir%\env2-launch-layer\env2-launch-dep mklink /j env2-launch-deps %launch_dir%\env2-launch-layer - echo "[types]" > %launch_dir%\env2-launch-layer.toml + echo [types] > %launch_dir%\env2-launch-layer.toml echo launch = true >> %launch_dir%\env2-launch-layer.toml ) diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat index 37bd44ba7..be3e8497d 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack-different-sha/bin/build.bat @@ -8,7 +8,7 @@ echo making launch layer %launch_dir%\launch-layer mkdir %launch_dir%\launch-layer echo Launch Dep Contents > "%launch_dir%\launch-layer\launch-dep mklink /j launch-deps %launch_dir%\launch-layer -echo "[types]" > %launch_dir%\launch-layer.toml +echo [types] > %launch_dir%\launch-layer.toml echo launch = true >> %launch_dir%\launch-layer.toml :: makes a cached launch layer @@ -17,7 +17,7 @@ if not exist %launch_dir%\cached-launch-layer.toml ( mkdir %launch_dir%\cached-launch-layer echo Cached Dep Contents > %launch_dir%\cached-launch-layer\cached-dep mklink /j cached-deps %launch_dir%\cached-launch-layer - echo "[types]" > %launch_dir%\cached-launch-layer.toml + echo [types] > %launch_dir%\cached-launch-layer.toml echo launch = true >> %launch_dir%\cached-launch-layer.toml echo cache = true >> %launch_dir%\cached-launch-layer.toml ) else ( diff --git a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat index dc0b208f4..78fd79c8f 100644 --- a/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat +++ b/acceptance/testdata/mock_buildpacks/simple-layers-buildpack/bin/build.bat @@ -8,7 +8,7 @@ echo making launch layer %launch_dir%\launch-layer mkdir %launch_dir%\launch-layer echo Launch Dep Contents > "%launch_dir%\launch-layer\launch-dep mklink /j launch-deps %launch_dir%\launch-layer -echo "[types]" > %launch_dir%\launch-layer.toml +echo [types] > %launch_dir%\launch-layer.toml echo launch = true >> %launch_dir%\launch-layer.toml :: makes a cached launch layer @@ -17,12 +17,12 @@ if not exist %launch_dir%\cached-launch-layer.toml ( mkdir %launch_dir%\cached-launch-layer echo Cached Dep Contents > %launch_dir%\cached-launch-layer\cached-dep mklink /j cached-deps %launch_dir%\cached-launch-layer - echo "[types]" > %launch_dir%\cached-launch-layer.toml + echo [types] > %launch_dir%\cached-launch-layer.toml echo launch = true >> %launch_dir%\cached-launch-layer.toml echo cache = true >> %launch_dir%\cached-launch-layer.toml ) else ( echo reusing cached launch layer %launch_dir%\cached-launch-layer - echo "[types]" > %launch_dir%\cached-launch-layer.toml + echo [types] > %launch_dir%\cached-launch-layer.toml echo launch = true >> %launch_dir%\cached-launch-layer.toml echo cache = true >> %launch_dir%\cached-launch-layer.toml mklink /j cached-deps %launch_dir%\cached-launch-layer