Install
openclaw skills install @lentiancn/skill-jenkinsUse when needing to interact with Jenkins CI/CD via REST API - triggering builds, listing projects, or checking build results
openclaw skills install @lentiancn/skill-jenkinsA modular skill package for interacting with Jenkins via REST API. Each feature can be called independently, and AI will guide you step by step.
Interaction rule: All user selections and inputs MUST use the question tool with interactive buttons. Users can scroll through options or type directly in the input box (e.g., enter an ID). Never ask the user to type commands or names manually.
The following environment variables must be configured:
| Environment Variable | Description | Example |
|---|---|---|
JENKINS_USER | Jenkins username | admin |
JENKINS_API_TOKEN | Jenkins API Token | 11a2... |
Note: Jenkins URL is NOT an environment variable. It is stored per-project in PROJECTS.md under the JENKINS_URL column. All API calls must extract the Jenkins URL from the project's record in PROJECTS.md.
| Feature | Description | Use Case |
|---|---|---|
| Feature 1: Project Configure | List/Create/Update project configurations | Manage project configuration info |
| Feature 2: Trigger by ID | Select project from list → Confirm → Trigger → Show result | Trigger a Jenkins build |
When the user says something like "trigger Jenkins build" or "build" or "jenkins":
Manage project configuration file (PROJECTS.md), including source code URL, Jenkins URL, etc.
Use the question tool to let the user choose:
{
"questions": [{
"question": "Please select an action:",
"header": "Project Config",
"options": [
{"label": "Create New Project", "description": ""},
{"label": "Update Existing Project", "description": ""},
{"label": "Cancel", "description": ""}
]
}]
}
Wait for the user's selection before continuing. Based on the selection:
Read PROJECTS.md and display existing project list:
cat PROJECTS.md
Display all projects in table format (ID, PROJECT_NAME, CODE_URL, JENKINS_URL).
Then use the question tool for project selection. The tool supports:
PRJ-001){
"questions": [{
"question": "Select a project to update (scroll to select or type ID):",
"header": "Select Project",
"options": [
{"label": "PRJ-001", "description": "my-project | https://github.com/user/repo"},
{"label": "PRJ-002", "description": "another-project | https://gitlab.com/team/app"}
]
}]
}
Create New Project:
Ask for the following information in order using the question tool (each must include options):
{
"questions": [{
"question": "Enter project name (e.g., my-project):",
"header": "Project Name",
"options": [
{"label": "Enter project name", "description": ""}
]
}]
}
{
"questions": [{
"question": "Enter source code repository URL:",
"header": "Code Repository",
"options": [
{"label": "Enter code repository URL", "description": ""}
]
}]
}
{
"questions": [{
"question": "Enter Jenkins job URL:",
"header": "Jenkins URL",
"options": [
{"label": "Enter Jenkins URL", "description": ""}
]
}]
}
Automatically generate project ID (format: PRJ-001, PRJ-002...) and append to PROJECTS.md.
Read PROJECTS.md and display all configured projects:
cat PROJECTS.md
Then use the question tool to let the user select a project (scrollable options) or type an ID:
{
"questions": [{
"question": "Select a project (scroll up/down to select, or type ID directly):",
"header": "Select Project",
"options": [
{"label": "PRJ-001", "description": "boss-sso | http://..."},
{"label": "PRJ-002", "description": "jg-merchant | http://..."}
]
}]
}
After user selects/enters the ID, look up the project in PROJECTS.md to get its JENKINS_URL:
PROJECT_LINE=$(grep -i "{project-id}" PROJECTS.md)
JENKINS_URL=$(echo "$PROJECT_LINE" | awk -F'|' '{print $5}' | xargs)
if [ -z "$PROJECT_LINE" ]; then
echo "Project not found in PROJECTS.md"
exit 1
fi
Then use the Jenkins URL to get project details from Jenkins:
curl -s -u "$JENKINS_USER:$JENKINS_API_TOKEN" \
"$JENKINS_URL/api/json" | echo "$(head -c 500)"
If project is not found in PROJECTS.md, inform the user.
Display project info and recent build status, then ask for confirmation:
{
"questions": [{
"question": "Confirm triggering build for {project-name}?",
"header": "Confirm Trigger",
"options": [
{"label": "Confirm Trigger", "description": "Trigger build and view results"},
{"label": "Cancel", "description": "Cancel operation"}
]
}]
}
curl -s -u "$JENKINS_USER:$JENKINS_API_TOKEN" \
-X POST "$JENKINS_URL/build" -w "HTTP %{http_code}"
Poll build status after trigger. Get the latest build and display result:
curl -s -u "$JENKINS_USER:$JENKINS_API_TOKEN" \
"$JENKINS_URL/lastBuild/api/json" | echo "$(head -c 300)"
Display in format:
✅ Build triggered/completed
Project: {project-name}
Build #: {build-number}
Status: {SUCCESS/FAILURE/ABORTED/In progress...}
Build URL: {full-build-url}
curl: (7) Failed to connect to {host}
JENKINS_URL in PROJECTS.md is correctHTTP 401 Unauthorized
JENKINS_USER and JENKINS_API_TOKENHTTP 404 Not Found
Get parameter definitions first:
curl -s -u "$JENKINS_USER:$JENKINS_API_TOKEN" \
"$JENKINS_URL/job/{project-name}/api/json" | jq '.property[0].parameterDefinitions[] | {name, description, defaultValue, type}'
Trigger with parameters:
curl -s -u "$JENKINS_USER:$JENKINS_API_TOKEN" \
-X POST "$JENKINS_URL/job/{project-name}/buildWithParameters" \
--data-urlencode "param1=value1" \
--data-urlencode "param2=value2" \
-w "HTTP %{http_code}"