Skip to content
Snippets Groups Projects
Unverified Commit 7356fede authored by Jonas Rutishauser's avatar Jonas Rutishauser Committed by GitHub
Browse files

feat(manager/helmfile): Support oci urls in helmfile (#27126)

parent 51eea2e6
No related merge requests found
...@@ -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',
}, },
], ],
}); });
......
...@@ -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';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment