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

Add users to sonar projects and show url

parent e31d7a81
No related branches found
No related tags found
No related merge requests found
Pipeline #33353 passed
......@@ -27,7 +27,8 @@ class AssignmentCreateCommand extends CommanderCommand {
.action(this.commandAction.bind(this));
if (SharedConfig.sonar.enabled) {
this.command.requiredOption('-s, --sonar', 'add sonar to the code checking process for exercises derived from the assignment')
this.command.requiredOption('-s, --sonar', 'add sonar to the code checking process for assignment and exercises')
.requiredOption('-d, --no-sonar', 'disable sonar for the code checking process for assignment and exercises')
.addOption(new Option('-g, --gate <gate>', 'quality gate for sonar').implies({sonar: true}))
.addOption(new Option('-p, --profile <profile...>', 'quality profiles for sonar').default([]).implies({sonar: true}));
}
......@@ -141,6 +142,9 @@ class AssignmentCreateCommand extends CommanderCommand {
oraInfo(`${ chalk.magenta('Web URL:') } ${ assignment.gitlabCreationInfo.web_url }`);
oraInfo(`${ chalk.magenta('HTTP Repo:') } ${ assignment.gitlabCreationInfo.http_url_to_repo }`);
oraInfo(`${ chalk.magenta('SSH Repo:') } ${ assignment.gitlabCreationInfo.ssh_url_to_repo }`);
if (assignment.useSonar) {
oraInfo(`${ chalk.magenta('Sonar project:') } ${SharedConfig.sonar.url}/dashboard?id=${ assignment.sonarKey }`);
}
} catch ( error ) {
return;
}
......
......@@ -7,6 +7,7 @@ import DojoBackendManager from '../../../managers/DojoBackendManager';
import AccessesHelper from '../../../helpers/AccessesHelper';
import Assignment from '../../../sharedByClients/models/Assignment';
import Exercise from '../../../sharedByClients/models/Exercise';
import SharedConfig from '../../../shared/config/SharedConfig';
class ExerciseCreateCommand extends CommanderCommand {
......@@ -82,6 +83,9 @@ class ExerciseCreateCommand extends CommanderCommand {
oraInfo(`${ chalk.magenta('Web URL:') } ${ exercise.gitlabCreationInfo.web_url }`);
oraInfo(`${ chalk.magenta('HTTP Repo:') } ${ exercise.gitlabCreationInfo.http_url_to_repo }`);
oraInfo(`${ chalk.magenta('SSH Repo:') } ${ exercise.gitlabCreationInfo.ssh_url_to_repo }`);
if (assignment.useSonar) {
oraInfo(`${ chalk.magenta('Sonar project:') } ${SharedConfig.sonar.url}/dashboard?id=${ exercise.sonarKey }`);
}
} catch ( error ) {
return;
}
......
......@@ -10,6 +10,7 @@ import Exercise from '../sharedByClients/models/Exercise';
import GitlabToken from '../shared/types/Gitlab/GitlabToken';
import User from '../sharedByClients/models/User';
import DojoStatusCode from '../shared/types/Dojo/DojoStatusCode';
import SharedConfig from '../shared/config/SharedConfig';
class DojoBackendManager {
......@@ -113,6 +114,8 @@ class DojoBackendManager {
} else {
if ( (error.response.data as DojoBackendResponse<unknown>).code === DojoStatusCode.ASSIGNMENT_CREATION_GITLAB_ERROR ) {
spinner.fail(`Assignment creation error: An unknown error occurred while creating the assignment on Gitlab. Please try again later or contact an administrator.`);
} else if ( (error.response.data as DojoBackendResponse<unknown>).code === DojoStatusCode.ASSIGNMENT_CREATION_SONAR_MEMBER ) {
spinner.fail(`Tous les membres du projet doivent s'être connectés une première fois à SonarQube avec leurs identifiants Gitlab pour pouvoir créer le projet.\nURL: ${SharedConfig.sonar.url}/`);
} else {
spinner.fail(`Assignment creation error: An unknown error occurred while creating the assignment on Dojo server. Please try again later or contact an administrator.`);
}
......@@ -155,6 +158,8 @@ class DojoBackendManager {
} else {
if ( (error.response.data as DojoBackendResponse<unknown>).code === DojoStatusCode.EXERCISE_CREATION_GITLAB_ERROR ) {
spinner.fail(`Exercise creation error: An unknown error occurred while creating the exercise on Gitlab. Please try again later or contact an administrator.`);
} else if ( (error.response.data as DojoBackendResponse<unknown>).code === DojoStatusCode.ASSIGNMENT_CREATION_SONAR_MEMBER ) {
spinner.fail(`Tous les membres du projet doivent s'être connectés une première fois à SonarQube avec leurs identifiants Gitlab pour pouvoir créer le projet.\nURL: ${SharedConfig.sonar.url}/`);
} else {
spinner.fail(`Exercise creation error: An unknown error occurred while creating the exercise on Dojo server. Please try again later or contact an administrator.`);
}
......
Subproject commit bd29fe76fdb1b124e3fe2f23e995a2b3b70694a7
Subproject commit 8efab438a60569011f2757c803a89c81bc46a174
Subproject commit 41b3d88544eb46171acf36b4fd61332c33db5bf8
Subproject commit d15be9b16181f5f172d51b13966e0e44bd34f55d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment