Jenkins中的预配置环境变量 [英] Pre-configured Environment Variable in Jenkins
问题描述
我正在通过docker映像运行Jenkins.
I am running Jenkins though the docker image.
我希望我的Jenkins安装程序提供一些预先配置的环境变量.
I want my Jenkins Installation to come up with few pre configured enviroment variables.
有什么方法可以复制一些环境变量,以便在启动詹金斯时,这些变量应该与这些预先配置的环境变量一起提供?
Is there any way I can copy some of my environment variables, so that when I bring my jenkins up, it should come with these pre-configured environment variables ?
TIA.
推荐答案
A list of available environment variables is available here: https://hub.docker.com/_/jenkins/
更新
如果要添加自己的环境变量,则需要构建自己的jenkins映像.您可以通过扩展现有图像或修改jenkins在 GitHub 上提供的官方docker构建项目来实现.
If you want to add your own environment variables you need to build your own jenkins image. You can do this by extending an existing image or modify the official docker build project provided by jenkins on GitHub.
Docker在此处上有一个很好的教程,介绍如何构建图像.
Docker has a nice tutorial on how to build images here.
在这种特定情况下,您需要修改docker入口点文件以在需要的地方检索和替换环境变量.对于jenkins,泊坞窗入口点文件位于/usr/local/bin/jenkins.sh
.
In this specific case you need to modify the docker entrypoint file to retrieve and replace the environment variables where needed. For jenkins, the docker entrypoint file is located in /usr/local/bin/jenkins.sh
.
这篇关于Jenkins中的预配置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!