Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Why this message "warning: Source control information is not available - the generated source link is empty" #981

Closed
mhsimkin opened this issue Mar 23, 2023 · 2 comments

Comments

@mhsimkin
Copy link

mhsimkin commented Mar 23, 2023

Hi.

All the packages that are built using our on-premises build server, fail to have the source link information embedded in the PDB.

We are getting the following warning from MSBuild:

warning: Source control information is not available - the generated source link is empty.

I have determined that the warning is a result of the build process not being able to authenticate to our on-premises Bitbucket/Stash server (V3.7.1).

When the builds happen, the build server uses a project level SSH Key to retrieve the source code from Stash. This information is stored in it's own credential manager, and not in the default Git store.

After reviewing various issues (727, 207, 878) and the Source Control and Source Link Packages documentation, I think I need to set the ScmRepositoryUrl to be the SSH URL to the server:

ssh://server:port/project/repo.git

However, I have not figured out how to provide the SSH key to the build.

Using GCM is not an option, as far as I know, since it doesn’t support SSH keys. Also, the build process is running under the LocalSystem account.

Is there any way to provide the SSH key as a build property?
If not, is there any way to just use the files that are already on disk to generate the hash values?

Thank you.

@mhsimkin
Copy link
Author

I've been digging through this for a few days now. I have come to realize, only @ctaggart dotnet utilities test command does an HTTP call to the Git Server. The SourceLink Build tasks do not make a call to the Git Server. Therefore, the issue has nothing to do with authentication.

When I compare MSBuild Binlogs of builds done on my development workstation (which has always worked) vs the build server, it is apparent that the repo url and the scm repo url for the source root location where the files are stored on disk is different between the two logs.

I'm not sure why. If someone can offer any insight, it would be appreciated. Otherwise, I will keep digging.

@mhsimkin mhsimkin changed the title Question: How to use SSH Uri with Key to access on-prem bitbucket server? Question: Why this message "warning: Source control information is not available - the generated source link is empty" Mar 30, 2023
@mhsimkin
Copy link
Author

mhsimkin commented Mar 30, 2023

I'm documenting this incase someone else has the same issue.

Our build server is TeamCity, when the VCS Root was configured for this project, the host name was not fully qualified, just the node name (ex: http://gitserver/scm/{projectName}/{repositoryName}). This is the value of the remote origin in the .git/Config.

The CSProj set the RepositoryUrl property to be the fully qualified host name (ex: http://gitserver.contoso.com/scm/{projectName}/{repositoryName}).

I was under the impression that setting the RepositoryUrl property in the project file would result in that url being used. That is the way I'm interrupting the comment on line 32 in InitializeSourceControlInformation.targets.

However, that is not what is happening.

As per the readme documentation on using a Bitbucket server the SourceLinkBitbucketGitHost item group is added to the CSProj file. The host value there is the fully qualified host name (ex: gitserver.contoso.com), along with the version of our server.

When the GetSourceLinkUrl task is run during the _InitializeBitbucketGitSourceLinkUrl target execution, the value of the repository url is being compared to the list of host from the SourceLink{provider}Host item group.

If you look at line 217 in the source file Common\GetSourceLinkUrlGitTask class, the if statement comparing the list of hosts from the SourceLink{provider}Host item group with the host portion of the repository url. It expects to find either an exact match or partial match against the domain (ex: .contoso.com).

Since the host portion of the repository url is just gitserver, a match is never found and the warning message is generated.

My questions for the team:

  1. If the RepositoryUrl property is set in the project file, should it be overridden by the repo url from the git config file?
  2. Why is there no check to see if the host portion of the RepositoryUrl matches just the first portion of each host specified in the SourceLink{provider}Host item group.
  3. Can either the readme.md be updated or a FAQ added that explains the various error/warning messages that can be generated, the common causes, and the possible solutions?

Thanks.

@mhsimkin mhsimkin closed this as completed Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant