Hello! Welcome to Implementing CICD Workshop proctored by Network to Code.
You can find the different lab instructions in each of the folders in this repository.
- Lab 1. Basic Git Operations
- Lab 2. First Pipeline
- Lab 3. Collaboration Tools
- Lab 4. Source Code Checks
- Lab 5. Generate Configs with Templates
- Lab 6. Testing Frameworks
But first things first, we would like to walk you through how to set up the development environment for the workshop.
Here is an overview of lab:
Here are the details regarding each components:
- GitLab: We will use the SaaS version of GitLab as the CI server. The CI server handles the committing, building, testing, staging, and releasing the changes.
- GitLab Runners: GitLab runners are workers that registers itself with the GitLab server and managed by the GitLab server. They are responsible to carry out the instructions by the GitLab server.
- GitHub Codespace: We will use GitHub codespace as our IDE as well as the virtual server to run our network lab. GitHub provides these container-based development environment for developers. We will use Containerlab to run a few network devices for our lab. GitHub offer a generous free tier in Codespace that should remain to be free for the duration of this lab.
- Containerlab: We will use containerlab for our lab devices running inside of codespace.
- Arista cEOS: We will use Arista cEOS for our lab for their light overhead and relative high adaption in production networks.
Please do the following steps to set up the lab:
- Register for a free GitLab.com account here if you do not have one. For a new registration, a project name is required, you can use a temp name or 'CICD Workshop Lab1' as that is one of the project we will create later:
- Download the free Arista cEOS image here. The image is free but you do need to register an Arista account with your business email. We will import the Arista image Codespace later.
Please download images later than 4.28. We will use 4.32.0F for our lab.
[!FYI] Download the 64 bit image.
Tip
You just need to download the image for now, for reference here is the import instruction from containerlab and a nice walk through video from Roman.
Alright, now it is time to tie everything together.
- In this repository, we can start Codespace by going to Code button on the top left corner and choose 'Create codespace on main':
Tip
It will take a bit of time to build codespace for the first time, you can click on building codespace to check on the progress. After it started for the first time, when you stop/start the instance it will be much faster.
Once Codespace is started, we can verify both Docker and containerlab are installed and running:
@ericchou1 ➜ /workspaces/workshop-implementing-cicd (main) $ poetry --version
Poetry (version 1.8.4)
@ericchou1 ➜ /workspaces/workshop-implementing-cicd (main) $ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
...<skip>
Hello from Docker!
This message shows that your installation appears to be working correctly.
<skip>
@ericchou1 ➜ /workspaces/workshop-implementing-cicd (main) $ containerlab version
____ ___ _ _ _____ _ ___ _ _ _____ ____ _ _
/ ___/ _ \| \ | |_ _|/ \ |_ _| \ | | ____| _ \| | __ _| |__
| | | | | | \| | | | / _ \ | || \| | _| | |_) | |/ _` | '_ \
| |__| |_| | |\ | | |/ ___ \ | || |\ | |___| _ <| | (_| | |_) |
\____\___/|_| \_| |_/_/ \_\___|_| \_|_____|_| \_\_|\__,_|_.__/
version: 0.58.0
commit: 2c249b2c
date: 2024-10-15T11:38:50Z
source: https://github.com/srl-labs/containerlab
rel. notes: https://containerlab.dev/rn/0.58/
- After codespace is started, right click in the Explorer section and choose upload:
- Use command
docker import cEOS64.<version>.tar.xz ceos:<version>to import the image, for example:
docker import cEOS64-lab-4.32.0F.tar ceos:4.32.0F- Run the GitLab Runner in a docker container.
docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest- Register GitLab Runner (screenshot following the steps):
- Under the GitLab project you created, get runner token via Project -> Settings -> CICD -> Project Runners.
- When creating this runner, we will use tags to specify the jobs this runner can pickup.
- Copy the
token. - Come back to the Codespace instance.
- Register runner via the following command
docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register - Answer the questions:
- Enter GitLab instance:
https://gitlab.com/ - Enter the registration token:
<token you copied previously> - Enter name for the runner:
leave the default - Enter an executor:
docker - Enter the default Docker image:
python:3.10
- Enter GitLab instance:
$ docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
Runtime platform arch=amd64 os=linux pid=7 revision=c6eae8d7 version=17.5.2
Running in system-mode.
Enter the GitLab instance URL (for example, https://gitlab.com/):
https://gitlab.com/
Enter the registration token:
glrt-t3_ABC123
Verifying runner... is valid runner=t3_GdM4Gs
Enter a name for the runner. This is stored only in the local config.toml file:
[460ba0646748]:
Enter an executor: custom, virtualbox, docker, instance, shell, ssh, parallels, docker-windows, docker+machine, kubernetes, docker-autoscaler:
docker
Enter the default Docker image (for example, ruby:2.7):
python:3.10
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"







