-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(kustomize): lookup Github dependency using HTTP (#7456)
Co-authored-by: Michael Kriese <[email protected]>
- Loading branch information
1 parent
da4bc37
commit 3b1ed2f
Showing
3 changed files
with
69 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,13 @@ exports[`manager/kustomize/extract extractPackageFile() extracts http dependency | |
Array [ | ||
Object { | ||
"currentValue": "v0.0.1", | ||
"datasource": "git-tags", | ||
"depName": "github.com/user/repo//deploy", | ||
"lookupName": "github.com/user/repo", | ||
"datasource": "github-tags", | ||
"depName": "user/repo", | ||
}, | ||
Object { | ||
"currentValue": "1.19.0", | ||
"datasource": "github-tags", | ||
"depName": "fluxcd/flux/deploy", | ||
"lookupName": "fluxcd/flux", | ||
"depName": "fluxcd/flux", | ||
}, | ||
] | ||
`; | ||
|
@@ -22,14 +20,16 @@ Array [ | |
Object { | ||
"currentValue": "v0.0.1", | ||
"datasource": "git-tags", | ||
"depName": "https://moredhel/remote-kustomize.git", | ||
"depName": "moredhel/remote-kustomize", | ||
"depNameShort": "moredhel/remote-kustomize", | ||
"lookupName": "https://moredhel/remote-kustomize.git", | ||
}, | ||
Object { | ||
"currentValue": "v0.0.1", | ||
"datasource": "git-tags", | ||
"depName": "https://moredhel/remote-kustomize.git//deploy", | ||
"lookupName": "https://moredhel/remote-kustomize.git//deploy", | ||
"depName": "moredhel/remote-kustomize", | ||
"depNameShort": "moredhel/remote-kustomize", | ||
"lookupName": "https://moredhel/remote-kustomize.git", | ||
}, | ||
] | ||
`; | ||
|
@@ -38,9 +38,8 @@ exports[`manager/kustomize/extract extractPackageFile() extracts ssh dependency | |
Array [ | ||
Object { | ||
"currentValue": "v0.0.1", | ||
"datasource": "git-tags", | ||
"depName": "[email protected]:moredhel/remote-kustomize.git", | ||
"lookupName": "[email protected]:moredhel/remote-kustomize.git", | ||
"datasource": "github-tags", | ||
"depName": "moredhel/remote-kustomize", | ||
}, | ||
] | ||
`; | ||
|
@@ -49,9 +48,8 @@ exports[`manager/kustomize/extract extractPackageFile() extracts ssh dependency | |
Array [ | ||
Object { | ||
"currentValue": "v2.0.0", | ||
"datasource": "git-tags", | ||
"depName": "[email protected]:kubernetes-sigs/kustomize.git//examples/helloWorld", | ||
"lookupName": "[email protected]:kubernetes-sigs/kustomize.git", | ||
"datasource": "github-tags", | ||
"depName": "kubernetes-sigs/kustomize", | ||
}, | ||
] | ||
`; | ||
|
@@ -60,15 +58,13 @@ exports[`manager/kustomize/extract extractPackageFile() should extract bases fro | |
Array [ | ||
Object { | ||
"currentValue": "v0.0.1", | ||
"datasource": "git-tags", | ||
"depName": "[email protected]:moredhel/remote-kustomize.git", | ||
"lookupName": "[email protected]:moredhel/remote-kustomize.git", | ||
"datasource": "github-tags", | ||
"depName": "moredhel/remote-kustomize", | ||
}, | ||
Object { | ||
"currentValue": "1.19.0", | ||
"datasource": "github-tags", | ||
"depName": "fluxcd/flux/deploy", | ||
"lookupName": "fluxcd/flux", | ||
"depName": "fluxcd/flux", | ||
}, | ||
] | ||
`; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,52 +69,71 @@ describe('manager/kustomize/extract', () => { | |
const version = 'v1.0.0'; | ||
const sample = { | ||
currentValue: version, | ||
datasource: datasourceGitTags.id, | ||
depName: base, | ||
lookupName: base, | ||
datasource: datasourceGitHubTags.id, | ||
depName: 'user/test-repo', | ||
}; | ||
|
||
const pkg = extractBase(`${base}?ref=${version}`); | ||
expect(pkg).toEqual(sample); | ||
}); | ||
|
||
it('should extract the version of a non http base', () => { | ||
const pkg = extractBase( | ||
'ssh://[email protected]/user/test-repo?ref=v1.2.3' | ||
); | ||
expect(pkg).toEqual({ | ||
currentValue: 'v1.2.3', | ||
datasource: datasourceGitTags.id, | ||
depName: 'bitbucket.com/user/test-repo', | ||
depNameShort: 'user/test-repo', | ||
lookupName: 'ssh://[email protected]/user/test-repo', | ||
}); | ||
}); | ||
it('should extract the version of a non http base with subdir', () => { | ||
const pkg = extractBase( | ||
'ssh://[email protected]/user/test-repo/subdir?ref=v1.2.3' | ||
); | ||
expect(pkg).toEqual({ | ||
currentValue: 'v1.2.3', | ||
datasource: datasourceGitTags.id, | ||
depName: 'bitbucket.com/user/test-repo', | ||
depNameShort: 'user/test-repo', | ||
lookupName: 'ssh://[email protected]/user/test-repo', | ||
}); | ||
}); | ||
it('should extract out the version of an github base', () => { | ||
const base = 'fluxcd/flux/deploy'; | ||
const base = 'github.com/fluxcd/flux/deploy'; | ||
const version = 'v1.0.0'; | ||
const sample = { | ||
currentValue: version, | ||
datasource: datasourceGitHubTags.id, | ||
depName: base, | ||
lookupName: 'fluxcd/flux', | ||
depName: 'fluxcd/flux', | ||
}; | ||
|
||
const pkg = extractBase(`github.com/${base}?ref=${version}`); | ||
const pkg = extractBase(`${base}?ref=${version}`); | ||
expect(pkg).toEqual(sample); | ||
}); | ||
it('should extract out the version of a git base', () => { | ||
const base = '[email protected]:user/repo.git'; | ||
const version = 'v1.0.0'; | ||
const sample = { | ||
currentValue: version, | ||
datasource: datasourceGitTags.id, | ||
depName: base, | ||
lookupName: base, | ||
datasource: datasourceGitHubTags.id, | ||
depName: 'user/repo', | ||
}; | ||
|
||
const pkg = extractBase(`${base}?ref=${version}`); | ||
expect(pkg).toEqual(sample); | ||
}); | ||
it('should extract out the version of a git base with subdir', () => { | ||
const base = '[email protected]:user/repo.git'; | ||
const base = '[email protected]:user/repo.git/subdir'; | ||
const version = 'v1.0.0'; | ||
const sample = { | ||
currentValue: version, | ||
datasource: datasourceGitTags.id, | ||
depName: `${base}//subdir`, | ||
lookupName: base, | ||
datasource: datasourceGitHubTags.id, | ||
depName: 'user/repo', | ||
}; | ||
|
||
const pkg = extractBase(`${sample.depName}?ref=${version}`); | ||
const pkg = extractBase(`${base}?ref=${version}`); | ||
expect(pkg).toEqual(sample); | ||
}); | ||
}); | ||
|
@@ -217,8 +236,7 @@ describe('manager/kustomize/extract', () => { | |
expect(res.deps).toHaveLength(2); | ||
expect(res.deps[0].currentValue).toEqual('v0.0.1'); | ||
expect(res.deps[1].currentValue).toEqual('1.19.0'); | ||
expect(res.deps[1].depName).toEqual('fluxcd/flux/deploy'); | ||
expect(res.deps[1].lookupName).toEqual('fluxcd/flux'); | ||
expect(res.deps[1].depName).toEqual('fluxcd/flux'); | ||
}); | ||
it('should extract out image versions', () => { | ||
const res = extractPackageFile(gitImages); | ||
|
@@ -240,8 +258,7 @@ describe('manager/kustomize/extract', () => { | |
expect(res.deps).toHaveLength(2); | ||
expect(res.deps[0].currentValue).toEqual('v0.0.1'); | ||
expect(res.deps[1].currentValue).toEqual('1.19.0'); | ||
expect(res.deps[1].depName).toEqual('fluxcd/flux/deploy'); | ||
expect(res.deps[1].lookupName).toEqual('fluxcd/flux'); | ||
expect(res.deps[1].depName).toEqual('fluxcd/flux'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters