简体   繁体   中英

Adding environment variables to already deployed application in OpenShift

I currently have a process in place to build and deploy our application to OpenShift utilizing the Jenkins OpenShift plugin via the commands below:

openshift.newBuild("--image-stream=${builderImageName}", "--binary=true", "-n ${projectName}", "--to=${applicationName}:${targetEnv}")
openshift.startBuild("${applicationName}", "--from-dir=.", "--wait=true", "-n ${projectName}")
openshift.newApp("-n ${projectName}", "--template=${templateName}", "--param-file=${appDeployConfigFileName}", "--env-file=${appEnvFileName}")

This works as intended. My question is once the app has been deployed how can I update the env variables if additional ones need to be added? I basically want to duplicate the functionality of going through the ui and adding env variables. However I would want to do this using the openshift plugin or oc tool and use a file of variables not just a set of key values.

您将需要为您的应用程序更新部署配置

oc set env dc/<your_app> MYVAR=foo -n <project_name>

If you're trying to store environment variables in SCM with a builder image (w/ S2I aka source-to-image enabled container image), use an environment file .s2i/environment .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM