NuKeeperDotNet / NuKeeper

Automagically update nuget packages in .NET projects
Apache License 2.0
541 stars 127 forks source link

Enable BitBucket Server integration to lookup current user using API #973

Closed KeyDecoder closed 3 years ago

KeyDecoder commented 4 years ago

🏗 Enhancement Proposal

Currently when using BitBucket Server integration, it takes the username from the repository (ie. nukeeper.exe repo --platform bitbucketlocal https://myusername@server/scm/...).

However when it creates a user to do the git commits, it (in GetCurrentUser() in BitBucketLocalPlatform) it only sets the username and leaves the Name and Email blank. This means it always falls back to using the name and email in the git config.

This uses the git config if the global git config is set, but if the global git config user and email is not set, it will fail with "Failed to build signature, did not get valid git user identity from token or from repo config" error.

This has been causing us problems when running on a build agent where we don't want to set the git settings globally and be able to set the user based on the username passed in. In this case, we are using this with a specific user for automatic updating so it's clear in the commits which user this was, but we don't want to set this in the global git settings.

Pitch

The change is to lookup the user in BitBucket Server API so it can return the complete user name and email. This makes it similar to GitHub and GitLab integrations.

This would use the BitBucket Server users API to lookup the user to get the name and email (https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8285279136).

Platforms affected (mark all that apply)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.