GitVersion throws authentication error in TeamCity build - teamcity

I've created a build in TeamCity for a project which uses GitVersion to manage versioning. When I attempt to have TeamCity run the build it fails showing the following error in the build log:
An unexpected error occured:
LibGit2Sharp.LibGit2SharpException: authentication required but no callback set
I have tried searching google for the LibGit2Sharp error, but find only a couple of closed bug reports with no details how they were able to work around the error.

After setting up the build's artifacts to capture the log output GitVersion was generating, the following message was found:
TeamCity doesn't make the current branch available through environmental variables.
Depending on your authentication and transport setup of your git VCS root things
may work. In that case, ignore this warning.
In your TeamCity build configuration, add a parameter called `env.Git_Branch` with
value %teamcity.build.vcs.branch.<vcsid>%
See http://gitversion.readthedocs.org/en/latest/build-server-support/build-server/teamcity
for more info
By setting the env.Git_Branch parameter to the %teamcity.build.vcs.branch.% value, GitVersion started working. This should have been a straightforward solution, but because the logs were not being captured and search results for the error message were unsuccessful, I've decided to post this answer to help others who may encounter this problem.

Related

TeamCity API call to get a list of modifications to a build configuration

I'm running TeamCity Enterprise 2019.2.4 (build 72059).
Is there an easy API call to get the username of a person who disabled a build step?
If that is not possible, as I suspect, what's the API endpoint to get a list of all modifications for a build configuration, and then the endpoint to get the contents of that modification?
Mind you, this is not about VCS changes. I know how to get those.
I enabled versioned settings for that project, so I just check the git history for the file that represents the build configuration and parse the commits for the one that disabled the build step.

Jenkins failure cause message not part of Gerrit trigger response

I have some Jenkins pipelines, and on failure they send a -1 Verified response back to the gerrit review that triggered it. I also have the Build Failure Analyzer plugin, which I used to scan the console log for failure causes when the job fails.
On an older Jenkins installation (that I didn't manage), I used to get this failure cause back in the -1 Verified response in the gerrit review if one was found. I don't have that working at the moment.
Does anyone know if there is some gerrit trigger configuration needed, or another plugin to use to enable this?

Maven build uses an HTTP proxy.. that I haven't configured

I was able to build Maven projects from command line with no issue for as long as I can remember.. But this morning, I am getting some error like it's trying to use the company HTTP proxy to fetch dependencies and it requires authentication.
We have internal Nexus repositories, so I reallyt don't get why all of a sudden, it tries to go outside.
I checked my M2_HOM/conf/settings.xml, and no proxy is defined there. I checked my env variables, and I don't see anything declaring a proxy either.
Where can it possibly get configured then ?
Thanks
OK, after couple of hours of struggle, I found the problem.
2 weeks back, I needed to install locally a Logstash plugin that wasn't available internally. This required me to fiddle here and there with my config, to allow Logstash to actually go through the proxy and fetch the required dependency - and it involved Maven, as I used the ugly workaround given here : https://github.com/elastic/logstash/issues/2851
As explained in the link, I defined the proxy for logstash plugin in $HOME/.m2/settings.xml .. and forgot to remove it after ;-/
I found this by running the build in debug mode (-X option) and this file was referenced at the beginning.

TFS Deployment times out, when using an existing Build

I'm trying to deploy an existing build with the "LabDefaultTemplate.11.xaml".
My problem is, that the build times out, as soon as I use an existing build. Here are the last steps including details and the timeout exception:
See http://i.stack.imgur.com/po1i6.png
I have two different servers. The first has TFS 2013 with Build Service, Controller and Agent installed on it. The second is thought to be used for Testing and has a Test-Controller and Agent on it (configured as a Standard-Environment in MS Test-Manager).
Build Service Account is a Domain-Admin
Build Connection to TFS goes with a TFS-Admin
Test Controller Service Login Account is a Local-Admin (mirrored on the Build-Server) and earlier tried with the Domain-Admin
Test Controller TFS-Connection also with a TFS-Admin
Test Controller Lab Service Account is not used, earlier also tried with the Domain-Admin
When I set the build to use the latest TFS-Build it runs into the timeout.
And when i set the path to use a Build from a specific location to the Build Directory on the Build-Server it all just works fine.
The difference between a working build and the timeout described above can be seen in this picture: http://i.stack.imgur.com/gPM07.png
Has anyone an idea where I'm struggling?
The problem was, that my previous builds only "partially succeeded" because they had some failing unit tests. The setting to use the only uses fully successful builds. So the latest build which was used had no drop folder configured.
I received no info about that, until I saw it in the logs. My fault was to never check, which build really is used as the latest.

Jenkins does not show some builds log and failed builds in history

We have updated our Jenkins CI tool to updated version number is: 1.596.1. The problem is, for some projects, we cannot see the build console log. When we try to see the log, Jenkins responds with 404 error page.
Also, when this problem occurs in a particular job, we have examined that, failed builds are not be shown in the build history list in the job page. Even though we see that there is build from the gerrit history, when I click on the job with the specified ID, I again get the 404 error.
We are using Jenkins with Git/Gerrit, and most builds are triggered from the Gerrit review system.
New information: Jobs that have this problem have also the inconsistent timestamp problem.
It seems that this problem also occurs when Jenkins job is triggered by a patchset creation/merge in Gerrit review system.
What may be the root cause for this problem? Is it the version we're using or some other factor?
This is a persistent problem with Jenkins. A restart, which you can do from the front page when you're authenticated, is the fix. Visit
https://yoursite/jenkins/quietDown
to restart the instance.

Resources