diff --git a/lib/modules/manager/terragrunt/__fixtures__/2.hcl b/lib/modules/manager/terragrunt/__fixtures__/2.hcl index 2141ad2d1cbdc3..ac753da5b3a8ac 100644 --- a/lib/modules/manager/terragrunt/__fixtures__/2.hcl +++ b/lib/modules/manager/terragrunt/__fixtures__/2.hcl @@ -182,7 +182,7 @@ terraform { # gitlab-tags ssh with custom port terraform { - source = "git::ssh://gitlab.com:1234/hashicorp/example?ref=v1.0.2" + source = "git::ssh://gitlab.com:1234/hashicorp/example.git?ref=v1.0.2" } # gitea-tags diff --git a/lib/modules/manager/terragrunt/__fixtures__/3.hcl b/lib/modules/manager/terragrunt/__fixtures__/3.hcl index 7e6967d5e3a41c..b33f8d4fedfc02 100644 --- a/lib/modules/manager/terragrunt/__fixtures__/3.hcl +++ b/lib/modules/manager/terragrunt/__fixtures__/3.hcl @@ -182,7 +182,7 @@ terraform { # gitlab-tags ssh with custom port terraform { - source = "git::ssh://gitlab.com:1234/hashicorp/example?ref=v1.0.2" + source = "git::ssh://gitlab.com:1234/hashicorp/example.git?ref=v1.0.2" } # gitea-tags diff --git a/lib/modules/manager/terragrunt/__fixtures__/4.hcl b/lib/modules/manager/terragrunt/__fixtures__/4.hcl index 6bce778dea0630..42a0a46e47944d 100644 --- a/lib/modules/manager/terragrunt/__fixtures__/4.hcl +++ b/lib/modules/manager/terragrunt/__fixtures__/4.hcl @@ -183,7 +183,7 @@ terraform { # gitlab-tags ssh with custom port terraform { - source = "git::ssh://gitlab.com:1234/hashicorp/example?ref=v1.0.2" + source = "git::ssh://gitlab.com:1234/hashicorp/example.git?ref=v1.0.2" } # gitea-tags diff --git a/lib/modules/manager/terragrunt/modules.ts b/lib/modules/manager/terragrunt/modules.ts index 3b9821460086c6..665966c0295689 100644 --- a/lib/modules/manager/terragrunt/modules.ts +++ b/lib/modules/manager/terragrunt/modules.ts @@ -76,7 +76,7 @@ export function analyseTerragruntModule( } dep.depType = 'gitTags'; // We don't want to have .git or subdirectory in the depName - dep.depName = `${hostname}${pathname.split('//')[0].replace('.git', '')}`; + dep.depName = `${hostname}${pathname.split('//')[0].replace(regEx('.git$'), '')}`; dep.currentValue = tag; dep.datasource = detectGitTagDatasource(url); if (dep.datasource === GitTagsDatasource.id) { @@ -87,7 +87,10 @@ export function analyseTerragruntModule( } } else { // The packageName should only contain the path to the repository - dep.packageName = pathname.replace(/^\//, '').split('//')[0]; + dep.packageName = pathname + .replace(regEx(/^\//), '') + .replace(regEx('.git$'), '') + .split('//')[0]; dep.registryUrls = [ protocol === 'https:' ? `https://${host}` : `https://${hostname}`, ];