如何以特定用户身份运行 TeamCity 构建 [英] How do I run a TeamCity build as a specific user

查看:28
本文介绍了如何以特定用户身份运行 TeamCity 构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个构建配置,可以将我的代码部署到一台机器上.根据我要部署到的机器(例如 dev/uat/prod),我需要以不同的用户身份运行.

I have a build configuration which deploys my code to a machine. Depending on which machine I am deploying to (e.g. dev/uat/prod), I need to run as a different user.

与其在构建文件中硬编码用户名和密码(实际上不太可能,因为出于安全原因它们会定期更改),我希望能够在运行构建时输入它们.我认为 TeamCity 中的运行自定义构建"会有这个选项,但我看不到任何地方可以输入该信息.

Rather than hardcoding the username and password in the build files (not really possible as they change regularly for security reasons) I would like to be able to type them in at the point I run the build. I would envisage the "Run Custom Build" in TeamCity would have this option but I can't see anywhere to input that information.

有没有办法做到这一点(除了远程访问构建代理并更改构建代理运行的用户)?

Is there any way to do this (short of remoting into the build agent and changing the user which the build agent runs as)?

谢谢

推荐答案

RunAs 插件组合使用 TeamCity 7 的新类型参数 可以让您将密码设为类型"参数插件.

The RunAs plugin combined with TeamCity 7's new Typed Parameters will let you make the password a "typed" parameter plugin.

然后,当它在运行屏幕上输入时,它将不会在构建历史中可见.

Then, when it's entered at the Run screen, it will not be visible in the build history.

很久以后,如评论中所述:您可能不想这样做.考虑拥有以不同用户身份运行的单独池,以及用于指定哪些池支持哪些构建的参数.

Much later, as covered in the comments: You probably don't want to do this. Consider having separate pools which run as different users, and parameters to specify what builds are supported by what pools.

这篇关于如何以特定用户身份运行 TeamCity 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆