Reputation: 1010
I am having this GitLab CI/CD which builds then tests and pushes my projects container to GitLab container register successfully. But now I am wondering how I can do the deployment stage automated too. currently, I am doing it manually and after each successful pipeline, I SSH to my server and run several commands to pull the latest images from the GitLab.com container registry and then run them. But I would like to make this step automated as well. Yet, I don't know how? Actually I have seen some examples of opening an ssh session from CI/CD pipeline but it doesn't feel secure enough. So I was wondering is there a better way for this or I have to actually do this.
Not that I am using gitlab.com so the GitLab server is not installed on my machine and I can't share assets between them directly
Upvotes: 2
Views: 990
Reputation: 9675
There are many ways to achieve this, depending on your setup, other requirements, scale etc.
I'll just give you two options.
kubectl apply -f ...
or helm install ...
, or rely on Auto DevOps to do this step for youThis is quite complex but sort of "right" way of doing things.
.gitlab-ci.yml
file, see documentationdocker pull...
and docker run ...
for your imageThis is a lot simpler, but is a "wrong" way, as you are mixing CI\CD infrastructure with target environment.
Upvotes: 2