Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
1af05b72
Unverified
Commit
1af05b72
authored
2 years ago
by
Sergei Zharinov
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
feat(bazel): Support GitLab-based http archives (#20393)
parent
fb7197ac
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/manager/bazel/extract.spec.ts
+46
-0
46 additions, 0 deletions
lib/modules/manager/bazel/extract.spec.ts
lib/modules/manager/bazel/rules/http.ts
+27
-0
27 additions, 0 deletions
lib/modules/manager/bazel/rules/http.ts
with
73 additions
and
0 deletions
lib/modules/manager/bazel/extract.spec.ts
+
46
−
0
View file @
1af05b72
...
@@ -163,5 +163,51 @@ describe('modules/manager/bazel/extract', () => {
...
@@ -163,5 +163,51 @@ describe('modules/manager/bazel/extract', () => {
expect
(
res
?.
deps
).
toHaveLength
(
2
);
expect
(
res
?.
deps
).
toHaveLength
(
2
);
expect
(
res
?.
deps
).
toMatchSnapshot
();
expect
(
res
?.
deps
).
toMatchSnapshot
();
});
});
it
(
'
http_archive with GitLab url
'
,
()
=>
{
// Sequential http_archive
// See https://github.com/aspect-build/rules_swc/commit/d4989f9dfed781dc0226421fb9373b45052e7bc8
const
res
=
extractPackageFile
(
codeBlock
`
http_archive(
name = "eigen3",
url = "https://gitlab.com/libeigen/eigen/-/archive/3.3.5/eigen-3.3.5.zip",
strip_prefix = "eigen-3.3.5",
sha256 = "0e7aeece6c8874146c2a4addc437eebdf1ec4026680270f00e76705c8186f0b5",
build_file = "@//third_party:eigen3.BUILD",
)
http_archive(
name = "eigen",
build_file = "//third_party:eigen.BUILD",
sha256 = "d76992f1972e4ff270221c7ee8125610a8e02bb46708a7295ee646e99287083b", # SHARED_EIGEN_SHA
strip_prefix = "eigen-90ee821c563fa20db4d64d6991ddca256d5c52f2",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/-/archive/90ee821c563fa20db4d64d6991ddca256d5c52f2/eigen-90ee821c563fa20db4d64d6991ddca256d5c52f2.tar.gz",
"https://gitlab.com/foo/bar",
"https://gitlab.com/libeigen/eigen/-/archive/90ee821c563fa20db4d64d6991ddca256d5c52f2/eigen-90ee821c563fa20db4d64d6991ddca256d5c52f2.tar.gz",
],
)
`
);
expect
(
res
?.
deps
).
toHaveLength
(
2
);
expect
(
res
?.
deps
).
toMatchObject
([
{
currentValue
:
'
3.3.5
'
,
datasource
:
'
gitlab-releases
'
,
depName
:
'
eigen3
'
,
depType
:
'
http_archive
'
,
packageName
:
'
libeigen/eigen
'
,
},
{
currentDigest
:
'
90ee821c563fa20db4d64d6991ddca256d5c52f2
'
,
datasource
:
'
gitlab-tags
'
,
depName
:
'
eigen
'
,
depType
:
'
http_archive
'
,
packageName
:
'
libeigen/eigen
'
,
},
]);
});
});
});
});
});
This diff is collapsed.
Click to expand it.
lib/modules/manager/bazel/rules/http.ts
+
27
−
0
View file @
1af05b72
...
@@ -4,6 +4,8 @@ import { escapeRegExp, regEx } from '../../../../util/regex';
...
@@ -4,6 +4,8 @@ import { escapeRegExp, regEx } from '../../../../util/regex';
import
{
parseUrl
}
from
'
../../../../util/url
'
;
import
{
parseUrl
}
from
'
../../../../util/url
'
;
import
{
GithubReleasesDatasource
}
from
'
../../../datasource/github-releases
'
;
import
{
GithubReleasesDatasource
}
from
'
../../../datasource/github-releases
'
;
import
{
GithubTagsDatasource
}
from
'
../../../datasource/github-tags
'
;
import
{
GithubTagsDatasource
}
from
'
../../../datasource/github-tags
'
;
import
{
GitlabReleasesDatasource
}
from
'
../../../datasource/gitlab-releases
'
;
import
{
GitlabTagsDatasource
}
from
'
../../../datasource/gitlab-tags
'
;
import
type
{
PackageDependency
}
from
'
../../types
'
;
import
type
{
PackageDependency
}
from
'
../../types
'
;
// Source: https://bazel.build/rules/lib/repo/http
// Source: https://bazel.build/rules/lib/repo/http
...
@@ -76,6 +78,27 @@ export function parseGithubPath(
...
@@ -76,6 +78,27 @@ export function parseGithubPath(
:
{
datasource
,
packageName
,
currentValue
:
value
};
:
{
datasource
,
packageName
,
currentValue
:
value
};
}
}
function
parseGitlabPath
(
pathname
:
string
):
Partial
<
PackageDependency
>
|
null
{
// https://gitlab.com/libeigen/eigen/-/archive/3.3.5/eigen-3.3.5.zip
// https://gitlab.com/libeigen/eigen/-/archive/90ee821c563fa20db4d64d6991ddca256d5c52f2/eigen-90ee821c563fa20db4d64d6991ddca256d5c52f2.tar.gz
const
[
p0
,
p1
,
p2
,
p3
,
p4
]
=
pathname
.
split
(
'
/
'
).
slice
(
1
);
const
packageName
=
p0
+
'
/
'
+
p1
;
if
(
p2
===
'
-
'
&&
p3
===
'
archive
'
&&
p4
)
{
return
isHash
(
p4
)
?
{
datasource
:
GitlabTagsDatasource
.
id
,
packageName
,
currentDigest
:
p4
,
}
:
{
datasource
:
GitlabReleasesDatasource
.
id
,
packageName
,
currentValue
:
p4
,
};
}
return
null
;
}
export
function
parseArchiveUrl
(
export
function
parseArchiveUrl
(
urlString
:
string
|
undefined
|
null
urlString
:
string
|
undefined
|
null
):
Partial
<
PackageDependency
>
|
null
{
):
Partial
<
PackageDependency
>
|
null
{
...
@@ -89,6 +112,10 @@ export function parseArchiveUrl(
...
@@ -89,6 +112,10 @@ export function parseArchiveUrl(
return
parseGithubPath
(
url
.
pathname
);
return
parseGithubPath
(
url
.
pathname
);
}
}
if
(
url
?.
host
===
'
gitlab.com
'
)
{
return
parseGitlabPath
(
url
.
pathname
);
}
return
null
;
return
null
;
}
}
...
...
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