atomist / sdm-pack-docker

Extension Pack for an Atomist SDM to integrate Docker
Apache License 2.0
0 stars 2 forks source link

DockerDeploy goal sometimes exits 0 when deploy fails. #66

Closed XertroV closed 5 years ago

XertroV commented 5 years ago

You can "deploy" a docker image which ultimately fails but the DockerDeploy goal reports success.

I think this is because on https://github.com/atomist/sdm-pack-docker/blob/5fcac6459ef876fc89f2a2f76be87f7444054fef/lib/deploy/DockerPerBranchDeployer.ts#L96 the PID is checked to be running immediately after calling "docker run". If the container is still starting up (but then the app in the container fails), the port check can return success (I'm not sure if this is because of the successPattern). Presumably this happens for all docker images via this race condition.

I'm configuring dockerDeploy:

goals.dockerDeploy.with({ successPatterns: [/.*/], ... })
XertroV commented 5 years ago

Ahh, seems if I add something sensible to successPatterns I get a failure as expected:

2019-09-05T05:04:16.539Z [m:119182:f09f4c31-401c-4449-b637-6e376603af26:x-sv-alpha.x:FulfillGoalOnRequested:179] [error] Docker deployment failure vvvvvvvvvvvvvvvvvvvvvv
2019-09-05T05:04:16.539Z [m:119182:f09f4c31-401c-4449-b637-6e376603af26:x-sv-alpha.x:FulfillGoalOnRequested:179] [error] stdout:

stderr:
docker: Error response from daemon: Conflict. The container name "/trivial-sdm_master" is already in use by container "509ecbb630b117e5a1bfe275ed32af71b050cee79ffe28522a4eea90962ef7cc". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'