Jenkins Plugin
Gives the agent read access to a Jenkins instance: jobs and their status, builds and why they failed, console logs, job configuration (config.xml), the queue and nodes. It also offers a gated build trigger and a generic API escape hatch. Tools authenticate as the calling user: each reads the user's <username>:<API token> from User Secrets at call time, so Jenkins' own permissions decide what each user's agent sees. There is no shared instance credential.
Load user_secrets alongside this plugin.
The plugin has no UI of its own. Every result carries Jenkins URLs (job, build, console, configure page), so the agent links to Jenkins' pages instead of re-rendering them.
Tools
| Tool | Approval | Purpose |
|---|---|---|
jenkins_list_jobs | none (read) | One folder level, or a search below it by name query and/or status (failure, unstable, running...). |
jenkins_get_job | none (read) | One job: description, health, parameters with defaults, recent builds, upstream/downstream; a folder's children. |
jenkins_get_build | none (read) | One build (number or permalink, default lastBuild): result, timing, causes, parameters, git commit and changes, pipeline stages, failing tests, artifacts. |
jenkins_get_console | none (read) | A build's log: the last lines (default 150), or grep matches with context; save: true stages the whole log as a file. |
jenkins_get_config | none (read) | A job's config.xml (needs Extended Read or Configure on the job). |
jenkins_overview | none (read) | Version, queue with why each item waits, running builds, nodes with busy executors and offline reasons. |
jenkins_api_request | jenkins.api_request (POST only) | Escape hatch for any endpoint of the configured instance; GET runs unattended. |
jenkins_build_job | jenkins.build_job | Queue a build; picks build or buildWithParameters and validates parameter names first. |
Jobs are named by their Jenkins full name (folder/job, or project/feature%2Fx for a multibranch branch), or by pasting any URL of the instance. A build or console URL also selects the build. URLs on other origins, or outside the configured context path, are refused because the request would carry the user's token.
Context budget
Results are compact JSON with Jenkins' _class noise and empty values removed, and every request is narrowed with tree=. Console logs are never returned whole: the tail reads only the end of the log (one window, however large the log), grep returns numbered matching lines with context, and text over inline_text_limit is staged to a read-only file under from-jenkins/ with only its start shown.
Who gets which half
target_agents (default all) decides whether the family is offered; write_target_agents (default main) decides who gets jenkins_build_job and jenkins_api_request. By default a subagent can read a failing build's log but cannot start a build.
Configuration
plugins:
- module: codumentor.plugins.jenkins
class: JenkinsPlugin
args:
url: https://ci.example.com/jenkins # base URL incl. context path
api_token_secret: jenkins_api_token # per-user secret name (default)
target_agents: all
write_target_agents: main
inline_text_limit: 16000 # chars of log/XML/API text shown inline
console_max_bytes: 20971520 # max bytes of one log fetched per call
Each user adds a secret named jenkins_api_token with the value <jenkins-username>:<api-token>. The token comes from Jenkins: your name, then Configure, API Token, Add new Token. The User Secrets pane lists it under Needed by plugins.
CSRF crumbs are fetched for POSTs (API-token requests are exempt since Jenkins 2.96, but stricter instances still work). Pipeline stages need the Pipeline Stage View plugin and failing tests need JUnit results; without them those fields are simply absent.