Skip to content
Snippets Groups Projects
Commit 21b0cb40 authored by joel.vonderwe's avatar joel.vonderwe
Browse files

Test sonar qualities before creating assignment

parent c126a1d1
No related branches found
No related tags found
No related merge requests found
Pipeline #32210 passed
...@@ -96,6 +96,20 @@ class AssignmentCreateCommand extends CommanderCommand { ...@@ -96,6 +96,20 @@ class AssignmentCreateCommand extends CommanderCommand {
languagesSpinner.succeed(`Language "${ options.language }" is supported`); 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 ) { if ( options.template ) {
templateIdOrNamespace = options.template; templateIdOrNamespace = options.template;
......
...@@ -254,6 +254,15 @@ class DojoBackendManager { ...@@ -254,6 +254,15 @@ class DojoBackendManager {
const resp = await axios.get<DojoBackendResponse<string[]>>(this.getApiUrl(ApiRoute.LANGUAGES)); const resp = await axios.get<DojoBackendResponse<string[]>>(this.getApiUrl(ApiRoute.LANGUAGES));
return resp.data.data; 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;
}
} }
......
Subproject commit 102e79d9b78d79e495f7b82e5e767eb7898248db Subproject commit 4d1e63ebbbe7e6fec1de74d79a2919047eea5775
Subproject commit 76e13d9d08d52d31ece9a58645ac113c51132c71 Subproject commit b54af90977a928488d2346fe95635aef567dfacc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment