Refactor Connector to allow setup before connection

What does this MR do?

Refactors Connector interface so that a initial setup can be performed.

Before the function signature was Connect() (io.ReadWriteCloser, error).

It is now Connect() (func() (io.ReadWriteCloser, error), error). This allows setup to be performed when Connect() is called, and then a function that will perform the actual dial/connection is returned in the closure.

In addition, the step-runner serve now broadcasts via stderr when it's ready/listening, so that we can watch for it.

Why was this MR needed?

Docker executor has container start-up time, where an entrypoint can perform additional tasks before the step-runner is serving. We were previously attempting to connect immediately.

What's the best way to test this MR?

The recently introduced Docker integration steps tests should cover the behaviour, with now more tests passing than previous executions.

What are the relevant issue numbers?

step-runner#289 (closed)

Edited by Arran Walker

Merge request reports

Loading