在Linux下以用户身份运行Jenkins作业
我在Linux中安装了Jenkins,我想在用户下运行该构建.
I have Jenkins installed in Linux and I want to run the build(s) under a user.
不仅是一个简单的用户,而且是属于访问linux计算机的用户列表的一个用户,它属于某个组,因为它具有在特定文件夹下修改/创建文件的特权.
Not just a simple user, but one that belongs to the list of user that access the linux machine and that belongs to a certain group as it has privileges to modify/create files under a certain folder.
我在某处阅读过可以设置变量$ JENKINS_USER的地方,但我不知道在哪里以及如何去做. 谢谢您的宝贵时间
I have read somewhere that you can set the variable $JENKINS_USER but I do not know where and how. Thank you for your time
P.S.我做了一些研究,所有发布的问题都与此相似,但不相同
P.S. I did some research all the questions posted are similar but not the same as this one
如果我不清楚,请阅读以下内容: 通常,Jenkins使用一个名为jenkins的用户执行构建,现在我希望能够使用其他用户(已存在).
Please if I am not clear read this: Usually Jenkins execute the build using a user called jenkins, now I want to be able to use a different user (pre-existing).
看看Started-By Environment Variable插件.
Have a look at the Started-By Environment Variable plugin.
https://wiki.jenkins-ci .org/display/JENKINS/Started-By + Environment + Variable + Plugin
如果您只是问如何在Linux中将Jenkins设置为在其他用户下运行,则取决于您的安装方式.我从未在Linux上设置Jenkins(但我可以使用google).看看 https://wiki.jenkins-ci.org/display/JENKINS/Installing + Jenkins 提供不同的设置选项.我看过将Jenkins安装为Unix守护程序,在第7步中,您需要设置一个配置文件.更改该文件的最后一行(RUN_AS_USER=jenkins
)以包含您选择的用户.
If you are just asking how to set up Jenkins to run under a different user in Linux it depends on how you installed it. I never set up Jenkins on Linux yet (but I can use google). Have a look at https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins for different setup options. I had a look at Installing Jenkins as a Unix daemon and at step 7 you need to setup a configuration file. Change the last line in that file (RUN_AS_USER=jenkins
) to contain the user of your choice.