Meterian
Search…
Pipeline
Jenkins Pipeline is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins.

Defining your Pipeline

The definition of a Jenkins Pipeline is written into a text file (called a Jenkinsfile) which in turn is committed to a project’s source control repository.
The following sample Pipeline example is equipped with common stages of CI/CD and an additional "Meterian Scan" stage
1
// Jenkinsfile
2
3
pipeline {
4
agent any
5
options {
6
skipStagesAfterUnstable()
7
}
8
stages {
9
stage('Build') {
10
steps {
11
// Some build steps...
12
}
13
}
14
stage('Test') {
15
steps {
16
// Run tests...
17
}
18
}
19
stage('Meterian Scan') {
20
steps {
21
withCredentials([string(credentialsId: 'MeterianApiToken', variable: 'METERIAN_API_TOKEN')]) {
22
sh '''
23
echo Perform Meterian vulnerability scan...
24
docker run --rm -v $(pwd):/workspace -e METERIAN_API_TOKEN=$METERIAN_API_TOKEN meterian/cli
25
'''
26
}
27
}
28
}
29
stage("Deploy") {
30
steps {
31
// Deployment...
32
}
33
}
34
}
35
}
Copied!
Note: the above "Meterian Scan" stage uses the withCredentials plugin for credentials binding and requires you to set your API token within Jenkins's credentials with an ID of choice.
Once your Pipeline is placed within the repository with the codebase you wish to scan, all that is left to do is configuring Jenkins for its execution.

Pipeline configuration in Jenkins

1) In the Jenkins homepage, click on New Item on the top left dashboard
2) Enter an item name, from the relative wizard, specifying the name of your new Pipeline project. Then click on Pipeline and OK at the end of the page to confirm and open the Pipeline configuration page.
3) In the Pipeline configuration page, click the Pipeline tab at the top of the page to scroll down to the Pipeline section. Here select Pipeline script from SCM from the Definition field and fill the subsequent information about your SCM of choice where your repository containing your Jenkinsfileis hosted
4) Once done configuring Save your work
Now when you update the designated repository, a new build is triggered, as long as the Pipeline is configured with an SCM polling trigger. Alternatively you can manually trigger it by clicking Build Now in your newly created Pipeline project menu.
Last modified 3mo ago