Best way to auto update remote computer to a GitLab branch

Viewed 48

I'm currently using GitLab as a version control method to develop a project used on another computer. I'm hoping to use two branches "Development" and "Stable" using Development to do my own testing and Stable to be the one ran by other computers.

The first problem I have is making sure that none of the remote computers have the ability to change the branch. This seems doable with GitLabs "protected" branches. But, I'm concerned that I will need to make an account for each of these computer (maybe with ssh keys to make the GitLab server happy?) to access the server.

The second problem I'd like to solve is how do I go about making sure that each of these computers are updating when I push to the stable branch. Do I have to periodically check if the branch is out of date and pull when this happens? Or is there an alarm of sorts for when the remote branch has an update?

1 Answers

First you can define an account named (for instance) "reader" on GitLab, with a project member permission of "reporter" (no push possible: read-only role)

You can add an SSH public key to that account, and use the private key on your different computers (considering this is a read-only account, using the same private key is not too big a deal)

Finally, following "Deploy from Github/Gitlab to server using Webhook", you can setup webhooks on each computers, which will be contacted by GitLab on each push, for said computer to make a git pull.

That assumes your computers are internet-facing (accessible from gitlab.com)

If not, you would need to setup some kind of cron in order to periodically check if an update is needed.

Related