GitLab CI在完成多个构建阶段中的一个之后执行部署阶段



我有四个构建阶段,它们是手动操作的。我想要的是在一个构建阶段完成后执行部署阶段。现在,我的实现只有在所有四个构建阶段都完成时才能工作。

用例:Dev了解他想要构建的环境。构建完成后,将其部署到系统中。构建完成后应自动启动部署

Q: 是否有一种方法可以在只完成一个构建之后执行部署阶段?

我的构建管道的实现(简化(:

production:
  stage: env
  script:
    - echo build one
  when: manual
  allow_failure: false
production2:
  stage: env
  script: 
    - echo build two
  when: manual
  allow_failure: false
staging:
  stage: env
  script: 
    - echo build three
  when: manual
  allow_failure: false
staging2:
  stage: env
  script:
    - echo build four
  when: manual
  allow_failure: false

这是我的部署阶段

build:
  stage: build
  needs: [production, production2, staging, staging2]
  when: on_success
  script:
    - echo do deploy stuff

非常感谢,我祝你今天愉快

也许这样的东西有帮助?

build:
  stage: build
  needs:
    - job: production
      optional: true
    - job: production2
      optional: true
    - job: staging
      optional: true
    - job: staging2
      optional: true
  when: on_success
  script:
    - echo do deploy stuff

到目前为止,我只找到了一个有效的解决方案。

stages:
  - env
  - connections
  - build
production:
  stage: env
  script:
    - echo build one
  when: manual
  allow_failure: false
production2:
  stage: env
  script: 
    - echo build two
  when: manual
  allow_failure: false
staging:
  stage: env
  script: 
    - echo build three
  when: manual
  allow_failure: false
staging2:
  stage: env
  script:
    - echo build four
  when: manual
  allow_failure: false
# Connections 
  
run:build:production:
  extends: .build
  stage: connections
  needs:
    - job: production
    
run:build:production2:
  extends: .build
  stage: connections
  needs:
    - job: production2
run:build:staging:
  extends: .build
  stage: connections
  needs:
    - job: staging
run:build:staging2:
  extends: .build
  stage: connections
  needs:
    - job: staging2 
.build:
  stage: build
  script:
    - echo do deploy stuff  

相关内容

  • 没有找到相关文章

最新更新