Skip to content

Jenkins Connector

The Jenkins connector provides visibility into your Jenkins CI/CD server with 7 live tools and comprehensive ETL ingestion of jobs, builds, nodes, views, and plugins into the knowledge graph.

Authentication

The Jenkins connector authenticates using a username and API token. Generate an API token from Manage Jenkins > Users > Configure > API Token.

json
{
  "name": "CI Jenkins",
  "source_type": "jenkins",
  "config": {
    "base_url": "https://jenkins.example.com",
    "username": "agentcy-bot",
    "api_token": "11a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
    "modules": ["jobs", "builds", "nodes", "views", "plugins"]
  }
}
VariableRequiredDescription
base_urlYesJenkins server URL (e.g., https://jenkins.example.com)
usernameYesJenkins username with API access
api_tokenYesAPI token generated from the Jenkins user settings
modulesNoModules to enable: jobs, builds, nodes, views, plugins, credentials

TIP

Create a dedicated Jenkins user for Agentcy with read access to all jobs and builds. Avoid using your personal account.

Live Tools (7)

ToolDescriptionArguments
jenkins_list_jobsList all jobs with status, last build info, and healthfolder?, view?
jenkins_get_jobGet detailed information about a specific jobjob_name
jenkins_get_buildGet build details including status, duration, and logsjob_name, build_number
jenkins_trigger_buildTrigger a new build for a jobjob_name, parameters?
jenkins_stop_buildAbort a running buildjob_name, build_number
jenkins_list_nodesList all build nodes with status and executor infooffline_only?
jenkins_list_pluginsList installed plugins with version and update statusupdates_only?

Example: Agent Using Jenkins Tools

User: "Which jobs have been failing most often this week?"

Agent: Let me check your Jenkins jobs.
→ Calls jenkins_list_jobs()
→ Filters for jobs with recent failures
→ Reports: "3 jobs have failed in the last 7 days:
  - backend-integration-tests: 5 failures (last: #412)
  - deploy-staging: 2 failures (last: #89)
  - nightly-e2e: 1 failure (last: #201)"
User: "Show me the logs for backend-integration-tests build #412"

Agent: I'll pull the build details.
→ Calls jenkins_get_build(job_name: "backend-integration-tests", build_number: 412)
→ Returns build status, duration, console output, and failure cause

ETL Ingestion

When you trigger a sync, the Jenkins connector ingests the following resources into the knowledge graph. A JenkinsServer root node is created to anchor all resources.

Nodes Created

Node LabelPropertiesJenkins Resource
JenkinsServerurl, version, mode, num_executorsServer root
JenkinsJobname, url, color, buildable, last_build, last_success, last_failure, health_scoreJobs
JenkinsBuildnumber, result, timestamp, duration, building, built_on, trigger_causeBuilds
JenkinsNodedisplay_name, offline, num_executors, architecture, os, labelsNodes
JenkinsViewname, url, descriptionViews
JenkinsPluginshort_name, long_name, version, active, has_updatePlugins

Relationships Created

RelationshipFromTo
HAS_JOBJenkinsServerJenkinsJob
HAS_BUILDJenkinsJobJenkinsBuild
HAS_NODEJenkinsServerJenkinsNode
CONTAINSJenkinsViewJenkinsJob
BUILT_BYJenkinsBuildJenkinsNode

Graph Queries

cypher
-- Find jobs with the most consecutive failures
MATCH (j:JenkinsJob)-[:HAS_BUILD]->(b:JenkinsBuild)
WHERE b.result = "FAILURE"
RETURN j.name, count(b) AS failures
ORDER BY failures DESC
LIMIT 10

-- Find which nodes are building the most jobs
MATCH (b:JenkinsBuild)-[:BUILT_BY]->(n:JenkinsNode)
WHERE b.result IS NOT NULL
RETURN n.display_name, count(b) AS build_count
ORDER BY build_count DESC

-- Find jobs visible in a specific view
MATCH (v:JenkinsView)-[:CONTAINS]->(j:JenkinsJob)
WHERE v.name = "Production"
RETURN j.name, j.health_score, j.last_build

Configuration Reference

json
{
  "name": "CI Jenkins",
  "source_type": "jenkins",
  "config": {
    "base_url": "https://jenkins.example.com",
    "username": "agentcy-bot",
    "api_token": "...",
    "modules": ["jobs", "builds", "nodes", "views", "plugins", "credentials"],
    "job_filter": "backend-*",
    "max_builds_per_job": 50
  }
}
FieldTypeDefaultDescription
base_urlstringrequiredJenkins server URL
usernamestringrequiredJenkins username
api_tokenstringrequiredJenkins API token
modulesstring[]allModules to enable for ingestion
job_filterstring--Glob pattern to filter jobs by name
max_builds_per_jobnumber50Max number of builds to ingest per job

Troubleshooting

ErrorCauseFix
401 UnauthorizedInvalid username or API tokenRegenerate the API token in Jenkins user settings
403 ForbiddenUser lacks read permissionsGrant Overall/Read and Job/Read permissions
Connection refusedJenkins server is unreachableVerify base_url and network/firewall rules
404 Not FoundJob or build does not existCheck the job name and build number
503 Service UnavailableJenkins is starting up or shutting downWait for Jenkins to become ready

Built by AgentcyLabs. For in-house deployment or Agentcy Cloud (PaaS) access, visit agentcylabs.com.