diff --git a/NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts b/NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts index af5395e8563430016fc5495f854a9cf35f3b9101..79fd5e41c3499773aa64acd9440785d96ba22c77 100644 --- a/NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts +++ b/NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts @@ -96,6 +96,20 @@ class AssignmentCreateCommand extends CommanderCommand { languagesSpinner.succeed(`Language "${ options.language }" is supported`); + if ((sonarGate ?? "") !== "" || sonarProfiles.length > 0) { + const qualitiesSpinner: ora.Ora = ora('Checking sonar qualities').start(); + + // SonarQube quality gate and profiles + const result = await DojoBackendManager.testSonarQualities(sonarGate ?? "", sonarProfiles); + if (!result.valid) { + const invalid = (result.badGate == undefined ? result.badProfiles : [result.badGate, ...result.badProfiles]); + qualitiesSpinner.fail(`Invalid quality gate or profiles : ${invalid}`); + return; + } + + qualitiesSpinner.succeed(`Quality gate and profiles are valid`); + } + if ( options.template ) { templateIdOrNamespace = options.template; diff --git a/NodeApp/src/managers/DojoBackendManager.ts b/NodeApp/src/managers/DojoBackendManager.ts index a3467585a829827626911ce71566d5ab21172874..46e7c6a6ef0ddc6338000db2d32de6633e1e9af4 100644 --- a/NodeApp/src/managers/DojoBackendManager.ts +++ b/NodeApp/src/managers/DojoBackendManager.ts @@ -254,6 +254,15 @@ class DojoBackendManager { const resp = await axios.get<DojoBackendResponse<string[]>>(this.getApiUrl(ApiRoute.LANGUAGES)); return resp.data.data; } + + public async testSonarQualities(gate: string, profiles: string[]) { + const resp = await axios.post<DojoBackendResponse<{ valid: boolean, badProfiles: string[], badGate: string | undefined }>>( + this.getApiUrl(ApiRoute.SONAR_QUALITIES), { + gate: gate, + profiles: profiles, + }); + return resp.data.data; + } } diff --git a/NodeApp/src/shared b/NodeApp/src/shared index 102e79d9b78d79e495f7b82e5e767eb7898248db..4d1e63ebbbe7e6fec1de74d79a2919047eea5775 160000 --- a/NodeApp/src/shared +++ b/NodeApp/src/shared @@ -1 +1 @@ -Subproject commit 102e79d9b78d79e495f7b82e5e767eb7898248db +Subproject commit 4d1e63ebbbe7e6fec1de74d79a2919047eea5775 diff --git a/NodeApp/src/sharedByClients b/NodeApp/src/sharedByClients index 76e13d9d08d52d31ece9a58645ac113c51132c71..b54af90977a928488d2346fe95635aef567dfacc 160000 --- a/NodeApp/src/sharedByClients +++ b/NodeApp/src/sharedByClients @@ -1 +1 @@ -Subproject commit 76e13d9d08d52d31ece9a58645ac113c51132c71 +Subproject commit b54af90977a928488d2346fe95635aef567dfacc