Task03
Trigger CI Pipeline

Trigger CI Pipeline

Check Branch

Before starting this lab, make sure you are on the stage branch


git branch --show-current


stage

Step 1 - Commit code to local stage branch

Make sure you are in the root directory of the project folder


cd /home/cisco/CiscoLive/DEVWKS-3928

First issue the git status . command to see the list of files that have been modified in the previous lab tasks.


git status .



    On branch stage
    Changes not staged for commit:
      (use "git add ..." to update what will be committed)
      (use "git restore ..." to discard changes in working directory)
            modified:   group_vars/all/overlay.yml
            modified:   group_vars/prod/fabric.yml
            modified:   group_vars/prod/overlay.yml
            modified:   group_vars/stage/fabric.yml
            modified:   group_vars/stage/overlay.yml
            modified:   hosts.prod.yml
            modified:   hosts.stage.yml
            modified:   roles/configure_overlay/files/cisco_live_attach_nets.yml
            modified:   roles/configure_overlay/files/cisco_live_attach_vrfs.yml
    
    Untracked files:
      (use "git add ..." to include in what will be committed)
            .gitlab-ci.yml

Check Closely!

Make sure your modified list of files matches the list of files above in the lab guide. If it does not then that means you missed a step or did not save one of the files you modified.

Now commit the code to your github repo.


git add .
git commit -a -m "initial setup"



➜  DEVWKS-3928 git:(stage) ✗ git commit -a -m "initial setup"
[stage 304f3a9] initial setup
    15 files changed, 516 insertions(+), 4 deletions(-)
    rewrite hosts.prod.yml (100%)
    rewrite hosts.stage.yml (100%)
➜  DEVWKS-3928 git:(stage) 


Step 2 - Push local branch stage to remote


git push --set-upstream origin stage 


Enumerating objects: 38, done.
Counting objects: 100% (31/31), done.
Delta compression using up to 8 threads
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 3.43 KiB | 1.14 MiB/s, done.
Total 21 (delta 4), reused 0 (delta 0), pack-reused 0
remote: 
remote: To create a merge request for stage, visit:
remote:   http://10.0.208.215/CL-POD10/DEVWKS-3928/-/merge_requests/new?merge_request%5Bsource_branch%5D=stage
remote: 
To 10.0.208.215:CL-POD10/DEVWKS-3928.git
    * [new branch]      stage -> stage
branch 'stage' set up to track 'origin/stage'.


Step 3 - Check the code on gitlab

Open gitlab on a new tab:

  • Gitlab URL: http://10.0.208.215/CL-POD30/DEVWKS-3928

At the Gitlab login screen, login using your username and password:

  • Username: user30
  • Password: cisco.123

Select stage branch:

  1. Click main
  2. Click stage branch


Step 4 - Check to make sure the Lint Stage was run.

As soon as the code was committed to the stage branch, Ansible Lint validation was triggered, open pipelines:

  1. Hover over Build on the side menu
  2. Then click Pipelines


Only the lint stage is triggered when committing the code to the stage branch, circle check icon indicates pipeline succeeds

To see details of the job Click passed under the Status column

This shows the ansible_lint job ran successfully for the initial setup commit.



Step 5 - Create a Merge Request (Also known as a pull request)

Now we need to create merge request to verify/test the configuration against the NDFC staging environment fabric.

  1. Hover over Code on the side menu
  2. Then click Merge Requests

  3. Click New Merge Requests

  4. Select stage as Source branch
  5. Select main as Target branch
  6. Then click Compare branches and continue

  7. Leave all of the fields with the default settings, then click Create merge request

  8. Click theh circle icon in screen below to navigate to pipeline page

  9. Wait until the pipeline finishes, if any pipeline fails, you can click the step to check the error message


Step 6 - Verfiy on NDFC

In your browser, open another instance of the browser or another tab. Copy the url of Nexus Dashboard:

  • ND URL: https://10.15.0.98/appcenter/cisco/ndfc/ui/lan-fabric/fabrics
  • Username: admin
  • Password: cisco.123

Open fabric page and open fabric-stage, and verify VRF and Networks are provisioned:

  • Introduction
  • NDFC and Ansible
  • Lab Environment and Topology
  • Task01 Setup Ansible
  • Task02 Overlay Playbook
  • Task03 CI/CD Pipeline
  • Thanks
  • Bonus: Task04 Policy Playbook