除了 GitLab 的受保护环境之外,还有其他选择吗?

Is there alternative to GitLab's Protected environments?

Protected environments are available only on premium tier. Are there any alternatives to use on free? I've been researching this topic for a while and for now I have one idea - use multi-project pipelines。但是这个解决方案增加了太多的复杂性。

您可以执行以下操作以至少模拟受保护的环境。

  • 在其 gitlab-ci.yml.
  • 中创建一个仅包含部署作业的 repo
  • 在您想要保护的工作中,使用 multi-project-pipeline
  • 调用上述存储库中的管道
  • 只授予某些用户 developer/maintainer 访问您受保护的存储库的权限
  • 现在只有有权访问受保护存储库的用户才能运行手动作业,所有其他用户都会遇到错误
deploy_prod:
  stage: deploy
  trigger:
    project: group/protected-repo
    strategy: depend
  environment:
    name: production
    url: https://example.com
  when: manual
  only:
     - master

因此,我的目标是限制 运行 用户管道上的手动作业 - 我发现 protected branches 和受保护的变量将是我目前拥有的最佳解决方案。

然后只限制谁可以 merge/push 共同保护分支机构,自动只有那些人才能在这些分支机构中触发手动作业。