You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否实现一键批量审批多发布部署?30+CD流水线批量审批需求

一键审批多条CD流水线的解决方案

Great question—managing 30+ CD pipelines with individual approvals is definitely a drag, and most modern CI/CD tools have solutions to let you approve all of them in one go. Here’s how to set this up depending on what tool you’re using:

Jenkins

  • Use the Batch Task Plugin or Pipeline Aggregator Plugin to group your pipelines under a single approval stage. Create a parent pipeline that holds the approval step, then triggers all 30+ child pipelines once approved.
  • Example parent pipeline snippet:
pipeline {
    agent any
    stages {
        stage('Batch Approval') {
            steps {
                input message: 'Approve all 30 CD pipelines for deployment?', submitter: 'devops-team'
            }
        }
        stage('Trigger All Pipelines') {
            steps {
                // Loop through your pipeline list instead of repeating lines
                def pipelineJobs = ['Pipeline-Service-1', 'Pipeline-Service-2', ...]
                pipelineJobs.each { job ->
                    build job: job, wait: false
                }
            }
        }
    }
}
  • The loop makes this scalable—just update the pipelineJobs list with all your pipeline names instead of writing 30+ build commands.

GitLab CI/CD

  • Use parent-child pipelines with a single manual approval job in the parent pipeline. Once approved, the parent triggers all child deployment pipelines at once.
  • Example parent .gitlab-ci.yml snippet:
stages:
  - batch_approval
  - trigger_deployments

approve_all_deploys:
  stage: batch_approval
  rules:
    - if: $CI_COMMIT_BRANCH == 'main'
      when: manual
      allow_failure: false
  script: echo "Batch approval granted for all CD pipelines"

# Dynamically generate trigger jobs (scalable for 30+ pipelines)
.trigger_template:
  stage: trigger_deployments
  needs: [approve_all_deploys]
  trigger:
    include: $PIPELINE_FILE

trigger-service-1:
  extends: .trigger_template
  variables:
    PIPELINE_FILE: pipelines/deploy-service-1.yml

trigger-service-2:
  extends: .trigger_template
  variables:
    PIPELINE_FILE: pipelines/deploy-service-2.yml

# Repeat the above block for all your 30+ services
  • Using a template (trigger_template) cuts down on repetition, making it easier to manage as you add more pipelines.

GitHub Actions

  • Create a workflow dispatch workflow that requires environment approval, then uses the GitHub API to trigger all your deployment workflows in one batch.
  • Example batch approval workflow:
name: Batch Approve & Trigger CD Pipelines
on:
  workflow_dispatch:

jobs:
  batch_approval:
    runs-on: ubuntu-latest
    environment: production # Requires manual approval configured in repo settings
    steps:
      - name: Trigger all deployment pipelines
        uses: actions/github-script@v6
        with:
          script: |
            // List all your deployment workflow files here
            const deployWorkflows = [
              '.github/workflows/deploy-service-1.yml',
              '.github/workflows/deploy-service-2.yml',
              // Add all 30+ workflows
            ];
            
            for (const workflow of deployWorkflows) {
              await github.rest.actions.createWorkflowDispatch({
                owner: context.repo.owner,
                repo: context.repo.repo,
                workflow_id: workflow,
                ref: 'main'
              });
            }
  • You’ll need to set up an environment approval rule in your GitHub repo settings for the production environment to enforce the single approval step.

For Other CI/CD Tools

If you’re using tools like CircleCI, Azure DevOps, or Bitbucket Pipelines, the core approach stays the same: create a central "control" workflow that handles the single approval, then triggers all your deployment pipelines once that approval is granted. Most tools have built-in features for pipeline chaining or batch triggering that you can leverage.

内容的提问来源于stack exchange,提问作者usha chokka

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:04:30