sglebs / ndeploy

Utility to deploy N microservices to N PaaS
2 stars 0 forks source link

OpenShift secrets config may happen too late (on a fast machine / OpenShift install) #10

Open sglebs opened 7 years ago

sglebs commented 7 years ago

We configure the app's private key (so that OpenShift can clone the project) here:

https://github.com/sglebs/ndeploy/blob/master/nd/openshift.py#L91

But the app is created earlier, here:

https://github.com/sglebs/ndeploy/blob/master/nd/openshift.py#L86

This means there is a race condition going on. If OpenShift is fast enough, it will start building as soon as line 86 runs and will fail to clone because the key has not been setup yet. Indeed we have seen this happen with a new/faster machine:

Cloning "ssh://git@bitbucket.org/namoroon/core-server.git" ...
error: build error: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Manually forcing a second build works (because now the secret has been setup).

It is necessary to create the app but tell OpenShift to wait a bit longer before trying to build (line 86). We should signal GO only after the key/secret has been configured (line 91).

sglebs commented 7 years ago

We may need to create a son file, tweak it and then create the app: https://docs.openshift.com/enterprise/3.0/dev_guide/new_app.html#output-without-creation