this.newStep('REQUIREMENTS_CHECKING','Please wait while we are checking requirements...');
@@ -98,7 +102,7 @@ class AssignmentValidator {
awaitexecAsync(`docker ps`);
}catch (error){
this.emitError(`Docker daemon isn't running`,`Some requirements are not satisfied.`,AssignmentCheckerError.DOCKER_DAEMON_NOT_RUNNING);
return;
thrownewError();
}
this.endSubStep('Docker daemon is running',false);
@@ -110,7 +114,7 @@ class AssignmentValidator {
if (missingFiles.length>0){
this.emitError(`The exercise folder is missing the following files: ${missingFiles.map((file:[string,boolean])=>file[0]).join(', ')}`,'Some requirements are not satisfied',AssignmentCheckerError.REQUIRED_FILES_MISSING);
this.emitError(`dojo_assignment.json file schema is invalid.\nHere are the errors:\n${validationResults.error}`,'dojo_assignment.json file is invalid',AssignmentCheckerError.ASSIGNMENT_FILE_SCHEMA_ERROR);
return;
this.emitError(`dojo_assignment.json file schema is invalid.\nHere are the errors:\n${validationResults.error}`,assignmentFileValidationError,AssignmentCheckerError.ASSIGNMENT_FILE_SCHEMA_ERROR);
thrownewError();
}
assignmentFile=validationResults.content!;
this.assignmentFile=validationResults.content!;
this.endSubStep('dojo_assignment.json file schema is valid',false);
// Immutable files validation (Check if exists and if the given type is correct)
this.emitError(`Immutable (${immutable.path}) is declared as a file but is a directory.`,'dojo_assignment.json file is invalid',AssignmentCheckerError.IMMUTABLE_PATH_IS_NOT_DIRECTORY);
return;
this.emitError(`Immutable (${immutable.path}) is declared as a file but is a directory.`,assignmentFileValidationError,AssignmentCheckerError.IMMUTABLE_PATH_IS_NOT_DIRECTORY);
this.emitError(`Immutable (${immutable.path}) is declared as a directory but is a file.`,'dojo_assignment.json file is invalid',AssignmentCheckerError.IMMUTABLE_PATH_IS_DIRECTORY);
return;
this.emitError(`Immutable (${immutable.path}) is declared as a directory but is a file.`,assignmentFileValidationError,AssignmentCheckerError.IMMUTABLE_PATH_IS_DIRECTORY);
thrownewError();
}
}
this.endSubStep('Immutable files are valid',false);
@@ -163,23 +168,24 @@ class AssignmentValidator {
this.endStep('dojo_assignment.json file is valid',false);
if (!(assignmentFile.result.containerindockerComposeFile!.services)){
this.emitError(`Container specified in ${ClientsSharedConfig.assignment.filename} is missing from compose file.`,'Docker compose file is invalid',AssignmentCheckerError.COMPOSE_FILE_CONTAINER_MISSING);
return;
if (!(this.assignmentFile.result.containerinthis.dockerComposeFile.services)){
this.emitError(`Container specified in ${ClientsSharedConfig.assignment.filename} is missing from compose file.`,composeFileValidationError,AssignmentCheckerError.COMPOSE_FILE_CONTAINER_MISSING);
thrownewError();
}
if (assignmentFile.result.volume&&(!dockerComposeFile!.volumes||!(assignmentFile.result.volumeindockerComposeFile!.volumes))){
this.emitError(`Volume specified in ${ClientsSharedConfig.assignment.filename} is missing from compose file.`,'Docker compose file is invalid',AssignmentCheckerError.COMPOSE_FILE_VOLUME_MISSING);
return;
if (this.assignmentFile.result.volume&&(!this.dockerComposeFile.volumes||!(this.assignmentFile.result.volumeinthis.dockerComposeFile.volumes))){
this.emitError(`Volume specified in ${ClientsSharedConfig.assignment.filename} is missing from compose file.`,composeFileValidationError,AssignmentCheckerError.COMPOSE_FILE_VOLUME_MISSING);
thrownewError();
}
this.endSubStep('Docker compose file content is valid',false);
@@ -216,22 +222,22 @@ class AssignmentValidator {
this.endStep('Docker compose file is valid',false);
this.emitError(`Dockerfiles not found: ${filesNotFound.join(', ')}`,'Dockerfiles are invalid',AssignmentCheckerError.DOCKERFILE_NOT_FOUND);
return;
thrownewError();
}
this.endSubStep('Docker compose file content is valid',false);
@@ -239,16 +245,16 @@ class AssignmentValidator {
this.endStep('Dockerfiles are valid',false);
}
/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////// Step 5: Run
- Make a run of the assignment (If the return code is 0, the assignment is not valid because it means that there no need of modification for succeed the exercise)
/**
* Step 5: Run
* - Make a run of the assignment (If the return code is 0, the assignment is not valid because it means that there no need of modification for succeed the exercise)
* @private
*/
{
privateasyncrunAssignment(){
this.newStep('ASSIGNMENT_RUN','Please wait while we are running the assignment...');