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.
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)?
Thanks
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.
EDIT: 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.
Neil, you can pass build parameters via Run Custom Build dialog.
There are "System properties" and "Environment variables" sections, where you can add new build parameters or redefine existing ones.
Please read more: http://confluence.jetbrains.net/display/TCD6/Triggering+a+Custom+Build
Related
We are using Jenkins for a variety of jobs, including both building and testing, with different developers having access only to the jobs within their scope.
However, when we are allowing a Jenkins user to "Configure" the job, we are basically permitting them to run shell (via the "Execute shell" step) with the privileges of the user who is running the Jenkins binary. That, in turn, gives theoretical ability to change things on the server and access files they are not supposed to.
Question: How can we control that?
So basically, I am looking for a way to disable the ability of users to edit the existing shell fields of particular builds (or altogether).
As a workaround that I haven't personally tested, you can overwrite the sh executable used by Jenkins in the global settings, but then everyone won't be able to use "Execute Shell".
You could then have some programmers write plugins for actions that you DO allow.
The solution that we ended up implementing is a master-slave tandem, where the master node has the number of executors set to 0.
I would like a module to be run by all agents when a VCS trigger condition is met.
Is this possible?
One way you can do this is by adding a Schedule Trigger which has an option to run on all agents.
Having looked into it, as far as I can see, not directly,
the behaviour could potentially be achieved by using the command line remote runner plugin,(http://confluence.jetbrains.net/display/TW/Command+Line+Remote+Run+Tool) through a seperate build configuration linked to the VCS to detect the changes, calling the Remote Run tool from a command line build step to build the project on each required agent.
Further research into the Command Line Remote Run tool would be required to confirm this is possible.
There may also be some functionality allowing this in the REST API, although my look through the documentation didn't show anything up.
Have you had much luck working on alternative solutions?
I've created a build configuration to update our source managed third party referenced assemblies directory and this is a snapshot dependency on most if not all build configurations. When I update this directory with a new or more recent assembly, I'll too would like this configuration to be run on all build agents.
At the moment, I've simply duplicated the configuration and bound each to a specific agent. It adds management overhead, but has temporarily resolved the issue.
You could install this plugin and specify the list of agent names and it will run once per "value" in the matrix.
https://github.com/presidentio/teamcity-matrix-build-plugin
I have an environmental build system which currently has the following environments:
dev
ci
uat
live
Just to be clear when I say environmental build I mean there are a set of properties files for each environment and during the build these properties are used to template project files, so a database server may be "localhost" on dev environment but "12.34.56.78" on CI. So when starting the build you can give it an environment property and it will build for something other than dev (which is the default environment).
Now the CI build works fine and spits out the artifacts correctly, however as the build is CI all of it is configured to work on that environment, and I am looking at being able to trigger a build for live or uat when a CI build succeeds. This would then run the same build but with a different build argument.
Now I noticed there are a few mechanisms for this, one seems to be doing an automatic trigger on complete which could trigger another build, but this seems to require 2 separate build configurations which are essentially identical other than the build argument being "environment=live" rather than "environment=ci". Then there is adding another build step which would be the same as the first but take different argument and output the live artifacts elsewhere, but this would always happen much like the first option.
The final option I could see was to trigger a manual build once I have a live candidate, but it is unclear as to how to set a build argument, I could make a build parameter however it doesn't seem to get pulled into the build script like a command like build argument would.
I will see if there is a better answer, but after writing this I found that using Build Parameters seems the best option, this then can be embedded within your build configuration anywhere using the %environment% (or %your_parameter_here%).
This can then be setup to create a form element for manual builds so you can easily create a build for a different environments.
I have a custom application which requires a bunch of things to be set up before it is run. I want to add it as a build phase so I can use it when I do "Build and Run" but not when I do "Build". How do I check it in a shell script which is run as a build phase at the end?
Please don't ask why
Don't know if there is something special triggered for "Build" vs "Build and Run". You might want to check out a different build configuration. Projects come with a Debug and a Build configuration, maybe add a "Config&Build" that has some flags set. If the flag is set then do your setup stuff. Then it would be easy enough to switch configurations. I do something similar with my debug output and only turning them on in the debug configuration.
I don't even have a Mac, so this is purely my imagination. I assume, XCode allows you to specify which executable to run when "Build and Run" is used. If so, you can write a simple batch file, which will perform all the required setup and then run your main app. Point XCode to that file and you're fine.
In our development environment each developer has their own dev server. Often times they do not actually develop on that server but develop from their local machine, deploy to their dev server, and then attach with the remote debugger to do debugging.
My question is; how can I use MSBuild to execute a different set of tasks for each user?
I want to enable each user to define their own build process with MSBuild tasks but I don't want that to necessarily affect the other developers. I also want a default set of tasks to execute if a given user explicitly defined their own process.
Example:
SomeProj.csproj
Default MS Build process is to copy to test server or staging server
Custom process for Steve is to copy to Steve's dev server
Custom process for Eric is to copy to Eric's dev server
You could use the project user file (*.suo / *.user) to do some 'poor mans dependency injection'.
looks like this guy did something similar
Yeah, I've done this before. Try trick is to key off $(USERNAME) in your msbuild script. If you haven't tried editing msbuild scripts before, you've got a lot of learning to do.