Skip to content

Commit

Permalink
Merge branch 'importhuman' into importhuman
Browse files Browse the repository at this point in the history
* 'importhuman' of https://github.com/importhuman/pack:
  Fix spelling mistake
  Actually use error enum
  Concurrency Support for Registry Caching
  Bump github.com/golang/mock from 1.5.0 to 1.6.0
  Bump github.com/pelletier/go-toml from 1.9.2 to 1.9.3
  Bump github.com/pelletier/go-toml from 1.9.1 to 1.9.2
  Bump github.com/docker/docker
  update testing and resolve branch updates
  formatting updates
  add platform api 0.6 support to enable new lifecycle features
  • Loading branch information
importhuman committed Jul 6, 2021
2 parents b4eb53f + b6a2e29 commit d54a4c4
Show file tree
Hide file tree
Showing 17 changed files with 138 additions and 39 deletions.
2 changes: 1 addition & 1 deletion acceptance/testdata/pack_fixtures/report_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Pack:

Default Lifecycle Version: 0.11.3

Supported Platform APIs: 0.3, 0.4
Supported Platform APIs: 0.3, 0.4, 0.5, 0.6

Config:
default-builder-image = "{{ .DefaultBuilder }}"
Expand Down
4 changes: 2 additions & 2 deletions doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
// This example shows the basic usage of the package: Create a client,
// call a configuration object, call the client's Build function.
func Example_build() {
//create a context object
// create a context object
context := context.Background()

//initialize a pack client
// initialize a pack client
client, err := pack.NewClient()
if err != nil {
panic(err)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ require (
github.com/buildpacks/lifecycle v0.11.3
github.com/containerd/containerd v1.4.1 // indirect
github.com/containerd/continuity v0.0.0-20200107194136-26c1120b8d41 // indirect
github.com/docker/docker v20.10.6+incompatible
github.com/docker/docker v20.10.7+incompatible
github.com/docker/go-connections v0.4.0
github.com/ghodss/yaml v1.0.0
github.com/golang/mock v1.5.0
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.5.6
github.com/google/go-containerregistry v0.5.1
github.com/google/go-github/v30 v30.1.0
Expand All @@ -25,7 +25,7 @@ require (
github.com/opencontainers/image-spec v1.0.1
github.com/opencontainers/runc v0.1.1 // indirect
github.com/opencontainers/selinux v1.6.0 // indirect
github.com/pelletier/go-toml v1.9.1
github.com/pelletier/go-toml v1.9.3
github.com/pkg/errors v0.9.1
github.com/sabhiram/go-gitignore v0.0.0-20201211074657-223ce5d391b0
github.com/sclevine/spec v1.4.0
Expand Down
21 changes: 14 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ github.com/docker/cli v0.0.0-20200312141509-ef2f64abbd37/go.mod h1:JLrzqnKDaYBop
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v20.10.6+incompatible h1:oXI3Vas8TI8Eu/EjH4srKHJBVqraSzJybhxY7Om9faQ=
github.com/docker/docker v20.10.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v20.10.7+incompatible h1:Z6O9Nhsjv+ayUEeI1IojKbYcsGdgYSNqxe1s2MYzUhQ=
github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.6.3 h1:zI2p9+1NQYdnG6sMU26EX4aVGlqbInSQxQXLvzJ4RPQ=
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
Expand Down Expand Up @@ -183,8 +183,9 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.5.0 h1:jlYHihg//f7RRwuPfptm04yp4s7O6Kw8EZiVYIGcH0g=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -378,8 +379,8 @@ github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqi
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.9.1 h1:a6qW1EVNZWH9WGI6CsYdD8WAylkoXBS5yv0XHlh17Tc=
github.com/pelletier/go-toml v1.9.1/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -474,6 +475,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
Expand Down Expand Up @@ -561,6 +563,7 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand All @@ -578,8 +581,9 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -626,8 +630,10 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -686,6 +692,7 @@ golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
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=
Expand Down
12 changes: 6 additions & 6 deletions internal/build/container_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func copyDirWindows(ctx context.Context, ctrClient client.CommonAPIClient, conta
"cmd",
"/c",

//xcopy args
// xcopy args
// e - recursively create subdirectories
// h - copy hidden and system files
// b - copy symlinks, do not dereference
Expand Down Expand Up @@ -185,10 +185,10 @@ func createReader(src, dst string, uid, gid int, includeRoot bool, fileFilter fu
return archive.ReadZipAsTar(src, dst, uid, gid, -1, false, fileFilter), nil
}

//EnsureVolumeAccess grants full access permissions to volumes for UID/GID-based user
//When UID/GID are 0 it grants explicit full access to BUILTIN\Administrators and any other UID/GID grants full access to BUILTIN\Users
//Changing permissions on volumes through stopped containers does not work on Docker for Windows so we start the container and make change using icacls
//See: https://github.com/moby/moby/issues/40771
// EnsureVolumeAccess grants full access permissions to volumes for UID/GID-based user
// When UID/GID are 0 it grants explicit full access to BUILTIN\Administrators and any other UID/GID grants full access to BUILTIN\Users
// Changing permissions on volumes through stopped containers does not work on Docker for Windows so we start the container and make change using icacls
// See: https://github.com/moby/moby/issues/40771
func EnsureVolumeAccess(uid, gid int, os string, volumeNames ...string) ContainerOperation {
return func(ctrClient client.CommonAPIClient, ctx context.Context, containerID string, stdout, stderr io.Writer) error {
if os != "windows" {
Expand All @@ -210,7 +210,7 @@ func EnsureVolumeAccess(uid, gid int, os string, volumeNames ...string) Containe
cmd += "&&"
}

//icacls args
// icacls args
// /grant - add new permissions instead of replacing
// (OI) - object inherit
// (CI) - container inherit
Expand Down
3 changes: 2 additions & 1 deletion internal/build/lifecycle_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ func (l *LifecycleExecution) Build(ctx context.Context, networkMode string, volu
}

func determineDefaultProcessType(platformAPI *api.Version, providedValue string) string {
shouldSetForceDefault := platformAPI.Compare(api.MustParse("0.4")) >= 0
shouldSetForceDefault := platformAPI.Compare(api.MustParse("0.4")) >= 0 &&
platformAPI.Compare(api.MustParse("0.6")) < 0
if providedValue == "" && shouldSetForceDefault {
return defaultProcessType
}
Expand Down
83 changes: 82 additions & 1 deletion internal/build/lifecycle_execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) {
api.MustParse("0.3"),
api.MustParse("0.4"),
api.MustParse("0.5"),
api.MustParse("0.6"),
}))
h.AssertNil(t, err)

lifecycleExec := newTestLifecycleExec(t, false, fakes.WithBuilder(fakeBuilder))
h.AssertEq(t, lifecycleExec.PlatformAPI().String(), "0.4")
h.AssertEq(t, lifecycleExec.PlatformAPI().String(), "0.6")
})
})

Expand Down Expand Up @@ -566,6 +567,26 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) {
h.AssertIncludeAllExpectedPatterns(t, configProvider.ContainerConfig().Cmd, []string{"-process-type", "web"})
})
})

when("platform >= 0.6", func() {
when("no user provided process type is present", func() {
it("doesn't provide 'web' as default process type", func() {
fakeBuilder, err := fakes.NewFakeBuilder(fakes.WithSupportedPlatformAPIs([]*api.Version{api.MustParse("0.6")}))
h.AssertNil(t, err)
lifecycle := newTestLifecycleExec(t, true, fakes.WithBuilder(fakeBuilder))
fakePhaseFactory := fakes.NewFakePhaseFactory()

err = lifecycle.Export(context.Background(), "test", "test", true, "", "test", fakeBuildCache, fakeLaunchCache, []string{}, fakePhaseFactory)
h.AssertNil(t, err)

lastCallIndex := len(fakePhaseFactory.NewCalledWithProvider) - 1
h.AssertNotEq(t, lastCallIndex, -1)

configProvider := fakePhaseFactory.NewCalledWithProvider[lastCallIndex]
h.AssertSliceNotContains(t, configProvider.ContainerConfig().Cmd, "-process-type")
})
})
})
})

when("publish is false", func() {
Expand Down Expand Up @@ -755,6 +776,26 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) {
h.AssertIncludeAllExpectedPatterns(t, configProvider.ContainerConfig().Cmd, []string{"-process-type", "web"})
})
})

when("platform >= 0.6", func() {
when("no user provided process type is present", func() {
it("doesn't provide 'web' as default process type", func() {
fakeBuilder, err := fakes.NewFakeBuilder(fakes.WithSupportedPlatformAPIs([]*api.Version{api.MustParse("0.6")}))
h.AssertNil(t, err)
lifecycle := newTestLifecycleExec(t, true, fakes.WithBuilder(fakeBuilder))
fakePhaseFactory := fakes.NewFakePhaseFactory()

err = lifecycle.Export(context.Background(), "test", "test", false, "", "test", fakeBuildCache, fakeLaunchCache, []string{}, fakePhaseFactory)
h.AssertNil(t, err)

lastCallIndex := len(fakePhaseFactory.NewCalledWithProvider) - 1
h.AssertNotEq(t, lastCallIndex, -1)

configProvider := fakePhaseFactory.NewCalledWithProvider[lastCallIndex]
h.AssertSliceNotContains(t, configProvider.ContainerConfig().Cmd, "-process-type")
})
})
})
})

when("override GID", func() {
Expand Down Expand Up @@ -1912,6 +1953,26 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) {
h.AssertIncludeAllExpectedPatterns(t, configProvider.ContainerConfig().Cmd, []string{"-process-type", "web"})
})
})

when("platform >= 0.6", func() {
when("no user provided process type is present", func() {
it("doesn't provide 'web' as default process type", func() {
fakeBuilder, err := fakes.NewFakeBuilder(fakes.WithSupportedPlatformAPIs([]*api.Version{api.MustParse("0.6")}))
h.AssertNil(t, err)
lifecycle := newTestLifecycleExec(t, true, fakes.WithBuilder(fakeBuilder))
fakePhaseFactory := fakes.NewFakePhaseFactory()

err = lifecycle.Export(context.Background(), "test", "test", true, "", "test", fakeBuildCache, fakeLaunchCache, []string{}, fakePhaseFactory)
h.AssertNil(t, err)

lastCallIndex := len(fakePhaseFactory.NewCalledWithProvider) - 1
h.AssertNotEq(t, lastCallIndex, -1)

configProvider := fakePhaseFactory.NewCalledWithProvider[lastCallIndex]
h.AssertSliceNotContains(t, configProvider.ContainerConfig().Cmd, "-process-type")
})
})
})
})

when("publish is false", func() {
Expand Down Expand Up @@ -2097,6 +2158,26 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) {
h.AssertIncludeAllExpectedPatterns(t, configProvider.ContainerConfig().Cmd, []string{"-process-type", "web"})
})
})

when("platform >= 0.6", func() {
when("no user provided process type is present", func() {
it("doesn't provide 'web' as default process type", func() {
fakeBuilder, err := fakes.NewFakeBuilder(fakes.WithSupportedPlatformAPIs([]*api.Version{api.MustParse("0.6")}))
h.AssertNil(t, err)
lifecycle := newTestLifecycleExec(t, true, fakes.WithBuilder(fakeBuilder))
fakePhaseFactory := fakes.NewFakePhaseFactory()

err = lifecycle.Export(context.Background(), "test", "test", false, "", "test", fakeBuildCache, fakeLaunchCache, []string{}, fakePhaseFactory)
h.AssertNil(t, err)

lastCallIndex := len(fakePhaseFactory.NewCalledWithProvider) - 1
h.AssertNotEq(t, lastCallIndex, -1)

configProvider := fakePhaseFactory.NewCalledWithProvider[lastCallIndex]
h.AssertSliceNotContains(t, configProvider.ContainerConfig().Cmd, "-process-type")
})
})
})
})

when("override GID", func() {
Expand Down
2 changes: 2 additions & 0 deletions internal/build/lifecycle_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ var (
SupportedPlatformAPIVersions = builder.APISet{
api.MustParse("0.3"),
api.MustParse("0.4"),
api.MustParse("0.5"),
api.MustParse("0.6"),
}
)

Expand Down
2 changes: 1 addition & 1 deletion internal/commands/buildpack_new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func testBuildpackNewCommand(t *testing.T, when spec.G, it spec.S) {
when("BuildpackNew#Execute", func() {
it("uses the args to generate artifacts", func() {
mockClient.EXPECT().NewBuildpack(gomock.Any(), pack.NewBuildpackOptions{
API: "0.4",
API: "0.6",
ID: "example/some-cnb",
Path: filepath.Join(tmpDir, "some-cnb"),
Version: "1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/config_experimental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func testConfigExperimental(t *testing.T, when spec.G, it spec.S) {
it("returns error if invalid value provided", func() {
cmd.SetArgs([]string{"disable-me"})
h.AssertError(t, cmd.Execute(), fmt.Sprintf("invalid value %s provided", style.Symbol("disable-me")))
//output := outBuf.String()
//h.AssertContains(t, output, "Experimental features disabled.")
// output := outBuf.String()
// h.AssertContains(t, output, "Experimental features disabled.")
cfg, err := config.Read(configPath)
h.AssertNil(t, err)
h.AssertEq(t, cfg.Experimental, false)
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/config_registries_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func ConfigRegistriesDefault(logger logging.Logger, cfg config.Config, cfgPath s
}
logger.Infof("Successfully unset default registry %s", style.Symbol(oldRegistry))
logger.Infof("Default registry has been set to %s", style.Symbol(config.OfficialRegistryName))
case len(args) == 0: //list
case len(args) == 0: // list
if cfg.DefaultRegistryName == "" {
cfg.DefaultRegistryName = config.OfficialRegistryName
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/config_run_image_mirrors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func testConfigRunImageMirrorsCommand(t *testing.T, when spec.G, it spec.S) {
cfg, err := config.Read(configPath)
h.AssertNil(t, err)
h.AssertEq(t, cfg, testCfg)
//This ensures that there are no dups
// This ensures that there are no dups
h.AssertEq(t, len(cfg.RunImages[0].Mirrors), 2)
})
})
Expand Down
2 changes: 1 addition & 1 deletion internal/dist/buildpack_descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type BuildpackDescriptor struct {
}

func (b *BuildpackDescriptor) EscapedID() string {
return strings.Replace(b.Info.ID, "/", "_", -1)
return strings.ReplaceAll(b.Info.ID, "/", "_")
}

func (b *BuildpackDescriptor) EnsureStackSupport(stackID string, providedMixins []string, validateRunStageMixins bool) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/image/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (w *colorizedWriter) Write(p []byte) (n int, err error) {
">": style.ProgressBar,
}
for pattern, colorize := range colorizers {
msg = strings.Replace(msg, pattern, colorize(pattern), -1)
msg = strings.ReplaceAll(msg, pattern, colorize(pattern))
}
return w.writer.Write([]byte(msg))
}
Loading

0 comments on commit d54a4c4

Please sign in to comment.