git-plugin
git-plugin copied to clipboard
Notify Commit: Ignore ssh subdomain to allow matching azure devops git ssh urls for notify
Notify commit does not work with ssh and Azure DevOps.
Azure devops adds a "ssh." in front of the subdomain for git urls (ssh.dev.azure.com vs dev.azure.com). Hence the loose match for the host fails. This is especially painful since azure devops jenkins plugin does not allow to send the ssh based url in the commit hook, but always sends the https based one.
I have updated the looselyMatches in GitStatus to ignore the prepended ssh. subdomain in the host.
Testing done
Added a unit test to check matching works and project is triggered.
Submitter checklist
- [x] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [x] Ensure you have provided tests that demonstrate the feature works or the issue is fixed
My account on visualstudio.com uses:
- SSH URL
[email protected]:v3/MarkEWaite/git-client-plugin/git-client-plugin - HTTPS URL
https://markewaite.visualstudio.com/DefaultCollection/git-client-plugin/_git/git-client-plugin
Where can I find an Azure DevOps location that matches the URL's that are being changed here? As far as I can tell, my URL's don't fit the pattern that you're describing.
I removed the import reformatting in e500fa1190aa04f96011f32d3b691a84c8be6d06 because import reformatting causes merge conflicts in other pull requests.
Hello @MarkEWaite
Our https url looks like this https://dev.azure.com/organizationname/
While our ssh url looks like this: ssh.dev.azure.com/organizationname/
It's the general pattern for azure devops. As also mentioned e.g. here https://learn.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops
visualstudio.com has been moved to dev.azure.com as also mentioned in the link above.
A nice side effect with the new urls is that the path is actually the same for ssh and https - allowing the matching to work.
Our https url looks like this https://dev.azure.com/organizationname/
While our ssh url looks like this: ssh.dev.azure.com/organizationname/
It's the general pattern for azure devops.
I assume that must be the pattern for paying customers of Azure DevOps. I test with a free account and it remains https://markewaite.visualstudio.com/ with the repository hosted at https://markewaite.visualstudio.com/DefaultCollection/git-plugin/_git/git-plugin and [email protected]:v3/MarkEWaite/git-plugin/git-plugin
I can't afford to purchase Azure DevOps in order to test the changes. Is there another way that I can be granted access to Azure DevOps at the dev.azure.com URL?
According to azure devops website you can get unlimited free private repos. https://azure.microsoft.com/en-us/products/devops/repos
Also in your organization settings there should be an option to migrate the url from visualstudio.com to dev.azure.com
See also here https://stackoverflow.com/questions/60279119/migrating-from-myorg-visualstudio-com-to-dev-azure-com-myorg
I also checked the paths for cloning in azure devops again
for https it looks like this:
https://[email protected]/myorg/PROJECT/_git/repositoryname
and for ssh like this:
[email protected]:v3/myorg/PROJECT/repositoryname
I assume it would also be required to replace /_git/ with / for the matching to work. I actually missed that part.
I have added that change to the PR.
I actually added the urls as they are used in azure devops to the unit test. There is also a version part in the ssh url (:v3/) which would need to be ignored.
Also in your organization settings there should be an option to migrate the url from visualstudio.com to dev.azure.com
Thanks for the pointer. I found it in the organization settings and have moved my organization to https://dev.azure.com/MarkEWaite/ . Now I need to find all the locations that reference the old URL and replace them with the new URL.
any update? :)
Is there anything holding this back? This would be very helpful for our integration of jenkins with azure devops.
If I can help any way please let me know.
Is there anything holding this back? This would be very helpful for our integration of jenkins with azure devops.
If I can help any way please let me know.
You can already use it in your Jenkins controller. Instructions on using the incremental build are available in the "checks tab" under the "Jenkins Incrementals Publisher". The most recent incremental is here and a new incremental will appear in about 60 minutes when the next build completes.
I now enabled the plugin created by the incremental compiler in our jenkins instance. Notification is now working well with SSH from Azure DevOps - would be great to see in the main branch though, to be able to update the git-plugin "normally" again.
Works well with the custom build - thanks for the hint again! I would be very happy to see this in the main branch though. Also to be able to update the git plugin normally in jenkins again.