Skip to content
Snippets Groups Projects
Unverified Commit 1d661b90 authored by Sebastian Poxhofer's avatar Sebastian Poxhofer Committed by GitHub
Browse files

fix(ansible-galaxy): allow usage of ssh:// style git urls (#5700)

parent 7ce4f24c
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,20 @@
src: git@gitlab.company.com:mygroup/ansible-base.git
version: "0.1"
# Git repo, url with protocol prefix
## with user
- scm: git
src: ssh://git@gitlab.company.com/testGroup/testProject.git
version: "0.1"
## without user
- scm: git
src: ssh://gitlab.company.com/testGroup/testProject2.git
version: "0.1"
## with custom port
- scm: git
src: ssh://git@gitlab.company.com:23/testGroup/testProject3.git
version: "3.1"
# include
- include: <path_to_requirements>/webserver.yml
......
......@@ -43,6 +43,24 @@ Array [
"depName": "mygroup/ansible-base",
"lookupName": "git@gitlab.company.com:mygroup/ansible-base.git",
},
Object {
"currentValue": "0.1",
"datasource": "git-tags",
"depName": "testGroup/testProject",
"lookupName": "ssh://git@gitlab.company.com/testGroup/testProject.git",
},
Object {
"currentValue": "0.1",
"datasource": "git-tags",
"depName": "testGroup/testProject2",
"lookupName": "ssh://gitlab.company.com/testGroup/testProject2.git",
},
Object {
"currentValue": "3.1",
"datasource": "git-tags",
"depName": "testGroup/testProject3",
"lookupName": "ssh://git@gitlab.company.com:23/testGroup/testProject3.git",
},
Object {
"currentValue": "0.14",
"datasource": "git-tags",
......
......@@ -22,7 +22,7 @@ describe('lib/manager/ansible-galaxy/extract', () => {
it('extracts multiple dependencies from requirements.yml', () => {
const res = extractPackageFile(yamlFile1);
expect(res.deps).toMatchSnapshot();
expect(res.deps).toHaveLength(6);
expect(res.deps).toHaveLength(9);
});
it('extracts dependencies from a not beautified requirements file', () => {
const res = extractPackageFile(yamlFile2);
......
......@@ -47,7 +47,7 @@ function finalize(dependency: PackageDependency): boolean {
const source: string = dep.managerData.src;
const sourceMatch: RegExpMatchArray = new RegExp(
/^(git|http|git\+http)s?(:\/\/|@).*(\/|:)(.+\/[^.]+)\/?(\.git)?$/
/^(git|http|git\+http|ssh)s?(:\/\/|@).*(\/|:)(.+\/[^.]+)\/?(\.git)?$/
).exec(source);
if (sourceMatch) {
dep.datasource = datasourceGitTags.id;
......
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