Which command starts a build with an environment variable KEY=VALUE?

Prepare for the Red Hat OpenShift Developer II DO288 Exam with our quizzes. Study with flashcards and multiple choice questions, each with hints and explanations. Get ready for your certification!

Multiple Choice

Which command starts a build with an environment variable KEY=VALUE?

Explanation:
Injecting the variable at build start so it’s visible to the build steps is done with the start-build command and the --env flag. Using oc start-build <buildconfig_name> --env=<key>=<value> launches a new build for that BuildConfig and sets KEY to VALUE inside the build container as it runs. This is the exact way to pass a one-time variable into that specific build. Modifying the BuildConfig with a command like oc set env would affect the default environment for all future builds, not start a single build with a one-off variable. Patching a DeploymentConfig or linking a secret doesn’t start a build or inject build-time environment variables.

Injecting the variable at build start so it’s visible to the build steps is done with the start-build command and the --env flag. Using oc start-build --env== launches a new build for that BuildConfig and sets KEY to VALUE inside the build container as it runs. This is the exact way to pass a one-time variable into that specific build.

Modifying the BuildConfig with a command like oc set env would affect the default environment for all future builds, not start a single build with a one-off variable. Patching a DeploymentConfig or linking a secret doesn’t start a build or inject build-time environment variables.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy