From c2d4725211041ed1d30aa885272385f128d194db Mon Sep 17 00:00:00 2001 From: Matthias Diester Date: Thu, 29 Feb 2024 16:26:44 +0100 Subject: [PATCH] Fix Heruko buildpacks samples Ref: https://github.com/heroku/procfile-cnb/issues/214 Ref: https://github.com/heroku/libcnb.rs/commit/033f6128c647b7bc6effc8b80fae8b96a4373169 Add `CNB_TARGET_OS` and `CNB_TARGET_ARCH` to fix error during the detect phase, where the target system cannot be detected: ``` [Error: Internal Buildpack Error] Couldn't determine target os: environment variable not found err: heroku/procfile@3.0.0 (1) ======== Output: heroku/procfile@3.0.0 ======== ``` There seems to be a changed behavior that was introduced in the common buildpacks library that is in use that expects these environment variables to be present to detect the target system OS and architecture. Signed-off-by: Matthias Diester --- .../buildstrategy_buildpacks-v3-heroku_cr.yaml | 12 +++++++++++- ...dstrategy_buildpacks-v3-heroku_namespaced_cr.yaml | 10 ++++++++++ .../buildstrategy_buildpacks-v3-heroku_cr.yaml | 12 +++++++++++- ...dstrategy_buildpacks-v3-heroku_namespaced_cr.yaml | 10 ++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml b/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml index 61eca36ee..1a3214d67 100644 --- a/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml +++ b/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml @@ -8,6 +8,12 @@ spec: - name: platform-env emptyDir: {} parameters: + - name: operating-system + description: The target operating system for the buildpacks build. + default: "linux" + - name: system-architecture + description: The target system architecture for the buildpacks build. + default: "x86_64" - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. default: "0.7" @@ -15,6 +21,10 @@ spec: - name: build-and-push image: heroku/builder:22 env: + - name: CNB_TARGET_OS + value: $(params.operating-system) + - name: CNB_TARGET_ARCH + value: $(params.system-architecture) - name: CNB_PLATFORM_API value: $(params.platform-api-version) - name: PARAM_SOURCE_CONTEXT @@ -62,7 +72,7 @@ spec: mkdir -p "$CACHE_DIR" "$LAYERS_DIR" function announce_phase { - printf "===> %s\n" "$1" + printf "===> %s\n" "$1" } announce_phase "ANALYZING" diff --git a/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml b/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml index aa0134055..024361ad0 100644 --- a/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml +++ b/samples/v1alpha1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml @@ -8,6 +8,12 @@ spec: - name: platform-env emptyDir: {} parameters: + - name: operating-system + description: The target operating system for the buildpacks build. + default: "linux" + - name: system-architecture + description: The target system architecture for the buildpacks build. + default: "x86_64" - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. default: "0.7" @@ -15,6 +21,10 @@ spec: - name: build-and-push image: heroku/builder:22 env: + - name: CNB_TARGET_OS + value: $(params.operating-system) + - name: CNB_TARGET_ARCH + value: $(params.system-architecture) - name: CNB_PLATFORM_API value: $(params.platform-api-version) - name: PARAM_SOURCE_CONTEXT diff --git a/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml b/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml index 11494bb45..492bf4ca7 100644 --- a/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml +++ b/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_cr.yaml @@ -8,6 +8,12 @@ spec: - name: platform-env emptyDir: {} parameters: + - name: operating-system + description: The target operating system for the buildpacks build. + default: "linux" + - name: system-architecture + description: The target system architecture for the buildpacks build. + default: "x86_64" - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. default: "0.7" @@ -15,6 +21,10 @@ spec: - name: build-and-push image: heroku/builder:22 env: + - name: CNB_TARGET_OS + value: $(params.operating-system) + - name: CNB_TARGET_ARCH + value: $(params.system-architecture) - name: CNB_PLATFORM_API value: $(params.platform-api-version) - name: PARAM_SOURCE_CONTEXT @@ -62,7 +72,7 @@ spec: mkdir -p "$CACHE_DIR" "$LAYERS_DIR" function announce_phase { - printf "===> %s\n" "$1" + printf "===> %s\n" "$1" } announce_phase "ANALYZING" diff --git a/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml b/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml index c960cdd54..a7357f99a 100644 --- a/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml +++ b/samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_buildpacks-v3-heroku_namespaced_cr.yaml @@ -8,6 +8,12 @@ spec: - name: platform-env emptyDir: {} parameters: + - name: operating-system + description: The target operating system for the buildpacks build. + default: "linux" + - name: system-architecture + description: The target system architecture for the buildpacks build. + default: "x86_64" - name: platform-api-version description: The referenced version is the minimum version that all relevant buildpack implementations support. default: "0.7" @@ -15,6 +21,10 @@ spec: - name: build-and-push image: heroku/builder:22 env: + - name: CNB_TARGET_OS + value: $(params.operating-system) + - name: CNB_TARGET_ARCH + value: $(params.system-architecture) - name: CNB_PLATFORM_API value: $(params.platform-api-version) - name: PARAM_SOURCE_CONTEXT