Configuring the Jenkins plugin
The Agile Service Manager software includes the Jenkins plugin, which you install on your Jenkins server using the Jenkins Plugin Manager Advanced installation wizard. From the Jenkins server, the plugin gathers and sends information to the Jenkins Observer.
Before you begin
Ensure you have all the required administrator or management permissions to let you deploy the Agile Service Manager Jenkins component onto the Jenkins server.
Plugin | Version | Description |
---|---|---|
Jenkins core | 2.159 | Jenkins server minimum version |
apache-httpcomponents-client-4-api | 4.5.10-2.0 | Provided by Jenkins core |
workflow-step-api | 2.22 | |
workflow-cps | 1.9 | |
workflow-multibranch | 2.17 | |
credentials | 2.3.1 | Compatible version usually provided by Jenkins core |
Git | 2.6.5 | |
artifactory | 3.15.0 | Optional (for using the Artifactory integration only) |
- On-prem
- The Jenkins plugin is available on the Agile Service Manager server after the Jenkins Observer
is installed. Find it as in the following
example:
Sample result:$ find /opt/ibm/netcool/asm/integrations/jenkins/*plugin*
/opt/ibm/netcool/asm/integrations/jenkins/asm-observer-plugin-<version>.hpi
- On OCP
- You can find the Jenkins plugin included with the Jenkins Observer image. For
example:
$ JENKINS_OBSERVER_POD=$(oc get pod -l app=jenkins-observer -o jsonpath='{.items[0].metadata.name}')
To copy the plugin from the image:$ echo ${JENKINS_OBSERVER_POD} asm-jenkins-observer-84c456f58c-jxlrj
$ oc cp $JENKINS_OBSERVER_POD:/opt/ibm/asm-observer-plugin-<version>.hpi asm-observer-plugin-<version>.hpi
$ ls asm-observer-plugin-<version>.hpi asm-observer-plugin-<version>.hpi
- On-prem
- Obtain the credentials from ASM_HOME/.env
- On OCP
- The Agile Service Manager UI API credentials are dynamically created. If Agile Service Manager
is installed with a release name of
asm
, then:ASM_RELEASE_NAME=asm ASM_USER=$(oc get secret ${ASM_RELEASE_NAME}-asm-credentials -o jsonpath={.data.username} | base64 -d) ASM_PASS=$(oc get secret ${ASM_RELEASE_NAME}-asm-credentials -o jsonpath={.data.password} | base64 -d)
- On-prem
- If your installation uses the proxy service, generate the required certificate as in the
following
example:
openssl pkcs12 -export -out <your_cert_file>.p12 -inkey asm-nginx.key -in asm-nginx.crt
- On OCP
- The following sample steps apply to the default router deployed on OCP. If additional routers are used, adjust these steps accordingly. You perform these steps as cluster administrator.
- On-prem
- The expected observer URL is https://<your-asm-onprem-host>/
- On OCP
- Obtain the hostname as in the following
example:
# oc get routes -l release=asm -l app=jenkins-observer -o jsonpath='{.items[*].spec.host}' asm.netcool.apps.<your-ocp-cluster>
About this task
The Jenkins plugin defines Jenkins pipeline DSL steps that you use to instruct the Jenkins builds to generate and then send topology data to the Jenkins Observer. The DSL steps to send the notification lets you include Artifactory BuildInfo modules information in order for the build products to be modeled. You create an observer instance, which then triggers the sending of the notification to the observer.
For information on configuring Jenkins Observer jobs, see the related tasks.
Procedure
Install the Jenkins plugin
Configure the Jenkins plugin
Configuring your Jenkins build to notify Agile Service Manager
Example
The following Jenkinsfile code sample shows the integration with Agile Service Manager. It starts
with the declaration of the observer instance, and ends with the notification to Agile Service
Manager. This notification should be added as a post / always
block, so that the
information is sent as the last operation of the build, and is sent regardless of the result of the
build.
The optional try / catch
around the notification to Agile Service Manager is
included in this sample to avoid the build failing if the notification to Agile Service Manager
fails.
def asm = ASM.newObserver()
def buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = true
… your build logic here …
post {
always {
script {
try {
ASM.notifyASM asmObserver: asm, artModules: buildInfo.getModules()
} catch (err) {
echo "An error ocurred sending a notification to ASM: ${err}"
}
}
}
}
}
What to do next
After you have installed and configured the Jenkins plugin, you configure the Jenkins Observer listen job.
You can further refine your Agile Service Manager system to take advantage of its topology and other customization functionality.