From 7394cb381733753e7e0bd5531d73883b2f2afc2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Aug 2021 19:03:34 +0000 Subject: [PATCH 1/5] Bump github.com/BurntSushi/toml from 0.3.1 to 0.4.1 Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 0.3.1 to 0.4.1. - [Release notes](https://github.com/BurntSushi/toml/releases) - [Commits](https://github.com/BurntSushi/toml/compare/v0.3.1...v0.4.1) --- updated-dependencies: - dependency-name: github.com/BurntSushi/toml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d4efe95..cb098c0 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/buildpacks/libcnb go 1.15 require ( - github.com/BurntSushi/toml v0.3.1 + github.com/BurntSushi/toml v0.4.1 github.com/onsi/gomega v1.14.0 github.com/sclevine/spec v1.4.0 github.com/stretchr/testify v1.7.0 diff --git a/go.sum b/go.sum index ad69afa..1e5a041 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= +github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= 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= From 1112c1f8ee841bb3cc32382a186015380a9037ba Mon Sep 17 00:00:00 2001 From: David O'Sullivan Date: Thu, 12 Aug 2021 11:29:05 +0100 Subject: [PATCH 2/5] Adds support for buildpack log level environment variable 'BP_LOG_LEVEL' which currently accepts 'INFO' (default) or 'DEBUG' Signed-off-by: David O'Sullivan --- poet/logger.go | 16 +++++++++++++--- poet/logger_test.go | 15 +++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/poet/logger.go b/poet/logger.go index 3799b0a..8d62c57 100644 --- a/poet/logger.go +++ b/poet/logger.go @@ -57,13 +57,23 @@ func NewLoggerWithOptions(writer io.Writer, options ...Option) Logger { func NewLogger(writer io.Writer) Logger { var options []Option - if _, ok := os.LookupEnv("BP_DEBUG"); ok { - options = append(options, WithDebug(writer)) - } + // check for presence and value of log level environment variable + options = LogLevel(options, writer) return NewLoggerWithOptions(writer, options...) } +func LogLevel(options []Option, writer io.Writer) []Option { + // Check for older log level env variable + _, dbSet := os.LookupEnv("BP_DEBUG") + + // Then check for common buildpack log level env variable - if either are set to DEBUG/true, enable Debug Writer + if level, ok := os.LookupEnv("BP_LOG_LEVEL"); (ok && strings.ToLower(level) == "debug") || dbSet { + options = append(options, WithDebug(writer)) + } + return options +} + // Debug formats using the default formats for its operands and writes to the configured debug writer. Spaces are added // between operands when neither is a string. func (l Logger) Debug(a ...interface{}) { diff --git a/poet/logger_test.go b/poet/logger_test.go index 49d7dc4..ebf0c13 100644 --- a/poet/logger_test.go +++ b/poet/logger_test.go @@ -64,6 +64,21 @@ func testLogger(t *testing.T, context spec.G, it spec.S) { }) }) + context("with BP_LOG_LEVEL set to DEBUG", func() { + it.Before(func() { + Expect(os.Setenv("BP_LOG_LEVEL", "DEBUG")).To(Succeed()) + l = poet.NewLogger(b) + }) + + it.After(func() { + Expect(os.Unsetenv("BP_LOG_LEVEL")).To(Succeed()) + }) + + it("configures debug", func() { + Expect(l.IsDebugEnabled()).To(BeTrue()) + }) + }) + context("with debug disabled", func() { it.Before(func() { l = poet.NewLoggerWithOptions(b) From 4ae60411a2f79d3c6cda8b0672fedd56729ab917 Mon Sep 17 00:00:00 2001 From: buildpack-bot Date: Mon, 6 Sep 2021 05:09:21 +0000 Subject: [PATCH 3/5] Bump pipeline from 1.10.2 to 1.10.5 Bumps pipeline from 1.10.2 to 1.10.5. Signed-off-by: GitHub --- .github/pipeline-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pipeline-version b/.github/pipeline-version index 5ad2491..db77e0e 100644 --- a/.github/pipeline-version +++ b/.github/pipeline-version @@ -1 +1 @@ -1.10.2 +1.10.5 From 03d8910db4d5f0befcc14dbe0696703153437cfb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Sep 2021 17:21:23 +0000 Subject: [PATCH 4/5] Bump github.com/onsi/gomega from 1.14.0 to 1.16.0 Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.14.0 to 1.16.0. - [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.14.0...v1.16.0) --- updated-dependencies: - dependency-name: github.com/onsi/gomega 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 cb098c0..1a87542 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/BurntSushi/toml v0.4.1 - github.com/onsi/gomega v1.14.0 + github.com/onsi/gomega v1.16.0 github.com/sclevine/spec v1.4.0 github.com/stretchr/testify v1.7.0 ) diff --git a/go.sum b/go.sum index 1e5a041..7279209 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,8 @@ github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.14.0 h1:ep6kpPVwmr/nTbklSx2nrLNSIO62DoYAhnPNIMhK8gI= -github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= +github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c= +github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= 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= From a1b09287081eed979c80f7f293a644023b651a71 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Fri, 24 Sep 2021 09:06:20 -0400 Subject: [PATCH 5/5] Include BOM in test for emptiness The `BuildTOML.isEmpty()` method is used in one place, build.go, to check if it should write out build.toml. In the present state, if Unmet is empty but you have BOM entries then the build.toml and BOM entries are never written out. This change will look at both BOM & Unmet to determine emptiness. Thus it will write build.toml if BOM or Unmet has values. Signed-off-by: Daniel Mikusa --- application.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.go b/application.go index 36faf73..ffa8aba 100644 --- a/application.go +++ b/application.go @@ -90,7 +90,7 @@ type BuildTOML struct { } func (b BuildTOML) isEmpty() bool { - return len(b.Unmet) == 0 + return len(b.BOM) == 0 && len(b.Unmet) == 0 } // BOMEntry contains a bill of materials entry.