Skip to content

CI/CD Pipelines

1. Adding CI/CD Pipeline job

  1. Go to CI/CD Pipelines
  2. Click to Add button in the upper right corner

    • System will move to Add new Pipelines

      Untitled

  3. Fill in the mandatory fields for adding a schedule job

    • Name: The name of the CI/CD Pipelines job that is displayed in the CI/CD Pipelines for job.
    • Description: Description of the CI/CD Pipelines job.
    • Agent pool: Select an agent pool - is a collection of agents. When running the job, it runs on an agent from that pool. (See How to create an Agent Pool)
  4. Adding tasks.

    Adding Tasks in CICD Job will be the same with adding task in Job Schedule (See Adding Job and Sample flow)

  5. After filling in the fields, click on the Save button to add new task.

    • After saving successfully, click on Webhook button of selected CICD Job

    Webhook_button

    • System will show information of job for previewing

    webhook infor.png

    • You can re-preview information of job by:
      1. In list of CI/CD Pipelines jobs, you click on name of the job that wanting to re-preview
      2. Clicking on Webhook button

Note: To run CI/CD Pipeline job by event (Eg: merge code, build code) → You have to use these information to config in third-party

Or you can test by click Run directly on Job

2. Trigger CI/CD event

Precondition: You have already created new CICD job successfully and agent have registered successfully.

2.1. Trigger CI/CD via Azure DevOps Webhook

  • Step 1: On the Azure project, select Project Setting then click on the Service hooks.

  • Step 2: Click on the Create new subscription button.

  • Step 3: Select Web Hooks is the service to integrate then click on the Next button.

servicehooks_popup.PNG

  • Step 4: On the Trigger information, select type of event then filter event. For example, I select Code push event and I filter repository, member group,...It means that CICD job will run whenever member of selected group push code to the selected repository. Click on the Next button.

Trigger.PNG

  • Step 5: Copy URL, Header from Webhook information on Test Engine then paste into URL, Header textbox of Webhook azure popup.

akahook_i.PNG

azure_hook_i.PNG

  • Step 6: Click on the Test button on the popup. If connection is successful, the system will fill into Basic authentication user and Basic authentication passsword text fields automatically. Then click on the Finish button

Azure hook 2.PNG

  • Step 7: Back to job cicd and verify that when connect successfully, the job will run automatically.

result.PNG

result.PNG

  • Step 8: Try to push code from local to the repository, you can see the CICD job will be run automatically.

Note: If connection is falsed, please go to Webhook information on the Test Engine then click on the Revoke Token button next to the Header text field. After that, you repeat from step 5 to step 8.

2.2. Trigger CI/CD via Jenkins pipeline

addnew.png

  • On the Add new Item screen, input item name, select Pipeline option then click on the OK button.

enternew.png

  • On the Configuration screen, go to Pipeline tab, input pipeline script then click on the Save button.

script_img.png

<img src="\Version_3\image\CICD\jenkin_hook.png" alt="jenkin_hook.png" style="float:center";/>
  • For example: I want to run CICD job whenever have change on the special repository of any branch. If you change any code on the master branch, you can see the CICD job will run automatically.

pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                checkout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'https://dev.azure.com/LinhVTT20309/testEngine2']]])
            }
        }
        stage('Automation Test') {
            steps {
                sh 'curl --header "x-akaat-request-resource: eyJ0ZW5hbnRLZXkiOiJUZXN0UHJvZF9MTlRLIiwicHJvamVjdElkIjoiZjRhZmI2NjAtOGVlZi00MmZmLWI1N2MtYTU5YmI2NDNkNTc3IiwicHJvamVjdEtleSI6ImRlbW8ifQ==" -X POST -L --user akaat:jSR7v6cNsETT https://manager.akaat.com/api/v2/automation/job/execute/452'
            }
        }
    }
}

3. Editing CI/CD Pipeline job

  1. On job CI/CD Pipelines screen, click on the job that wanting to edit.

    • System shows screen job runner of that job

      Untitled 2

  2. Click on Edit button in the top right corner

    • Systems shows edit job screen
    • Users can:
      • Edit overview of the job.
      • Add/edit/delete tasks.
  3. After editing, click on the Save button to finalize any changes to the job.

4. Deleting CI/CD Pipeline job

  1. Go to “CI/CD Pipelines” screen

    • System shows list of jobs in CI/CD Pipelines

      Untitled 3

  2. Simply click on horizontal ellipsis in each job and click Delete in dropdown menu. action

  3. A pop-up will appear asking "Are you sure you want to delete"?

  4. Confirm by entering the text, then click on Delete button to remove job.

5. Clone CI/CD Pipeline job

  1. Go to “CI/CD Pipelines” screen
  2. System shows list of jobs in CI/CD Pipelines

    Untitled 3

  3. Simply click on horizontal ellipsis in each job and click Clone in dropdown menu. action

  4. A copy version will appear

  5. Click on Save button to clone job.

6. Active/In-Active CI/CD Pipeline job

  1. Go to “CI/CD Pipelines” screen
  2. System shows list of jobs in CI/CD Pipelines

    Untitled 3

  3. Simply click on horizontal ellipsis in each job. action

  4. Click Active job or In-Active job in dropdown menu to active or in-active job.