Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NodeClientSharedCode
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
Shared
NodeClientSharedCode
Commits
04e9ad7c
Commit
04e9ad7c
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
ExerciseDockerCompose => Refactor code
parent
e8114e05
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
helpers/Dojo/ExerciseDockerCompose.ts
+11
-7
11 additions, 7 deletions
helpers/Dojo/ExerciseDockerCompose.ts
with
11 additions
and
7 deletions
helpers/Dojo/ExerciseDockerCompose.ts
+
11
−
7
View file @
04e9ad7c
...
...
@@ -44,6 +44,10 @@ class ExerciseDockerCompose {
this
.
events
.
emit
(
'
logs
'
,
message
,
error
,
displayable
,
this
.
currentStep
);
}
private
finished
(
success
:
boolean
,
code
:
number
)
{
this
.
events
.
emit
(
'
finished
'
,
success
,
code
);
}
private
registerChildProcess
(
childProcess
:
ChildProcessWithoutNullStreams
,
resolve
:
(
value
:
(
number
|
PromiseLike
<
number
>
))
=>
void
,
reject
:
(
reason
?:
unknown
)
=>
void
,
displayable
:
boolean
)
{
childProcess
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
this
.
log
(
data
.
toString
(),
false
,
displayable
);
...
...
@@ -86,7 +90,7 @@ class ExerciseDockerCompose {
});
}
catch
(
error
)
{
this
.
endStep
(
`Error while running the docker compose file`
,
true
);
this
.
events
.
emit
(
'
finished
'
,
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_RUN_ERROR
);
this
.
finished
(
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_RUN_ERROR
);
return
;
}
this
.
endStep
(
`Docker Compose file run successfully`
,
false
);
...
...
@@ -110,7 +114,7 @@ class ExerciseDockerCompose {
});
}
catch
(
error
)
{
this
.
endStep
(
`Error while getting the linked services logs`
,
true
);
this
.
events
.
emit
(
'
finished
'
,
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_LOGS_ERROR
);
this
.
finished
(
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_LOGS_ERROR
);
return
;
}
this
.
endStep
(
`Linked services logs acquired`
,
false
);
...
...
@@ -135,10 +139,10 @@ class ExerciseDockerCompose {
});
}
catch
(
error
)
{
this
.
endStep
(
`Error stop and remove containers`
,
true
);
this
.
events
.
emit
(
'
finished
'
,
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_DOWN_ERROR
);
this
.
finished
(
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_DOWN_ERROR
);
return
;
}
this
.
e
vents
.
emit
(
'
endStep
'
,
this
.
currentStep
,
`Containers stopped and removed`
,
false
);
this
.
e
ndStep
(
`Containers stopped and removed`
,
false
);
}
}
...
...
@@ -161,14 +165,14 @@ class ExerciseDockerCompose {
});
}
catch
(
error
)
{
this
.
endStep
(
`Error while removing dangling images`
,
true
);
this
.
events
.
emit
(
'
finished
'
,
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_REMOVE_DANGLING_ERROR
);
this
.
finished
(
false
,
ExerciseCheckerError
.
DOCKER_COMPOSE_REMOVE_DANGLING_ERROR
);
return
;
}
this
.
e
vents
.
emit
(
'
endStep
'
,
this
.
currentStep
,
`Dangling images removed`
,
false
);
this
.
e
ndStep
(
`Dangling images removed`
,
false
);
}
}
this
.
events
.
emit
(
'
finished
'
,
true
,
containerExitCode
);
this
.
finished
(
true
,
containerExitCode
);
})();
}
}
...
...
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