# How to setup the testing Jenkins server Following this guide, you can create a plugin testing environement in Jenkins server. ## Prerequest - A server to run a jenkins server. - A setup k8s cluster with expose the service to NodeIP (for REST API) - [Setup a jenkins server on Linux](https://www.jenkins.io/doc/book/installing/linux/) ## Introduction - In our jenkins plugin, we have two mode - Standalone mode, run the service inside the docker images - REST API mode, run the service inside external controller - We will need to run a pipeline to verify, we scan a alpine images. ```groovy pipeline { agent any stages { stage('docker pull') { steps{ sh 'docker pull alpine:3.9.4' } } stage('docker tag'){ steps{ sh 'docker tag alpine:3.9.4 mydemo:1.0' sh 'docker ps' } } stage('Build') { steps { # We need to let jenkins generate this part for us, intro in below. # Result may looks like the following. neuvector nameOfVulnerabilityToExemptFour: '', nameOfVulnerabilityToExemptOne: '', nameOfVulnerabilityToExemptThree: '', nameOfVulnerabilityToExemptTwo: '', nameOfVulnerabilityToFailFour: '', nameOfVulnerabilityToFailOne: '', nameOfVulnerabilityToFailThree: '', nameOfVulnerabilityToFailTwo: '', numberOfHighSeverityToFail: '', numberOfMediumSeverityToFail: '', registrySelection: 'docker-hub', repository: 'songlongtj/alpine', scanTimeout: 10, tag: '3.10' } } } } ``` ## How to setup a pipeline 1. Click new item ![](https://hackmd.io/_uploads/Sk9Jv2s-p.png) 2. Click create pipeline with the name ![](https://hackmd.io/_uploads/BJReP3obp.png) 3. Select the template step - *Click the check box means Standalone else REST API* ![](https://hackmd.io/_uploads/B1_eqni-p.png) ## How to setup the endpoint for plugins. - Home Page > Manage Jenkins > configuration. - Next two section shows you how to configure in different mode. ### REST API 1. Replace the Neuvector Controller REST API url with the exposed IP of cluster prepared before. 2. Replace the certificate if you know how to get the certificate, in generalwe we can get it with following step - access into the pods of the expose cluster - file should be here `/etc/neuvector/certs/ssl-cert.pem` - copy the content and paste it here as the certificate. ![](https://hackmd.io/_uploads/SkI5s3ib6.png) ### Standalon 1. Set up you own docker repo, then push the neuvector onto it. 2. Set it to the following. ![](https://hackmd.io/_uploads/S1UVp3o-T.png)