gitlab:如何拥有另一个 gitlab-ci.yml 并在需要时使用它,而不是自动触发

gitlab: How to have a another gitlab-ci.yml and use it whenever i want, instead of automatic triggering

我有一个 gitlab-ci.yml 文件,当我提交更改时它会被触发。

我想要另一个不会被触发的文件gitlab-ci-notrigger.yml。但是我可以随时将其用于 运行 管道

你可以create a job than must be run manually

You can require that a job doesn’t run unless a user starts it.
This is called a manual job.

You might want to use a manual job for something like deploying to production.

To specify a job as manual, add when: manual to the job in the .gitlab-ci.yml file.

By default, manual jobs display as skipped when the pipeline starts.

OP 添加:

# WANT deploy-to-stage TO BE RUN ONLY WHEN automatic
deploy-to-stage:
  stage: staging
  script:
    -..........

检查 using except 是否可以提供帮助:

# WANT deploy-to-stage TO BE RUN ONLY WHEN automatic
deploy-to-stage:
  stage: staging
  rules:
    - except: manual
  script:
    -..........