-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cli] Fix #3655 : Check docker-compose file validity, result of docker-compose up and containers #3731
Conversation
…ose up command and also check each container of docker-compose services if they’re running or not Change-Id: Ie7ef9cc301c2605ec40db70f00d06f1fca694e4c Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
@@ -45,12 +45,16 @@ cmd_start() { | |||
info "start" "Starting containers..." | |||
COMPOSE_UP_COMMAND="docker_compose --file=\"${REFERENCE_CONTAINER_COMPOSE_FILE}\" -p=\"${CHE_MINI_PRODUCT_NAME}\" up -d" | |||
|
|||
## validate the compose file (quiet mode) | |||
docker_compose --file=${REFERENCE_CONTAINER_COMPOSE_FILE} config -q || (error "Invalid docker compose file content at ${REFERENCE_CONTAINER_COMPOSE_FILE}" && return 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the circumstances where the end user has provided a valid che.env, but this configuration check would fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe with only che.env it's not possible but a dev could break the docker-compose file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added that check only if "local_repo" is used.
if ! debug_server; then | ||
COMPOSE_UP_COMMAND+=" >> \"${LOGS}\" 2>&1" | ||
fi | ||
|
||
log ${COMPOSE_UP_COMMAND} | ||
eval ${COMPOSE_UP_COMMAND} | ||
eval ${COMPOSE_UP_COMMAND} || (error "Error while running compose up command" && tail -30 ${LOGS} && error "The command compose UP has failed. Latest 30lines of log files ${CHE_HOST_CONFIG}/cli.log have been printed." && return 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be a bit more concise:
(error "Error during 'compose up' - printing 30 line tail of ${CHE_HOST_CONFIG}/cli.log:" && tail -30 ${LOGS} && return 2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
return 2 | ||
fi | ||
done <<< "${LIST_OF_COMPOSE_CONTAINERS}" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -136,8 +140,10 @@ check_if_booted() { | |||
info "start" "Server logs at \"docker logs -f ${CHE_SERVER_CONTAINER_NAME}\"" | |||
fi | |||
|
|||
check_containers_are_running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to check this before the server is booted command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to check that before and after the containers are still running
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/1632/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 but please add requested changes from @TylerJewell
…er-compose up command and also check each container of docker-compose services if they’re running or not Change-Id: I91f0298aaaa3c547925989f964a8d2c38f6393d3 Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/1641/ |
@TylerJewell are the changes ok for you now ? |
Yes - ok by me. |
…lt of docker-compose up and containers (eclipse-che#3731) * Fix eclipse-che#3655 : Check docker-compose file validity, result of docker-compose up command and also check each container of docker-compose services if they’re running or not Change-Id: Ie7ef9cc301c2605ec40db70f00d06f1fca694e4c Signed-off-by: Florent BENOIT <fbenoit@codenvy.com> * fixup! Fix eclipse-che#3655 : Check docker-compose file validity, result of docker-compose up command and also check each container of docker-compose services if they’re running or not Change-Id: I91f0298aaaa3c547925989f964a8d2c38f6393d3 Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
Fix for #3655
Change-Id: Ie7ef9cc301c2605ec40db70f00d06f1fca694e4c
Signed-off-by: Florent BENOIT fbenoit@codenvy.com