Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Go 1.21, drop 1.19, update default to 1.20 #595

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 17 additions & 31 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,7 @@ api = "0.7"
include-files = ["bin/run", "bin/build", "bin/detect", "buildpack.toml"]
pre-package = "./scripts/build.sh"
[metadata.default-versions]
go = "1.19.*"

[[metadata.dependencies]]
checksum = "sha256:ee18f98a03386e2bf48ff75737ea17c953b1572f9b1114352f104ac5eef04bb4"
cpe = "cpe:2.3:a:golang:go:1.19.11:*:*:*:*:*:*:*"
id = "go"
licenses = ["BSD-3-Clause"]
name = "Go"
purl = "pkg:generic/[email protected]?checksum=ee18f98a03386e2bf48ff75737ea17c953b1572f9b1114352f104ac5eef04bb4&download_url=https://go.dev/dl/go1.19.11.linux-amd64.tar.gz"
source = "https://go.dev/dl/go1.19.11.src.tar.gz"
source-checksum = "sha256:e25c9ab72d811142b7f41ff6da5165fec2d1be5feec3ef2c66bc0bdecb431489"
stacks = ["*"]
strip-components = 1
uri = "https://go.dev/dl/go1.19.11.linux-amd64.tar.gz"
version = "1.19.11"

[[metadata.dependencies]]
checksum = "sha256:48e4fcfb6abfdaa01aaf1429e43bdd49cea5e4687bd5f5b96df1e193fcfd3e7e"
cpe = "cpe:2.3:a:golang:go:1.19.12:*:*:*:*:*:*:*"
id = "go"
licenses = ["BSD-3-Clause"]
name = "Go"
purl = "pkg:generic/[email protected]?checksum=48e4fcfb6abfdaa01aaf1429e43bdd49cea5e4687bd5f5b96df1e193fcfd3e7e&download_url=https://go.dev/dl/go1.19.12.linux-amd64.tar.gz"
source = "https://go.dev/dl/go1.19.12.src.tar.gz"
source-checksum = "sha256:ee5d50e0a7fd74ba1b137cb879609aaaef9880bf72b5d1742100e38ae72bb557"
stacks = ["*"]
strip-components = 1
uri = "https://go.dev/dl/go1.19.12.linux-amd64.tar.gz"
version = "1.19.12"
go = "1.20.*"

[[metadata.dependencies]]
checksum = "sha256:b945ae2bb5db01a0fb4786afde64e6fbab50b67f6fa0eb6cfa4924f16a7ff1eb"
Expand Down Expand Up @@ -74,13 +46,27 @@ api = "0.7"
uri = "https://go.dev/dl/go1.20.7.linux-amd64.tar.gz"
version = "1.20.7"

[[metadata.dependencies]]
checksum = "sha256:d0398903a16ba2232b389fb31032ddf57cac34efda306a0eebac34f0965a0742"
cpe = "cpe:2.3:a:golang:go:1.21.0:*:*:*:*:*:*:*"
id = "go"
licenses = ["BSD-3-Clause"]
name = "Go"
purl = "pkg:generic/[email protected]?checksum=d0398903a16ba2232b389fb31032ddf57cac34efda306a0eebac34f0965a0742&download_url=https://go.dev/dl/go1.21.0.linux-amd64.tar.gz"
source = "https://go.dev/dl/go1.21.0.src.tar.gz"
source-checksum = "sha256:818d46ede85682dd551ad378ef37a4d247006f12ec59b5b755601d2ce114369a"
stacks = ["*"]
strip-components = 1
uri = "https://go.dev/dl/go1.21.0.linux-amd64.tar.gz"
version = "1.21.0"

[[metadata.dependency-constraints]]
constraint = "1.19.*"
constraint = "1.20.*"
id = "go"
patches = 2

[[metadata.dependency-constraints]]
constraint = "1.20.*"
constraint = "1.21.*"
id = "go"
patches = 2

Expand Down
6 changes: 3 additions & 3 deletions integration/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("go1.19")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("go1.20")).OnPort(8080))

Expect(logs).To(ContainLines(
MatchRegexp(fmt.Sprintf(`%s \d+\.\d+\.\d+`, buildpackInfo.Buildpack.Name)),
" Resolving Go version",
" Candidate version sources (in priority order):",
" <unknown> -> \"\"",
"",
MatchRegexp(` Selected Go version \(using <unknown>\): 1\.19\.\d+`),
MatchRegexp(` Selected Go version \(using <unknown>\): 1\.20\.\d+`),
"",
" Executing build process",
MatchRegexp(` Installing Go 1\.19\.\d+`),
MatchRegexp(` Installing Go 1\.20\.\d+`),
MatchRegexp(` Completed in ([0-9]*(\.[0-9]*)?[a-z]+)+`),
"",
fmt.Sprintf(" Generating SBOM for /layers/%s/go", strings.ReplaceAll(buildpackInfo.Buildpack.ID, "/", "_")),
Expand Down
10 changes: 5 additions & 5 deletions integration/environment_variable_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func testEnvironmentVariableConfiguration(t *testing.T, context spec.G, it spec.
image, logs, err = pack.WithNoColor().Build.
WithPullPolicy("never").
WithBuildpacks(buildpack, buildPlanBuildpack).
WithEnv(map[string]string{"BP_GO_VERSION": "1.20.*"}).
WithEnv(map[string]string{"BP_GO_VERSION": "1.21.*"}).
Execute(name, source)
Expect(err).ToNot(HaveOccurred(), logs.String)

Expand All @@ -77,19 +77,19 @@ func testEnvironmentVariableConfiguration(t *testing.T, context spec.G, it spec.
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("go1.20")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))

Expect(logs).To(ContainLines(
MatchRegexp(fmt.Sprintf(`%s \d+\.\d+\.\d+`, buildpackInfo.Buildpack.Name)),
" Resolving Go version",
" Candidate version sources (in priority order):",
" BP_GO_VERSION -> \"1.20.*\"",
" BP_GO_VERSION -> \"1.21.*\"",
" <unknown> -> \"\"",
"",
MatchRegexp(` Selected Go version \(using BP_GO_VERSION\): 1\.20\.\d+`),
MatchRegexp(` Selected Go version \(using BP_GO_VERSION\): 1\.21\.\d+`),
"",
" Executing build process",
MatchRegexp(` Installing Go 1\.20\.\d+`),
MatchRegexp(` Installing Go 1\.21\.\d+`),
MatchRegexp(` Completed in ([0-9]*(\.[0-9]*)?[a-z]+)+`),
))
})
Expand Down
14 changes: 7 additions & 7 deletions integration/layer_reuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ func testLayerReuse(t *testing.T, context spec.G, it spec.S) {
" Candidate version sources (in priority order):",
" <unknown> -> \"\"",
"",
MatchRegexp(` Selected Go version \(using <unknown>\): 1\.19\.\d+`),
MatchRegexp(` Selected Go version \(using <unknown>\): 1\.20\.\d+`),
"",
" Executing build process",
MatchRegexp(` Installing Go 1\.19\.\d+`),
MatchRegexp(` Installing Go 1\.20\.\d+`),
MatchRegexp(` Completed in \d+(\.?\d+)*`),
))

Expand Down Expand Up @@ -121,7 +121,7 @@ func testLayerReuse(t *testing.T, context spec.G, it spec.S) {
" Candidate version sources (in priority order):",
" <unknown> -> \"\"",
"",
MatchRegexp(` Selected Go version \(using <unknown>\): 1\.19\.\d+`),
MatchRegexp(` Selected Go version \(using <unknown>\): 1\.20\.\d+`),
"",
fmt.Sprintf(" Reusing cached layer /layers/%s/go", strings.ReplaceAll(buildpackInfo.Buildpack.ID, "/", "_")),
))
Expand All @@ -136,7 +136,7 @@ func testLayerReuse(t *testing.T, context spec.G, it spec.S) {

containerIDs[secondContainer.ID] = struct{}{}

Eventually(secondContainer).Should(Serve(ContainSubstring("go1.19")).OnPort(8080))
Eventually(secondContainer).Should(Serve(ContainSubstring("go1.20")).OnPort(8080))

Expect(secondImage.Buildpacks[0].Layers["go"].SHA).To(Equal(firstImage.Buildpacks[0].Layers["go"].SHA))
})
Expand Down Expand Up @@ -166,7 +166,7 @@ func testLayerReuse(t *testing.T, context spec.G, it spec.S) {
firstImage, _, err := pack.WithNoColor().Build.
WithPullPolicy("never").
WithBuildpacks(buildpack, buildPlanBuildpack).
WithEnv(map[string]string{"BP_GO_VERSION": "1.19.*"}).
WithEnv(map[string]string{"BP_GO_VERSION": "1.20.*"}).
Execute(name, source)
Expect(err).NotTo(HaveOccurred())

Expand All @@ -192,7 +192,7 @@ func testLayerReuse(t *testing.T, context spec.G, it spec.S) {
secondImage, _, err := pack.WithNoColor().Build.
WithPullPolicy("never").
WithBuildpacks(buildpack, buildPlanBuildpack).
WithEnv(map[string]string{"BP_GO_VERSION": "1.20.*"}).
WithEnv(map[string]string{"BP_GO_VERSION": "1.21.*"}).
Execute(name, source)
Expect(err).NotTo(HaveOccurred())

Expand All @@ -212,7 +212,7 @@ func testLayerReuse(t *testing.T, context spec.G, it spec.S) {

containerIDs[secondContainer.ID] = struct{}{}

Eventually(secondContainer).Should(Serve(ContainSubstring("go1.20")).OnPort(8080))
Eventually(secondContainer).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))

Expect(secondImage.Buildpacks[0].Layers["go"].SHA).NotTo(Equal(firstImage.Buildpacks[0].Layers["go"].SHA))
})
Expand Down
2 changes: 1 addition & 1 deletion integration/offline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func testOffline(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("go1.19")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("go1.20")).OnPort(8080))
})
})
}