App Connect

 View Only

Using IBM App Connect to interact with Jenkins

By Shahmini Arumugam posted Tue December 15, 2020 05:30 AM


Jenkins is an extensible open source automation server that can be used to automate the building and delivery of your projects, and support continuous integration and continuous delivery (CI/CD).  Jenkins manages and controls DevOps processes throughout the lifecycle.

Using Jenkins with IBM® App Connect

You can use App Connect to perform actions on the following objects:

  • Projects
  • Builds

To use App Connect to integrate Jenkins with your other applications, you need to connect App Connect to your Jenkins account by providing the following information:

  • Application URL: The application URL of the Jenkins instance in the format https://hostname.
  • Username: The username for the Jenkins account.
  • Password: The password for the specified username.
  • Network name: The name of the network that App Connect uses to access your system. A network name is required only if you’re connecting to a system in a private network.

Scenario: Retrieve the last build from Jenkins and, if the build fails, create an issue in Jira® if an issue doesn’t already exist

Consider this scenario where you use App Connect to create a flow for an API that, when called, retrieves the last build details from Jenkins. If the build fails, an issue is created in Jira if an issue doesn’t already exist.

In this scenario, the Request node retrieves details of the last build from Jenkins through the Retrieve builds action.  The flow includes an If node from the Toolbox to check whether the value of the ‘Result’ property for the last build is ‘FAILURE’.

If the result is ‘FAILURE’, Jira retrieves the issue ID if it exists for that build.  After the issue is retrieved, an If node is used to check whether the Name field of the issue is ‘Bug’. If the Name field is ‘Bug’, a message that says “BuildDetails already exists” is created in Slack.

If the Name field in the issue is not ‘Bug’, a new issue is created in Jira, and a message that says “Jira Issue JiraIssueID created for Jenkins build JenkinsBuildDisplayName” is created in Slack.

 If the value of the ‘Result’ property is not ‘FAILURE’, a message that says “Your last build JenkinsBuildDisplayName is either in progress or passed” is created in Slack.

The Response node contains an example of the output mapping for the build details.

For more information about other supported connectors, see Connectors.