gitlab-ci/cd(九)流水线设置

release:

https://docs.gitlab.com/ee/ci/yaml/#release-cli-docker-image

release_job:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  rules:
    - if: $CI_COMMIT_TAG                  # Run this job when a tag is created manually
  script:
    - echo 'running release_job'
  release:
    name: 'Release $CI_COMMIT_TAG'
    description: 'Created using the release-cli $EXTRA_DESCRIPTION'  # $EXTRA_DESCRIPTION must be defined
    tag_name: '$CI_COMMIT_TAG'                                       # elsewhere in the pipeline.
    ref: '$CI_COMMIT_TAG'
    milestones:
      - 'm1'
      - 'm2'
      - 'm3'
    released_at: '2020-07-15T08:00:00Z'  # Optional, is auto generated if not defined, or can use a variable.
    assets: # Optional, multiple asset links
      links:
        - name: 'asset1'
          url: 'https://example.com/assets/1'
        - name: 'asset2'
          url: 'https://example.com/assets/2'
          filepath: '/pretty/url/1' # optional
          link_type: 'other' # optional

timeout

build:
  script: build.sh
  timeout: 3 hours 30 minutes

test:
  script: rspec
  timeout: 3h 30m

resource_group

有时在一个环境中同时运行多个作业可能会导致部署过程中出现错误。
例如:代码提交两次,使用resource_group可以避免,当第二次部署比第一次部署快时,部署版本是前一次【版本不是最新】的问题

deploy-to-production:
  script: deploy
  resource_group: production

debug

方法一:pepiline中点击debug

修改:config.toml 文件

https://docs.gitlab.com/ee/ci/interactive_web_terminal/#configuration

GitOps、新兴技术能力gitlab-ci/cd(九)流水线设置插图

方法二:

GitOps、新兴技术能力gitlab-ci/cd(九)流水线设置插图1

部署冻结

GitOps、新兴技术能力gitlab-ci/cd(九)流水线设置插图2