Skip to main content
Version: 15.2.1

Jenkins Connector

The Jenkins connector ingests data from a self-hosted Jenkins controller into the Catalog, through its JSON REST API. It runs through the ibdm binary in one mode only:

  • Sync — pull-based: walks the folder tree of the controller, reads the requested data and exits.

The source has no event stream: ibdm run jenkins is refused as an invalid integration name. To keep the Catalog up to date, run the sync on a schedule.

Commands​

ibdm sync jenkins --include-internal-mappings=all

The command uses every internal mapping of the source. To select only some of them, or to add mappings of your own, see Mappings.

Requirements​

The source supports Jenkins LTS 2.555.1 or later. It reads the data exposed by these plugins:

PluginUsed for
Foldersfolders and folder credentials stores
Branch API and Pipeline: Multibranchorganization folders, multibranch projects and their primary branch
Pipeline: Groovy Librariesshared libraries loaded by the builds
Pipeline Graph Viewstages of the builds, with their hierarchy
Pipeline: Stage Viewstages of the builds, and structured failure details
Credentialscredentials metadata and usage tracking

At least one of Pipeline Graph View and Pipeline: Stage View is needed to read the stages of the builds. When both are installed, the stages come from Pipeline Graph View, which exposes their hierarchy, and the failure details from Pipeline: Stage View. When neither is installed, workflows are imported without stages and a single warning is logged.

Configuration​

VariableRequiredDefaultDescription
JENKINS_URLYes—URL of the controller, with scheme and an optional path (e.g. https://ci.example.com or https://ci.example.com/jenkins). It must not include user information, a query or a fragment. It also identifies the controller in the Catalog: see Items are identified by the controller URL.
JENKINS_USERNAMEYes—Jenkins user that owns the API token. Sent as the HTTP Basic Auth username.
JENKINS_API_TOKENYes—API token of the user. Sent as the HTTP Basic Auth password and never logged.
JENKINS_HTTP_TIMEOUTNo30sTimeout for HTTP requests (Go duration). Must be positive.

Authentication​

The source authenticates with a username and an API token through HTTP Basic Auth. To create a token, open the user menu in Jenkins, select Security, and add a new token under API Token.

The user only sees what its permissions allow. The minimum permissions are:

PermissionNeeded for
Overall/Readevery request
Job/Readfolders, multibranch projects, workflows, builds and stages
Credentials/Viewcredentials metadata, at system level and on every folder to read
Overall/Administer or Overall/SystemReadthe plugin data type; optional for detecting the stage plugins

When the user cannot list the plugins, the sync logs a warning, emits no plugin item and still succeeds with the other data types.

Every request is built from JENKINS_URL: the URLs returned by Jenkins are only reported in the data and never called, so the credentials are only sent to the configured controller.

Supported data types​

TypeSyncDescription
instance✅The controller: URL, version, system message, usage mode.
folder✅Every folder and organization folder, at any depth.
multibranch✅Every multibranch project, with its primary branch and the number of branches, pull requests and tags.
workflow✅Every Pipeline job: the standalone ones and the primary branch of every multibranch project, with its last completed build, the stages of that build and the shared libraries it loaded. Freestyle, matrix and maven jobs are skipped.
sharedlibrary✅Every shared library loaded by the last completed build of at least one workflow, with the workflows using it.
credential✅Every credential of the system store and of the folder stores: metadata only, secret values are never requested.
plugin✅Every installed plugin, with its version, status and dependencies.

The fields of each data type are described in the Jenkins integration guide of ibdm.

Internal mappings​

ibdm mappings list jenkins prints the internal mappings of this source, and the Internal Mappings reference lists the Item Type each one writes.

Internal mappingSyncIts relationships point at
credentialsone item per credential of the system store and of the folder stores—
foldersone item per folder and organization folderinstances, folders
instancesone item for the controller—
multibranchesone item per multibranch projectinstances, folders
pluginsone item per installed plugininstances
sharedlibrariesone item per shared library loaded by a last completed build—
workflowsone item per standalone workflow and per primary branch of a multibranch projectinstances, folders, multibranches

Every item with a container is related to it with a part-of relationship: a folder, a multibranch project and a standalone workflow are part of their parent folder, or of the instance at the top level of the controller; the primary branch workflow is part of its multibranch project; a plugin is part of the instance. Credentials and shared libraries have no relationship: the jobs and folders they refer to are listed in their usages and store.

Select them all. Each mapping works alone, but writes its relationships even when the mapping of their target is not selected: with workflows alone, the relationships point at folders, multibranch projects and an instance that the sync does not write. The sync reads only the data the selected mappings need: for example, only workflows reads the stages of the builds, and only credentials reads the credentials stores.

Limitations​

Items are never deleted​

The sync only creates and updates items. An item renamed, moved or removed in Jenkins stays in the Catalog with its last known state: a job moved to another folder becomes a new item, and the old one remains. The stages are the exception: they live inside the workflow, and every sync replaces them with those of the last completed build.

Only the last completed build​

Workflows carry their last completed build only. A build still running is not reported until it completes, and the history of the builds is not read. The stages, the shared libraries and the failure details all refer to that single build.

Only Pipeline jobs and primary branches​

Only Pipeline jobs become workflows. Of a multibranch project, only the branch that the SCM marks as primary becomes a workflow: the other branches, the pull requests and the tags are never read, and a multibranch project whose SCM marks no branch has no workflow.

Shared libraries​

Jenkins does not expose the configuration of the shared libraries through its REST API, so the source reports the libraries loaded by the last completed builds: a library that no last completed build loaded is not reported, and libraries with the same name defined in different folders are grouped in a single item.

Credentials​

Only the credentials of the system store and of the folder stores are read: the credentials of a user and those exposed by external secret manager plugins are not. The usages of a credential are complete only as far as Jenkins tracks them, which happens when the plugin consuming the credential records it, as Credentials Binding (withCredentials), Git and SSH Agent do.

Folder depth​

The folder tree is walked down to 20 levels: a folder at the 20th level is reported, but its content is not read, and a warning naming the folder is logged.

Items are identified by the controller URL​

The Jenkins names, such as the full name of a job or the id of a credential, are unique only within one controller, so the internal mappings combine them with a key derived from JENKINS_URL: the scheme and the default port are dropped, the host is lowercased, the path is kept and the trailing slash removed. For example, HTTPS://CI.Example.com:443/jenkins/ and https://ci.example.com/jenkins both give the key ci.example.com/jenkins. Several controllers can therefore write to the same Catalog, with two consequences:

  • changing JENKINS_URL to an address with a different key, such as a new domain, a different path or an internal address of the same controller, creates a new set of items, and the old ones stay in the Catalog;
  • two controllers reached through the same address, such as the same in-cluster service name in two Kubernetes clusters, get the same key and their items collide: reach each controller through a distinct address.

See also​