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
7356fede
Unverified
Commit
7356fede
authored
1 year ago
by
Jonas Rutishauser
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
feat(manager/helmfile): Support oci urls in helmfile (#27126)
parent
51eea2e6
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/manager/helmfile/extract.spec.ts
+10
-0
10 additions, 0 deletions
lib/modules/manager/helmfile/extract.spec.ts
lib/modules/manager/helmfile/extract.ts
+17
-3
17 additions, 3 deletions
lib/modules/manager/helmfile/extract.ts
with
27 additions
and
3 deletions
lib/modules/manager/helmfile/extract.spec.ts
+
10
−
0
View file @
7356fede
...
@@ -319,6 +319,9 @@ describe('modules/manager/helmfile/extract', () => {
...
@@ -319,6 +319,9 @@ describe('modules/manager/helmfile/extract', () => {
- name: jenkins
- name: jenkins
chart: jenkins/jenkins
chart: jenkins/jenkins
version: 3.3.0
version: 3.3.0
- name: oci-url
version: 0.4.2
chart: oci://ghcr.io/example/oci-repo/url-example
`
;
`
;
const
fileName
=
'
helmfile.yaml
'
;
const
fileName
=
'
helmfile.yaml
'
;
const
result
=
await
extractPackageFile
(
content
,
fileName
,
{
const
result
=
await
extractPackageFile
(
content
,
fileName
,
{
...
@@ -338,6 +341,13 @@ describe('modules/manager/helmfile/extract', () => {
...
@@ -338,6 +341,13 @@ describe('modules/manager/helmfile/extract', () => {
{
{
currentValue
:
'
3.3.0
'
,
currentValue
:
'
3.3.0
'
,
depName
:
'
jenkins
'
,
depName
:
'
jenkins
'
,
registryUrls
:
[
'
https://charts.jenkins.io
'
],
},
{
currentValue
:
'
0.4.2
'
,
depName
:
'
url-example
'
,
datasource
:
'
docker
'
,
packageName
:
'
ghcr.io/example/oci-repo/url-example
'
,
},
},
],
],
});
});
...
...
This diff is collapsed.
Click to expand it.
lib/modules/manager/helmfile/extract.ts
+
17
−
3
View file @
7356fede
...
@@ -24,6 +24,10 @@ function isLocalPath(possiblePath: string): boolean {
...
@@ -24,6 +24,10 @@ function isLocalPath(possiblePath: string): boolean {
);
);
}
}
function
isOciUrl
(
possibleUrl
:
string
):
boolean
{
return
possibleUrl
.
startsWith
(
'
oci://
'
);
}
export
async
function
extractPackageFile
(
export
async
function
extractPackageFile
(
content
:
string
,
content
:
string
,
packageFile
:
string
,
packageFile
:
string
,
...
@@ -100,7 +104,11 @@ export async function extractPackageFile(
...
@@ -100,7 +104,11 @@ export async function extractPackageFile(
dep
.
version
=
String
(
dep
.
version
);
dep
.
version
=
String
(
dep
.
version
);
}
}
if
(
dep
.
chart
.
includes
(
'
/
'
))
{
if
(
isOciUrl
(
dep
.
chart
))
{
const
v
=
dep
.
chart
.
substring
(
6
).
split
(
'
/
'
);
depName
=
v
.
pop
()
!
;
repoName
=
v
.
join
(
'
/
'
);
}
else
if
(
dep
.
chart
.
includes
(
'
/
'
))
{
const
v
=
dep
.
chart
.
split
(
'
/
'
);
const
v
=
dep
.
chart
.
split
(
'
/
'
);
repoName
=
v
.
shift
()
!
;
repoName
=
v
.
shift
()
!
;
depName
=
v
.
join
(
'
/
'
);
depName
=
v
.
join
(
'
/
'
);
...
@@ -130,7 +138,10 @@ export async function extractPackageFile(
...
@@ -130,7 +138,10 @@ export async function extractPackageFile(
const
repository
=
doc
.
repositories
?.
find
(
const
repository
=
doc
.
repositories
?.
find
(
(
repo
)
=>
repo
.
name
===
repoName
,
(
repo
)
=>
repo
.
name
===
repoName
,
);
);
if
(
repository
?.
oci
)
{
if
(
isOciUrl
(
dep
.
chart
))
{
res
.
datasource
=
DockerDatasource
.
id
;
res
.
packageName
=
repoName
+
'
/
'
+
depName
;
}
else
if
(
repository
?.
oci
)
{
res
.
datasource
=
DockerDatasource
.
id
;
res
.
datasource
=
DockerDatasource
.
id
;
res
.
packageName
=
registryAliases
[
repoName
]
+
'
/
'
+
depName
;
res
.
packageName
=
registryAliases
[
repoName
]
+
'
/
'
+
depName
;
}
}
...
@@ -142,7 +153,10 @@ export async function extractPackageFile(
...
@@ -142,7 +153,10 @@ export async function extractPackageFile(
}
}
// Skip in case we cannot locate the registry
// Skip in case we cannot locate the registry
if
(
is
.
emptyArray
(
res
.
registryUrls
))
{
if
(
res
.
datasource
!==
DockerDatasource
.
id
&&
is
.
emptyArray
(
res
.
registryUrls
)
)
{
res
.
skipReason
=
'
unknown-registry
'
;
res
.
skipReason
=
'
unknown-registry
'
;
}
}
...
...
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