TeamCity copying artifacts from one agent to another - teamcity

I'm extremely new to TeamCity and need to copy files from one TeamCity agent to another. I'm basically looking for some conceptual direction so I can start researching on how to accomplish the following:
Currently have a TeamCity Agent which builds program and creates corresponding artifacts. I need to copy these artifacts to another TeamCity Agent machine.
I'm getting acquainted with the build steps, we are using a commandline build runner. So I'll need to setup the build step for copying files via commandline--any hints on how to get started is greatly appreciated.
I apologize for any conceptual or term errors. I guess this is why I'm posting this question.

Kme,
In case you want to re-use the results of one build in another (e.g., run tests using results of compilation), you should take a look at two things:
Publish your build artifacts to server (more details here)
Download an artifact from server before build starts (more details here)
This will allow TeamCity to ensure that artifacts arrive at correct agent at correct moment of time. Also TeamCity will track usages of such artifacts.

Related

Azure Artifacts - Downloading Maven package content throws azure UnhandledPromiserejectionWarning

One of our development teams have recently migrated their Maven project files from another version control system to Azure DevOps. However, a major caveat is that these Maven projects were created with no POM files (I have no idea why).
The project team have in any case managed to move all of their Maven packages into Azure Artifacts. When a release pipeline job is then run, it is then expected to retrieve the desired artifacts (*.war files) from Azure Artifacts, download to the agent's artifacts directory and subsequently deploy to the target server. The pipeline itself is completed successfully (all tasks set to green status), however when we review the output log, we discover that the artifacts were never downloaded and instead, the download task returns an "UnhandledPromiserejectionWarning". Any idea why this is happening?
So far, we've tried using CURL as an alternative to download the artifacts, but all has been in vain. Naturally, we've also tried and failed with the Azure Artifacts' dedicated "Download Package" pipeline task, but are willing to try an alternative solution, if anyone has some kind suggestions. Been wondering something like Powershell (or other script) can for instance be used to download the desired package files.
I must also mention that the CURL option only appears to fail over a failed OAuth authentication. Any advice on that front will also be helpful, as it is probably our quickest route to a workaround.
I had a similar issue, it turns out the problem was just the capital case.
The DownloadPackage task was trying to download 0.0.30-SNAPSHOT, but instead you can only download the package as 0.0.30-snapshot, as it states on the microsoft official docs.
In order to fix it, I had to install an external plugin, then add an additional task before download, that task was converting the name to lower case.
I was using the classical release pipeline, btw.

What exactly are teamcity artifacts?

A noob question, but googling and stack overflow search didn't seem to yield an answer.
Can someone explain what exactly are teamcity artifacts?
From the documentation
"Typically these include distribution packages, WAR files, reports,
log files, etc. When creating a build configuration, you specify artifacts
of your build at the General Settings page.
It doesn't really explain to me what an artifact is. A .Net oriented answer will be very helpful. I have a couple of builds already working on teamcity, but I'm not sure what exactly I would need an artifact for ?
thank you
Artifacts are the files you want the TeamCity server to store so that they can be downloaded after the build has finished. They will be downloadable from the TeamCity dashboard from each build.
For a .NET project you might choose the store the output of the compiler (i.e. .exe and .dll files), and the log files from running unit tests. You might just have a Windows Installer package (i.e. .msi).
It is completely up to you what gets stored for your specific needs. Just note that build artifacts do take up disk space on the TeamCity server, so if yours are large you'll want to configure the Build History Clean-up rules.

tagging built artifacts in Bamboo CI server

We are using bamboo as our integration server. During each build it produces binary packs of our products. Some of the built artifacts then goes in to QA.
Is there a way to retain build artifacts of a certain build job number, irrespective of the global build expire configuration. For an example, at some point we identify one of the built artifacts as release candidate.
The QA should be able to download that specific pack even after one weeks time. Right now we are copying the build artifacts from CI server to some other machine. It is a script, but still it is a manual process.
In Hudson there is an option called 'keep this build forever'.
Depending on your version this is possible by applying a label to it. Under a plan's configuration on the "Miscellaneous" tab, you can set a label which can then be used to prevent a build from expiring.
For example, our system has builds that can get labelled "SaveBuild" which then prevents their expiry.

TeamCity - non-trivial build sequence, please advice

I am tasked to improve quality and implement TeamCity for continuous integration. My experience with TeamCity is very limited - I use mostly TFS myself and have some experience with CC.NET.
A lot should happen within a build process... actually the build is already pushed into three different configurations that will run one after the next.
My main problem is that in each of those I actually would need to start multiple runners. For example, the first build step shall consist of:
The generation of new AssemblyInfo.cs files for consistent in assembly numbering
The actual compilation
A partial unit test run (all tests that run fast and check core functionality)
An FxCop run
A StyleCop run
The current version of TeamCity only allows to configure one runner ... which leaves me stuck with a lot of things.
How you would approach this? My current idea is going towards using the MsBuild runner for everything and basically start my own MsBuild based script which then does all the things, pretty much the way that TFS handles it (and the same way i did things back in the cc.net way with my own Nant build script).
On a further problem the question is how to present statistical information, for example from unit tests running in different stages (build configurations). We have some further down that take some time to run and want that to run in a 2nd or 3rd step (the latest for example testing database generation code which, including loading base data, takes about 15+ minutes to run). OTOH we would really like test results to be somehow consolidated.
Anyone any ideas?
Thanks.
TeamCity 6.0 allows multiple build steps for a single build configuration. Isn't it what you're looking for?
You'll need to script this out, at least parts of it. TeamCity provides some nice UI based config for some of your needs, but not all. Here's my suggestion:
Create an msbuild script to handle your first two bullet points, AssemblyInfo generation and compilation. Configure the msbuild runner to run your script, and to run your tests. Collect your assemblies as artifacts.
Create a second build configuration for FxCop. Trigger it from the first build. Give it an 'artifact dependency' on the first build, which is how it gets a hold of your dlls.
For StyleCop, TC doesn't support it out of the box like it does FxCop. Add it to your msbuild script manually, and have it produce an html report (which TeamCity can then display).
You need to take a look at the Dependencies functionality in the TeamCity. This feature allows you to create a sequence of build configurations. In other words, you need to create a build configuration for each step and then link all them as dependencies.
For consolidating test results please take a loot at the Artifact Dependencies. It might help.

TeamCity users: a few questions

These questions are for TeamCity users only
1) Is it possible to configure TeamCity to extract build artifact information based on your own your regular expressions? This is exactly what Pulse does here
2) Does TeamCity integrate with any task/bug tracking tool? like JIRA?
3) This question is for people who run static code analyzer only. A tool like PC-Lint/Visual Lint can generate XML reports. Can TeamCity be configured to parse these artifacts and generate a build failure?
4) I'm currently evaluating TeamCity right now...there community forum doesnt seem to be very active. For those who pay for support, how is Jetbrains support? Is it good? Atlassian seems to be much better.
TeamCity allows to get build artifacts with a Ant-based pattern. You can specify multiple patterns and set target directory for each pattern. Read more at http://www.jetbrains.net/confluence/display/TCD4/Build+Artifact
There is an integration which allows to link RF-3432 to the Jira issue. More advanced integration may appear in the next release of TC. Read more at http://www.jetbrains.net/confluence/display/TCD4/Mapping+External+Links+in+Comments
Only with custom plugin. Or your build process can send a specific "echo" message which will change build status and description.
OK, I'm JetBrainer. May be we don't response immediately, but we strive to answer forum questions ASAP. Paid customers also have e-mail support.
Hope this helps,
KIR
Disclaimer: I don't work for JetBrains! But I've worked with Pulse and TeamCity in my current job.
Build Artifacts: Yes, TeamCity will export artifacts that remain after a build. You can add define ant-style wildcard patterns to match files (the default pattern matches any files left in the root build directory). These files can be seen from the project view against each individual build.
You can use special service commands in a build script to immediately export artifacts along the way too, I do this for a code complexity tool that generates xml files, for which I've also defined a custom graph.
Bug Tracking: I don't have experience with this, but KIR pointed out some alternatives.
XML Parsing: You can control this with ant. I included a third-party tool called andariel in my build that can run XPaths across xml documents, then used service messages to export the result (in this case a count of methods exceeding a complexity limit) to be displayed in a custom graph.
I believe you could also publish the artifacts, provide TeamCity with an XSL to render the XML, and create an additional tab in your build results to display it (however I have not done this)
Tech Support: I've found the community forums to be pretty good, most questions I've had answered within a day or two by both civilians and Jetbrains employees, and I was using the free 'Professional' version.
I can only imagine that email support will be just as good if not better!
I am a little confused about this question because my use of TeamCity, TC (and I guess the design principles of TC) is to allow the build script (and not TC) to remain the correspondent of build imperatives.
In other words, if you need TeamCity to do something cool, just add that cool stuff in your build script either using an existing task in your build system or write one yourself.
TeamCity supports NAnt, MSBuild, Ant and am sure, any other build platform you can install on on the buildagents.
The only integration I will want TC or any other CI platform to have is source control integration with my choice of SC. The rest of the integration should be controlled by my build script. That way, I only configure my TC once at the beginning of project for each project and then, don't touch it ever again. In contrast, the build can change per version.
So, the indirect answer to your question is Yes, theoretically, through the build script.
Hope this helps.

Resources