question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TeamCity Repository doesn't have any commit - need to support object/info/alternates

See original GitHub issue

I’m having trouble getting the latest beta to work from TeamCity https://github.com/ctaggart/SourceLink/issues/359 . TeamCity is simply delegating to run the build from the official docker image. I’m create the standard CI environment variables.

I’ve set the Standard CI environment variables:

[1:11:50][Step 1/1] STANDARD_CI_REPOSITORY_TYPE: git
[21:11:50][Step 1/1] STANDARD_CI_REPOSITORY_URL: git@github.ecorp.test:taggac/vsphere-automation-sdk-.net.git
[21:11:50][Step 1/1] STANDARD_CI_SOURCE_REVISION_ID: 2faeb58bbe59b000c517f7c19e53fc371b10324e
1:12:38][Step 1/1] /root/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta-63105-01/build/Microsoft.Build.Tasks.Git.targets(36,5): warning : Repository doesn't have any commit, the source code won't be available via source link. [/build/VMware.vSphere.Management/VMware.vSphere.Management.csproj]
[21:12:38][Step 1/1] /root/.nuget/packages/microsoft.sourcelink.common/1.0.0-beta-63105-01/build/Microsoft.SourceLink.Common.targets(73,5): warning : No SourceRoot items specified - the generated source link is empty. [/build/VMware.vSphere.Management/VMware.vSphere.Management.csproj]
[21:14:43][Step 1/1]   VMware.vSphere.Management -> /build/VMware.vSphere.Management/bin/release/netstandard2.0/VMware.vSphere.Management.dll

The sourcelink json ends up being {"documents":{}}, so it did not work.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ctaggartcommented, Jul 10, 2018

The root cause of this is that the TeamCity uses git object/info/alternates to speed up clones. These are basically links to files elsewhere. The Docker process needed access to these. git log -3 would fail from inside the docker container with:

[22:18:28][Step 1/1] error: object directory /opt/teamcity/TeamCity/buildAgent10/system/git/git-30CD863F.git/objects does not exist; check .git/objects/info/alternates.
[22:18:28][Step 1/1] fatal: bad object HEAD
[22:18:29][Step 1/1] Process exited with code 128

The solution I used was to simply mount it readonly at the same location:

docker run --rm -v $PWD:/app -w /app \
-v /opt/teamcity:/opt/teamcity:ro \
microsoft/dotnet:2.1-sdk \
./build.sh

Any advantages of settings the STANDARD_CI variables? Is the main benefit that it set DeterministicSourcePaths like we saw in https://github.com/JamesNK/Newtonsoft.Json/pull/1746#issuecomment-400019582 ?

0reactions
tmatcommented, Jul 12, 2018

I don’t know how to detect the condition. It seems indistinguishable from empty repository.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git describe within docker
We are generating an header file containing git version information using "git describe" within a docker container build. The problem is that ...
Read more >
TeamCity with BitBucket Cloud Commit Status Publisher. ...
It seems that the issue is that there is no user dedicated for the build itself. **You are unable to use deployment keys...
Read more >
Installing GitHub Webhooks from TeamCity
Unfortunately, installation and configuration of commit hooks is not an easy task and for on-premises VCS repositories it requires administration skills.
Read more >
10 things I hate about Git - Steve Bennett blogs
Git doesn't provide any useful subsets – every command soon requires another; even simple actions often require complex actions to undo or ...
Read more >
Public git repository for testing. Check if vulnerability alerts a
Public git repository for testing. Check if vulnerability alerts are enabled for a repository. To the right of the Filters drop-down menus, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found