Update :GitLab 8.10中引入了手动操作 . 从手册"Manual actions are a special type of job that are not executed automatically; they need to be explicitly started by a user. Manual actions can be started from pipeline, build, environment, and deployment views. You can execute the same manual action multiple times."手动操作的一个示例用法是部署到 生产环境 . 本答案的其余部分仅适用于Gitlab 8.9及更早版本 .
3 回答
Update :GitLab 8.10中引入了手动操作 . 从手册"Manual actions are a special type of job that are not executed automatically; they need to be explicitly started by a user. Manual actions can be started from pipeline, build, environment, and deployment views. You can execute the same manual action multiple times."手动操作的一个示例用法是部署到 生产环境 . 本答案的其余部分仅适用于Gitlab 8.9及更早版本 .
历史答案:
看起来好像8.9中的Gitlab中没有手动部署/发布 .
一种可能性是使受保护的分支触发释放 . 请在此处查看有关受保护分支的信息:http://doc.gitlab.com/ce/workflow/protected_branches.html
本质上,受保护的分支将允许您创建一个分支(testdeploybranch),只允许您将代码合并到其中 . 每当提交dev都会通过Gitlab CI测试并部署作业以及手动审核时,您可以将该提交合并到受保护的分支中以触发发布 . 对于此分支,您可以使用.gitlab-ci.yml作业定义中的唯一选项在Gitlab CI中设置特殊的发布作业 . 在这里阅读更多:http://doc.gitlab.com/ci/yaml/README.html
所以像这样:
这可能不是您所追求的,但它确实允许您从Gitlab手动发布 . 它不提供为不同服务器手动手动执行相同发布过程的简便方法 . 也许其他人可能能够扩展这一战略 .
最后,我们在GitLab 8.10中引入了Gitlab CI manual actions .
您可以在作业中使用
when: manual
将任务设置为手动(documentation) .因此,例如,如果您希望部署员在每次推送时都发生,但是可以选择手动拆除基础架构,那么您可以这样做:
使用上面的配置,如果你转到GitLab项目>管道,你应该看到最后一次提交旁边的播放按钮 . 单击播放按钮时,您可以看到
destroy
选项 .