You are setting up a new app’s CI/CD process. Due to compliance requirements, this team’s code needs to run on your organization’s infrastructure, not GitHub’s. You will be provided with an EC2 instance, which you will need to set up to work as a GitHub runner. You will then need to set up a workflow to run only on that runner. Finally, you will need to disconnect the runner from your repo for the end of the lab.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Set Up the Lab VM to Work as a Runner Connected to Your GitHub Repo
Create a new GitHub repo. Under Settings, click on Actions, then Runners. Click Add Runner and select Linux as the operating system. GitHub will generate a set of scripts to configure and enable the runner agent. Note these scripts for the next step.
SSH into the lab VM. Run the first set of commands to download and extract the installer. Then, run the
configure
commands. Leave the terminal session open with the trailing logs. Back in the GitHub console, you will see the runner show up.
- Set Up a Workflow to Run on the Runner
Create a
/github/workflows/action.yaml
file. Create a workflow with one job and one step. It can echoHello cloud gurus
. Set up the job to run on the self-hosted runner. Commit the changes.You can see the job’s execution status in the GitHub console. You can also go back to the terminal with your SSH session and see the log from the runner.
- Remove the Runner from Your Repo
When the lab ends, the runner will be destroyed. However, you will need to go into your GitHub repo and manually delete the runner’s record from there. This can be done at any time. Remember if you want to run that workflow again, you will need to update the
runs-on
command.