Spin up an EC2 instance containing Gitlab, Gitlab runner and a Docker registry.
Note that there are two ways this can be done;
- Create a Packer image
- Use an EC2 instance with a
UserData
script
Once you have you GitLab instance up and running, complete the following steps.
-
SSH into the instance and start Gitlab:
make start-gitlab
-
Browse to the Gitlab server and create password.
Note: Gitlab can take a few minutes to spin up. Keep refreshing your browser until the "Change password" page is displayed.
-
Log in with the username
root
and the password you just set. -
Click "Settings" (the spanner icon), then click "Runners".
-
Find the registration token on this page, then enter the command below:
make REGISTRATION_TOKEN=<token> register-gitlab-runner
-
Refresh the page to ensure your runner has successfully registered.
-
Create a repository
-
Settings -> General -> Merge Requests - Enable
Pipelines must succeed
-
Settings -> CI/CD -> Variables - Add variables and secrets which are consumed by your pipeline