Downloading builds from TeamCity - teamcity

Is there a way to download specific builds of a project in TeamCity?

You can use the build id, build number or one of the static build identifiers:
http://{TeamCity-Server}/repository/download/{BUILD_TYPE_ID}/{BUILD_NUMBER}/{ARTIFACT_PATH}
http://confluence.jetbrains.net/display/TCD65/Patterns+For+Accessing+Build+Artifacts

What you're actually looking to do is create artifacts in TeamCity. Artifacts are normally a build output which are then attached to the individual build runs so that you can download and review them at a later date. There's a walk through including the creation of build artifacts in You're deploying it wrong! TeamCity, Subversion & Web Deploy part 5: Web Deploy with TeamCity.

we attach the .msi file generated from the build as an artifact containing the build number (you can use %env.BUILD_NUMBER% to find the artifact path).

As mentioned above, one can download using REST API. It is also possible using FluentTc library with fluent api:
Download artifacts of the latest successful build:
IConnectedTc connectedTc = new RemoteTc().Connect(a => a.ToHost("tc")
.AsUser("MYUSERNAME", "MYPASSWORD"))
IBuild lastSuccessfulBuild = connectedTc.GetLastBuild(having =>
having.BuildConfiguration(with => with.Id("FluentTc"))
.Status(BuildStatus.Success));
IList<string> downloadedFiles = connectedTc.DownloadArtifacts(lastSuccessfulBuild.Id,
#"C:\DownloadedArtifacts");
Download specific file from artifacts of specific build by build Id:
string downloadedFile = connectedTc.DownloadArtifacts(
buildId,
#"C:\DownloadedArtifacts",
"binaries.zip");

To get latest successful build artifacts from Team City you can use the following link templates:
with guest authentication: http://<buildServer>/guestAuth/downloadArtifacts.html?buildTypeId=<buildTypeId>&buildId=lastSuccessful
with your credentials: http://<buildServer>/repository/downloadAll/<buildTypeId>/.lastSuccessful/artifacts.zip
with specific artifact: http://<buildServer>/httpAuth/repository/download/<buildTypeId>/.lastSuccessful/<some file.ext>

Related

Accessing artifacts from previous run of the same build

I want to implement rerun solution for flaky tests.
I have problem with passing artifacts from previous run on build to next build.
Artifacts B -> B (Run 2)
Is there any option to get artifacts from latest run of the same build in same snapshot? For now I know that only option would be to get artifacts from Teamcity API.
As was said before only option was to get latest build number from TC API and then get artifacts from API by this build number. There is no better option.
Get latest build:
https://teamcity.com/httpAuth/app/rest/builds?locator=snapshotDependency:(from:(id:$parentBuildId),includeInitial:false),defaultFilter:false,buildType:$buildTypeId,state:finished,failedToStart:false,canceled:false,count:1
Get artifacts:
"https://teamcity.com/httpAuth/app/rest/builds/id:$latestBuildId/artifacts/content/$failed_tests_filename"
I'm answering in case if someone else will look for solution.

One build-agent for several repo

I have 2 configurations in the teamcity which refer to 2 separate repositories in the mercurial. When starting a build the project updates all its files. Can we configure 1 build agent to have 2 reprositories so that only the changes of the corresponding project are taken and not all files of the project at updated when starting the configuration? Or do we need to create 2 agents?
If TeamCity decided to clean checkout directory on an agent, it should log why this happens into the build log of the build.
Possible reasons of clean checkout are outlined in documentation: https://confluence.jetbrains.com/display/TCD18/Clean+Checkout

How do I get Travis-CI to show build artifacts?

I have added Travic-CI on travis-ci.org to my github project.
The .travis.yml file looks like this:
language: csharp
solution: MyProject.sln
So, when I go to
https://travis-ci.org/username/MyProject/builds/somenumber
, then it shows the build as passing.
I can also see the log-file, but I can nowhere see the the files generated (the .exe).
Do I have to add anything to .travis.yml so it displays/publishes my .exe as artifact on my project's page on travis-ci.org ?
Or do I have to flip a switch somewhere else ?
Or is Travis not thought to do this ?
Note:
Show the executable on travis-ci.org (so I can link to it from github), not publishing it automagically as release to github, althought that would be fine, too.
By default, the build artifacts are thrown away with the machine. What counts is the build and test result. If you want to retain some or all build artifacts, have a look at the deploy options: https://docs.travis-ci.com/user/deployment/
Travis now offers a built-in option to upload build artifacts to AWS: https://docs.travis-ci.com/user/uploading-artifacts/. To set it up you just have to enable the add-on and provide some configuration:
For a minimal configuration, add the following to your .travis.yml:
addons:
artifacts: true
and add the following environment variables in the repository
settings:
ARTIFACTS_KEY=(AWS access key id)
ARTIFACTS_SECRET=(AWS secret access key)
ARTIFACTS_BUCKET=(S3 bucket name)

sonar-pdfreport-plugin-1.4 with Sonar 4.5.1

I am using Sonar 4.5.1 and sonar-pdfreport-plugin-1.4 to run the build. PDF report is not getting generated an is showing below message : Internal error: Can't retrieve project info. Parent project node is empty. Authentication?.
I saw a bug posted for this (https://jira.sonarsource.com/browse/SONARPLUGINS-3854) but would like to know what is the workaround available for this issue. User Authentication is already set for this in General Settings->Pdf report but doesn't work either.
This issue has been fixed in commit a49b8f61afbf47b5f7976d0a759cb0efcd6c5bce.
For now you cannot download jar with this fix, but you can download sources and build custom version:
fetch sources (by git clone https://github.com/SonarQubeCommunity/sonar-pdf-report.git or download zip)
execute maven command mvn clean install
copy generated jar to sonar/data/extensions/plugins

Dependencies not getting updated in TFS Build Server

I have created a Smart Device CAB Deployment Project and contains dependencies eg: Test.dll.
Where Test is a seperate class library. I have created a build definition for this solution(contains Test Proj + CAB deployment Proj). When i trigger queue new build for this definition Test.dll is not getting updated in CAB deployment project in Build Agent folder of TFS Server.
PLease let me know how can i reload this dependencies on checking in / queuing new build.
Thanks in advance
Check your Workspace option on Process tab. It should be All or Outputs if you wish to have always fresh version. None option is for incremental builds. If your project is really small "All" is the best option for you.
All - erase entire workspace and download and build everything again
Outputs - like All but only output bin folders are erased and new
version is downloaded (get latest version) from source control.
(incremental get) (like Rebuild (cleen + build) in your solution)
None - sources are build incrementally. Like Get latest version +
Build command in VS

Resources