{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":21270,"path":"integrate-applications/integration-hub/jenkins-spoke.md","title":"Jenkins v2 Spoke","bundle":null,"doc_type":null,"release":"australia","body":"\n# Jenkins v2 Spoke\n\nManage builds, users, settings, and jobs on the Jenkins server. Retrieve Jenkins data to use in a flow.\n\n## Request apps on the Store\n\nVisit the [ServiceNow Store](https://store.servicenow.com/sn_appstore_store.do#!/store/home) to view all the available apps, and for information about submitting requests to the store. For cumulative release notes information for all released apps, see the [ServiceNow Store version history release notes](https://www.servicenow.com/docs/r/store-release-notes/sn-store-release-notes.html).\n\n## Integration Hub subscription\n\nThis spoke requires an Integration Hub subscription. For more information, see [Legal schedules - IntegrationHub overview](https://www.servicenow.com/content/dam/servicenow-assets/public/en-us/doc-type/legal/snc-addendum-integrationhub.pdf).\n\n## Spoke version\n\nJenkins v2 spoke v1.4.1 is the latest version. For version history of the spoke, see [Jenkins v2 spoke release notes](https://www.servicenow.com/docs/r/store-release-notes/store-integrationhub-rn-jenkins-v2-spoke.html).\n\n## Spoke dependencies\n\nIf you’re having trouble installing the app, ensure that these dependent plugins are installed:\n\n-   ServiceNow IntegrationHub Runtime \\(com.glide.hub.integration.runtime\\)\n-   ServiceNow IntegrationHub Action Step - REST \\(com.glide.hub.action\\_step.rest\\)\n-   ServiceNow IntegrationHub Action Template - Data Stream \\(com.glide.hub.action\\_type.datastream\\)\n\n**Note:** Some of these plugins are licensable features and require an appropriate license if used outside the spoke implementation. For information on licenses, contact your account manager.\n\n## Spoke requirements\n\nThe Jenkins v2 spoke v2 requires generating an API token. See [Security Hardening: New API token system in Jenkins 2.129+](https://jenkins.io/blog/2018/07/02/new-api-token-system/) for more information about the API tokens.\n\n## Supported versions\n\nAll versions between 2.176.2 to 2.222.1.\n\n## Spoke modules\n\nYou can configure the Jenkins v2 spoke v2 to receive updates from Jenkins at your ServiceNow instance. In the routing policies, conditions that must be met to receive updates at your ServiceNow instance are defined. When the conditions are met, routing policy triggers the associated subflow, which in turn automates the Jenkins tasks. This requires separate setup and can be used independently without using the spoke actions. See [Set up a webhook for the Jenkins spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/receive-jenkins-upd.md) for information regarding setting up and configuring the webhooks. To use other conditions in the routing policy or customize the default subflows, see [Customize a webhook](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/receive-jenkins-upd.md).\n\nRouting policies and subflows support these fields:\n\n-   Keywords\n-   Build Number\n-   Job Name\n-   Job Path\n-   Show Related Fields\n\nBy default, the Jenkins v2 application is available in the Jenkins v2 spoke and has these modules:\n\n|Module|Description|\n|------|-----------|\n|Webhook Answer Subflows|Details of the webhook authorization key to authorise requests from Jenkins.|\n|Webhook Client Detail|Details about the subflows in Jenkins v2 spoke.|\n\nThe Jenkins v2 spoke v2 includes these tables:\n\n-   Jenkins v2 Webhook Answer Subflow \\[sn\\_jenkinsv2\\_spoke\\_webhook\\_answer\\_subflow\\]\n-   Jenkins Webhook Client Details \\[sn\\_jenkinsv2\\_spoke\\_webhook\\_client\\_details\\]\n\n## Spoke subflows\n\nThe Jenkins v2 spoke provides sample subflows to demonstrate automating Jenkins tasks. Available sample subflows include:\n\n|Subflow|Description|\n|-------|-----------|\n|Build Jenkins Job|Receives updates from Jenkins at the ServiceNow instance.|\n|Jenkins Webhook Answer Subflow: Process build information|Builds Jenkins job and retrieves the information. To customize this subflow, create a copy of the subflow and change it as per your requirement.|\n|Build Jenkins Job with Parameters|Builds Jenkins job with the specified parameters and retrieves the information.|\n\n## Spoke actions\n\nThe Jenkins v2 spoke provides actions to automate Jenkins tasks when events occur in ServiceNow. Available actions include:\n\n|Category|Action|Description|\n|--------|------|-----------|\n|Build Management|Delete Build|Deletes a build from a Jenkins server job.|\n|Get Build ID|Retrieves the Build ID of an executed job from the Jenkins server.|\n|Get Build Timestamp|Retrieves build timestamp of a given job from the Jenkins server.|\n|Get Console Output|Retrieves build console output for a given job from Jenkins Server.|\n|List Builds|Retrieves all the builds for a given job from the Jenkins server.|\n|Perform Build with Parameters|Executes a job with parameters on the Jenkins server.|\n|Get Build History|Retrieves a range of build history for a given job from Jenkins Server.|\n|Get Build Information|Retrieves the build timestamp, build status, and complete build information of a given job from the Jenkins server.|\n|Get Build Number|Retrieves the build number for a Jenkins server job based on a pre-defined build filter, such as last successful build.|\n|Perform Build|Executes a job on the Jenkins server.|\n|Look up Builds by Date Range|Retrieves all the builds between date range for a given job from the Jenkins server.|\n|Look up Commits by Build|Retrieves the commits of a particular build for a given job from the Jenkins server.|\n|Look up Stage Nodes by Build|Retrieves information about the Sonar actions, restartable stages, and nodes of all stages of a particular build for a given pipeline job from the Jenkins server.|\n|Look up Stages by Build|Retrieves the build status, start time, end time, duration, and stages of a particular build for a given pipeline job from the Jenkins server.|\n|Look up Test Report by Build|Retrieves information about the test summaries, total number of executed tests, passed tests, failed tests, skipped tests, and time taken to execute JUnit tests in a particular build for a given job from the Jenkins server.|\n|Configuration Management|Create Node|Creates a node that you can launch with Java Web Start software. A node is a machine that is part of the Jenkins environment and capable of executing jobs.|\n|Delete Node|Deletes a node from the Jenkins server.|\n|Get Version|Retrieves the Jenkins server version.|\n|Restart Jenkins|Restarts the Jenkins server.|\n|Test Connection|Tests the connection to the Jenkins server.|\n|Job Management|Copy Job|Creates a job by copying an existing Jenkins server job.|\n|Create Folder|Creates a Jenkins server folder to organize jobs.|\n|Create Job|Creates a Jenkins server job from an XML file.|\n|Delete Folder|Deletes an existing Jenkins server folder.|\n|Delete Job|Deletes a Jenkins server job.|\n|List Jobs By Folder|Retrieves all the jobs for a given folder from the Jenkins server.|\n|Get Job Configuration|Retrieves the XML configuration for a Jenkins server job.|\n|Reload Job|Reloads a Jenkins server job.|\n|Rename Job|Renames a Jenkins server job.|\n|User Management|Create User|Creates a Jenkins server user.|\n|Delete User|Deletes an existing Jenkins server user.|\n|View Management|Add Job To View|Adds a job to the Jenkins server view. Views are containers to organize jobs. As a Jenkins instance grows, you can create views for appropriate groups and categories. For example, you may want to create a Build view, which only displays build-specific jobs.|\n|Create View|Creates a Jenkins server view.|\n|Delete View|Deletes a Jenkins server view.|\n|List Jobs By View|Retrieves all jobs from a view on the Jenkins server.|\n|Remove Job From View|Removes a job from a Jenkins server view.|\n\n## Spoke triggers\n\nUse triggers in the Jenkins spoke to subscribe to the required events. The endpoint enables webhooks to connect with your ServiceNow instance. You can configure the flows to execute only when the specified trigger conditions are met. The supported events are:\n\n|Category|Trigger|Description|\n|--------|-------|-----------|\n|Build Management|Build Aborted|Trigger initiates when a Jenkins build is aborted.|\n|Build Failed|Trigger initiates when a Jenkins build fails.|\n|Build Success|Trigger initiates when a Jenkins build is successful.|\n|Build Unstable|Trigger initiates when a Jenkins build is unstable.|\n|Job Management|Pipeline Failed|Trigger initiates when a Jenkins pipeline fails.|\n\n## Connection and credential requirements\n\nIntegration Hub uses aliases to manage connection and credential information, and OAuth credentials. Using an alias eliminates the need to configure multiple credentials and connection information profiles when using multiple environments. If the connection or credential information changes, you don't need to update any actions that use the connection.\n\nThis spoke uses the Jenkins v2 Connection &amp; Credential Alias record to authorize actions. To use the spoke connection alias, create an associated Connection record and an associated Credential record. For information about setting up the spoke, see [Set up the Jenkins spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/set-up-jenkins.md).\n\n## MID Server requirements\n\nThese actions use REST calls, which must run on a MID Server. Use the connection record associated with the Jenkins alias to configure where actions run as well as set MID Server selection attributes. For more information, see [MID server](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/mid-server-landing.md).\n\nTo set up the MID Server for this spoke, see [Set up MID Server for a spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/config-adv-mid-settings-for-oauth-on-mid.md).\n\n"}}