使用gitlab持续集成进行自动部署

时间:2016-09-27 14:30:33

标签: deployment continuous-integration gitlab digital-ocean

我想设置从gitlab分支到digitalocean droplet的自动部署。我在droplet中创建了一个runner和exec git clone。但是现在我无法将我的gitlab-ci.yml配置为从分支“dev”到droplet的autodeploy。

我的gitlab-ci.yml:

image: python:3.5
staging:
  type: deploy
  only:
  - dev
  script:
  # there must be some kind of connection to the droplet to further code executed already on server
  - git pull
  # - server restart

如何在gitlab-ci.yml中连接服务器以制作“git pull”命令?

1 个答案:

答案 0 :(得分:-1)

好的,我解决了这个问题。首先,我们需要将 GitLab CI runner 添加到服务器。您可以在文档中看到如何执行此操作。然后gitlab-ci.yml的所有命令都将在服务器上执行。所以" git pull"命令也将在跑步者的服务器上执行。