Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoCLI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
UI
DojoCLI
Commits
a7082518
Commit
a7082518
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Plain Diff
Merge branch 'correct_compose_override_path' into v3.0.1
parents
ef8b72f3
c52ea10c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts
+22
-11
22 additions, 11 deletions
.../src/commander/exercise/subcommands/ExerciseRunCommand.ts
with
22 additions
and
11 deletions
NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts
+
22
−
11
View file @
a7082518
...
@@ -42,7 +42,8 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -42,7 +42,8 @@ class ExerciseRunCommand extends CommanderCommand {
private
displayExecutionLogs
()
{
private
displayExecutionLogs
()
{
ora
({
ora
({
text
:
`
${
chalk
.
magenta
(
'
Execution logs folder:
'
)
}
${
this
.
folderResultsVolume
}
`
,
indent
:
0
text
:
`
${
chalk
.
magenta
(
'
Execution logs folder:
'
)
}
${
this
.
folderResultsVolume
}
`
,
indent
:
0
}).
start
().
info
();
}).
start
().
info
();
}
}
...
@@ -66,13 +67,15 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -66,13 +67,15 @@ class ExerciseRunCommand extends CommanderCommand {
ora
({
ora
({
text
:
`Checking exercise content:`
,
indent
:
4
text
:
`Checking exercise content:`
,
indent
:
4
}).
start
().
info
();
}).
start
().
info
();
// Exercise folder
// Exercise folder
{
{
const
spinner
:
ora
.
Ora
=
ora
({
const
spinner
:
ora
.
Ora
=
ora
({
text
:
`Checking exercise folder`
,
indent
:
8
text
:
`Checking exercise folder`
,
indent
:
8
}).
start
();
}).
start
();
const
files
=
fs
.
readdirSync
(
options
.
path
);
const
files
=
fs
.
readdirSync
(
options
.
path
);
...
@@ -89,7 +92,8 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -89,7 +92,8 @@ class ExerciseRunCommand extends CommanderCommand {
// dojo_assignment.json validity
// dojo_assignment.json validity
{
{
const
spinner
:
ora
.
Ora
=
ora
({
const
spinner
:
ora
.
Ora
=
ora
({
text
:
`Checking
${
ClientsSharedConfig
.
assignment
.
filename
}
file`
,
indent
:
8
text
:
`Checking
${
ClientsSharedConfig
.
assignment
.
filename
}
file`
,
indent
:
8
}).
start
();
}).
start
();
const
validationResults
=
SharedAssignmentHelper
.
validateDescriptionFile
(
path
.
join
(
options
.
path
,
ClientsSharedConfig
.
assignment
.
filename
));
const
validationResults
=
SharedAssignmentHelper
.
validateDescriptionFile
(
path
.
join
(
options
.
path
,
ClientsSharedConfig
.
assignment
.
filename
));
...
@@ -108,7 +112,8 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -108,7 +112,8 @@ class ExerciseRunCommand extends CommanderCommand {
// Docker daemon
// Docker daemon
{
{
const
spinner
:
ora
.
Ora
=
ora
({
const
spinner
:
ora
.
Ora
=
ora
({
text
:
`Checking Docker daemon`
,
indent
:
4
text
:
`Checking Docker daemon`
,
indent
:
4
}).
start
();
}).
start
();
try
{
try
{
...
@@ -130,7 +135,7 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -130,7 +135,7 @@ class ExerciseRunCommand extends CommanderCommand {
let
composeFileOverride
:
string
[]
=
[];
let
composeFileOverride
:
string
[]
=
[];
const
composeOverridePath
:
string
=
path
.
join
(
localExercisePath
,
'
docker-compose-override.yml
'
);
const
composeOverridePath
:
string
=
path
.
join
(
localExercisePath
,
'
docker-compose-override.yml
'
);
if
(
haveResultsVolume
)
{
if
(
haveResultsVolume
)
{
const
composeOverride
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
../../../assets/docker-compose-override.yml
'
),
'
utf8
'
).
replace
(
'
{{VOLUME_NAME}}
'
,
assignmentFile
.
result
.
volume
!
).
replace
(
'
{{MOUNT_PATH}}
'
,
this
.
folderResultsExercise
);
const
composeOverride
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
../../../
../
assets/docker-compose-override.yml
'
),
'
utf8
'
).
replace
(
'
{{VOLUME_NAME}}
'
,
assignmentFile
.
result
.
volume
!
).
replace
(
'
{{MOUNT_PATH}}
'
,
this
.
folderResultsExercise
);
fs
.
writeFileSync
(
composeOverridePath
,
composeOverride
);
fs
.
writeFileSync
(
composeOverridePath
,
composeOverride
);
composeFileOverride
=
[
composeOverridePath
];
composeFileOverride
=
[
composeOverridePath
];
...
@@ -152,7 +157,8 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -152,7 +157,8 @@ class ExerciseRunCommand extends CommanderCommand {
exerciseDockerCompose
.
events
.
on
(
'
step
'
,
(
name
:
string
,
message
:
string
)
=>
{
exerciseDockerCompose
.
events
.
on
(
'
step
'
,
(
name
:
string
,
message
:
string
)
=>
{
spinner
=
ora
({
spinner
=
ora
({
text
:
message
,
indent
:
4
text
:
message
,
indent
:
4
}).
start
();
}).
start
();
if
(
options
.
verbose
&&
name
==
'
COMPOSE_RUN
'
)
{
if
(
options
.
verbose
&&
name
==
'
COMPOSE_RUN
'
)
{
...
@@ -164,7 +170,8 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -164,7 +170,8 @@ class ExerciseRunCommand extends CommanderCommand {
if
(
error
)
{
if
(
error
)
{
if
(
options
.
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
if
(
options
.
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
ora
({
ora
({
text
:
message
,
indent
:
4
text
:
message
,
indent
:
4
}).
start
().
fail
();
}).
start
().
fail
();
}
else
{
}
else
{
spinner
.
fail
(
message
);
spinner
.
fail
(
message
);
...
@@ -172,7 +179,8 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -172,7 +179,8 @@ class ExerciseRunCommand extends CommanderCommand {
}
else
{
}
else
{
if
(
options
.
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
if
(
options
.
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
ora
({
ora
({
text
:
message
,
indent
:
4
text
:
message
,
indent
:
4
}).
start
().
succeed
();
}).
start
().
succeed
();
}
else
{
}
else
{
spinner
.
succeed
(
message
);
spinner
.
succeed
(
message
);
...
@@ -210,7 +218,8 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -210,7 +218,8 @@ class ExerciseRunCommand extends CommanderCommand {
exerciseResultsValidation
.
events
.
on
(
'
step
'
,
(
name
:
string
,
message
:
string
)
=>
{
exerciseResultsValidation
.
events
.
on
(
'
step
'
,
(
name
:
string
,
message
:
string
)
=>
{
spinner
=
ora
({
spinner
=
ora
({
text
:
message
,
indent
:
4
text
:
message
,
indent
:
4
}).
start
();
}).
start
();
});
});
...
@@ -242,7 +251,9 @@ class ExerciseRunCommand extends CommanderCommand {
...
@@ -242,7 +251,9 @@ class ExerciseRunCommand extends CommanderCommand {
// Step 4: Display results + Volume location
// Step 4: Display results + Volume location
{
{
ClientsSharedExerciseHelper
.
displayExecutionResults
(
exerciseResultsValidation
.
exerciseResults
!
,
exerciseDockerCompose
.
exitCode
,
{
ClientsSharedExerciseHelper
.
displayExecutionResults
(
exerciseResultsValidation
.
exerciseResults
!
,
exerciseDockerCompose
.
exitCode
,
{
INFO
:
chalk
.
bold
,
SUCCESS
:
chalk
.
green
,
FAILURE
:
chalk
.
red
INFO
:
chalk
.
bold
,
SUCCESS
:
chalk
.
green
,
FAILURE
:
chalk
.
red
},
`\n\n
${
chalk
.
bold
(
'
Execution results folder
'
)
}
:
${
this
.
folderResultsVolume
}
`
);
},
`\n\n
${
chalk
.
bold
(
'
Execution results folder
'
)
}
:
${
this
.
folderResultsVolume
}
`
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment