-
Ticket
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
-
None
-
False
-
-
False
-
-
Description of problem:
OpenShift BuildConfig Docker and S2I strategies support setting environment variables on the runtime container resulting from the build. Currently the shipwright cluster build strategies installed by the operator do not support this functionality, although it would be relatively straight forward to add it, handling them similarly to the build-args on the buildah strategy.
--- buildah.yaml 2025-07-09 09:24:41.501870970 -0400
+++ custom-buildah.yml 2025-07-09 09:24:37.993606458 -0400
...
@@ -18,6 +11,11 @@
name: build-args
type: array
- defaults: []
+ description: The values for environment variables to be set in the image.
+ Values must be in the format KEY=VALUE.
+ name: env
+ type: array
+ - defaults: []
description: The registries that need to block pull access.
name: registries-block
type: array
@@ -59,6 +57,7 @@
image=
budArgs=()
inBuildArgs=false
+ inEnvArgs=false
registriesBlock=""
inRegistriesBlock=false
registriesInsecure=""
@@ -72,6 +71,7 @@
if [ "${arg}" == "--context" ]; then
inBuildArgs=false
+ inEnvArgs=false
inRegistriesBlock=false
inRegistriesInsecure=false
inRegistriesSearch=false
@@ -79,6 +79,7 @@
shift
elif [ "${arg}" == "--dockerfile" ]; then
inBuildArgs=false
+ inEnvArgs=false
inRegistriesBlock=false
inRegistriesInsecure=false
inRegistriesSearch=false
@@ -86,6 +87,7 @@
shift
elif [ "${arg}" == "--image" ]; then
inBuildArgs=false
+ inEnvArgs=false
inRegistriesBlock=false
inRegistriesInsecure=false
inRegistriesSearch=false
@@ -93,6 +95,7 @@
shift
elif [ "${arg}" == "--target" ]; then
inBuildArgs=false
+ inEnvArgs=false
inRegistriesBlock=false
inRegistriesInsecure=false
inRegistriesSearch=false
@@ -102,26 +105,38 @@
shift
elif [ "${arg}" == "--build-args" ]; then
inBuildArgs=true
+ inEnvArgs=false
+ inRegistriesBlock=false
+ inRegistriesInsecure=false
+ inRegistriesSearch=false
+ elif [ "${arg}" == "--env" ]; then
+ inEnvArgs=true
+ inBuildArgs=false
inRegistriesBlock=false
inRegistriesInsecure=false
inRegistriesSearch=false
elif [ "${arg}" == "--registries-block" ]; then
inRegistriesBlock=true
inBuildArgs=false
+ inEnvArgs=false
inRegistriesInsecure=false
inRegistriesSearch=false
elif [ "${arg}" == "--registries-insecure" ]; then
inRegistriesInsecure=true
inBuildArgs=false
+ inEnvArgs=false
inRegistriesBlock=false
inRegistriesSearch=false
elif [ "${arg}" == "--registries-search" ]; then
inRegistriesSearch=true
inBuildArgs=false
+ inEnvArgs=false
inRegistriesBlock=false
inRegistriesInsecure=false
elif [ "${inBuildArgs}" == "true" ]; then
budArgs+=("--build-arg" "${arg}")
+ elif [ "${inEnvArgs}" == "true" ]; then
+ budArgs+=("--env" "${arg}")
elif [ "${inRegistriesBlock}" == "true" ]; then
registriesBlock="${registriesBlock}'${arg}', "
elif [ "${inRegistriesInsecure}" == "true" ]; then
@@ -204,6 +219,8 @@
- $(params.shp-output-image)
- --build-args
- $(params.build-args[*])
+ - --env
+ - $(params.env[*])
- --registries-block
- $(params.registries-block[*])
- --registries-insecure