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:
-
Ensure the namespace is specified in the cluster settings. Click the Settings icon in the top right corner and select Cluster settings:
-
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:
-
Create several applications using the Create strategy. Navigate to the EDP tab, choose Components, click the + button:
-
Select Application and Create from template:
notePlease refer to the Add Application section for details.
-
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
- Git server:
-
On the Advanced settings tab, define the below values and push the Apply button:
- Default branch:
main
- Codebase versioning type:
default
- Default branch:
-
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
- Git server:
-
In the Components tab, click one of the applications name to enter the application menu:
-
Click the three dots (â‹®) button, select Build:
-
Click the down arrow (v) to observe and wait for the application to be built:
-
Click the application run name to watch the building logs in Tekton:
-
Wait till the build is successful:
-
Repeat steps 8-12 for the rest of the applications.
Create Autotests​
The steps below instruct how to create autotests in KubeRocketCI:
-
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:
notePlease refer to the Add Autotest section for details.
-
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
- Repository URL:
-
On the Advanced settings tab, leave the settings as is and click the Apply button:
-
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
- Repository URL:
Create CD Pipeline​
Now that applications and autotests are created, create pipeline for them by following the steps below:
-
Navigate to the CD Pipelines tab and click the + button:
-
On the Pipeline tab, in the Pipeline name field, enter demo-pipeline:
-
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:
-
On the Stages tab, click the Add stage button to open the Create stage menu:
-
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
- Cluster:
-
After the dev stage is added, click Apply:
-
After the pipeline is created, click its name to open the pipeline details page:
-
In the pipeline details page, click the Create button to create a new stage:
-
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
- Cluster:
Run Autotests​
After the CD pipeline is created, deploy applications and run autotests by following the steps below:
-
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:
-
Once applications are built, scroll down to Quality Gates and click Promote:
-
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: