Contents:

Related pages:

 

 


Integration with GitLab Continuous Integration


What does the plugin do?


Kiuwan provides integration with GitLab.

GitLab is a powerful tool for software development, security, and operations that enables concurrent DevOps, making the software lifecycle faster.

 

In continuous integration and continuous delivery (CI/CD) environments is very common (and recommendable) to ensure the security and quality of the software under development.

Kiuwan allows to do baseline or delivery analyses as a step in the pipeline defined in GitLab.

 

The Kiuwan analysis will be executed by a gitlab runner.



How to use it?


To run a Kiuwan analysis, it is needed to follow the next steps:


1. Insert or add a Kiuwan step in the YAML definition

In the project home it is needed to add a YAML file with the steps to invoke Kiuwan:



The next code example shows a very simple case with a Maven step and a Kiuwan baseline analysis:

stages:
 - build
 - analyze
 
maven-build:
 stage: build
 script:
   - mvn clean
 tags:
   - maven
   
kiuwan-bl-analysis:
 stage: analyze
 script:
   - agent -n %CI_PROJECT_NAME% -s %CI_PROJECT_DIR% -l "GitLab build %CI_JOB_ID%" -c --user %KIUWAN_USER% --pass %KIUWAN_PASSWD%
 tags:
   - kiuwan

Bear in mind that the tags used in the step are important because they will be used in the configuration of the local agents (runners).

 

2. Install Kiuwan Local Analyzer in the runner machine

As we can see in the previous example the call to Kiuwan is through a command line.

So it is needed to install the Kiuwan Local Analyzer in the machine where the gitlab runner will be installed.


To do that go to kiuwan.com, log in, and in the user options download the Kiuwan Local Analyzer:


In addition, it is needed to add the folder: KLA_HOME/bin to the environment variable PATH.


3. Define credentials as secret variables

Kiuwan credentials should be added as secret variables. These variables will be applied to environments via the runner.


To add the variables go to Settings -> CI/CD menu and clicking on Expand and add both variables.



4. Perform an analysis

To perform a Kiuwan analysis we need to install a gitlab runner (local agent) that will be the responsible to execute the steps of the pipeline.


To install a gitlab runner we could follow next instructions:

https://docs.gitlab.com/runner/install/


When we create the agent it is necessary to specify the tags of the steps we want to analyze with the runner.

In the previous example tags are maven,kiuwan:




Once we have done it, we could perform an analysis in the pipeline screen in order to test the configuration.