Skip to content

Commit

Permalink
Fixes naming error for default fallbacks in harbor scanner matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
bomoko committed Oct 23, 2020
1 parent 982cfe0 commit 3d61f61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions services/api/src/resources/problem/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const addProblemHarborScanMatch = async (
description,
defaultLagoonProject,
defaultLagoonEnvironment,
defaultLagoonServiceName,
defaultLagoonService,
regex
},
},
Expand All @@ -219,7 +219,7 @@ export const addProblemHarborScanMatch = async (
description,
default_lagoon_project: defaultLagoonProject,
default_lagoon_environment: defaultLagoonEnvironment,
default_lagoon_service_name: defaultLagoonServiceName,
default_lagoon_service_name: defaultLagoonService,
regex
}
),
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/resources/problem/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const standardProblemHarborScanMatchReturn = {
description: 'description',
default_lagoon_project: 'defaultLagoonProject',
default_lagoon_environment: 'defaultLagoonEnvironment',
default_lagoon_service_name: 'defaultLagoonServiceName',
default_lagoon_service: 'defaultLagoonServiceName',
regex: 'regex'
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,10 @@ const matchRepositoryAgainstPatterns = (repoFullName, matchPatterns = []) => {
}

const matchPatternDetails = matchingRes.pop() || DEFAULT_REPO_DETAILS_MATCHER;

const {
lagoonProjectName = matchPatternDetails.defaultProjectName,
lagoonEnvironmentName = matchPatternDetails.defaultEnvironmentName,
lagoonServiceName = matchPatternDetails.defaultServiceName,
lagoonProjectName = matchPatternDetails.defaultLagoonProject,
lagoonEnvironmentName = matchPatternDetails.defaultLagoonEnvironment,
lagoonServiceName = matchPatternDetails.defaultLagoonService,
} = extractRepositoryDetailsGivenRegex(repoFullName, matchPatternDetails.regex);

return {lagoonProjectName, lagoonEnvironmentName, lagoonServiceName};
Expand All @@ -190,7 +189,7 @@ const generateRegex = R.memoizeWith(R.identity, re => new RegExp(re));
const extractRepositoryDetailsGivenRegex = (repoFullName, pattern = DEFAULT_REPO_DETAILS_REGEX) => {
const re = generateRegex(pattern);
const match = re.exec(repoFullName);
return match.groups;
return match.groups || {};
}

const generateWebhookData = (
Expand Down

0 comments on commit 3d61f61

Please sign in to comment.