ABC Jenkins Deployment Skill
Interactively trigger Jenkins builds, supporting intelligent parameter inference (automatic branch name parsing, environment inference) and real-time status monitoring.
Prerequisites
- environment variable is set (Jenkins username)
- environment variable is set (Jenkins API Token)
- Currently in a Git repository (for automatically retrieving branches and tags)
Installation
bash
npx add-skill https://github.com/ABCFed/claude-marketplace/tree/main/skills/jenkins-deploy
Preparation
bash
# Edit ~/.zshrc or ~/.bashrc
export JENKINS_USER="your_jenkins_username"
export JENKINS_TOKEN="your_jenkins_api_token"
source ~/.zshrc
Usage Workflow
Method 1: Two-stage Deployment (Recommended, Progress Visible)
Step 1: Trigger Build (Returns JSON)
bash
python scripts/jenkins_deploy.py \
<project_name> \
--trigger-only-no-monitor \
--yes \
--params "<json>"
Returned JSON:
json
{
"queue_id": 161484,
"full_name": "abc-his/test/PcFeatureTest",
"project_name": "PcFeatureTest",
"build_url": "http://ci.abczs.cn/job/abc-his/job/test/job/PcFeatureTest/"
}
Step 2: Start Background Monitoring
Claude Code (Use run_in_background=true):
bash
# Use Bash tool in Claude Code, set run_in_background=true
python scripts/jenkins_deploy.py \
--monitor-only \
--full-name abc-his/test/PcFeatureTest \
--queue-id 161484 \
--display-name PcFeatureTest
Other AI Tools or Terminal (Use nohup):
bash
nohup python scripts/jenkins_deploy.py \
--monitor-only \
--full-name abc-his/test/PcFeatureTest \
--queue-id 161484 \
--display-name PcFeatureTest > /dev/null 2>&1 &
Important Notes:
- The monitoring task runs as a background task and does not block the main conversation/terminal
- Claude Code: Progress is displayed in the background task output
- Other tools: Use to run in the background, you will receive a system notification when the build is completed
- Users can continue with other operations
Monitoring Output Example:
📊 Starting build monitoring: PcFeatureTest
Queue ID: 161484
Project: abc-his/test/PcFeatureTest
Task execution started (Build #11122)
📦 Build Number: #11122
⏳ Monitoring build progress...
To cancel, please tell me: "Cancel build #11122"
⏳ [███████████░░░░░░░░░░░░░░░] 42% (125s)
...
✅ PcFeatureTest build succeeded!
Parameter Description
--trigger-only-no-monitor Mode (Trigger Build)
| Parameter | Required | Description |
|---|
| ✓ | Jenkins project name (e.g., PcFeatureTest) |
--trigger-only-no-monitor
| ✓ | Only trigger build, do not start monitoring, returns JSON |
| ✓ | Skip interactive confirmation |
| ✓ | Complete build parameters in JSON format |
--monitor-only Mode
| Parameter | Required | Description |
|---|
| ✓ | Background monitoring mode |
| ✓ | Full project path (e.g., abc-his/test/PcFeatureTest) |
| ✓ | Queue ID |
| ✓ | Project display name (for notifications) |
Complete Examples
Test Environment Deployment
bash
# Step 1: Trigger build
python scripts/jenkins_deploy.py \
PcFeatureTest \
--trigger-only-no-monitor \
--yes \
--params '{"repoTag":"pc-t2025.53.19","tapdId":"1167459320001118371","featureNo":"70"}'
# Returned JSON:
# {"queue_id": 161484, "full_name": "abc-his/test/PcFeatureTest", ...}
# Step 2: Start background monitoring
# Claude Code: Run directly (will use run_in_background=true)
# Other tools: Add nohup and & to run in background
python scripts/jenkins_deploy.py \
--monitor-only \
--full-name abc-his/test/PcFeatureTest \
--queue-id 161484 \
--display-name PcFeatureTest
Development Environment Deployment
bash
python scripts/jenkins_deploy.py \
staticPcOwn \
--trigger-only-no-monitor \
--yes \
--params '{"repoBranch":"hotfix/xxx-1167459320001118371"}'
Other Commands
bash
# List all projects
python scripts/jenkins_deploy.py --list --all
# List projects related to current repository (automatic filtering)
python scripts/jenkins_deploy.py --list
# Stop specified build number
python scripts/jenkins_deploy.py --stop <build_number>
Testing and Validation
After each skill modification, it is recommended to verify following this process:
Quick Test Command
bash
# Automatically run all test cases
python scripts/run_tests.py
Manual Testing
1. Parameter Validation (Mandatory)
bash
python scripts/jenkins_deploy.py \
PcFeatureTest \
--validate \
--params '{"repoTag":"pc-t2025.53.19","featureNo":"70"}'
2. Dry Run (Mandatory)
bash
python scripts/jenkins_deploy.py \
PcFeatureTest \
--dry-run \
--params '{"repoTag":"pc-t2025.53.19","featureNo":"70"}'
Detailed Test Cases: See test-cases.md
Workflow (Recommended Mode)
┌─────────────────────────────────────────────────────────────┐
│ 1. Claude Code: Use AskUserQuestion to collect parameters │
│ Other AI Tools: Collect parameters through conversation │
│ - Project Name │
│ - Git Branch / Tag │
│ - TAPD ID (automatically parsed from branch name) │
│ - featureNo (**required** if the project has this parameter) │
│ - Other build parameters │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ 2. Call script in --trigger-only mode │
│ - Pass complete JSON parameters │
│ - Directly trigger Jenkins API │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ 3. Return build information │
│ - Queue ID │
│ - Build page URL │
└─────────────────────────────────────────────────────────────┘
Intelligent Parameter Inference
| Parameter | Inference Rule | Example |
|---|
| Current Git branch | hotfix/盘点页面增加备注及搜索-1167459320001118371
|
| Latest Git tag | |
| / | Automatically parsed from branch name (standard process: numbers at the end of branch name) | |
| deploy if tag exists, build if no tag | deploy if tag exists → |
| Required (if the project has this parameter), must be explicitly specified by user | |
| Required for some projects, must be explicitly specified by user | |
TAPD ID Automatic Parsing
Under standard process, branch name format is
or
:
Branch name: hotfix/盘点页面增加备注及搜索-1167459320001118371
└────────────────────┘
Automatically extract TAPD ID
No manual configuration needed, it will be automatically filled into
or
parameter during deployment.
⚠️ Important:
- (Feature Number): Required if the project has this parameter, must be provided by user
- (Environment Number): Required for some projects, must be provided by user
Supported Parameter Types
| Parameter Type | Description | Interaction Method |
|---|
StringParameterDefinition
| Text input | Direct input or press Enter to use default value |
ChoiceParameterDefinition
| Dropdown selection | Display option list, select by entering number |
| Multiple selection via checkbox | Display option list, enter comma-separated numbers |
BooleanParameterDefinition
| Boolean value | Select y/n |
WReadonlyStringParameterDefinition
| Read-only parameter | Automatically used, cannot be modified |
Common Project Types
Detailed Project Parameter Reference: See projects.md
1. PcFeatureTest (Test Environment Deployment)
Purpose: Deploy to test environment using tags
Key Parameters:
- : Deployment tag (e.g., )
- : TAPD requirement ID (automatically parsed from branch name)
- : Feature Number (Required), must be provided by user
- : Fixed as
Example:
bash
python scripts/jenkins_deploy.py \
PcFeatureTest \
--trigger-only \
--params '{"repoTag":"pc-f2026.05.48","tapdId":"1167459320001118371","featureNo":"1122044681001112866"}'
2. staticPcOwn (Development Environment Deployment)
Purpose: Deploy to development environment using branches
Key Parameters:
- : Deployment branch (e.g.,
hotfix/xxx-1167459320001118371
)
- : Docker image tag (default )
- : Fixed as
Example:
bash
python scripts/jenkins_deploy.py staticPcOwn
3. static-mf-deepseek (Microservice Deployment)
Purpose: Microservice project deployment, supports multi-region deployment
Key Parameters:
- : Project subdirectory (e.g., )
- : Deployment zone (checkbox: / )
- : Deployment branch
Example:
bash
python scripts/jenkins_deploy.py static-mf-deepseek
Caching Mechanism
Cache Strategy:
- First run: Retrieve 542 projects from Jenkins API and cache them
- Subsequent runs: Directly use cache (faster speed)
- Force refresh: Use parameter
Manual Cache Clear:
bash
rm scripts/cache/jobs.json
Supported Jenkins Environments
| Environment | Dev | Test |
|---|
| abc-his | ✓ | ✓ |
| abc-bis | ✓ | ✓ |
| abc-cooperation | ✓ | ✓ |
| abc-global | ✓ | ✓ |
| abc-oa | ✓ | ✓ |
| mira | ✓ | ✓ |
Error Handling
| Scenario | Handling Method |
|---|
| Authentication not configured | Prompt to set and |
| Project does not exist | List available projects |
| Missing featureNo | If the project has this parameter, must prompt user to provide it |
| Build failed | Display build URL and log link |
| Parameter validation failed | Prompt correct format |
| Network timeout | Prompt to check network connection |
Trigger Keywords
Jenkins, Deploy, Deployment, Build, CI/CD