From 5f554ff3e7935b0d77989828adb6113d26e316d9 Mon Sep 17 00:00:00 2001 From: Sascha Schwarze Date: Mon, 19 Jun 2023 22:21:08 +0200 Subject: [PATCH] Update Buildpacks strategy --- .../build/build_buildpacks-v3-heroku_cr.yaml | 2 +- ...ld_buildpacks-v3-heroku_namespaced_cr.yaml | 2 +- ...buildstrategy_buildpacks-v3-heroku_cr.yaml | 22 +++++++++---------- ...gy_buildpacks-v3-heroku_namespaced_cr.yaml | 22 +++++++++---------- .../buildstrategy_buildpacks-v3_cr.yaml | 18 +++++++-------- ...dstrategy_buildpacks-v3_namespaced_cr.yaml | 18 +++++++-------- 6 files changed, 40 insertions(+), 44 deletions(-) diff --git a/samples/build/build_buildpacks-v3-heroku_cr.yaml b/samples/build/build_buildpacks-v3-heroku_cr.yaml index 7bd4d8248e..c666eca31e 100644 --- a/samples/build/build_buildpacks-v3-heroku_cr.yaml +++ b/samples/build/build_buildpacks-v3-heroku_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: source: url: https://github.com/shipwright-io/sample-nodejs - contextDir: source-build + contextDir: source-build-heroku strategy: name: buildpacks-v3-heroku kind: ClusterBuildStrategy diff --git a/samples/build/build_buildpacks-v3-heroku_namespaced_cr.yaml b/samples/build/build_buildpacks-v3-heroku_namespaced_cr.yaml index 62568ba333..b6278d6597 100644 --- a/samples/build/build_buildpacks-v3-heroku_namespaced_cr.yaml +++ b/samples/build/build_buildpacks-v3-heroku_namespaced_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: source: url: https://github.com/shipwright-io/sample-nodejs - contextDir: source-build + contextDir: source-build-heroku strategy: name: buildpacks-v3-heroku kind: BuildStrategy diff --git a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml index 35275da39d..61eca36ee8 100644 --- a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml +++ b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml @@ -10,13 +10,11 @@ spec: parameters: - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. - default: "0.4" + default: "0.7" buildSteps: - name: build-and-push - image: heroku/buildpacks:18 + image: heroku/builder:22 env: - - name: ALLOW_INSECURE_HEROKU_18_BUILDER - value: "1" - name: CNB_PLATFORM_API value: $(params.platform-api-version) - name: PARAM_SOURCE_CONTEXT @@ -58,23 +56,23 @@ spec: fi done - LAYERS_DIR=/tmp/layers - CACHE_DIR=/tmp/cache + LAYERS_DIR=/tmp/.shp/layers + CACHE_DIR=/tmp/.shp/cache - mkdir "$CACHE_DIR" "$LAYERS_DIR" + mkdir -p "$CACHE_DIR" "$LAYERS_DIR" function announce_phase { printf "===> %s\n" "$1" } + announce_phase "ANALYZING" + /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" "${PARAM_OUTPUT_IMAGE}" + announce_phase "DETECTING" /cnb/lifecycle/detector -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" - announce_phase "ANALYZING" - /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" -cache-dir="$CACHE_DIR" "${PARAM_OUTPUT_IMAGE}" - announce_phase "RESTORING" - /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" + /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" -layers="$LAYERS_DIR" announce_phase "BUILDING" /cnb/lifecycle/builder -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" @@ -86,7 +84,7 @@ spec: /cnb/lifecycle/exporter "${exporter_args[@]}" "${PARAM_OUTPUT_IMAGE}" # Store the image digest - grep digest /tmp/report.toml | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" + grep digest /tmp/report.toml | tail -n 1 | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" volumeMounts: - mountPath: /platform/env name: platform-env diff --git a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml index a5354abc5d..aa01340555 100644 --- a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml +++ b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml @@ -10,13 +10,11 @@ spec: parameters: - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. - default: "0.4" + default: "0.7" buildSteps: - name: build-and-push - image: heroku/buildpacks:18 + image: heroku/builder:22 env: - - name: ALLOW_INSECURE_HEROKU_18_BUILDER - value: "1" - name: CNB_PLATFORM_API value: $(params.platform-api-version) - name: PARAM_SOURCE_CONTEXT @@ -58,23 +56,23 @@ spec: fi done - LAYERS_DIR=/tmp/layers - CACHE_DIR=/tmp/cache + LAYERS_DIR=/tmp/.shp/layers + CACHE_DIR=/tmp/.shp/cache - mkdir "$CACHE_DIR" "$LAYERS_DIR" + mkdir -p "$CACHE_DIR" "$LAYERS_DIR" function announce_phase { printf "===> %s\n" "$1" } + announce_phase "ANALYZING" + /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" "${PARAM_OUTPUT_IMAGE}" + announce_phase "DETECTING" /cnb/lifecycle/detector -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" - announce_phase "ANALYZING" - /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" -cache-dir="$CACHE_DIR" "${PARAM_OUTPUT_IMAGE}" - announce_phase "RESTORING" - /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" + /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" -layers="$LAYERS_DIR" announce_phase "BUILDING" /cnb/lifecycle/builder -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" @@ -86,7 +84,7 @@ spec: /cnb/lifecycle/exporter "${exporter_args[@]}" "${PARAM_OUTPUT_IMAGE}" # Store the image digest - grep digest /tmp/report.toml | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" + grep digest /tmp/report.toml | tail -n 1 | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" volumeMounts: - mountPath: /platform/env name: platform-env diff --git a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_cr.yaml b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_cr.yaml index 310c33013b..f4c11a65f1 100644 --- a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_cr.yaml +++ b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_cr.yaml @@ -10,7 +10,7 @@ spec: parameters: - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. - default: "0.4" + default: "0.7" buildSteps: - name: build-and-push image: docker.io/paketobuildpacks/builder-jammy-full:latest @@ -56,23 +56,23 @@ spec: fi done - LAYERS_DIR=/tmp/layers - CACHE_DIR=/tmp/cache + LAYERS_DIR=/tmp/.shp/layers + CACHE_DIR=/tmp/.shp/cache - mkdir "$CACHE_DIR" "$LAYERS_DIR" + mkdir -p "$CACHE_DIR" "$LAYERS_DIR" function announce_phase { printf "===> %s\n" "$1" } + announce_phase "ANALYZING" + /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" "${PARAM_OUTPUT_IMAGE}" + announce_phase "DETECTING" /cnb/lifecycle/detector -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" - announce_phase "ANALYZING" - /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" -cache-dir="$CACHE_DIR" "${PARAM_OUTPUT_IMAGE}" - announce_phase "RESTORING" - /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" + /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" -layers="$LAYERS_DIR" announce_phase "BUILDING" /cnb/lifecycle/builder -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" @@ -84,7 +84,7 @@ spec: /cnb/lifecycle/exporter "${exporter_args[@]}" "${PARAM_OUTPUT_IMAGE}" # Store the image digest - grep digest /tmp/report.toml | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" + grep digest /tmp/report.toml | tail -n 1 | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" volumeMounts: - mountPath: /platform/env name: platform-env diff --git a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_namespaced_cr.yaml b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_namespaced_cr.yaml index 450d6647f2..32dcadc67c 100644 --- a/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_namespaced_cr.yaml +++ b/samples/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3_namespaced_cr.yaml @@ -10,7 +10,7 @@ spec: parameters: - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. - default: "0.4" + default: "0.7" buildSteps: - name: build-and-push image: docker.io/paketobuildpacks/builder-jammy-full:latest @@ -56,23 +56,23 @@ spec: fi done - LAYERS_DIR=/tmp/layers - CACHE_DIR=/tmp/cache + LAYERS_DIR=/tmp/.shp/layers + CACHE_DIR=/tmp/.shp/cache - mkdir "$CACHE_DIR" "$LAYERS_DIR" + mkdir -p "$CACHE_DIR" "$LAYERS_DIR" function announce_phase { printf "===> %s\n" "$1" } + announce_phase "ANALYZING" + /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" "${PARAM_OUTPUT_IMAGE}" + announce_phase "DETECTING" /cnb/lifecycle/detector -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" - announce_phase "ANALYZING" - /cnb/lifecycle/analyzer -layers="$LAYERS_DIR" -cache-dir="$CACHE_DIR" "${PARAM_OUTPUT_IMAGE}" - announce_phase "RESTORING" - /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" + /cnb/lifecycle/restorer -cache-dir="$CACHE_DIR" -layers="$LAYERS_DIR" announce_phase "BUILDING" /cnb/lifecycle/builder -app="${PARAM_SOURCE_CONTEXT}" -layers="$LAYERS_DIR" @@ -84,7 +84,7 @@ spec: /cnb/lifecycle/exporter "${exporter_args[@]}" "${PARAM_OUTPUT_IMAGE}" # Store the image digest - grep digest /tmp/report.toml | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" + grep digest /tmp/report.toml | tail -n 1 | tr -d ' \"\n' | sed s/digest=// > "$(results.shp-image-digest.path)" volumeMounts: - mountPath: /platform/env name: platform-env