“Build my branch and deploy it to QA” sounds like one request. On a shared Jenkins instance it means finding the right jobs, specifying the code branch and the deploy-config branch in different places, getting a version out of the build, and passing that version to the deploy job. If something fails, someone has to work out which lines in the console matter.
The same Jenkins instance also held production deploy jobs. A short request in the terminal assistant people already used made sense as the interface. The skill covers build, preview, and deploy to non-production, with a way to run tests and roll back when needed. Each step surfaces the Jenkins details that matter before the next one starts.
The assistant drives a small CLI
The plugin lives in an internal marketplace monorepo. The stable interface is the skill, which describes when to load it, what to ask the user, and what to do next. Behind it is a Bash CLI that makes the Jenkins requests using curl and jq. That gives the assistant a vocabulary like find, params, run, wait, and diff, without asking it to construct REST calls from scratch.
Job selection is where the conversation helps. The skill can infer a component name from the Git remote, then ask the user to choose if several jobs match. It can also point out uncommitted or unpushed changes before asking Jenkins to build, since the build sees the pushed branch. If a previous deployment used a different deploy-config branch from the default, the assistant calls that out before proceeding. Someone else on the shared environment might be testing a config change.
The CLI is where checks run consistently. It inspects job metadata and classifies jobs as build, deploy, QA, production, or unknown. It rejects production and unknown jobs, checks parameter names and values, and requires explicit values for environment-like parameters. An environment has to be on the wrapper’s non-production allowlist and, where the job supplies choices, among those choices as well. QA jobs have their own flag, which the skill uses when the user asks for tests.
Here’s the explicit-environment check, shortened. This is one validation step. Job classification and checking the job’s own choices happen elsewhere.
NONPROD_ENVS="dev qa staging sandbox" for key in $env_param_names; do value=$(pget "$key") [[ -n "$value" ]] || refuse "Set $key explicitly." in_list "$value" "$NONPROD_ENVS" || refuse "Unsupported environment for $key." done Each person authenticates with their own Jenkins API token. The request reaches Jenkins under their identity, without adding a privileged service account for the assistant. The wrapper passes the credential to curl through a config read on stdin, keeping it out of the command arguments. Setup happens in the user’s terminal, outside the chat.
The CLI checks the login before doing the requested Jenkins work. That keeps connection and access problems from looking like bad job names or broken pipelines. A 401 leads the user back to their login name and token. A 403 points them to the platform team for access. This is part of making the workflow self-service.
Preview gives the user something specific to approve
Building the code and deploying it are separate operations. The assistant waits for the build to finish and reads the version it produced. Then it inspects the deploy job and looks up the last successful deploy for the requested environment. That history is useful context, especially when someone used a different config branch. The preview gives the assistant a version to record for a possible rollback and shows what the proposed deploy would change.
In Jenkins this preview is a run of the deploy job with its diff-only parameter set. The job needs to support that mode. In the chat, a preview is a short summary with the deploy job, environment, deployed and proposed versions, deploy-config branch, and the relevant changes. Image tag, version label, and checksum changes can often fit into one line. A change to the ingress or application configuration deserves to be called out.
A synthetic session looks like this:
User: Build my current branch and deploy it to qa. Assistant: Building billing-service from feature/new-api. BUILD: billing-service/feature%2Fnew-api #42 RESULT: SUCCESS VERSION: 1.4.0-42 Preview for billing-service-nonprod-deploy Environment: qa Current version: 1.3.9-37 Proposed version: 1.4.0-42 Deploy-config branch: main Only the version changes. Deploy these values? User: Yes. Assistant: Jenkins reports a successful deploy of 1.4.0-42 to qa. Rollback target: 1.3.9-37 with deploy-config branch main. Check the application’s health endpoint? The skill waits for the user’s answer before passing --confirmed. The wrapper requires an explicit mode for a real deploy invocation and sets the job’s own confirmation parameter itself. That flag represents a decision in the conversation. The wrapper checks the flag, and the assistant is responsible for obtaining the user’s approval of the exact values. If the team needs Jenkins to enforce a human approval independently, that belongs in the pipeline. When a pipeline pauses for manual input, the wrapper reports the pause and gives the user the build URL.
The preview also makes the limits of rollback easier to explain. The assistant can run another confirmed deploy using the recorded version and the same deploy-config branch. If the newer application migrated the database schema, deploying the older application leaves that schema in place. The skill asks about migrations before attempting the rollback. On a shared environment, the captured version is also a snapshot from the time of the preview. Other deployments can happen after it.
A guardrail starts with loading the skill
The first trigger description listed phrases like “build and deploy my branch” and “deploy X to QA.” That worked until somebody said “roll out,” “release,” or “build this tag.” The assistant sometimes skipped the skill altogether. The revised frontmatter describes the user’s intent, including requests that omit the environment or explicitly name production.
--- name: jenkins-trigger description: ">" Use for Jenkins requests to build, deploy, release, roll out, roll back, or test a branch, tag, or version. Covers non-production workflows. Also load for requests with no environment or requests for production, so the skill can ask for a target or refuse the operation. --- The revised skill asks for the target before making any Jenkins calls on a deployment workflow. It can still handle read-only questions without a target, and an explicitly build-only request stays build-only. Putting those cases in the routing description helps the assistant choose the workflow that knows how to respond to them.
The classifier is a practical guardrail for that workflow. It can reject ambiguous metadata and catch familiar production naming and dangerous defaults. It can also check the previous run’s console for evidence that a build job started a production-looking downstream job. That check is historical. It says what the previous run logged, while the next run may have different pipeline code or inputs. Enforcing a production boundary on a shared controller depends on Jenkins permissions, the pipeline’s execution identity, and the credentials available to jobs. The user’s API token identifies the caller. Jenkins documents build authorization separately from request authentication. Jenkins build authorization
Two places where the shell details mattered
The first version of the wrapper required Bash 4.4. That sent people on macOS to install another shell before they could even try the tool. Moving to Bash 3.2 meant replacing associative arrays with indexed arrays and using portable forms of the text-processing commands. Some fixes mattered more than the syntax changes.
One was the read of the previous build’s downstream jobs. With process substitution, the loop can reach the end without seeing the producer’s error. For a safety check, an empty list after a failed read looks too much like an empty list after a successful one. Capturing the result first gives the wrapper a place to deal with the error explicitly. The shortened example uses an explicit error check to show the intended behavior:
started=$(started_jobs "$job" "$build_number") || die "Could not read the previous build's downstream jobs." while IFS= read -r downstream_job; do if is_prodish "$downstream_job"; then refuse "Previous run started a production-looking downstream job." fi done <<< "$started" Another was text processing under the default locale. A console log can contain bytes that are invalid UTF-8, so the wrapper uses the C locale for these checks. The practical requirement is that a failure to read or parse evidence must have its own outcome.
The same idea applies to status reporting. A queued job, a job paused for manual approval, and a job still running after the local wait limit all need different responses. The wrapper gives the assistant stable markers and distinct exit codes, so it can tell the user what happened without treating every nonzero exit as a failed deploy. A successful Jenkins job also leaves an open question: does the app answer? The skill offers a separate opt-in health check, using an ingress host from the preview that matches the configured non-production domain.
When a job actually fails, the CLI gives the assistant stage results, failed tests, and relevant console lines. The assistant can explain those and suggest a read-only Kubernetes check for the user to run. That keeps the explanation connected to the evidence and leaves cluster access with the operator.
What I would test next
The monorepo’s pytest suite checks the registry entry, the manifest, and the skill frontmatter. It never executes the Bash wrapper. Dry runs make it possible to inspect the planned request, and diff-only runs exercise the preview path. The branch still has no dedicated script tests.
I’d start with recorded, synthetic job metadata and a table of expected results for the classifier. Include ordinary build and deploy jobs, ambiguous jobs, unexpected environment parameters, and failures to read or parse metadata. Then I’d run the wrapper against a stub and assert that a rejected request never reaches the build endpoint. I’d run that suite under Bash 3.2 too, because the portability work already changed how an error reaches the caller.
The workflow is useful because the user can see which version is about to go where, approve that exact change, and understand what Jenkins reports afterward. The test I’d care about most is whether an ambiguous or failed check stops the request before Jenkins queues it.
![UI Practice - Duolingo [1]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8uawvr6a0e07ilktpkk7.png)

