Has anyone used gitlab ci/cd features beyond test runners?

Has anyone set up gitlab’s CI/CD pipeline beyond tests?
If so, where do you deploy to?

1 Like

I’m using Gitlab to build Docker images for deployment. The cool thing is that Gitlab has its own container registry which makes it perfect for deploying Docker apps.

My pipeline looks like this:

             | -> test  |
build assets | -> build | -> package & deploy
1 Like

@wmnnd can you please share some enlightenment how to push the image to the repositories docker registry? I googled a lot, but wasn’t able to find anything about how to log into gitlabs registry without having credentials visible in the build log.

Currently I do only use it for building my blog and some documentation from sources and host them via gitlabs pages, but my goal is to find a way to automate pushes of my rust and elixir packages to hex.pm and crates.io.

But before that I probably have to move them from GitHub to gitlab :wink:

@NobbZ Sure thing and maybe it would be time for me to revive my blog and write about that :slight_smile:

There is an environment variable $CI_JOB_TOKEN which can be used to login to the Gitlab registry:

Here is a part from my .gitlab-ci file:

  stage: package
  image: docker:latest
    - docker build
        -t registry.gitlab.com/USERNAME/APP:latest
        -f Dockerfile.release .
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
    - docker push registry.gitlab.com/USERNAME/APP
    - docker:dind

Cool, thank you!

I use gitlab-runner to run a script that builds, migrates, and deploys a new Distillery release to my beta instance. No fancy stuff like Docker, it does a git pull on the server, builds the thing, runs migration tasks, copies it on top of the old release and restarts the systemd service.

It’s a hack but it works: https://gitlab.com/code-stats/code-stats/blob/master/.gitlab-ci.yml#L45-68