Skip to main content
Version: 3.9.0

Autotest as a Quality Gate

This use case outlines the process of integrating an autotest as a quality gate into a newly created CD pipeline. The CD pipeline includes a selected build version of an application that needs to be promoted. The purpose of incorporating autotests is to ensure that the application meets predefined criteria for stability and functionality, guaranteeing that only reliable versions are promoted. By implementing this feature, users can perform comprehensive testing, thereby enhancing the overall stability of the application.

In the KubeRocketCI platform, users can seamlessly add autotests as quality gates to their CD pipelines, enabling them to validate the application's stability and functionality before promoting it to the next stage. This ensures that only reliable versions of the application are deployed, improving the overall quality and reliability of the software.

Roles​

This documentation is tailored for the Developers and Quality Assurance specialists.

Goals​

  • Create several applications and autotests quickly.
  • Create a pipeline for Continuous Deployment.
  • Perform testing.
  • Update delivery by deploying the new version.

Preconditions​

  • KubeRocketCI instance is configured with Gerrit, Tekton and Argo CD.
  • Developer has access to the platform using the Single-Sign-On approach.
  • Developer has the Administrator role (to perform merge in Gerrit).

Create Applications​

To implement autotests as Quality Gates, follow the steps below:

  1. Ensure the namespace is specified in the cluster settings. Click the Settings icon in the top right corner and select Cluster settings:

    Cluster settings

  2. Enter the name of the default namespace, then enter your default namespace in the Allowed namespaces field and click the + button. You can also add other namespaces to the Allowed namespaces:

    Specify namespace

  3. Create several applications using the Create strategy. Navigate to the EDP tab, choose Components, click the + button:

    Add component

  4. Select Application and Create from template:

    Create new component menu

    note

    Please refer to the Add Application section for details.

  5. On the Codebase info tab, define the following values and press the Proceed button:

    • Git server: gerrit
    • Git repo relative path: js-application
    • Component name: js-application
    • Description: js application
    • Application code language: JavaScript
    • Language version/Provider: Vue
    • Build tool: NPM

    Codebase info tab

  6. On the Advanced settings tab, define the below values and push the Apply button:

    • Default branch: main
    • Codebase versioning type: default

    Advanced settings tab

  7. Repeat the procedure twice to create the go-application and python-application applications. These applications will have the following parameters:

    go-application:

    • Git server: gerrit
    • Git repo relative path: go-application
    • Component name: go-application
    • Description: go application
    • Application code language: Go
    • Language version/Provider: Gin
    • Build tool: Go
    • Default branch: main
    • Codebase versioning type: default

    python-application:

    • Git server: gerrit
    • Git repo relative path: python-application
    • Component name: python-application
    • Description: python application
    • Application code language: Python
    • Language version/Provider: FastAPI
    • Build tool: Python
    • Default branch: main
    • Codebase versioning type: default
  8. In the Components tab, click one of the applications name to enter the application menu:

    Components list

  9. Click the three dots (â‹®) button, select Build:

    Application menu

  10. Click the down arrow (v) to observe and wait for the application to be built:

    Application building

  11. Click the application run name to watch the building logs in Tekton:

    Tekton pipeline run

  12. Wait till the build is successful:

    Successful build

  13. Repeat steps 8-12 for the rest of the applications.

Create Autotests​

The steps below instruct how to create autotests in KubeRocketCI:

  1. Create a couple of autotests using the Create strategy. Navigate to the EDP tab, choose Components, click on the + button. Select Autotest and Clone project:

    Add autotest

    note

    Please refer to the Add Autotest section for details.

  2. On the Codebase info tab, define the following values and press the Proceed button:

    • Repository URL: https://github.com/SergK/autotests.git
    • Git server: gerrit
    • Git repo relative path: demo-autotest-gradle
    • Component name: demo-autotest-gradle
    • Description: demo-autotest-gradle
    • Autotest code language: Java
    • Language version/framework: Java11
    • Build tool: Gradle
    • Autotest report framework: Allure

    Codebase info tab for autotests

  3. On the Advanced settings tab, leave the settings as is and click the Apply button:

    Advanced settings tab for autotests

  4. Repeat the steps 1-3 to create one more autotest with the parameters below:

    • Repository URL: https://github.com/Rolika4/autotests.git
    • Git server: gerrit
    • Git repo relative path: demo-autotest-maven
    • Component name: demo-autotest-maven
    • Description: demo-autotest-maven
    • Autotest code language: Java
    • Language version/framework: Java11
    • Build tool: Maven
    • Autotest report framework: Allure

Create CD Pipeline​

Now that applications and autotests are created, create pipeline for them by following the steps below:

  1. Navigate to the CD Pipelines tab and click the + button:

    CD pipelines tab

  2. On the Pipeline tab, in the Pipeline name field, enter demo-pipeline:

    Pipeline tab

  3. On the Applications tab, add all the three applications, specify the main branch for all for them and check Promote in pipeline for Go and JavaScript applications:

    Applications tab

  4. On the Stages tab, click the Add stage button to open the Create stage menu:

    Stages tab

  5. In the Create stage menu, specify the following parameters and click Apply:

    • Cluster: In cluster
    • Stage name: dev
    • Description: dev
    • Trigger type: manual
    • Quality gate type: Autotests
    • Step name: dev
    • Autotest: demo-autotest-gradle
    • Autotest branch: main

    Create stage menu

  6. After the dev stage is added, click Apply:

    Create stage menu

  7. After the pipeline is created, click its name to open the pipeline details page:

    Enter pipeline

  8. In the pipeline details page, click the Create button to create a new stage:

    Create a new stage

  9. In the Create stage menu, specify the following parameters:

    • Cluster: In cluster
    • Stage name: sit
    • Description: sit
    • Trigger type: manual
    • Quality gate type: Autotests
    • Step name: dev
    • Autotest: demo-autotest-maven
    • Autotest branch: main

Run Autotests​

After the CD pipeline is created, deploy applications and run autotests by following the steps below:

  1. Click the dev stage name to expand its details, specify image versions for each of the applications in the Image stream version field and click Deploy:

    Deploy applications

  2. Once applications are built, scroll down to Quality Gates and click Promote:

    Promote in pipeline

  3. Once promotion procedure is finished, the promoted applications will become available in the Sit stage. You will be able to select image stream versions for the promoted applications. The non-promoted application will stay grey in the stage and won't be allowed to get deployed:

    Sit stage