Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added deprecated runner validation #426

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/lib/jsonvalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var fs = require("fs");
var check = require("validator");
var trace = require("./trace");

const deprecatedRunners = ["Node6"];

/*
* Checks a json file for correct formatting against some validation function
* @param jsonFilePath path to the json file being validated
Expand Down Expand Up @@ -36,6 +38,7 @@ export function validate(jsonFilePath: string, jsonMissingErrorMessage?: string)
}

trace.debug("Json is valid.");
validateRunner(taskJson);
deferred.resolve(taskJson);
return <any>deferred.promise;
}
Expand All @@ -50,6 +53,20 @@ export function exists(path: string, errorMessage: string) {
}
}

/*
* Validates a task against deprecated runner
* @param taskData the parsed json file
*/
export function validateRunner(taskData: any) {
if(taskData == undefined || taskData.execution == undefined)
return

const validRunnerCount = Object.keys(taskData.execution).filter(itm=> deprecatedRunners.indexOf(itm) == -1) || 0;
if(validRunnerCount == 0){
trace.warn("Task %s is dependent on a task runner that is end-of-life and will be removed in the future. Authors should review Node upgrade guidance: https://aka.ms/node-runner-guidance.",taskData.name)
}
}

/*
* Validates a parsed json file describing a build task
* @param taskPath the path to the original json file
Expand Down