寻求支持生产环境代码上线前手动审批构建的Jenkins插件
Hey there! I totally get where you’re coming from—you want a simple, Jenkins-native way to add manual gates before pushing code to production, and you don’t want to mess with Spinnaker. Let’s break down the best options that might have slipped your radar:
1. Use Jenkins' Built-in input Step (No Plugins Required!)
You might not realize this, but Jenkins Pipeline has a native input step that’s perfect for this use case. It pauses the pipeline until an authorized user gives the go-ahead. Here’s a quick example for your Jenkinsfile:
pipeline { agent any stages { stage('Build & Test') { steps { // Your regular build/test commands here sh 'npm install && npm run build' sh 'npm run test' } } stage('Production Deployment Approval') { steps { input message: '⚠️ Do you want to deploy this build to PRODUCTION? ⚠️', ok: 'Deploy to Prod', submitter: 'prod-admins,dev-leads' // Restrict approvals to specific users/groups } } stage('Deploy to Production') { when { beforeAgent true expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' } } steps { // Your production deployment script here sh './deploy-prod.sh' } } } }
- This will halt the pipeline right before production deployment, and only proceed when someone in the approved list clicks "Deploy to Prod".
- You can even add custom input parameters (like deployment notes) if you need more context for approvals.
2. Approval Plugin (For Granular Control & Audit Logs)
If you need extra features like approval queues, detailed audit trails, or multi-step approval chains, the Approval Plugin is a solid pick. Here’s how to use it:
- Install it from Jenkins’ Plugin Manager (search for "Approval Plugin").
- Add the
approvalstep to your pipeline:
stage('Prod Approval Gate') { steps { approval message: 'Requesting production deployment approval', approvers: ['prod-deployment-team'], block: true // Forces the pipeline to wait until approved } }
- This plugin logs every approval action, which is great for compliance or tracking who signed off on deployments.
3. Build Pipeline Plugin (Visual Approval Workflows)
If you prefer a visual, dashboard-friendly pipeline with clear approval gates, the Build Pipeline Plugin works well. It lets you create linear pipelines where specific stages require manual sign-off:
- Install the plugin, then configure your pipeline to mark the pre-production stage as "Requires Manual Approval".
- Users can approve or reject deployments directly from the pipeline’s visual dashboard, making it easy to track progress at a glance.
Quick Troubleshooting Note
If you couldn’t find these plugins earlier, double-check Jenkins’ Plugin Manager for typos—sometimes the exact plugin name is easy to miss. Also, make sure to use Jenkins’ built-in user/group permissions to lock down who can approve production changes.
Hope these options solve your problem! Let me know if you need help with any specific setup details.
内容的提问来源于stack exchange,提问作者Shashank Omre




