{"id":18797778,"url":"https://github.com/networktocode/workshop-implementing-cicd-documentation","last_synced_at":"2026-01-18T19:04:04.597Z","repository":{"id":259315296,"uuid":"877558119","full_name":"networktocode/autocon2-cicd-workshop","owner":"networktocode","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-23T21:37:13.000Z","size":2795,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-10-24T10:04:43.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/networktocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-23T21:24:03.000Z","updated_at":"2024-10-23T21:37:17.000Z","dependencies_parsed_at":"2024-10-24T10:15:31.185Z","dependency_job_id":"20dbdf71-64b8-4ba3-8120-b0411311af89","html_url":"https://github.com/networktocode/autocon2-cicd-workshop","commit_stats":null,"previous_names":["networktocode/autocon2-cicd-workshop"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fautocon2-cicd-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fautocon2-cicd-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fautocon2-cicd-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fautocon2-cicd-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/networktocode","download_url":"https://codeload.github.com/networktocode/autocon2-cicd-workshop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239727046,"owners_count":19687098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T22:09:33.107Z","updated_at":"2026-01-01T18:30:13.348Z","avatar_url":"https://github.com/networktocode.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Autocon2 CI/CD Workshop Development Repository\n\nHello! Welcome to [Autocon2 CI/CD workshop](https://networkautomation.forum/autocon2#workshop) proctored by [Eric Chou](https://github.com/ericchou1/), [Jeff Kala](https://github.com/jeffkala), and assisted by [Tim Fiola](https://github.com/tim-fiola). \n\nYou can find the different lab instructions in each of the folders in this repository. \n\n- [Lab 1. Basic Git Operations](./Lab_1_Basic_Git_Operations/README.md)\n- [Lab 2. First Pipeline](./Lab_2_First_Pipeline/README.md)\n- [Lab 3. Collaboration Tools](./Lab_3_Collaboration_Tools/README.md)\n- [Lab 4. Source Code Checks](./Lab_4_Source_Code_Checks/README.md)\n- [Lab 5. Generate Configs](./Lab_5_Generate_Configs/README.md)\n- [Lab 6. Testing Frameworks](./Lab_6_Testing_Frameworks/README.md)\n\nBut first things first, we would like to walk you through how to set up the development environment for the workshop.\n\n## Lab Components\n\nHere is an overview of lab:   \n\n![Lab_Diagram_v1](images/Lab_Diagram_v1.drawio.png)\n\nHere are the details regarding each components: \n\n- [GitLab](https://about.gitlab.com/pricing/): 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. \n- [GitLab Runners](https://docs.gitlab.com/runner/): 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. \n- [GitHub Codespace](https://github.com/features/codespaces): We will use GitHub codepsace 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. \n- [Containerlab](https://containerlab.dev/): We will use containerlab for our lab devices running inside of codepsace.  \n- [Arista cEOS](https://containerlab.dev/manual/kinds/ceos/): We will use Arista cEOS for our lab for their light overhead and relative high adaption in production networks. \n\n## GitLab Account Registration and cEOS Download\n\nPlease do the following steps to set up the lab: \n\n1. Register for a free GitLab.com account [here](https://gitlab.com/users/sign_up) if you do not have one. For a new registration, a project name is required, you can use a temp name or 'Autocon_Lab1' as that is one of the project we will create later: \n\n\u003e [!FYI] \n\u003e If you registered a new account, you **must** do the email verfication of the new account or you may see issues later.\n\n\n![gitlab_account_signup](images/gitlab_account_signup.png)\n\n2. Download the free Arista cEOS image [here](https://www.arista.com/en/login). 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. \n\n![arista_download_1](images/arista_download_1.png)\n\nPlease download images later than 4.28. We will use 4.32.0F for our lab. \n\n![arista_downaload_2](images/arista_download_2.png)\n\n\u003e [!FYI] \n\u003e Download the 64 bit image.\n\n\u003e [!TIP]\nYou just need to download the image for now, for reference here is the import instruction from [containerlab](https://www.youtube.com/watch?v=KJMVH2okO24) and a nice walk through video from [Roman](https://www.youtube.com/watch?v=KJMVH2okO24). \n\n### Lab Setup\n\nAlright, now it is time to tie everything together. \n\n1. In this repository, we can start Codespace by going to Code button on the top left corner and choose 'Create codespace on main': \n\n![codespace_start](images/codespace_start.png)\n\n\u003e [!TIP] \n\u003e It will take a bit of time to build codespace for the first time, you can click on [building codespace](images/building_codespace.png) to check on the progress. After it started for the first time, when you stop/start the instance it will be much faster. \n\nOnce Codespace is started, we can verify both Docker and containerlab are installed and running: \n\n```\n@ericchou1 ➜ /workspaces/autocon2-cicd-workshop-dev (main) $ poetry --version\nPoetry (version 1.8.4)\n\n@ericchou1 ➜ /workspaces/autocon2-cicd-workshop-dev (main) $ docker run hello-world\nUnable to find image 'hello-world:latest' locally\nlatest: Pulling from library/hello-world\n...\u003cskip\u003e\nHello from Docker!\nThis message shows that your installation appears to be working correctly.\n\u003cskip\u003e\n\n@ericchou1 ➜ /workspaces/autocon2-cicd-workshop-dev (main) $ containerlab version\n  ____ ___  _   _ _____  _    ___ _   _ _____ ____  _       _     \n / ___/ _ \\| \\ | |_   _|/ \\  |_ _| \\ | | ____|  _ \\| | __ _| |__  \n| |  | | | |  \\| | | | / _ \\  | ||  \\| |  _| | |_) | |/ _` | '_ \\ \n| |__| |_| | |\\  | | |/ ___ \\ | || |\\  | |___|  _ \u003c| | (_| | |_) |\n \\____\\___/|_| \\_| |_/_/   \\_\\___|_| \\_|_____|_| \\_\\_|\\__,_|_.__/ \n\n    version: 0.58.0\n     commit: 2c249b2c\n       date: 2024-10-15T11:38:50Z\n     source: https://github.com/srl-labs/containerlab\n rel. notes: https://containerlab.dev/rn/0.58/\n```\n\n2. After codespace is started, right click in the Explorer section and choose upload: \n\n![upload_ceos](images/upload_ceos.png)\n\n\n3. Use command ```docker import cEOS64.\u003cversion\u003e.tar.xz ceos:\u003cversion\u003e``` to import the image, for example: \n\n```sh\ndocker import cEOS64-lab-4.32.0F.tar ceos:4.32.0F\n```\n\n4. Run the GitLab Runner in a docker container.\n\n```sh\ndocker run -d --name gitlab-runner --restart always \\\n-v /srv/gitlab-runner/config:/etc/gitlab-runner \\\n-v /var/run/docker.sock:/var/run/docker.sock \\\ngitlab/gitlab-runner:latest\n```\n\n5. Register GitLab Runner (screenshot following the steps): \n    - Under the GitLab project you created, get runner token via Project -\u003e Settings -\u003e CI/CD -\u003e Project Runners. \n    - When creating this runner, we will use tags recommend something like `first-last-01` to specify the jobs this runner can pickup. \n    - Copy the `token`.\n    - Come back to the Codespace instance.\n    - Register runner via the following command `docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register`\n    - Answer the questions:\n      - Enter GitLab instance: `https://gitlab.com/`\n      - Enter the registration token: `\u003ctoken you copied previously\u003e`\n      - Enter name for the runner: `leave the default`\n      - Enter an executor: `docker`\n      - Enter the default Docker image: `python:3.10`\n\n![gitlabrunner_1](images/gitlabrunner_1.png)\n\n![gitlabrunner_2](images/gitlabrunner_2.png)\n\n```sh\n$ docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register\nRuntime platform arch=amd64 os=linux pid=7 revision=c6eae8d7 version=17.5.2\n\nRunning in system-mode.\n\nEnter the GitLab instance URL (for example, https://gitlab.com/):\nhttps://gitlab.com/\n\nEnter the registration token:\nglrt-t3_ABC123\n\nVerifying runner... is valid runner=t3_GdM4Gs\n\nEnter a name for the runner. This is stored only in the local config.toml file:\n[460ba0646748]:\n\nEnter an executor: custom, virtualbox, docker, instance, shell, ssh, parallels, docker-windows, docker+machine, kubernetes, docker-autoscaler:\ndocker\n\nEnter the default Docker image (for example, ruby:2.7):\npython:3.10\n\nRunner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!\nConfiguration (with the authentication token) was saved in \"/etc/gitlab-runner/config.toml\"\n```\n\n![gitlabrunner_3](images/gitlabrunner_3.png)\n\n\n## Lab Setup Walkthrough Video\n\nHere are video walkthrough to help with illustrate the lab setup. \n\nVideo 1. Overview and Software Download\n\n[![video_step_1](images/video_step_1.png)](https://www.youtube.com/watch?v=p7FcvGOZHuY)\n\nVideo 2. Codespace Launch and Preparation\n\n[![video_step_2](images/video_step_2.png)](https://www.youtube.com/watch?v=FbbZD1IWgFA)\n\nVideo 3. Create Gitlab Project\n\n[![video_step_3](images/video_step_3.png)](https://www.youtube.com/watch?v=Rqtnxg9mPmM)\n\nVideo 4. Runner Registration\n\n[![video_step_4](images/video_step_4.png)](https://www.youtube.com/watch?v=I3ng43OSUjc)\n\nThat is it, having gone thru the steps will ensure we can jump right into the workshop lab at Autocon2. \n\nBelow is an optional step for those who are somewhat familiar with Gitlab and want to check the end-to-end setup. \n\n## (Optional) Checking for end-to-end Lab Setup\n\nThis is complete optional and we will go over it in the workshop as our first lab, but if you are up for some testing, we can test the end-to-end lab setup with the following steps. \n\n- Start containerlab (and use --node-filter to only create 2 nodes for now.)\n\n```\n@jeffkala ➜ /workspaces/autocon2-cicd-workshop (main) $ cd clab/\n\n\n@jeffkala ➜ /workspaces/autocon2-cicd-workshop/clab (main) $ sudo containerlab deploy --topo ceos-lab.clab.yml --node-filter ceos-01,ceos-02\nINFO[0000] Containerlab v0.59.0 started                 \nINFO[0000] Applying node filter: [\"ceos-01\" \"ceos-02\"]  \nINFO[0000] Parsing \u0026 checking topology file: ceos-lab.clab.yml \nWARN[0000] Unable to init module loader: stat /lib/modules/6.5.0-1025-azure/modules.dep: no such file or directory. Skipping... \nINFO[0000] Creating lab directory: /workspaces/autocon2-cicd-workshop/clab/clab-ceos-lab \nINFO[0000] Creating container: \"ceos-02\"                \nINFO[0000] Creating container: \"ceos-01\"                \nINFO[0000] Running postdeploy actions for Arista cEOS 'ceos-01' node \nINFO[0000] Created link: ceos-01:eth1 \u003c--\u003e ceos-02:eth1 \nINFO[0000] Running postdeploy actions for Arista cEOS 'ceos-02' node \nINFO[0046] Adding containerlab host entries to /etc/hosts file \nINFO[0046] Adding ssh config for containerlab nodes     \n+---+---------+--------------+--------------+------+---------+---------------+--------------+\n| # |  Name   | Container ID |    Image     | Kind |  State  | IPv4 Address  | IPv6 Address |\n+---+---------+--------------+--------------+------+---------+---------------+--------------+\n| 1 | ceos-01 | a425c6fb993a | ceos:4.32.0F | ceos | running | 172.17.0.3/16 | N/A          |\n| 2 | ceos-02 | 44ad61fe178c | ceos:4.32.0F | ceos | running | 172.17.0.4/16 | N/A          |\n+---+---------+--------------+--------------+------+---------+---------------+--------------+\n```\n\n - Create a test project(back in GitLab) with the following `hosts.yaml` file\n\n\u003e [!info]\n\u003e Best to create a brand new project as `Autocon_Lab1` you created originally is going to be built upon in the following labs.\n\n```yml\n---\neos-1:\n    hostname: '172.17.0.3'  # Update if your deploy chose different IPs\n    port: 22\n    username: 'admin'\n    password: 'admin'\n    platform: 'arista_eos'\n\neos-2:\n    hostname: '172.17.0.4'  # Update if your deploy chose different IPs\n    port: 22\n    username: 'admin'\n    password: 'admin'\n    platform: 'arista_eos'\n```\n\n- Create the following `show_version.py` file\n\n```python\n#!/usr/bin/env python\nfrom nornir import InitNornir\nfrom nornir_netmiko import netmiko_send_command\nfrom nornir_utils.plugins.functions import print_result\n\n# Initialize Nornir, by default it will look for the \n# hosts.yaml file in the same directory. \nnr = InitNornir()\n\n# Run the show version command for each of the devices. \n# store the value in the results variable. \nresult = nr.run(\n    task=netmiko_send_command,\n    command_string=\"show version\"\n)\n\n# print the results in \nprint_result(result)\n```\n\n- Create the following CI file `.gitlab-ci.yml`\n\n ```yml\nstages: \n  - deploy\n\ndeploy testing:\n  image: \"python:3.10\"\n  stage: deploy\n  tags: \n    - \"ericchou-1\"  # Update this with the tag you add to your runner.\n  script: \n    - pip3 install nornir_utils nornir_netmiko\n    - python3 show_version.py\n ```\n\n- You should see the following result by navigating to Build --\u003e Pipelines: \n\n![optional_first_pipeline](images/optional_fisrt_pipeline.png)\n\n## Final Lab Walk-Through\n\nWe encourage you to perform the labs first, if you run into any issues and prefer to see a walk-through for the labs, we prepared the following videos: \n\n- [Lab 0. Preparation](https://www.youtube.com/watch?v=khg4QeWR-bI\u0026list=PLAaTeRWIM_wtlNigH6vmUlfwM1-BD9mQH\u0026index=1)\n- [Lab 1. Basic Git Operations](https://www.youtube.com/watch?v=a1lfu4FKwt8\u0026list=PLAaTeRWIM_wtlNigH6vmUlfwM1-BD9mQH\u0026index=2)\n- [Lab 2. First Pipeline](https://www.youtube.com/watch?v=Ftl8vABR1R0\u0026list=PLAaTeRWIM_wtlNigH6vmUlfwM1-BD9mQH\u0026index=3)\n- [Lab 3. Collaboration Tools](https://www.youtube.com/watch?v=03vlGKHs9Tc\u0026list=PLAaTeRWIM_wtlNigH6vmUlfwM1-BD9mQH\u0026index=4)\n- [Lab 4. Source Code Checks](https://www.youtube.com/watch?v=i4gffAeCQ0o\u0026list=PLAaTeRWIM_wtlNigH6vmUlfwM1-BD9mQH\u0026index=5)\n- [Lab 5. Generate Configs](https://www.youtube.com/watch?v=SNhDoPAMRkw\u0026list=PLAaTeRWIM_wtlNigH6vmUlfwM1-BD9mQH\u0026index=6)\n- [Lab 6. Testing Frameworks](https://www.youtube.com/watch?v=c7O_fV5SZpg\u0026list=PLAaTeRWIM_wtlNigH6vmUlfwM1-BD9mQH\u0026index=7)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetworktocode%2Fworkshop-implementing-cicd-documentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetworktocode%2Fworkshop-implementing-cicd-documentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetworktocode%2Fworkshop-implementing-cicd-documentation/lists"}