SSH Server Service for Github Actions Testing

I have created a tool that uses SSH to automate deployment. Currently, I tested too using vagrant machines on the local host.

How can i setup a testing environment using GitHub actions using job services

To use jobs.<job_id>.services you need to have a Docker image available from a registry that provides what your tests need (the SSH server, and possibly other things your deployment tool expects).

If having the image in a registry is impractical you could commit a Dockerfile to your repository and build and run the container as part of the job. If you want the container to communicate with other services started using jobs.<job_id>.services you just need to attach it to the Docker network defined in job.container.network.

If you’d like some inspiration how to set up SSH inside a Docker container, I have a Dockerfile that does just that. Note that it does not define login credentials, the idea is that another tool will copy a public key to /home/test/.ssh/authorized_keys at runtime.

1 Like