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.
- 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.
One of the following are used for workshops:
- Digital Ocean Droplets: We will use a server from Digital Ocean as the as the virtual server to run our network lab. It has all services and software pre-installed to streamline the lab environment. We will use Containerlab to run a few network devices for our lab that will run inside the Droplet 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.
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 (seen screen shot below):
- You can select private or public for Visibility level
- You can also initialize the project with a README
- You must regsiter Download the free Arista cEOS image before the end of the workshop. The image is already installed in the server provided, but you must still register for an account with Arista here. The image is free but you do need to register an Arista account with your business email. We will import and use the Arista image later.
Please download images later than 4.28. We will use 4.32.0F for our lab. Again, it is already on the server. The important piece is that you should register for account on Arista.com before the end of the workshop.
[!FYI] Download the 64 bit image.
Tip
You just need to register to download the image for now, for reference here is the import instruction from containerlab and a nice walk through video from Roman.
First, you will connect to the server with the IP address and password given to you by the instructors.
ssh root@<ip-of-your-server>
Once you connect, you will be in /root. You will need to move into the /root/workshop-implementing-cicd-documentation/ directory:
root@ubuntu-cicd-workshop-techex25-instructor-01:~# ls
workshop-implementing-cicd-documentation
root@ubuntu-cicd-workshop-techex25-instructor-01:~# cd workshop-implementing-cicd-documentation/
root@ubuntu-cicd-workshop-techex25-instructor-01:~/workshop-implementing-cicd-documentation#
Now time to check versions of software ensuring everything is installed correctly:
@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/
- Use command
docker import cEOS64-lab-<version>.tar.xz ceos:<version>to import the image, for example:
docker import cEOS64-lab-4.32.0F.tar ceos:4.32.0FYou'll see a response like this:
root@ubuntu-cicd-workshop-techex25-instructor-01:~/workshop-implementing-cicd-documentation# docker import cEOS64-lab-4.32.0F.tar ceos:4.32.0F
sha256:b99006d1deed4f33658e488b1a3bb17f24821be33aacfd6673d197c726b17c4f
- 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:latestThis is what it'll look like on the terminal as you enter it:
root@ubuntu-cicd-workshop-techex25-instructor-01:~/workshop-implementing-cicd-documentation# 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
49b49638eda01fe7dac8c725f96aa3e491306af992a05d80bd2c65f40bbd7ce2
root@ubuntu-cicd-workshop-techex25-instructor-01:~/workshop-implementing-cicd-documentation#
- Register GitLab Runner (screenshot following the steps):
-
Under the GitLab project you created, get runner token via Project -> Settings -> CICD -> Runners.
-
Click "Create project runner."
-
When creating this runner, we will use tags to specify the jobs this runner can pickup, so add a tag.
-
Create the runner - after clicking create, you'll see the token you need
-
Copy the
$token. -
Come back to the server
-
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:
-
Once you populate your Tags and go to the next page you will get your registration token.
$ 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"






