Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CI stuff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
shore
CI stuff
Commits
bb81c056
Commit
bb81c056
authored
3 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
Handle missing Compose projects.
parent
080a6307
No related branches found
No related tags found
No related merge requests found
Pipeline
#2398
passed
3 years ago
Stage: .pre
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
images/docker/compose-health-check
+6
-1
6 additions, 1 deletion
images/docker/compose-health-check
with
6 additions
and
1 deletion
images/docker/compose-health-check
+
6
−
1
View file @
bb81c056
...
@@ -49,6 +49,8 @@ def wait_for_project_health(project, timeout):
...
@@ -49,6 +49,8 @@ def wait_for_project_health(project, timeout):
docker_client
.
ping
()
docker_client
.
ping
()
while
True
:
while
True
:
healths
=
get_project_containers_health
(
docker_client
,
project
)
healths
=
get_project_containers_health
(
docker_client
,
project
)
if
not
healths
:
raise
RuntimeError
(
f
"
No containers found for project
{
project
}
.
"
)
# pylint: disable=no-else-return
# pylint: disable=no-else-return
if
not
get_unhealthy_project_containers
(
docker_client
,
project
):
if
not
get_unhealthy_project_containers
(
docker_client
,
project
):
return
[]
return
[]
...
@@ -107,7 +109,10 @@ def main():
...
@@ -107,7 +109,10 @@ def main():
"
Compose project wasn
'
t specified, the COMPOSE_PROJECT_NAME variable is missing from the environment and from the .env file.
"
# noqa: E501
"
Compose project wasn
'
t specified, the COMPOSE_PROJECT_NAME variable is missing from the environment and from the .env file.
"
# noqa: E501
)
)
try
:
unhealthy
=
wait_for_project_health
(
project
,
args
.
timeout
)
unhealthy
=
wait_for_project_health
(
project
,
args
.
timeout
)
except
Exception
as
e
:
# pylint: disable=broad-except
arg_parser
.
error
(
str
(
e
))
if
not
unhealthy
:
if
not
unhealthy
:
print
(
f
"
Project
{
project
}
is healthy.
"
)
print
(
f
"
Project
{
project
}
is healthy.
"
)
...
...
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