Skip to content

Commit f4e4336

Browse files
authored
Update gitlab_ci_demo.md
1 parent a555f4d commit f4e4336

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

05_testing_and_ci/gitlab_ci_demo.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,12 @@ Test code in [automation lecture repository](https://gitlab-sim.informatik.uni-s
2525
- Instances -> Launch instance
2626
- Ubuntu 24.04
2727
- Flavor: m1.small
28-
- `sudo apt update && sudo apt -y upgrade`
29-
- `sudo apt install -y docker.io`
3028
- VM is up and running, connect to it: `ssh ubuntu@<IP>`
29+
- Apply updates: `sudo apt update && sudo apt -y upgrade`
30+
- Install Docker: `sudo apt install -y docker.io`
3131

3232
You can get the IP from the [Instances view](https://portal.bw-cloud.org/project/instances/). Note that there are two addresses here: an IPv4 (decimal) and an IPv6 (hexadecimal) address. New VMs on bwCloud only support IPv6 networks, so you need the second address.
3333

34-
## Workarounds for IPv6
35-
36-
New bwCloud VMs only support IPv6 by default. Asking for IPv4 for a specific VM might be possible via the [helpdesk](https://bw-cloud.org/q/t).
37-
38-
A few workarounds are needed to make the GitLab runner work in this IPv6-only environment, especially since [`registry.gitlab.com` does not support IPv6](https://gitlab.com/gitlab-com/gl-infra/production-engineering/-/issues/18058) and the Docker support for IPv6 needs to be expliticly configured.
39-
40-
First, we need to tell Docker to use the host network and DNS. We also need to replace the helper image with [the one from Docker Hub](https://hub.docker.com/r/gitlab/gitlab-runner-helper/tags?name=x86_64-v17.10.1). Edit the `[runners.docker]` section in `/srv/gitlab-runner/config/config.toml`:
41-
42-
```toml
43-
volumes = ["/etc/resolv.conf:/etc/resolv.conf:ro", "/srv/gitlab-runner/custom-hosts:/etc/hosts:ro", "/cache"]
44-
helper_image = "gitlab/gitlab-runner-helper:x86_64-v17.10.1"
45-
network_mode = "host"
46-
```
47-
48-
While you could pass `--network host` to `docker run`, setting this system-wide makes it easier to also start the job containers with the same settings.
49-
50-
Whenever changing this configuration file, we need to restart the runner (e.g., by restarting the respective container).
51-
52-
We also need to hard-code the IPv6 address that corresponds to the GitLab instance domain. Add the following line in the `/srv/gitlab-runner/custom-hosts`:
53-
54-
```
55-
2001:7c0:2015:216::19 gitlab-sim.informatik.uni-stuttgart.de
56-
```
57-
58-
You can get this address by running `dig aaaa gitlab-sim.informatik.uni-stuttgart.de`.
59-
6034
## Setup GitLab Runner
6135

6236
- Install GitLab Runner via Docker:
@@ -84,6 +58,7 @@ You can register a runner using the following command. Notice again the `--netwo
8458

8559
```bash
8660
sudo docker run --rm -it \
61+
--network host \
8762
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
8863
gitlab/gitlab-runner register \
8964
--url https://gitlab-sim.informatik.uni-stuttgart.de/
@@ -92,14 +67,42 @@ sudo docker run --rm -it \
9267
- Enter the following details:
9368
- URL: (press Enter to confirm)
9469
- Token: see above
95-
- Description: `SSE Automation Demo Runner`
70+
- Name/Description: `SSE Automation Demo Runner`
9671
- No tags, no maintenance note
9772
- Executor: `docker`
9873
- Default Docker image: `alpine:latest` (used for pipelines that do not specify any Docker image themselves, can be overwritten in configuration of pipeline)
9974
- `sudo vi /srv/gitlab-runner/config/config.toml`
10075
- Verify that there is now a runner in the repo settings
10176
- Verify that pipeline now ran
10277

78+
The `--network host` is needed in this IPv6-only VM (see section below).
79+
10380
- More information:
10481
- [Executors and their abilities](https://docs.gitlab.com/runner/executors/)
10582
- [Registering runners](https://docs.gitlab.com/runner/register/index.html#docker).
83+
84+
## Workarounds for IPv6
85+
86+
New bwCloud VMs only support IPv6 by default. Asking for IPv4 for a specific VM might be possible via the [helpdesk](https://bw-cloud.org/q/t).
87+
88+
A few workarounds are needed to make the GitLab runner work in this IPv6-only environment, especially since [`registry.gitlab.com` does not support IPv6](https://gitlab.com/gitlab-com/gl-infra/production-engineering/-/issues/18058) and the Docker support for IPv6 needs to be expliticly configured.
89+
90+
First, we need to tell Docker to use the host network and DNS. We also need to replace the helper image with [the one from Docker Hub](https://hub.docker.com/r/gitlab/gitlab-runner-helper/tags?name=x86_64-v17.10.1) (depends on the GitLab version. You can start without this setting, and see which image GitLab is trying to pull). Edit the `[runners.docker]` section in `/srv/gitlab-runner/config/config.toml`:
91+
92+
```toml
93+
volumes = ["/etc/resolv.conf:/etc/resolv.conf:ro", "/srv/gitlab-runner/custom-hosts:/etc/hosts:ro", "/cache"]
94+
helper_image = "gitlab/gitlab-runner-helper:x86_64-v17.10.1"
95+
network_mode = "host"
96+
```
97+
98+
While we already pass `--network host` to `docker run`, setting this system-wide makes it easier to also start the job containers with the same settings.
99+
100+
Whenever changing this configuration file, we need to restart the runner (e.g., by restarting the respective container).
101+
102+
We also need to hard-code the IPv6 address that corresponds to the GitLab instance domain. Add the following line in the `/srv/gitlab-runner/custom-hosts` (create the file):
103+
104+
```
105+
2001:7c0:2015:216::19 gitlab-sim.informatik.uni-stuttgart.de
106+
```
107+
108+
You can get this address by running `dig aaaa gitlab-sim.informatik.uni-stuttgart.de`.

0 commit comments

Comments
 (0)