A Jenkins plugin providing two utility features:
- Job Build Name Parameter: Select build names from other Jenkins jobs as parameters
- Git Branch Environment Variables: Automatically add environment variables for Git branch parameters
- Jenkins → Manage Jenkins → Plugin Manager
- Search for "Opsbox Utility Plugin" and install
- Restart Jenkins
Add parameter to job configuration:
pipeline {
agent any
parameters {
jobBuildNameParam(
name: 'BUILD_NAME',
jobName: 'upstream-job',
countLimit: 5,
description: 'Select build name from upstream job'
)
}
stages {
stage('Deploy') {
steps {
echo "Deploying build: ${params.BUILD_NAME}"
}
}
}
}
Configuration Options:
name
: Parameter namejobName
: Source job name (supports folder paths likefolder/job
)countLimit
: Maximum number of builds to show (default: 5)description
: Parameter description
Works with List Git Branches Parameter plugin:
pipeline {
agent any
parameters {
listGitBranches(
name: 'BRANCH',
remoteURL: 'https://github.com/user/repo.git',
credentialsId: 'git-credentials'
)
}
stages {
stage('Build') {
steps {
echo "Branch: ${params.BRANCH}"
echo "Repository: ${env.PARAMS__BRANCH__REMOTE_URL}"
echo "Credentials: ${env.PARAMS__BRANCH__CREDENTIALS_ID}"
}
}
}
}
Auto-generated Environment Variables:
PARAMS__{PARAM_NAME}__REMOTE_URL
: Git repository URLPARAMS__{PARAM_NAME}__CREDENTIALS_ID
: Git credentials ID{PARAM_NAME}
: Clean branch name
- Jenkins 2.414+
- Java 11+
- List Git Branches Parameter Plugin (for Git features)
# Build
mvn clean package
# Test
mvn test
# Run in development mode
mvn hpi:run
Q: How to handle jobs in folders? A: Use full path, e.g., folder1/folder2/job-name
Q: Can't see build name options? A: Ensure source job exists and has successful build records
Q: Environment variables not set? A: Make sure List Git Branches Parameter plugin is installed and configured correctly
MIT License - see LICENSE file for details
Author: Seanly Liu - seanly.me@gmail.com