CI/CD Pipeline
NetDevOps

With your infrastructure as code, and tests along with your pipeline file present in your Git repo staging branch, the next step you need to take is to create a merge request. Merge request is the terminology used by GitLab and is equivalent to GitHub's Pull Request terminology. This is the step in the process where the developer opens a "ticket" for the change to the code base, i.e. main branch, they wish to make. Upon opening this ticket request, Continuous Integration (CI) occurs where the build and test steps execute. In the paradigm of NetDevOps with CI, the build and deploy phase is the configuration of the staging fabric and the testing is the linting steps and pyATS network test steps.

The Continuous Delivery (CD) aspect of the pipeline typically executes at the click of a button pending all staging and test pipeline stages pass; for example upon the merge request being accepted or merged into the main branch. The CD in CI/CD can be replaced as Continuous Deployment in cases where no manual or human intervention occurs, i.e. after the staging and test pipeline stages pass, then update or change is automatically released to prod. For this lab, you will perform Continuous Delivery.


Step 1 - Navigate to Merge Requests

In the left navigation bar of GitLab:

  1. Click Merge requests


Step 2 - Launch Create New Merge Request

In GitLab Merge Requests pane:

  1. Click New Merge request


Step 3 - Select Branch to Merge into Main Branch

In Source branch:

  1. Select staging
  2. Then click Compare branches and continue


Step 4 - Create New Merge Requests

In the desired merge request make note that you can make things pretty extensive by updating the title, adding a robust description, adding specific assignees and reviewers to own and review the request, etc. For this lab, we'll leave things basic to understand the concept:

  1. Toward the bottom, click Create merge request


Step 5 - Navigate to Staging Pipeline Execution

In the opened merge request page:

  1. Locate the pipeline section that is starting to execute
  2. Click the the pipeline number link denoted by #


Step 6 - Review Staging Pipeline

In running pipeline view:

  • Observe the Pipeline steps that are currently running
  • Review the different steps in each pipeline stage that align with the .gitlab-ci.yml file you created for staging


Step 7 - Navigate to Deploy Stage

Wait until the steps in the Lint stage turn green and the Deploy stage moves to in-progress as shown in the screenshot below.

  1. Once the Deploy stage is in-progress, click on the deploy_to_staging step


Step 8 - Review Deploy Stage

In the Deploy stage, the job or step being run is executing your Ansible playbook to configure a VXLAN EVPN fabric you developed earlier. While this may seem a bit redundant as you manually executed this earlier, this is normal. Ansible, through it's idempotency, handles actually needing to reissue configuration commands. Additionally, when creating the staging branch, you indeed made an infrastructure as code change in your Ansible leaf role variables to configure an additional L2VNI, so this will be deployed (configured) to your staging fabric during this execution.

In the execution window, you can actually see the Ansible playbook executing as you did locally in your VSCode Terminal.


Step 9 - Navigate to All Pipelines

From the deployment job execution:

  1. Locate and click Pipelines in the left navigation


Step 10 - Navigate Back to Staging Pipeline

The view you arrive at should be where you would see all currently running and previoulsy executed pipelines if there were more than your first pipeline.

  1. Click running on your current pipeline


Step 11 - Review Staging Pipeline Again

Wait until your pipeline finishes deployment and the stage moves to testing. Feel free to review the testing steps in the Test stage the same way you reviewed the Deploy step or you can just wait until the tests are done executing since you've seen then before.


Step 12 - Verify Staging Pipeline Successfully Passed

Wait until the Test stage is complete and confirm that the pipeline passed. Your screen should look similar to the screenshot below.

  • Review overall pipeline status. You may need to Refresh your browser to see all the tests.


Step 13 - Review Overall pyATS Test Result Status Directly in GitLab

  1. Click the Tests tab on your current pipeline
  2. Then, click pyats_aetest_test_staging


Step 14 - Review pyATS AETest Test Result Status Directly in GitLab

  1. Review test statuses
  2. Then, click back arrow <


Step 15 - Navigate to pyATS Robot Test Result Status Directly in GitLab

  1. Click pyats_robot_test_staging


Step 16 - Review pyATS Robot Test Result Status Directly in GitLab

  1. Review test statuses
  2. When done reviewing, click !1 to return to your merge request


Step 17 - Merge the Merge Request!

With your Staging Pipeline successfully passing, it must be safe to merge and deploy to your prod fabric. In the merge request:

  1. Click Merge


Step 18 - Navigate to Prod Pipeline Execution

In the now completed merge request that has joined your staging branch into your main branch:

  1. Locate the pipeline section that is starting to execute on main
  2. Click the the pipeline number link denoted by #


Step 19 - Review Prod Pipeline & Navigate to Deploy Stage

In running pipeline view:

  • Locate the Pipeline tab
  • Review the different steps in each pipeline stage that align with the .gitlab-ci.yml file you created for prod
  1. Click on the deploy_to_prod step


Step 20 - Review Deploy Stage

In the Deploy stage, the job or step being run is executing your Ansible playbook to configure the entire VXLAN EVPN fabric of your prod fabric since the staging pipeline was successful.

Again, in the execution window, you can see the Ansible playbook executing against the prod switches:


Step 21 - Navigate to All Pipelines

From the deployment job execution:

  1. Locate and click Pipelines in the left navigation


Step 22 - Navigate Back to Prod Pipeline

The view you arrive at now should show your currently running prod pipeline and your previoulsy executed staging pipeline.

  1. Click running on your current prod pipeline


Step 23 - Review Prod Pipeline Again

Wait until your pipeline finishes deployment and the stage moves to testing. Feel free to review the testing steps in the Test stage the same way you reviewed the Deploy step or you can just wait until the tests are done executing since you've seen them before.


Step 24 - Verify Prod Pipeline Successfully Passed

Wait until the Test stage is complete and confirm that the pipeline passed. Your screen should look similar to the screenshot below. Upon a successful pipeline execution, you have completed your NetDevOps journey from local development against a staging fabric to implementing a three-stage pipeline against a staging fabric then a two-stage pipeline against your prod fabric that leveraged the same infrastructure as code for configuration deployment and pyATS test scripts for testing. Congrats!

  • Review overall pipeline status. You may need to Refresh your browser to see all the tests.


Step 25 - Review Overall pyATS Test Result Status Directly in GitLab

  1. Click the Tests tab on your current pipeline


Continue to the next section to start exploring NetDevOps and Nexus Dashboard Fabric Controller.