在部署时,从启动CI / CD管道的合并请求描述中获取信息

时间:2020-03-11 01:50:31

标签: gitlab gitlab-ci

我的工作流程是将合并请求合并到主服务器后运行CI / CD。我使用微服务,所以我只想部署更新的微服务。我已经阅读了此文档,但是仍然无法完全获得合并请求的标题或描述:https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

我想在合并请求中我可以有类似以下内容:

合并请求:

Title: update services DEPLOY: foo, bar

Description:
updated foo and bar

DEPLOY: foo, bar

然后在部署脚本中,我将得到类似的内容:

stages:
  - deploy

deploy_python:
  stage: deploy
  image: python:3.6
  script:
    - 1. get the merge request title or description 
    - 2. custom parse the merge request title or description for the services to deploy
    - 3. deploy the services listed in the merge request
  only:
    - master

我不太确定如何获取信息。由于某种原因,CI_MERGE_REQUEST_TITLE并没有为我回声。

0 个答案:

没有答案