Skip to main content

Jenkins ExecModule

Overview

JenkinsModule connects ValkyrAI workflows to the Jenkins Remote Access API through the native map I/O ExecModule ABI. Workflow Studio discovers it as JenkinsModule. The Jenkins origin, username, and API token resolve only from a bound READY IntegrationAccount; workflow input cannot supply credentials or redirect the connector to another host.

The initial production surface focuses on governed CI/CD observation and control:

  • connection and infrastructure: verify_connection, list_nodes;
  • jobs and builds: list_jobs, get_job, list_builds, get_build, get_build_log;
  • approved execution: trigger_build, stop_build;
  • queue control: list_queue_items, get_queue_item, cancel_queue_item.

n8n's official Jenkins node is the functional reference for API-token authentication, build triggers, parameter encoding, job paths, and bounded build reads. ValkyrAI adds queue and node evidence, progressive log reads, fixed IntegrationAccount origins, explicit stop/cancel confirmation, response bounds, read-only retries, and credential redaction. Jenkins controller restart, shutdown, quiet-down, arbitrary script, plugin, credential, and raw-request operations are intentionally excluded.

Usage

  1. Create a dedicated Jenkins automation user and API token.
  2. Grant only the Overall/Read, Job/Read, Job/Build, Job/Cancel, and View/Read permissions required by the selected operations.
  3. Store the Jenkins HTTPS origin, including any context path such as /jenkins, in IntegrationAccount.accountId.
  4. Store the Jenkins user ID in IntegrationAccount.username and the API token in encrypted apiKey.
  5. Set the account status to READY and bind it through ExecModuleConfig.authConfig.integrationAccount.
  6. Use list_jobs or get_job to confirm the exact job path before triggering or stopping a build.

Inputs

NameTypeRequirementDefaultDescription and constraints
operationstringRequiredNoneOne of the twelve documented operations.
jobPathstringJob/build/log operationsNoneSlash-delimited folder and job path; 1–10 segments, each at most 128 characters.
buildNumberintegerBuild/log/stop operationsNonePositive Jenkins build number.
queueIdintegerQueue item/cancel operationsNonePositive Jenkins queue item ID.
parametersobject or JSON stringOptional trigger_build{}Up to 100 scalar values; names match [A-Za-z_][A-Za-z0-9_.-]*; 256 KiB total. Plaintext secret-bearing fields are rejected.
offsetintegerOptional tree-list continuation0Starting job/build slice offset from 0 through 1,000,000.
limitintegerOptional lists100Maximum returned resources, 1–10,000.
returnAllbooleanOptional job/build listsfalseFollow bounded tree slices until exhaustion or 10,000 results.
logOffsetintegerOptional get_build_log0Jenkins progressive console byte offset.
maxLogBytesintegerOptional get_build_log262144Maximum response bytes, 1,024–1,048,576.
confirmStopbooleanRequired stop_buildfalseMust be true to stop a running build.
confirmCancelbooleanRequired cancel_queue_itemfalseMust be true to remove a queued build.

Folder paths are converted to Jenkins' repeated /job/<segment> route shape with each segment encoded separately. Build parameters accept strings, numbers, and booleans only. Use Jenkins credentials bindings for sensitive build material; do not put plaintext secrets in workflow payloads.

Outputs

NameTypeWhen presentDescription
statusstringAlwayssuccess or error.
operationstringAlwaysNormalized operation name.
attemptsintegerAlwaysTotal provider attempts across tree slices.
httpStatusintegerProvider respondedLast Jenkins HTTP status.
dataobjectSingle-resource/mutation successBounded Jenkins object or {accepted:true} for an empty successful mutation.
id, name, number, queueIdscalarProvider returns itSafe convenience identity fields.
providerStatusstringBuild result is availableJenkins build result such as SUCCESS or FAILURE; it never replaces module status.
items / countarray / integerList successBounded provider resources and emitted count.
hasMore / nextOffsetboolean / integerJob/build list successTree-slice continuation state.
text / bytesstring / integerProgressive log successRedacted console chunk and emitted byte count.
nextLogOffsetintegerProgressive log successNext start value from X-Text-Size.
jenkinsVersion, sessionIdstringJenkins supplies headersSafe runtime evidence from Jenkins response headers.
errorobjectFailureSafe {code, message, httpStatus?, retryable} details.

The module never emits the configured origin, username/API-token pair, Basic header, or raw Location URL. Console and provider error text pass through ValkyrAI's shared workflow sensitive-data policy.

IntegrationAccount Requirements

SettingRequirement
ProviderJenkins Remote Access API
AuthenticationJenkins username plus API token using HTTP Basic authentication
accountNameHuman-readable Jenkins automation identity
accountIdRequired clean HTTPS Jenkins origin, including an optional context path
usernameRequired Jenkins user ID; whitespace is not allowed
apiKeyPreferred encrypted SecureField containing the Jenkins API token
passwordEncrypted fallback for an API token only; account passwords are not recommended
statusMust be READY

API-token-authenticated scripted requests are exempt from Jenkins' CSRF crumb requirement. Do not disable Jenkins CSRF protection. Restrict the automation user to the exact folders/jobs it needs, and rotate tokens through the IntegrationAccount lifecycle rather than workflow inputs.

Configuration

{
"version": "1.0.0",
"authConfig": {
"authStrategy": 1,
"integrationAccount": "integration-account:jenkins-release-automation"
},
"retryPolicy": {
"maxAttempts": 3,
"backoffStrategy": "EXPONENTIAL",
"initialDelayMs": 1000,
"maxDelayMs": 60000,
"jitter": false
},
"executionConfig": {"timeoutMs": 30000},
"payloadConfig": {
"parameters": "{\"operation\":\"list_builds\",\"jobPath\":\"release/api-production\",\"limit\":25}"
}
}

The integration-account value is symbolic. Persisted workflows use the generated relationship and never plaintext Jenkins credentials.

Operations

OperationJenkins behaviorSide effect
verify_connectionReads bounded controller mode, executor, security, and quiet-down state.Read-only; safe retries.
list_jobsLists top-level jobs using bounded Jenkins tree slices.Read-only; safe retries.
get_jobReads one folder-aware job plus health, last-build, and parameter definitions.Read-only; safe retries.
list_buildsLists bounded build summaries for one job.Read-only; safe retries.
get_buildReads one build, causes, culprits, and bounded change evidence.Read-only; safe retries.
get_build_logReads one bounded progressive console chunk.Read-only; safe retries.
trigger_buildCalls build or buildWithParameters; returns a queue ID when Jenkins supplies one.Enqueues a build; single attempt.
stop_buildRequests stop for one build after confirmStop=true.Interrupts work; single attempt.
list_queue_itemsLists bounded queue state.Read-only; safe retries.
get_queue_itemReads one queue item and causes.Read-only; safe retries.
cancel_queue_itemRemoves one queued item after confirmCancel=true.Cancels queued work; single attempt.
list_nodesLists bounded executor/node availability.Read-only; safe retries.

Errors and Failure Modes

CodeTypical causeRetryableResolution
VALIDATION_ERRORInvalid account origin, job path, identifier, parameter map, limit, or missing confirmation.NoCorrect the named value; no unsafe request was sent.
UNSUPPORTED_OPERATIONUnknown operation.NoSelect a documented operation.
INTEGRATION_ACCOUNT_REQUIREDNo bound account.NoBind a Jenkins IntegrationAccount.
INTEGRATION_ACCOUNT_NOT_READYAccount status is not READY.NoRepair or reconnect the account.
JENKINS_HTTP_400Malformed tree or build parameter.NoCorrect bounded input.
JENKINS_HTTP_401 / 403Invalid token or insufficient Jenkins permission.NoRotate credentials or grant least privilege.
JENKINS_HTTP_404Job, build, queue item, or endpoint is absent or hidden.NoRe-run discovery with the same account.
JENKINS_HTTP_429 / 5xxRate limiting, restart, proxy, or transient controller failure.Yes for readsHonor backoff; inspect Jenkins state before repeating a mutation.
NETWORK_ERRORTimeout, DNS, TLS, or connectivity failure.Yes for readsVerify the configured origin and network path. Reconcile queue/build state before retrying a write.
RESPONSE_TOO_LARGEJSON exceeded 5 MiB or a log chunk exceeded maxLogBytes.NoNarrow the list or advance the progressive log offset with a smaller chunk.
INVALID_PROVIDER_RESPONSEExpected job/build/queue/node structure or identity is missing.NoConfirm Jenkins and plugin compatibility before continuing.

Example

Trigger an approved release build after a ValkyrAI workflow has validated its artifact and change window:

{
"operation": "trigger_build",
"jobPath": "release/api-production",
"parameters": {
"VERSION": "2.4.1",
"DEPLOY": true,
"CHANGE_TICKET": "CHG-1842"
}
}

Expected result:

{
"status": "success",
"operation": "trigger_build",
"attempts": 1,
"httpStatus": 201,
"queueId": 812,
"data": {
"accepted": true,
"queueId": 812
}
}

Use get_queue_item with queueId: 812, then get_build and get_build_log after Jenkins assigns a build number.

Notes

  • Pagination: list_jobs and list_builds use Jenkins tree slicing in pages of at most 100 plus one lookahead item. limit/offset continuation is bounded at 10,000 results. Queue and node arrays are capped locally.
  • Rate limits and retries: GET operations retry HTTP 408, 429, 500, 502, 503, and 504 according to RetryPolicy and Retry-After. Build triggers, stops, and queue cancellation never retry automatically.
  • API limits: JSON responses are capped at 5 MiB, build parameter maps at 256 KiB and 100 scalar values, paths at ten bounded segments, and console chunks at 1 MiB.
  • Idempotency: a build trigger is not idempotent. Capture the returned queue ID and reconcile queue/build state before repeating any trigger after an ambiguous timeout. Stop and cancel are also single-attempt.
  • Destructive behavior: stop_build interrupts a running build and cancel_queue_item removes queued work. Each requires a separate explicit confirmation. Controller restart, shutdown, quiet-down, job creation/copy/deletion, and arbitrary configuration mutation are not exposed.
  • API behavior: Jenkins instances and plugins can customize authorization, queueing, tree fields, context paths, build retention, and redirect responses. Reverse proxies must preserve API-token authentication and Jenkins headers.
  • Security: the origin is bound to IntegrationAccount.accountId; it is not workflow input. Production requires HTTPS. API tokens avoid CSRF crumbs while Jenkins CSRF protection remains enabled. Log output is classified confidential and redacted, but Jenkins-side credentials masking remains essential.
  • External verification: authentication, request construction, folder encoding, tree bounds, progressive logs, retries, mutation single-attempt behavior, destructive guards, redaction, response identity, and metadata discovery have deterministic local tests. A live Jenkins instance and authorized token are not available in repository tests.
  • Deferred operations: job create/copy/delete/config XML, views, credentials, plugins, scripts, artifacts, test reports, SCM polling, quiet-down, restart/shutdown, webhook triggers, OAuth, and arbitrary raw requests.
  • Functional references: n8n Jenkins node source, Jenkins Remote Access API, Jenkins scripted-client authentication, and Jenkins CSRF protection.