Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Continuous integration 如何配置多个手动并行作业?_Continuous Integration_Gitlab Ci - Fatal编程技术网

Continuous integration 如何配置多个手动并行作业?

Continuous integration 如何配置多个手动并行作业?,continuous-integration,gitlab-ci,Continuous Integration,Gitlab Ci,我有一个应用程序,其管道设置如下: 图A 使用这样的.gitlab ci.yml文件 stages: - test - deploy test: script: - bash run_tests.sh deploy_staging: stage: deploy script: - rsync -rltvz --delete -e ssh --exclude=.git* public/ user@staging_node:/path/to/director

我有一个应用程序,其管道设置如下:

图A

使用这样的
.gitlab ci.yml
文件

stages:
  - test
  - deploy

test:
  script:
    - bash run_tests.sh

deploy_staging:
  stage: deploy
  script:
    - rsync -rltvz --delete -e ssh --exclude=.git* public/ user@staging_node:/path/to/directory
  environment:
    name: staging
    url: https://staging.app.example.com
  only:
    - master

deploy_production:
  stage: deploy
  script:
    - rsync -rltvz --delete -e ssh --exclude=.git* public/ user@production_node1:/path/to/directory
    - rsync -rltvz --delete -e ssh --exclude=.git* public/ user@production_node2:/path/to/directory
  environment:
    name: production
    url: https://app.example.com
  when: manual
  only:
    - master
我有另一个应用程序,我想部署类似的应用程序,但我想利用并行作业,如下所示:

图B

在图A中,
deploy\u production
是一个手动步骤(例如,将目录同步到多个服务器节点);在图B中,部署到
deploy_node1
deploy_node2
将是一个单独的步骤(例如,比rsync更占用时钟时间),通过Gitlab UI手动触发

如何配置
.gitlab ci.yml
以并行运行部署作业,同时仍保持单击式手动部署

更新(对Jakub Kania回答的回应):

这就是你的想法吗,Jakub

试图使用触发器,使我想到了这个
.gitlab ci.yml

stages:
  - test
  - stage
  - deploy

test:
  script:
    - bash run_tests.sh

staging:
  stage: stage
  script:
    - rsync -rltvz --delete -e ssh --exclude=.git* public/ user@staging_node:/path/to/directory
  environment:
    name: staging
    url: https://staging.app.example.com
  only:
    - master
  except:
    - triggers

deploy_trigger:
  stage: deploy
  script:
    - "curl -X POST -F token=TOKEN -F ref=master https://gitlab.example.com/api/v4/projects/1234/trigger/pipeline"
  environment:
    name: production
    url: https://app.example.com
  only:
    - master
  except:
    - triggers
  when: manual

deploy_node1:
  stage: deploy
  script:
    - rsync -rltvz --delete -e ssh --exclude=.git* public/ user@production_node1:/path/to/directory
  environment:
    name: production
    url: https://app.example.com
  only:
    - master
    - triggers

deploy_node2:
  stage: deploy
  script:
    - rsync -rltvz --delete -e ssh --exclude=.git* public/ user@production_node2:/path/to/directory
  environment:
    name: production
    url: https://app.example.com
  only:
    - master
    - triggers

使用一个。将部署任务设置为运行触发器,并将手动操作设置为使用cURL调用触发器的操作。

我用建议的新配置文件更新了我的问题:这与您的想法一致吗?