We like to deploy new features to a testing server as part of our user acceptance testing process.
Is it possible to deploy our Testing branch to a testing server and our Stable branch to a production server?
Let’s come back around to tags and rules for a minute and talk about server setup. I think there might be two approaches? If there’s a third I’m all ears.
I think one approach is to have a runner on
testing.example.com and a runner on
example.com. That seems to suggest I would also require two different
.gitlab-ci.yml files and some way to determine which one to run on which server. I haven’t seen any examples of this anywhere so I’m going to assume things are not done this way. I may have missed something.
Alternative option would be to put one runner on a third server such as
runner.example.com that would then make use of tags and/or rules eg,
if: '$CI_COMMIT_BRANCH == "testing"' to determine the location to deploy to. Which would then require some way of getting the built code from the runner server to the target server; possibly via ssh, possibly using a
scp command? I’m not sure if I’m going down the right path here, but that would require me to restart the service on the testing server once the files are there and that’s getting into an area I’m not sure I can do without some serious bash scripting. For spinning up new containers this is totally different scenario.
Some other things I read online included putting a private SSH key into an environment variable on GitLab to facilitate SSH transfer via a runner, but I am not at all comfortable doing that. The same goes for anything FTP related.
If I can only reliably use gitlab-runner to deploy to one or the other, that’s fine. I can manually handle production or use a different tool stack, whatever. If there’s another way to do this for both I’m happy to learn. Trying to grok an elephant isn’t easy. I do have a single runner up and working, but as soon as I try to use tags or rules I get the usual no runners online error. Not yet sure what’s up with that, but I’m sure it can be solved. This testing server situation is warping my brain a little.
Thanks in advance.