Skip to content

Commit

Permalink
Upgrade lifecycle, buildpack api and libcnb to latest version (#32)
Browse files Browse the repository at this point in the history
- Upgrade lifecycle from 0.11.1 to 0.13.2
- Upgrade buildpack api from 0.2 to 0.7
- Upgrade libcnb from v1.15.2 to v1.25.4

Signed-off-by: Benjamin Huo <benjamin@kubesphere.io>
  • Loading branch information
benjaminhuo committed Jan 21, 2022
1 parent 4bd5a48 commit fdc6aba
Show file tree
Hide file tree
Showing 88 changed files with 143 additions and 104 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ maven_install(
go_repository(
name = "com_github_buildpacks_libcnb",
importpath = "github.com/buildpacks/libcnb",
sum = "h1:f1b2LGqc0PXBSMHJyGFDepDn13YtiiXx2/JewQp9HWw=",
version = "v1.15.2",
sum = "h1:qI+dbgLFgaGcafNFDlZC/JGpSHI2Jfx99TiVQPQedgo=",
version = "v1.25.4",
)

go_repository(
Expand Down
2 changes: 1 addition & 1 deletion builders/base/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -472,4 +472,4 @@ description = "Ubuntu 18 base image with buildpacks for .NET, Go, Java, Node.js,
run-image = "gcr.io/buildpacks/gcp/run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/base/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/go115/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ description = "Ubuntu 18 base image with buildpacks for .NET, Go, Java, Node.js,
run-image = "openfunctiondev/buildpacks-go115-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/go115/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/go116/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ builder(
"//cmd/go/of_functions_framework:of_functions_framework.tgz",
],
},
image = "openfunction/builder-go",
image = "openfunction/builder-go:v2",
visibility = [
"//builders/go116/acceptance:__pkg__",
],
Expand Down
4 changes: 2 additions & 2 deletions builders/go116/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ bazel run //builders/go116/stack:build
This command creates two images:

```shell
openfunctiondev/buildpacks-run-go:v1
openfunctiondev/buildpacks-go116-build:v1
openfunctiondev/buildpacks-run-go:v2
openfunctiondev/buildpacks-go116-build:v2
```

## Build go116 builder
Expand Down
6 changes: 3 additions & 3 deletions builders/go116/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ description = "Ubuntu 18 base image with buildpacks for .NET, Go, Java, Node.js,
# Currently built with //builders/go116/stack/stack:build.
[stack]
id = "openfunction.go116"
build-image = "openfunctiondev/buildpacks-go116-build:v1"
run-image = "openfunctiondev/buildpacks-run-go:v1"
build-image = "openfunctiondev/buildpacks-go116-build:v2"
run-image = "openfunctiondev/buildpacks-run-go:v2"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
3 changes: 2 additions & 1 deletion builders/go116/stack/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ sh_binary(
data = [
"build.Dockerfile",
"parent.Dockerfile",
"run.parent.Dockerfile",
"run.busybox.Dockerfile",
"run.distroless.Dockerfile",
"run.Dockerfile",
"//licenses:licenses.tar",
],
Expand Down
4 changes: 2 additions & 2 deletions builders/go116/stack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set -euo pipefail
DIR="$(dirname "$1")"
LICENSES="$2"

TAG="v1"
TAG="v2"

# Extract licenses.tar because it is symlinked, which Docker does not support.
readonly TEMP="$(mktemp -d)"
Expand All @@ -44,7 +44,7 @@ tar xf "$LICENSES" -C "$TEMP/licenses"
echo "> Building base go116common image"
docker build -t "go116common" - < "${DIR}/parent.Dockerfile"
echo "> Building base go116run image"
docker build -t "go116run" - < "${DIR}/run.parent.Dockerfile"
docker build -t "go116run" - < "${DIR}/run.busybox.Dockerfile"
echo "> Building openfunctiondev/buildpacks-run-go:$TAG"
docker build --build-arg "from_image=go116run" -t "openfunctiondev/buildpacks-run-go:$TAG" - < "${DIR}/run.Dockerfile"
echo "> Building openfunctiondev/buildpacks-go116-build:$TAG"
Expand Down
4 changes: 2 additions & 2 deletions builders/go116/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand All @@ -35,7 +35,7 @@ LABEL io.buildpacks.stack.id=${stack_id}
RUN groupadd cnb --gid ${cnb_gid} && \
useradd --uid ${cnb_uid} --gid ${cnb_gid} -m -s /bin/bash cnb

RUN curl --fail --show-error --silent --location --retry 3 https://golang.org/dl/go1.16.linux-amd64.tar.gz | tar xz --directory /usr/local/ --strip-components=1
RUN curl --fail --show-error --silent --location --retry 3 https://go.dev/dl/go1.16.13.linux-amd64.tar.gz | tar xz --directory /usr/local/ --strip-components=1

ENV CNB_USER_ID=${cnb_uid}
ENV CNB_GROUP_ID=${cnb_gid}
Expand Down
2 changes: 1 addition & 1 deletion builders/go116/stack/run.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ ARG from_image
FROM ${from_image}

ENV PORT 8080
USER nonroot
USER cnb
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion builders/java11/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ description = "Ubuntu 18 base image with buildpacks for Nodejs"
run-image = "openfunctiondev/buildpacks-java11-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/java11/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/node10/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ description = "Ubuntu 18 base image with buildpacks for Nodejs"
run-image = "openfunctiondev/buildpacks-node10-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/node10/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/node12/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ description = "Ubuntu 18 base image with buildpacks for Nodejs"
run-image = "openfunctiondev/buildpacks-node12-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/node12/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/node14/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ description = "Ubuntu 18 base image with buildpacks for Nodejs"
run-image = "openfunctiondev/buildpacks-node14-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/node14/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/node16/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ description = "Ubuntu 18 base image with buildpacks for Nodejs"
run-image = "openfunctiondev/buildpacks-node16-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/node16/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/py37/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ description = "Ubuntu 18 base image with buildpacks for Python"
run-image = "openfunctiondev/buildpacks-py37-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/py37/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/py38/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ description = "Ubuntu 18 base image with buildpacks for Python"
run-image = "openfunctiondev/buildpacks-py38-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/py38/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/py39/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ description = "Ubuntu 18 base image with buildpacks for Python"
run-image = "openfunctiondev/buildpacks-py39-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/py39/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion builders/ruby26/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ description = "Builder for the GCF Ruby 2.6 runtime"
run-image = "openfunctiondev/buildpacks-ruby26-run:v1"

[lifecycle]
version = "0.11.1"
version = "0.13.2"
2 changes: 1 addition & 1 deletion builders/ruby26/stack/parent.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
FROM openfunctiondev/ubuntu_18_0_4

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/entrypoint/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.config.entrypoint"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cpp/clear_source/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.cpp.clear_source"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cpp/functions_framework/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.cpp.functions-framework"
Expand Down
2 changes: 1 addition & 1 deletion cmd/dotnet/appengine/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.dotnet.appengine"
Expand Down
2 changes: 1 addition & 1 deletion cmd/dotnet/appengine_main/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.dotnet.appengine_main"
Expand Down
2 changes: 1 addition & 1 deletion cmd/dotnet/functions_framework/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.dotnet.functions-framework"
Expand Down
2 changes: 1 addition & 1 deletion cmd/dotnet/publish/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.dotnet.publish"
Expand Down
2 changes: 1 addition & 1 deletion cmd/dotnet/runtime/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.dotnet.runtime"
Expand Down
4 changes: 2 additions & 2 deletions cmd/dotnet/runtime/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ func buildFn(ctx *gcp.Context) error {
ctx.SetMetadata(sdkl, versionKey, version)
ctx.SetMetadata(rtl, versionKey, version)
rtl.SharedEnvironment.Default("DOTNET_ROOT", rtl.Path)
rtl.SharedEnvironment.PrependPath("PATH", rtl.Path)
rtl.SharedEnvironment.Default("PATH", rtl.Path)
rtl.LaunchEnvironment.Default("DOTNET_RUNNING_IN_CONTAINER", "true")

ctx.AddBuildpackPlanEntry(libcnb.BuildpackPlanEntry{
ctx.AddBOMEntry(libcnb.BOMEntry{
Name: runtimeLayer,
Metadata: map[string]interface{}{"version": version},
})
Expand Down
4 changes: 2 additions & 2 deletions cmd/go/build/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.go.build"
Expand All @@ -12,4 +12,4 @@ id = "google"
id = "openfunction.go115"

[[stacks]]
id = "openfunction.go116"
id = "openfunction.go116"
6 changes: 4 additions & 2 deletions cmd/go/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func buildFn(ctx *gcp.Context) error {
// Create a layer for the compiled binary. Add it to PATH in case
// users wish to invoke the binary manually.
bl := ctx.Layer("bin", gcp.LaunchLayer)
bl.LaunchEnvironment.PrependPath("PATH", bl.Path)
bl.LaunchEnvironment.Default("PATH", bl.Path)
outBin := filepath.Join(bl.Path, golang.OutBin)

buildable, err := goBuildable(ctx)
Expand All @@ -74,10 +74,12 @@ func buildFn(ctx *gcp.Context) error {
}
golang.ExecWithGoproxyFallback(ctx, bld, gcp.WithEnv("GOCACHE="+cl.Path, "CGO_ENABLED=0"), gcp.WithWorkDir(workdir), gcp.WithMessageProducer(printTipsAndKeepStderrTail(ctx)), gcp.WithUserAttribution)

// Set the default process type
ctx.SetMetadata(bl, "buildpack-default-process-type", "web")
// Configure the entrypoint for production. Use the full path to save `skaffold debug`
// from fetching the remote container image (tens to hundreds of megabytes), which is slow.
if !devmode.Enabled(ctx) {
ctx.AddWebProcess([]string{outBin})
ctx.AddDefaultWebProcess([]string{outBin}, true)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/go/clear_source/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.go.clear_source"
Expand All @@ -12,4 +12,4 @@ id = "google"
id = "openfunction.go115"

[[stacks]]
id = "openfunction.go116"
id = "openfunction.go116"
2 changes: 1 addition & 1 deletion cmd/go/functions_framework/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "google.go.functions-framework"
Expand Down
4 changes: 2 additions & 2 deletions cmd/go/of_functions_framework/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "openfunction.go.of-functions-framework"
Expand All @@ -12,4 +12,4 @@ id = "google"
id = "openfunction.go115"

[[stacks]]
id = "openfunction.go116"
id = "openfunction.go116"
Loading

0 comments on commit fdc6aba

Please sign in to comment.