Skip to content

Commit

Permalink
fix(manager/ansible-galaxy): handle collections with http git referen…
Browse files Browse the repository at this point in the history
  • Loading branch information
secustor authored and jon4hz committed Nov 9, 2023
1 parent 30c9d93 commit e15db92
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ collections:
version: 1.2.2
type: git

# explicit git repo
- name: namespace.mycollection
version: 3.0.0
type: git
source: https://example.com/organization/repo_name.git

# appendix style version definition
- name: https://example.com/organization/repo_name.git,1.2.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ exports[`modules/manager/ansible-galaxy/extract extractPackageFile() check colle
"depType": "galaxy-collection",
"packageName": "https://example.com/organization/repo_name.git",
},
{
"currentValue": "3.0.0",
"datasource": "git-tags",
"depName": "namespace.mycollection",
"depType": "galaxy-collection",
"packageName": "https://example.com/organization/repo_name.git",
},
{
"currentValue": "1.2.2",
"datasource": "git-tags",
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/ansible-galaxy/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function interpretLine(
}
case 'source': {
localDependency.managerData.source = value;
if (value?.startsWith('git@')) {
if (value?.startsWith('git@') || value?.endsWith('.git')) {
localDependency.packageName = value;
} else {
localDependency.registryUrls = value
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/ansible-galaxy/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('modules/manager/ansible-galaxy/extract', () => {
it('extracts dependencies from requirements.yml with a space at the end of line', () => {
const yamlFile = codeBlock`collections:
- name: https://github.com/lowlydba/lowlydba.sqlserver.git
type: git
type: git
version: 1.1.3`;
const res = extractPackageFile(yamlFile, 'requirements.yml');
expect(res?.deps).toHaveLength(1);
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('modules/manager/ansible-galaxy/extract', () => {
it('check collection style requirements file', () => {
const res = extractPackageFile(collections1, 'requirements.yml');
expect(res?.deps).toMatchSnapshot();
expect(res?.deps).toHaveLength(13);
expect(res?.deps).toHaveLength(14);
expect(res?.deps.filter((value) => value.skipReason)).toHaveLength(6);
});

Expand Down

0 comments on commit e15db92

Please sign in to comment.