-
Notifications
You must be signed in to change notification settings - Fork 112
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
Azure DevOps mounter #150
base: master
Are you sure you want to change the base?
Azure DevOps mounter #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please add some testing
require 'glue/mounters/base_mounter' | ||
require 'fileutils' | ||
|
||
class Glue::AzDOMounter < Glue::BaseMounter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe think on a more clear name? AzureGitMounter maybe?
super(trigger) | ||
@options = options | ||
@name = "AzDO Git" | ||
@description = "Pull a repo." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@description = "Pull a repo." | |
@description = "Pull a repository from Azure DevOps" |
def mount target | ||
base = @options[:working_dir] | ||
|
||
Glue.debug "Making base." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it stay here?
|
||
# Grab the path used as git url, excluding PAT. | ||
# format of this target must be https://DUMMY:<PAT_TOKEN>@dev.azure.com/<account>/<project>/_git/<repository> | ||
protocol, azdo_domain, account, project, repository = target.match(/\A(.*\/\/).*@(.*)\/(.*)\/(.*)\/_git\/(.+?)[\/]{0,1}\z/i).captures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe get these parameters separately and build the URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking on maybe having PATTOKEN as a configuration parameter, as can be useful for something else (working on creating work items on Azure DevOps, like the ones for Jira, Pivotal...)
Parameters I extract from the match are for building the folder name used for temporary storage, but the target url should be ````https://dev.azure.com/../../_git/....```
So that way, you can just use the Git Url you can copy/paste from Azure DevOps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh I see. Ok, so just move the PAT to paramter - which could also help in reducting it.
Where can I find tests for the other mounters? |
The test coverage is not amazing - look on different tests under the |
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. |
GitMounter lacks the ability of mounting git repositories from Azure DevOps
I decided to create a new mounter, heavily inspired by the git one, to be able to mount Azure DevOps (aka Visual Studio Team Services) git repositories when they are specified as a target
format of the target URL should be:
It requires a Personal Access Token to be used as part of the target url, and having, at least, Code/Read capabilities against such repository, as specified in this link
sample of the tool mounting an Azure Devops repository and starting scanning the content:
Concern is having PAT tokens leaking on logs, so might be useful to redact that from the base mounters files.
Also, thinking on allowing PAT token to be a configuration option and use it for this mounter instead of using targets including tokens as part of the string