agentleFS
sagy101sagy101/DotSkills/jenkins-manager/SKILL.md

jenkins-manager

Skill4 starsChanged 8 months agoMITView on GitHub

Check Jenkins CI/CD build status, view console logs, trigger builds, view build changesets (commits), check queue status, list jobs and folders for Jenkins Pipeline and MultiBranch Pipeline projects. Auto-discovers Jenkins job from git remote origin. Use when the user mentions Jenkins, build status, CI/CD pipeline, build logs, trigger build, build changes, queue status, or check the build. Pure Python stdlib — zero pip dependencies.

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 11 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check build status, view logs, trigger builds, and list jobs on any Jenkins instance.

    line 20
  2. Distinctive:

    Use when the user wants to:

    line 24
  3. Distinctive:

    No pip install or venv needed — all scripts use Python stdlib only.

    line 39
  4. Distinctive:

    Run the preflight script before any other operation:

    line 85
  5. Distinctive:

    If any check fails, fix the issue and re-run before proceeding.

    line 99
  6. Distinctive:

    When no config exists, or the user asks to add a Jenkins instance:

    line 103
  7. Distinctive:

    Ask the user how many Jenkins instances they have and collect for each: name, base URL, description, username env var, token env var

    line 105
  8. Distinctive:

    Ask which instance should be the default

    line 106
  9. Very specific:

    After user approval, write ~/.jenkins.json

    line 118
  10. Distinctive:

    Run preflight to verify connectivity to all instances

    line 119
  11. Distinctive:

    When adding a new instance to an existing config: read the current config, ask for the new instance details, show the updated table, and …

    line 121
  12. Very specific:

    Remove --dry-run after review.

    line 189
  13. Very specific:

    All scripts accept --instance <name> (selects Jenkins instance), --job <name> (auto-detected from git remote if omitted), --folder <name> …

    line 231
  14. Very specific:

    ALWAYS use the provided scripts: Every operation has a dedicated script.

    line 235
  15. Distinctive:

    Never print credentials: Only confirm env vars are set.

    line 238

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Jenkins Manager

Check build status, view logs, trigger builds, and list jobs on any Jenkins instance.

When to use this skill

Use when the user wants to:

  • Check build status for a job or branch
  • View Jenkins console output / build logs
  • Trigger a Jenkins build (with optional parameters)
  • View changes — see which commits are included in a build
  • Check queue — see if a triggered build is queued, blocked, or started
  • List jobs across organization folders
  • List top-level folders and job types
  • Discover which Jenkins job corresponds to the current repo

Prerequisites

  1. Config: .jenkins.json in project root and/or ~/.jenkins.json for global defaults (see CONFIG.md)
  2. Credentials: Per-instance env vars (e.g. JENKINS_USER/JENKINS_TOKEN for CI, JENKINS_CD_TOKEN for CD) exported in shell profile or in a .env file

No pip install or venv needed — all scripts use Python stdlib only.

Config is auto-discovered — scripts search CWD upward, then ~/.jenkins.json. If both exist, they are deep-merged (project-level wins). No --config flag needed.

Config uses named instances — each instance has its own base_url, credentials, and job_cache:

{
  "instances": {
    "ci": {
      "base_url": "https://jenkins-ci.us1.example.com",
      "description": "CI builds for all services",
      "credentials": {
        "username_env": "JENKINS_USER",
        "token_env": "JENKINS_TOKEN"
      }
    },
    "cd-stg": {
      "base_url": "https://jenkins-cd.stg.example.com",
      "description": "CD deployments to staging",
      "credentials": {
        "username_env": "JENKINS_USER",
        "token_env": "JENKINS_CD_TOKEN"
      }
    }
  },
  "default_instance": "ci",
  "env_file": "/path/to/.env"
}

Then a minimal per-project .jenkins.json only needs optional overrides:

{
  "instances": {
    "ci": {
      "job_cache": {
        "my-service": "API/my-service"
      }
    }
  }
}

Pre-flight checks

Run the preflight script before any other operation:

python3 <skill_dir>/scripts/jenkins_preflight.py

This checks Python version, config file, credentials, connectivity, repo detection, and job discovery in one pass. Each check prints [PASS], [FAIL], or [WARN] with actionable fix instructions. Exit code 0 = all checks passed, 1 = at least one failed.

Skip the connectivity and discovery checks (faster, offline-safe):

python3 <skill_dir>/scripts/jenkins_preflight.py --skip-connectivity

If any check fails, fix the issue and re-run before proceeding.

Config setup flow

When no config exists, or the user asks to add a Jenkins instance:

  1. Ask the user how many Jenkins instances they have and collect for each: name, base URL, description, username env var, token env var
  2. Ask which instance should be the default
  3. Before writing the config, show a summary table for approval:
| Instance | URL                                     | Description           | User Env       | Token Env          |
|----------|-----------------------------------------|-----------------------|----------------|--------------------|
| ci       | https://jenkins-ci.us1.example.com      | CI builds             | JENKINS_USER   | JENKINS_TOKEN      |
| cd-stg   | https://jenkins-cd.stg.example.com      | STG deployments       | JENKINS_USER   | JENKINS_CD_TOKEN   |

Default instance: ci
  1. After user approval, write ~/.jenkins.json
  2. Run preflight to verify connectivity to all instances

When adding a new instance to an existing config: read the current config, ask for the new instance details, show the updated table, and write after approval.

Instance awareness

When the config is loaded, the agent should be aware of which Jenkins instances are available and their descriptions. The --instance flag selects which instance to use. If the user mentions a specific Jenkins (e.g. "check the CD build on stg"), match it to the right instance by description.

Workflow

  1. Pre-flight — run checks above
  2. Select instance — use --instance <name> if the user specifies one, otherwise the default is used
  3. Determine operation — status / logs / trigger / list
  4. Plan — for trigger: show plan with --dry-run and wait for user approval
  5. Execute — run the appropriate script
  6. Verify — offer to check status or view logs after trigger operations

Operations

Check build status

python3 <skill_dir>/scripts/get_status.py
python3 <skill_dir>/scripts/get_status.py --instance cd-stg
python3 <skill_dir>/scripts/get_status.py --build 1094
python3 <skill_dir>/scripts/get_status.py --folder MyFolder --job my-service --branch main
python3 <skill_dir>/scripts/get_status.py --format json
python3 <skill_dir>/scripts/get_status.py --watch --interval 30 --timeout 300
python3 <skill_dir>/scripts/get_status.py --build 1094 --watch

Auto-resolves folder, job, and branch from git remote + current branch. Override with flags.

Flags: --build N (specific build number, default: last build), --watch (poll until build finishes), --interval N (poll interval in seconds, default 60), --timeout N (max wait in seconds, default 600). Watch mode exit codes: 0=success, 1=build failed, 2=timeout.

View build logs

python3 <skill_dir>/scripts/get_logs.py
python3 <skill_dir>/scripts/get_logs.py --tail 50
python3 <skill_dir>/scripts/get_logs.py --grep "ERROR"
python3 <skill_dir>/scripts/get_logs.py --build 142 --tail 0
python3 <skill_dir>/scripts/get_logs.py --folder MyFolder --job my-service --branch main

Flags: --tail N (default 100, 0 for all), --grep PATTERN (regex filter), --build N (specific build number).

All log output is redacted — secrets (API keys, tokens, passwords, AWS keys, connection strings, private keys, JWTs) are scrubbed before display. ANSI escape codes (color, bold, etc.) are automatically stripped before redaction and grep matching.

View test results

python3 <skill_dir>/scripts/get_test_results.py
python3 <skill_dir>/scripts/get_test_results.py --build 142
python3 <skill_dir>/scripts/get_test_results.py --failures-only
python3 <skill_dir>/scripts/get_test_results.py --format json

Shows structured test results from JUnit reports: totals (pass/fail/skip) and failed test details (suite, test name, error message). Works with any language/framework that produces JUnit XML. Gracefully handles 404 when JUnit plugin is not installed.

Flags: --build N (specific build number), --failures-only (show only failed tests), --format json.

Trigger a build

python3 <skill_dir>/scripts/trigger_build.py --dry-run
python3 <skill_dir>/scripts/trigger_build.py --folder MyFolder --job my-service --branch feature/my-branch --dry-run
python3 <skill_dir>/scripts/trigger_build.py --parameters ENV=staging VERSION=1.2.3 --dry-run

Remove --dry-run after review. Supports parameterized builds with --parameters KEY=VALUE.

View build changes (commits)

python3 <skill_dir>/scripts/get_changesets.py
python3 <skill_dir>/scripts/get_changesets.py --folder MyFolder --job my-service --branch main
python3 <skill_dir>/scripts/get_changesets.py --build 142
python3 <skill_dir>/scripts/get_changesets.py --format json

Shows commits included in a build: short SHA, author, message, and affected file count. Defaults to the latest build.

Check queue status

python3 <skill_dir>/scripts/get_queue_item.py --queue-id 12345
python3 <skill_dir>/scripts/get_queue_item.py --queue-id 12345 --format json

Shows whether a queued build is waiting, blocked, stuck, or has started. Use the queue ID returned after triggering a build.

List top-level folders

python3 <skill_dir>/scripts/list_folders.py
python3 <skill_dir>/scripts/list_folders.py --format json

List jobs

python3 <skill_dir>/scripts/list_jobs.py
python3 <skill_dir>/scripts/list_jobs.py --folder MyFolder
python3 <skill_dir>/scripts/list_jobs.py --name "my-service"
python3 <skill_dir>/scripts/list_jobs.py --format json

Flags: --folder (search specific folder), --name PATTERN (regex/substring filter).

Common flags (all scripts)

All scripts accept --instance <name> (selects Jenkins instance), --job <name> (auto-detected from git remote if omitted), --folder <name> (auto-discovered if omitted), --branch <name> (auto-detected from current git branch if omitted), and --config <path> (auto-discovered if omitted).

Important rules

  1. ALWAYS use the provided scripts. Every operation has a dedicated script. Run them via python3 <skill_dir>/scripts/<script>.py. NEVER write inline Python to call JenkinsClient, jenkins_config, or the Jenkins REST API directly. The scripts handle auth, config merging, error formatting, job auto-discovery, secret redaction, and branch encoding.
  2. If a script fails, debug the script invocation (wrong flags, missing config, missing credentials). Do NOT abandon the scripts and write custom code. Check the error table below and re-run with corrected arguments.
  3. Never trigger a build without --dry-run first + explicit user approval.
  4. Never print credentials. Only confirm env vars are set.
  5. Job is auto-discovered from git remote. Override with --folder and --job if needed.
  6. All log output is redacted. Secret patterns are scrubbed before display. Do not attempt to bypass redaction.

Error handling

ErrorCauseFix
401 UnauthorizedBad credentialsVerify JENKINS_USER and JENKINS_TOKEN env vars. Token must be a Jenkins API token, not account password
403 ForbiddenInsufficient permissions or CSRF issueCheck user permissions. For POST operations, CSRF crumb is handled automatically
404 Not FoundWrong folder, job, or branch nameVerify with list_folders.py and list_jobs.py. Branch names are URL-encoded automatically
500 Internal Server ErrorJenkins server errorCheck Jenkins server health. Retry after a moment
SSL certificate verification failedSelf-signed cert or custom CASet ssl_verify: false in config, or set SSL_CERT_FILE env var
Config not foundNo .jenkins.json anywhereCreate ~/.jenkins.json with instances — see config setup flow
Instance not foundWrong --instance nameCheck available instances in config or run preflight
Job not foundAuto-discovery failedAdd job_cache entry to the instance in .jenkins.json, or use --folder + --job
env_file escapes project rootRelative env_file in global configUse an absolute path for env_file in global ~/.jenkins.json
env_file not foundPath in config doesn't existCheck the env_file path in config; use absolute path in global config

Troubleshooting

ProblemFix
python3: command not foundInstall Python 3.10+
Can't detect repo from git remoteProvide --job <name> explicitly
Can't find job in JenkinsRun list_jobs.py --name <repo> to search; add result to job_cache
Build trigger returns 403User may lack build permissions. Check Jenkins user roles
Console log is huge/slowUse --tail 50 or --grep "ERROR" to filter
Branch name with / not foundBranch encoding is automatic; verify branch exists with list_jobs.py --folder F --name J
SSL errors on corporate JenkinsSet "ssl_verify": false in .jenkins.json

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.