summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-11-09 09:55:53 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-09 18:57:45 +0000
commitb88c21df1ce78b3ede533f0edca0523f246aaabf (patch)
treedc4672dff3e9700180dace5d9bcc840fc93ddfe9
parentebf438687ee32b81f89520fa4a6fbf9337cb84bb (diff)
downloadchrome-ec-b88c21df1ce78b3ede533f0edca0523f246aaabf.tar.gz
gitlab: Add instructions for adding vms to doc
Document the commands needed to add a new VM to the gitlab runners. One of the VMs ran out of disk space, so add a daily cleanup cron job to delete old docker data. BRANCH=None BUG=b:244590155 TEST=Ran the crontab commands Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I0196cad3fbe113614feea33582741a3d15f27fca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4016955 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Al Semjonovs <asemjonovs@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Al Semjonovs <asemjonovs@google.com>
-rw-r--r--docs/gitlab.md69
1 files changed, 69 insertions, 0 deletions
diff --git a/docs/gitlab.md b/docs/gitlab.md
index 617c8a9154..2ebc5c60f7 100644
--- a/docs/gitlab.md
+++ b/docs/gitlab.md
@@ -82,3 +82,72 @@ If you used the command as shown above, all of the build artifacts and source,
as checked out by the Gitlab runner, should be under `~/gitlab-runner-output`.
This will persist after the container exits but also get overwritten again on
the next run.
+
+## Gitlab runners
+
+The gitlab builds run on a number of [virtual and real machines](https://gitlab.com/groups/zephyr-ec/-/runners)
+which are currently at Simon's house, and cloud virtual machines.
+
+### Create a new VM
+
+* Visit https://pantheon.corp.google.com/compute/instances?onCreate=true&project=chromeos-ec-gitlab
+ * Click on instance-1
+ * Click create similar
+* Wait for new instance to be created
+* Click on SSH
+* Install docker
+```
+sudo apt-get remove docker docker-engine docker.io containerd runc
+sudo apt-get update
+sudo apt-get install \
+ ca-certificates \
+ curl \
+ gnupg \
+ lsb-release
+sudo mkdir -p /etc/apt/keyrings
+curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+echo \
+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
+ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
+sudo apt-get update
+sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
+sudo docker run hello-world
+```
+* Install gitlab runner
+```
+sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
+sudo chmod +x /usr/local/bin/gitlab-runner
+sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
+sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
+sudo gitlab-runner start
+```
+* Register new runner using command from https://gitlab.com/groups/zephyr-ec/-/runners (click on Register a group runner, click on show instructions, click on Linux)
+```
+sudo gitlab-runner register --url https://gitlab.com/ --registration-token TOKENGOESHERE
+Runtime platform arch=amd64 os=linux pid=56156 revision=bbcb5aba version=15.3.0
+Running in system-mode.
+
+Enter the GitLab instance URL (for example, https://gitlab.com/):
+[https://gitlab.com/]:
+Enter the registration token:
+[TOKENGOESHERE]:
+Enter a description for the runner:
+[instance-2]: Cloud runner instance-2
+Enter tags for the runner (comma-separated):
+
+Enter optional maintenance note for the runner:
+
+Registering runner... succeeded runner=TOKENGOESHERE
+Enter an executor: docker, parallels, shell, docker-ssh+machine, custom, docker-ssh, ssh, virtualbox, docker+machine, kubernetes:
+docker
+Enter the default Docker image (for example, ruby:2.7):
+ruby:2.7
+Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
+
+Configuration (with the authentication token) was saved in "/etc/gitlab-runner/config.toml"
+```
+
+* Install cleanup docker cleanup daily cron
+```
+( echo "0 3 * * * /usr/bin/docker system prune -f -a --volumes" ; sudo crontab -l -u root ) | sudo crontab -u root -
+```