Modifying Saved Artifacts On a Particular Jenkins Build for Deployment
We have a .NET Jenkins installation that builds a few .NET apps. These apps include a bunch of *.exe
and *.exe.config
files. Right now, I save the app as a zipfile containi开发者_开发知识库ng all of the *.exe, the required DLLs and *.xml
files, and the default *.exe.config
files. The default *.exe.config
get their value from what is in the Subversion repository and is tuned for the production environment.
The *.exe.config
files contain the database name, the database server, the name of the server, etc. These are correct for the production environment, but not for UAT, QA, or developer testing.
What I'd like to do is have some sort of post-build task where a user can specify the particular build, and the values for those particular parameters that vary from environment to environment. If I got that, I could run an Nant or Ant task that unzips the zipfile, munges the *.exe.config
file and either deploy it (my ultimate goal), or at least zip that up and put it somewhere the user can access it.
I know there's a parameterized build, and I know there are batch tasks, but I need a combination of the two. Is that possible?
It's not as elegant, but I think you can implement what you want as a separate build. You need:
- A Parameterized Build (which you know about)
- A way to access artifacts from another build
Given these pieces, you should be able to create a Parameterized Build that does exactly what you describe: grabs the build artifact, munges the configuration and provides it somewhere for the user. Of course the devil is in the details, e.g. it may be tricky to make it easy for a user to "select the right build".
Update (now that I've learned about Batch Tasks - thanks!): I don't see a way to parameterize the batch task like you asked. I'm guessing that the combination of variables make it prohibitive to define a bunch of different batch tasks. You could define a couple of batch tasks for common release and testing configurations and also provide the "munger" program for more user-specific configuration.
精彩评论