diff --git a/.github/pipeline-version b/.github/pipeline-version index 359c410..7aa332e 100644 --- a/.github/pipeline-version +++ b/.github/pipeline-version @@ -1 +1 @@ -1.32.0 +1.33.0 diff --git a/.github/workflows/pb-update-go.yml b/.github/workflows/pb-update-go.yml index df93d14..726b362 100644 --- a/.github/workflows/pb-update-go.yml +++ b/.github/workflows/pb-update-go.yml @@ -1,7 +1,7 @@ name: Update Go "on": schedule: - - cron: 0 2 * * 1 + - cron: 17 2 * * 1 workflow_dispatch: {} jobs: update: @@ -29,7 +29,7 @@ jobs: go mod edit -go="$GO_VERSION" go mod tidy - go get -u all + go get -u -t ./... go mod tidy git add go.mod go.sum diff --git a/go.mod b/go.mod index b0a7ed9..b693639 100644 --- a/go.mod +++ b/go.mod @@ -3,19 +3,19 @@ module github.com/buildpacks/libcnb go 1.20 require ( - github.com/BurntSushi/toml v1.2.1 + github.com/BurntSushi/toml v1.3.2 github.com/Masterminds/semver/v3 v3.2.1 - github.com/onsi/gomega v1.27.6 + github.com/onsi/gomega v1.27.8 github.com/sclevine/spec v1.4.0 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.4 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.4.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect + golang.org/x/net v0.12.0 // indirect + golang.org/x/text v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 528d59e..15a2e52 100644 --- a/go.sum +++ b/go.sum @@ -1,34 +1,36 @@ -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= 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= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +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= 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/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= -github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= -github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= -github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= +github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss= +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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +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/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +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/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/platform.go b/platform.go index 0f52485..94009d7 100644 --- a/platform.go +++ b/platform.go @@ -119,6 +119,7 @@ func NewBindingFromPath(path string) (Binding, error) { type vcapServicesBinding struct { Name string `json:"name"` + Label string `json:"label"` Credentials map[string]string `json:"credentials"` } @@ -132,12 +133,13 @@ func NewBindingsFromVcapServicesEnv(content string) (Bindings, error) { } bindings := Bindings{} - for t, bArray := range contentTyped { + for p, bArray := range contentTyped { for _, b := range bArray { bindings = append(bindings, Binding{ - Name: b.Name, - Type: t, - Secret: b.Credentials, + Name: b.Name, + Type: b.Label, + Provider: p, + Secret: b.Credentials, }) } } diff --git a/platform_test.go b/platform_test.go index 735c977..8db9a51 100644 --- a/platform_test.go +++ b/platform_test.go @@ -53,7 +53,9 @@ func testPlatform(t *testing.T, context spec.G, it spec.S) { Expect(bindings).To(HaveLen(2)) types := []string{bindings[0].Type, bindings[1].Type} - Expect(types).To(ContainElements("elephantsql", "sendgrid")) + Expect(types).To(ContainElements("elephantsql-type", "sendgrid-type")) + providers := []string{bindings[0].Provider, bindings[1].Provider} + Expect(providers).To(ContainElements("elephantsql-provider", "sendgrid-provider")) }) it("creates empty bindings from empty VCAP_SERVICES", func() { @@ -77,7 +79,7 @@ func testPlatform(t *testing.T, context spec.G, it spec.S) { Expect(bindings).To(HaveLen(2)) types := []string{bindings[0].Type, bindings[1].Type} - Expect(types).To(ContainElements("elephantsql", "sendgrid")) + Expect(types).To(ContainElements("elephantsql-type", "sendgrid-type")) }) it("creates empty bindings from empty VCAP_SERVICES", func() { diff --git a/testdata/vcap_services.json b/testdata/vcap_services.json index f9fbe60..eda3a60 100644 --- a/testdata/vcap_services.json +++ b/testdata/vcap_services.json @@ -1,12 +1,12 @@ { - "elephantsql": [ + "elephantsql-provider": [ { "name": "elephantsql-binding-c6c60", "binding_guid": "44ceb72f-100b-4f50-87a2-7809c8b42b8d", "binding_name": "elephantsql-binding-c6c60", "instance_guid": "391308e8-8586-4c42-b464-c7831aa2ad22", "instance_name": "elephantsql-c6c60", - "label": "elephantsql", + "label": "elephantsql-type", "tags": [ "postgres", "postgresql", @@ -20,14 +20,14 @@ "volume_mounts": [] } ], - "sendgrid": [ + "sendgrid-provider": [ { "name": "mysendgrid", "binding_guid": "6533b1b6-7916-488d-b286-ca33d3fa0081", "binding_name": null, "instance_guid": "8c907d0f-ec0f-44e4-87cf-e23c9ba3925d", "instance_name": "mysendgrid", - "label": "sendgrid", + "label": "sendgrid-type", "tags": [ "smtp" ],