公司私有仓储
安装参考
- 安装 https://about.gitlab.com/installation/#centos
- 配置 https://docs.gitlab.com/omnibus/settings/nginx.html
- 初始化项目 newjc001
CI自动集成
配置environment
部署环境标识, 用于部署环境使用,重新部署, 查看部署历史, 配合when: manual可在web界面点击手动部署
示例
项目合并到master的tag提交文件自动上传到远程部署
# .gitlab-ci.yml
upload:
only:
[tags]
script:
# - git diff --name-status HEAD^ | awk '$1!="D"{print $2}' > update/`cat .git/HEAD`-files.log
- git diff --name-status `git tag | tac | awk 'NR==2{print}'` | awk '$1!="D"{print $2}' > update/`cat .git/HEAD`-files.log
- cat update/`cat .git/HEAD`-files.log | xargs -ti /root/.pyenv/versions/py2711/bin/ansible-playbook --check /etc/ansible/play_books/sync_file.yaml -e file={} -vvv