Integrate with Jenkins
ModelOp Center seamlessly integrates with existing CI/CD systems, such as Jenkins, to allow enterprises to leverage existing IT investments.
Table of Contents
Â
Introduction
ModelOp Center provides the ability to integrate with Jenkins to initiate and manage CI/CD pipelines as part of an overall Model Life Cycle.
Jenkins Integration Setup
Prerequisites
This guide is based on using the distribution moc-configuration for helm. If you do not have the distribution moc-configuration, please request download instructions here. This guide also assumes a running Jenkins instance.
For instructions on installing helm, see: Helm | Installing Helm
moc-configuration Jenkins Configuration
The configuration properties for Jenkins are located in application.yaml
. Edit the following properties:
modelop:
jenkins-url:
jenkins-user:
jenkins-password:
As an example, these properties might look as follows:
modelop:
jenkins-url: https://foo.jenkins.com
jenkins-user: jenkins@modelop.com
jenkins-password: jenkinspass
where https://foo.jenkins.com
is the Jenkins URL, jenkins@modelop.com
is the user name, and jenkinspass
is the password.
Next, ensure the configuration is active in the fleet.
If using sscs backed by git, commit the changes and refresh the actuator or restart mlc-manager
If using a configmap, run helm upgrade, restart sccs, and refresh the actuator or restart mlc-manager
Jenkins Job Monitor Configuration
The Jenkins Job monitor is a background task that periodically queries the state of Jenkins jobs and reacts appropriately to that state. The Jenkins job monitor comes with defaults but values can be configured to meet customer needs.
The default Jenkins Job Monitor Configuration is located in model-manage.yaml
and is defined as follows:
jenkins-job-monitor:
active-job-poll-rate: 10000
The available configuration properties are discussed below.
active-job-poll-rate
- The amount of time in milliseconds between checking the status of tracked, active Jenkins jobs.
After setting these properties ensure the configuration is updated in the fleet as described above.
Additional Jenkins Credentials Configuration
The integration allows for multiple sets of Jenkins credentials if needed. The Jenkins credentials configuration is located in model-manage.yaml
and is defined as follows:
By default the jenkinsUrl
, username
, and password
are coming from the values set previously. The storedCredentials
section allows a list of these credentials to be specified. The correct credentials to use for a Jenkins job is based on matching criteria described below.
After setting these properties ensure the configuration is updated in the fleet as described above.
Jenkins Job Customization
The integration provides parameters to customize the creation and lifecycle of the Jenkins Job. The delegate expression for the Create Jenkins Job activity is ${createJenkinsJob}
.
Required Parameters
JENKINS_JOB_NAME
- The job name on the Jenkins server to execute. If the job is within a folder structure include the full path to the job. (e.g., myfolder/job/subdirectory/job/JENKINS_JOB
)
JENKINS_URL
- The fully qualified URL of the Jenkins server. (e.g., https://jenkins.mycompany.com:8080/
). The URL is used to search for matching defined credentials.
Optional Parameters
JENKINS_USERNAME
- Username to attempt to locate credentials for
BUILD_PARAMETERS
- Build parameters to use for the Jenkins job. The format is a list of name-list value pairs in the following format: [param_name]:[value],[value],....;[param_name]:[value],....
. Each name-list value pair is separated by a semicolon. The name and list values are separated by a colon. Each value in the list is separated by a comma. As an example, three builder parameters foo:bar;values:val1,val2,val3;url:http://localhost:8090/path
would parse as
ASSOCIATED_MODEL
- A DeployableModel model that is associated with the Jenkins job.
Example MLC Integration with Jenkins
An example sub-process utilizing a Jenkins job is shown below.
Once created the Jenkins job will appear on the Jobs page.
Â
The metadata about the job along with logs are available on the Job info page.
Job-Specific Jenkins Metadata
The following fields are added to the base job fields
buildNumber
- the number of the Jenkins build
buildParameters
- the parameters used to initiate the Jenkins build
jenkinsBuildInfo
- more information about the Jenkins build
jenkinsPipelineInfo
- information about the pipeline used in the Jenkins build
jenkinsRuntime
- the jenkinsUrl
and username
associated with the build
jobName
- the name of the Jenkins job
model
- information about the deployable model used in the build
queueId
- id of the queue used in the Jenkins job
Â
Related Articles
Â
Â