Regenerate TLS certificates after docker machine resumes

After the system reboots, the docker machine is created, but in a
stopped state. As stated in the docker docs, you might get errors when
attempting to connect to a machine or pull an image from Docker Hub.

For instance, Error checking TLS connection: ...

The solution is to regenerate TLS certificates of docker machine after
machine resums.

Change-Id: I8781ac0f0790aeda6cc778aee9c44d03c2b788d3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Ryan Chu 2019-01-27 23:10:55 +01:00 committed by Liang Qi
parent 698078680f
commit 481db443d5

View File

@ -154,12 +154,14 @@ isEmpty(TESTSERVER_VERSION) {
MACHINE_STATE_CMD = \ MACHINE_STATE_CMD = \
docker-machine ls -q --filter "State=Running" --filter "Name=^qt-test-server\$\$" docker-machine ls -q --filter "State=Running" --filter "Name=^qt-test-server\$\$"
MACHINE_START_CMD = docker-machine start qt-test-server MACHINE_START_CMD = docker-machine start qt-test-server
MACHINE_RECERT = docker-machine regenerate-certs -f qt-test-server
PowerShell { PowerShell {
testserver_pretest.commands += \ testserver_pretest.commands += \
$$TEST_CMD if (!($$MACHINE_STATE_CMD)) {$$MACHINE_START_CMD} && $$TEST_CMD if (!($$MACHINE_STATE_CMD)) {$$MACHINE_START_CMD; $$MACHINE_RECERT} &&
} else { } else {
testserver_pretest.commands += \ testserver_pretest.commands += \
$(if $(shell $$MACHINE_STATE_CMD),,$(shell $$MACHINE_START_CMD > /dev/null)) $(if $(shell $$MACHINE_STATE_CMD),,\
$(shell $$MACHINE_START_CMD > /dev/null && $$MACHINE_RECERT > /dev/null))
} }
} }