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.
Ensure you have all the required administrator or management permissions to let you deploy the
Agile Service Manager Jenkins component onto the Jenkins server.
Table 1. Agile Service Manager requirements for the Jenkins plugin
| Plugin |
Version |
Description |
| Jenkins core |
2.150.1 |
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 |
|
| credentials |
2.3.1 |
Compatible version usually provided by Jenkins core |
| Git |
2.6.5 |
|
| artifactory |
2.15.0 |
Optional (for using the Artifactory integration only) |
Obtain the Jenkins plugin:
- 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:
$ find /opt/ibm/netcool/asm/integrations/jenkins/*plugin*
Sample
result:/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}')
$ echo ${JENKINS_OBSERVER_POD}
asm-jenkins-observer-84c456f58c-jxlrj
To
copy the plugin from the
image:$ 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
Obtain credentials:
- On-prem
- Obtain the credentials from ASM_HOME/.env
- The default is
asm and asm
- 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)
- Use the following command to obtain the UI API
credentials:
echo $ASM_USER $ASM_PASS
- Example user and password credentials
returned:
asm-netcool-user N8gJJGEfmmDnF6Q/1zg8NyAGKgQ9PmZQLhUSKd9/j54=
Obtain certificate:
- 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
- To generate the certificate from your installation truststore, use the following
example:
keytool -importkeystore -srckeystore {path to keystore} -srcstorepass {encrypted keystore password} -destkeystore <your_cert_file>.p12 -deststoretype PKCS12 -deststorepass { password you want to set} -destkeypass {password you want to set}
- 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.
- Obtain the
certificate:
oc get secret -n openshift-ingress router-certs-default -o jsonpath='{.data.tls\.crt}' | base64 -d > ocp-default-router.crt
- Obtain the certificate
key:
oc get secret -n openshift-ingress router-certs-default -o jsonpath='{.data.tls\.key}' | base64 -d > ocp-default-router.key
- Convert to
PKCS12:
openssl pkcs12 -export -out ocp-default-router.p12 -inkey ocp-default-router.key -in ocp-default-router.crt
Enter Export Password: enter-suitably-secure-password
Verifying - Enter Export Password: enter-suitably-secure-password
- Ensure that the files you have extracted from OCP are securely deleted.
Obtain observer URL:
- 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>
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.
Important: You perform the following steps as Jenkins administrator.
Install the Jenkins plugin
-
Log in to your Jenkins server with a user ID that has administration (management) permissions.
-
Navigate to and select the Advanced tab.
-
In the Upload Plugin section, upload and install the provided plugin
(asm-observer-plugin-<version>.hpi)
Configure the Jenkins plugin
-
Navigate to and select the Agile Service Manager plugin.
-
Enter the Jenkins Observer URL obtained earlier in the Observer URL
field.
-
Create credentials for Agile Service Manager using the configuration page.
Enter the credentials and the certificate details obtained earlier from the (or as the)
cluster administrator.
- Auth Credentials
- Enter the username and password to authenticate with the Jenkins Observer at API level.
- Click ADD.
- Certificate
- Enter the PKCS12 format certificate to secure the communication between the Jenkins plugin and
the observer using SSL.
- Click ADD.
See the Jenkins site for more detailed information on using the Jenkins Credentials feature:
https://jenkins.io/doc/book/using/using-credentials/
- Optional:
Enter a Default Tenant ID.
The tenant to be used as default when sending information to Agile Service Manager (if it is
not overridden in the build).
- Optional:
Enter a Default Job ID.
The default job ID to be used when sending information to Agile Service Manager (if it is not
overridden in the build). This represents the ID of the job the observer is running to process your
information.
-
Click TEST CONNECTION to attempt to establish a connection with the
observer using the configured credentials.
If successful, a
Connection successful! message is
displayed. If unsuccessful, an error is returned.
Note: The connection test does not verify the
default job and tenant IDs.
Configuring your Jenkins build to notify Agile Service Manager
After
configuring the installed plugin in Jenkins, you integrate the provided functionality into your
existing Jenkins build. The following two steps describe how to use scripted pipeline syntax to send
your build information to the Agile Service Manager Jenkins Observer.
Remember: You
perform the following two steps on your Jenkins build (and not the Jenkins
Observer).
-
Create an instance of the Agile Service Manager observer communication object using the default
credentials set during the configuration steps.
def <my observer> = ASM.newObserver()
Tip:
- Override credentials
- To override any configured credentials (that is, the Jenkins credentials ID rather than the
actual credentials themselves), you can use the following
syntax:
def <my observer> = ASM.newObserver
authCredsId: 'asm-auth-credentials-id', certCredsId: 'asm-cert-credentials-id'
-
Send a build notification using the following syntax:
ASM.notifyASM asmObserver: <my observer>
Tip:
You can override the default values for the tenant and job
IDs:
ASM.notifyASM tenantId: '<tenantId>', jobId: '<jobId>', asmObserver: <my observer>
You can integrate the Jenkins plugin with the Artifactory component using the modules information
to model any artifacts the build has published to the
repository:
ASM.notifyASM asmObserver: <my observer>, artModules: <buildInfoObject>.getModules()
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.
The following sample also depicts the use of Artifactory to publish the build products, and how
that information can be included in the notification to Agile Service Manager using the
artModules parameter.
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}"
}
}
}
}
}
Tip: You can further refine your refine your integration and visualization, as described
here.
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.