Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
88860db2
Unverified
Commit
88860db2
authored
1 year ago
by
jsperling-schwarz
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(datasource/go): private repositories on azure (#26984)
Co-authored-by:
Rhys Arkins
<
rhys@arkins.net
>
parent
73cc089f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/datasource/go/base.spec.ts
+26
-14
26 additions, 14 deletions
lib/modules/datasource/go/base.spec.ts
lib/modules/datasource/go/base.ts
+20
-0
20 additions, 0 deletions
lib/modules/datasource/go/base.ts
with
46 additions
and
14 deletions
lib/modules/datasource/go/base.spec.ts
+
26
−
14
View file @
88860db2
...
...
@@ -22,6 +22,8 @@ describe('modules/datasource/go/base', () => {
${
'
github.com/foo/bar
'
}
|
${
'
github-tags
'
}
|
${
'
foo/bar
'
}
${
'
bitbucket.org/foo/bar
'
}
|
${
'
bitbucket-tags
'
}
|
${
'
foo/bar
'
}
${
'
code.cloudfoundry.org/lager
'
}
|
${
'
github-tags
'
}
|
${
'
cloudfoundry/lager
'
}
${
'
dev.azure.com/foo/bar/_git/baz.git
'
}
|
${
'
git-tags
'
}
|
${
'
https://dev.azure.com/foo/bar/_git/baz
'
}
${
'
dev.azure.com/foo/bar/baz.git
'
}
|
${
'
git-tags
'
}
|
${
'
https://dev.azure.com/foo/bar/_git/baz
'
}
`
(
'
$module -> $datasource: $packageName
'
,
async
({
module
,
datasource
,
packageName
})
=>
{
...
...
@@ -347,21 +349,31 @@ describe('modules/datasource/go/base', () => {
it
(
'
handles go-import with azure devops source
'
,
async
()
=>
{
const
meta
=
'
<meta name="go-import" content="
dev.azure.com/my-organization
/my-project/_git/my-repo.git git https://
dev.azure.com/my-organization
/my-project/_git/my-repo.git" />
'
;
'
<meta name="go-import" content="
org.visualstudio.com
/my-project/_git/my-repo.git git https://
org.visualstudio.com
/my-project/_git/my-repo.git" />
'
;
httpMock
.
scope
(
'
https://
dev.azure
.com
'
)
.
get
(
'
/my-
organization/my-
project/_git/my-repo.git?go-get=1
'
)
.
scope
(
'
https://
org.visualstudio
.com
'
)
.
get
(
'
/my-project/_git/my-repo.git?go-get=1
'
)
.
reply
(
200
,
meta
);
const
res
=
await
BaseGoDatasource
.
getDatasource
(
'
dev.azure.com/my-organization
/my-project/_git/my-repo.git
'
,
'
org.visualstudio.com
/my-project/_git/my-repo.git
'
,
);
expect
(
res
).
toEqual
({
datasource
:
GitTagsDatasource
.
id
,
packageName
:
'
https://dev.azure.com/my-organization/my-project/_git/my-repo
'
,
packageName
:
'
https://org.visualstudio.com/my-project/_git/my-repo
'
,
});
});
it
(
'
returns null for invalid azure devops source
'
,
async
()
=>
{
httpMock
.
scope
(
'
https://dev.azure.com
'
)
.
get
(
'
/foo/bar.git?go-get=1
'
)
.
reply
(
200
);
const
res
=
await
BaseGoDatasource
.
getDatasource
(
'
dev.azure.com/foo/bar.git
'
,
);
expect
(
res
).
toBeNull
();
});
it
(
'
handles uncommon imports
'
,
async
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
lib/modules/datasource/go/base.ts
+
20
−
0
View file @
88860db2
...
...
@@ -71,6 +71,26 @@ export class BaseGoDatasource {
};
}
if
(
goModule
.
startsWith
(
'
dev.azure.com/
'
))
{
const
split
=
goModule
.
split
(
'
/
'
);
if
((
split
.
length
>
4
&&
split
[
3
]
===
'
_git
'
)
||
split
.
length
>
3
)
{
const
packageName
=
'
https://dev.azure.com/
'
+
split
[
1
]
+
'
/
'
+
split
[
2
]
+
'
/_git/
'
+
(
split
[
3
]
===
'
_git
'
?
split
[
4
]
:
split
[
3
]).
replace
(
regEx
(
/
\.
git$/
),
''
,
);
return
{
datasource
:
GitTagsDatasource
.
id
,
packageName
,
};
}
}
return
await
BaseGoDatasource
.
goGetDatasource
(
goModule
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment