Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
add variable format warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yradsmikham committed Apr 15, 2020
1 parent a94319e commit 4194aaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/commands/service/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export interface CommandValues extends CommandOptions {
serviceVariablesArray: string[];
}

export const validUpperUnderscoreCase = (segment: string): boolean => {
return !!segment.match(/^[A-Z0-9_]+$/);
};

export const fetchValues = (opts: CommandOptions): CommandValues => {
if (!isPortNumberString(opts.k8sBackendPort)) {
throw Error("value for --k8s-service-port is not a valid port number");
Expand All @@ -82,6 +86,12 @@ export const fetchValues = (opts: CommandOptions): CommandValues => {
.map((str) => str.trim());
}

serviceVariablesArray.forEach(function (r) {
if (!validUpperUnderscoreCase(r)) {
logger.warn(`${r} is not in a valid format. Valid strings include only uppercases, numbers, and underscores.`);
}
});

const values: CommandValues = {
gitPush: opts.gitPush,
helmChartChart: opts.helmChartChart,
Expand Down
2 changes: 0 additions & 2 deletions src/lib/fileutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ export const serviceBuildAndUpdatePipeline = (
const relativeServiceForDockerfile = relServicePath.startsWith("./")
? relServicePath
: "./" + relServicePath;
// const test = (serviceBuildVariables ?? []).map((group) => ({ group }));
// logger.info(`${test}`);

const pipelineYaml: AzurePipelinesYaml = {
trigger: {
Expand Down

0 comments on commit 4194aaf

Please sign in to comment.