Question
As a developer, you need to leverage Redis in your workflow. What is the best way to use Redis on a self-hosted Linux runner without affecting future workflow runs?
- A. Install Redis on the hosted runner image and place it in a runner group. Specify label: in your job to target the runner group.
- B. Set up Redis on a separate machine and reference that instance from your job.
- C. Specify container: and services: in your job definition to leverage a Redis service container. Correct
- D. Add a run step to your workflow, which dynamically installs and configures Redis as part of your job.
Explanation
A Redis service container is created fresh for the job and destroyed when the job completes, so nothing is left behind on the self-hosted runner for future runs; self-hosted runners only need to be Linux machines with Docker installed. Installing Redis on the runner image or with a run step changes the persistent runner state, and a separate shared Redis machine keeps data between runs.