Skip to content

Commit

Permalink
refactor: Remove depnameShort of terra* and kustomize (#8388)
Browse files Browse the repository at this point in the history
  • Loading branch information
secustor committed Feb 5, 2021
1 parent 8eccebc commit 3270c30
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 82 deletions.
2 changes: 0 additions & 2 deletions lib/manager/kustomize/__snapshots__/extract.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ Array [
"currentValue": "v0.0.1",
"datasource": "git-tags",
"depName": "moredhel/remote-kustomize",
"depNameShort": "moredhel/remote-kustomize",
"lookupName": "https://moredhel/remote-kustomize.git",
},
Object {
"currentValue": "v0.0.1",
"datasource": "git-tags",
"depName": "moredhel/remote-kustomize",
"depNameShort": "moredhel/remote-kustomize",
"lookupName": "https://moredhel/remote-kustomize.git",
},
]
Expand Down
2 changes: 0 additions & 2 deletions lib/manager/kustomize/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ describe('manager/kustomize/extract', () => {
currentValue: 'v1.2.3',
datasource: datasourceGitTags.id,
depName: 'bitbucket.com/user/test-repo',
depNameShort: 'user/test-repo',
lookupName: 'ssh://git@bitbucket.com/user/test-repo',
});
});
Expand All @@ -98,7 +97,6 @@ describe('manager/kustomize/extract', () => {
currentValue: 'v1.2.3',
datasource: datasourceGitTags.id,
depName: 'bitbucket.com/user/test-repo',
depNameShort: 'user/test-repo',
lookupName: 'ssh://git@bitbucket.com/user/test-repo',
});
});
Expand Down
1 change: 0 additions & 1 deletion lib/manager/kustomize/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export function extractBase(base: string): PackageDependency | null {
return {
datasource: datasourceGitTags.id,
depName: match.groups.path.replace('.git', ''),
depNameShort: match.groups.project.replace('.git', ''),
lookupName: match.groups.url,
currentValue: match.groups.currentValue,
};
Expand Down
40 changes: 0 additions & 40 deletions lib/manager/terraform/__snapshots__/extract.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Object {
"currentValue": "1.0.1",
"datasource": "helm",
"depName": "redis",
"depNameShort": "redis",
"depType": "helm",
"registryUrls": Array [
"https://charts.helm.sh/stable",
Expand All @@ -16,7 +15,6 @@ Object {
Object {
"datasource": "helm",
"depName": "redis",
"depNameShort": "redis",
"depType": "helm",
"registryUrls": Array [
"https://charts.helm.sh/stable",
Expand All @@ -25,7 +23,6 @@ Object {
Object {
"datasource": "helm",
"depName": "./charts/example",
"depNameShort": "./charts/example",
"depType": "helm",
"registryUrls": Array [
undefined,
Expand All @@ -36,7 +33,6 @@ Object {
"currentValue": "4.0.1",
"datasource": "helm",
"depName": undefined,
"depNameShort": undefined,
"depType": "helm",
"registryUrls": Array [
"https://charts.helm.sh/stable",
Expand All @@ -47,7 +43,6 @@ Object {
"currentValue": "5.0.1",
"datasource": "helm",
"depName": "redis",
"depNameShort": "redis",
"depType": "helm",
"registryUrls": Array [
"https://charts.helm.sh/stable",
Expand All @@ -57,7 +52,6 @@ Object {
"currentValue": "6.0.1",
"datasource": "helm",
"depName": "redis",
"depNameShort": "redis",
"depType": "helm",
"registryUrls": Array [
undefined,
Expand All @@ -74,91 +68,79 @@ Object {
"currentValue": "v1.0.0",
"datasource": "github-tags",
"depName": "github.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "github",
"lookupName": "hashicorp/example",
},
Object {
"currentValue": "next",
"datasource": "github-tags",
"depName": "github.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "github",
"lookupName": "hashicorp/example",
},
Object {
"currentValue": "tfmodule_one-v0.0.9",
"datasource": "github-tags",
"depName": "github.com/githubuser/myrepo",
"depNameShort": "githubuser/myrepo",
"depType": "github",
"lookupName": "githubuser/myrepo",
},
Object {
"currentValue": "v1.0.0",
"datasource": "github-tags",
"depName": "github.com/hashicorp/example.2.3",
"depNameShort": "hashicorp/example.2.3",
"depType": "github",
"lookupName": "hashicorp/example.2.3",
},
Object {
"currentValue": "v1.0.0",
"datasource": "github-tags",
"depName": "github.com/hashicorp/example.2.3",
"depNameShort": "hashicorp/example.2.3",
"depType": "github",
"lookupName": "hashicorp/example.2.3",
},
Object {
"currentValue": "0.1.0",
"datasource": "terraform-module",
"depName": "hashicorp/consul/aws",
"depNameShort": "hashicorp/consul/aws",
"depType": "terraform",
},
Object {
"currentValue": "v0.1.0",
"datasource": "github-tags",
"depName": "github.com/tieto-cem/terraform-aws-ecs-task-definition",
"depNameShort": "tieto-cem/terraform-aws-ecs-task-definition",
"depType": "github",
"lookupName": "tieto-cem/terraform-aws-ecs-task-definition",
},
Object {
"currentValue": "v0.1.0",
"datasource": "github-tags",
"depName": "github.com/tieto-cem/terraform-aws-ecs-task-definition",
"depNameShort": "tieto-cem/terraform-aws-ecs-task-definition",
"depType": "github",
"lookupName": "tieto-cem/terraform-aws-ecs-task-definition",
},
Object {
"currentValue": "v2.0.0",
"datasource": "github-tags",
"depName": "github.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "github",
"lookupName": "hashicorp/example",
},
Object {
"datasource": "terraform-module",
"depName": "terraform-aws-modules/security-group/aws",
"depNameShort": "terraform-aws-modules/security-group/aws",
"depType": "terraform",
},
Object {
"currentValue": "<= 2.4.0",
"datasource": "terraform-module",
"depName": "terraform-aws-modules/security-group/aws",
"depNameShort": "terraform-aws-modules/security-group/aws",
"depType": "terraform",
},
Object {
"currentValue": "~> 1.1.0",
"datasource": "terraform-module",
"depName": "app.terraform.io/example-corp/k8s-cluster/azurerm",
"depNameShort": "app.terraform.io/example-corp/k8s-cluster/azurerm",
"depType": "terraform",
"registryUrls": Array [
"https://app.terraform.io",
Expand All @@ -168,7 +150,6 @@ Object {
"currentValue": "~> 1.1",
"datasource": "terraform-module",
"depName": "app.terraform.io/example-corp/k8s-cluster/azurerm",
"depNameShort": "app.terraform.io/example-corp/k8s-cluster/azurerm",
"depType": "terraform",
"registryUrls": Array [
"https://app.terraform.io",
Expand All @@ -178,7 +159,6 @@ Object {
"currentValue": "~~ 1.1",
"datasource": "terraform-module",
"depName": "app.terraform.io/example-corp/k8s-cluster/azurerm",
"depNameShort": "app.terraform.io/example-corp/k8s-cluster/azurerm",
"depType": "terraform",
"registryUrls": Array [
"https://app.terraform.io",
Expand All @@ -188,7 +168,6 @@ Object {
"currentValue": ">= 1.0.0, <= 2.0.0",
"datasource": "terraform-module",
"depName": "hashicorp/consul/aws",
"depNameShort": "hashicorp/consul/aws",
"depType": "terraform",
},
Object {
Expand All @@ -201,103 +180,89 @@ Object {
"currentValue": "1.36.1",
"datasource": "terraform-provider",
"depName": "azurerm",
"depNameShort": "azurerm",
"depType": "terraform",
},
Object {
"currentValue": "=2.4",
"datasource": "terraform-provider",
"depName": "gitlab",
"depNameShort": "gitlab",
"depType": "terraform",
},
Object {
"currentValue": "=1.3",
"datasource": "terraform-provider",
"depName": "gitlab",
"depNameShort": "gitlab",
"depType": "terraform",
},
Object {
"datasource": "terraform-provider",
"depName": "helm",
"depNameShort": "helm",
"depType": "terraform",
},
Object {
"currentValue": "V1.9",
"datasource": "terraform-provider",
"depName": "newrelic",
"depNameShort": "newrelic",
"depType": "terraform",
},
Object {
"currentValue": "v1.0.0",
"datasource": "git-tags",
"depName": "bitbucket.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "gitTags",
"lookupName": "https://bitbucket.com/hashicorp/example",
},
Object {
"currentValue": "v1.0.0",
"datasource": "git-tags",
"depName": "bitbucket.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "gitTags",
"lookupName": "https://bitbucket.com/hashicorp/example",
},
Object {
"currentValue": "next",
"datasource": "git-tags",
"depName": "bitbucket.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "gitTags",
"lookupName": "https://bitbucket.com/hashicorp/example",
},
Object {
"currentValue": "v1.0.1",
"datasource": "git-tags",
"depName": "bitbucket.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "gitTags",
"lookupName": "https://bitbucket.com/hashicorp/example",
},
Object {
"currentValue": "v1.0.2",
"datasource": "git-tags",
"depName": "bitbucket.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "gitTags",
"lookupName": "http://bitbucket.com/hashicorp/example",
},
Object {
"currentValue": "v1.0.3",
"datasource": "git-tags",
"depName": "bitbucket.com/hashicorp/example",
"depNameShort": "hashicorp/example",
"depType": "gitTags",
"lookupName": "ssh://git@bitbucket.com/hashicorp/example",
},
Object {
"currentValue": ">= 2.7.0",
"datasource": "terraform-provider",
"depName": "aws",
"depNameShort": "aws",
"depType": "terraform",
},
Object {
"currentValue": ">= 2.0.0",
"datasource": "terraform-provider",
"depName": "azurerm",
"depNameShort": "azurerm",
"depType": "terraform",
},
Object {
"currentValue": "2.7.2",
"datasource": "terraform-provider",
"depName": "docker",
"depNameShort": "docker",
"depType": "terraform",
"registryUrls": Array [
"https://releases.hashicorp.com",
Expand All @@ -307,38 +272,33 @@ Object {
"currentValue": "2.7.0",
"datasource": "terraform-provider",
"depName": "aws",
"depNameShort": "aws",
"depType": "terraform",
"lookupName": "aws",
},
Object {
"currentValue": "=2.27.0",
"datasource": "terraform-provider",
"depName": "azurerm",
"depNameShort": "azurerm",
"depType": "terraform",
},
Object {
"currentValue": "1.2.4",
"datasource": "terraform-provider",
"depName": "invalid",
"depNameShort": "invalid",
"depType": "terraform",
"skipReason": "unsupported-url",
},
Object {
"currentValue": "1.2.4",
"datasource": "terraform-provider",
"depName": "helm",
"depNameShort": "helm",
"depType": "terraform",
"lookupName": "hashicorp/helm",
},
Object {
"currentValue": ">= 1.0",
"datasource": "terraform-provider",
"depName": "kubernetes",
"depNameShort": "kubernetes",
"depType": "terraform",
"lookupName": "hashicorp/kubernetes",
"registryUrls": Array [
Expand Down
9 changes: 2 additions & 7 deletions lib/manager/terraform/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,20 @@ export function analyseTerraformModule(dep: PackageDependency): void {
const gitTagsRefMatch = gitTagsRefMatchRegex.exec(dep.managerData.source);
/* eslint-disable no-param-reassign */
if (githubRefMatch) {
const depNameShort = githubRefMatch.groups.project.replace(/\.git$/, '');
dep.lookupName = githubRefMatch.groups.project.replace(/\.git$/, '');
dep.depType = 'github';
dep.depName = 'github.com/' + depNameShort;
dep.depNameShort = depNameShort;
dep.depName = 'github.com/' + dep.lookupName;
dep.currentValue = githubRefMatch.groups.tag;
dep.datasource = datasourceGithubTags.id;
dep.lookupName = depNameShort;
} else if (gitTagsRefMatch) {
dep.depType = 'gitTags';
if (gitTagsRefMatch.groups.path.includes('//')) {
logger.debug('Terraform module contains subdirectory');
dep.depName = gitTagsRefMatch.groups.path.split('//')[0];
dep.depNameShort = dep.depName.split(/\/(.+)/)[1];
const tempLookupName = gitTagsRefMatch.groups.url.split('//');
dep.lookupName = tempLookupName[0] + '//' + tempLookupName[1];
} else {
dep.depName = gitTagsRefMatch.groups.path.replace('.git', '');
dep.depNameShort = gitTagsRefMatch.groups.project.replace('.git', '');
dep.lookupName = gitTagsRefMatch.groups.url;
}
dep.currentValue = gitTagsRefMatch.groups.tag;
Expand All @@ -62,7 +58,6 @@ export function analyseTerraformModule(dep: PackageDependency): void {
}
dep.depType = 'terraform';
dep.depName = moduleParts.join('/');
dep.depNameShort = dep.depName;
dep.datasource = datasourceTerraformModule.id;
}
} else {
Expand Down
1 change: 0 additions & 1 deletion lib/manager/terraform/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export function analyzeTerraformProvider(dep: PackageDependency): void {
/* eslint-disable no-param-reassign */
dep.depType = 'terraform';
dep.depName = dep.managerData.moduleName;
dep.depNameShort = dep.managerData.moduleName;
dep.datasource = datasourceTerraformProvider.id;

if (is.nonEmptyString(dep.managerData.source)) {
Expand Down
1 change: 0 additions & 1 deletion lib/manager/terraform/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export function analyseTerraformResource(
dep.depType = 'helm';
dep.registryUrls = [dep.managerData.repository];
dep.depName = dep.managerData.chart;
dep.depNameShort = dep.managerData.chart;
dep.datasource = datasourceHelm.id;
break;

Expand Down

0 comments on commit 3270c30

Please sign in to comment.