Doing CICD correctly

I am getting started with Gitlab - CI. I have a few questions on how to approach automation in this space. Perhaps users here could guide me in the right direction.

I have gitlab-ce installed for a small research team. We are starting with one project on Gitlab to get used to CI/CD. As bare-bones, I have a single source file in it, and I am trying to learn the ropes. I have .gitlab-ci.yml that in turns calls make to compile the source file, runs the tests and generates the executable binary. Now, my question is that binary is lost because it is simply not copied back anywhere. What does a typical workflow here look like?

Say, I want to make a release every time a commit happens in master branch. I’d like gitlab-CI to run make, run tests, build the binary and release it as an asset downloadable by users. However, when I tag a release, Gitlab only grabs the source and makes .tar.gz, .zip etc. How can I get the binaries in there without manually compiling it myself and uploading it on the web UI?

Note:
My CI runner is a shell executor. NO docker.
Why?
CI runs on a build node, and I do not have or plan to have Docker running as root pulling arbitrary images from the internet on a system that has access to our primary storage.

Appreciate any help.

  • What are you seeing, and how does that differ from what you expect to see?
    I see source code released in a release. I expect CI runner to publish the built binaries as part of a release.

  • Consider including screenshots, error messages, and/or other helpful visuals
    Not Applicable.

  • What version are you on? Are you using self-managed or GitLab.com?

    • GitLab (Hint: /help): GitLab Community Edition 13.4.3
    • Runner (Hint: /admin/runners): Shell executor

There are different ways to approach the distribution of binary built on Gitlab CI.

One is using the artifacts keyword, that upload things back to Gitlab itself: https://docs.gitlab.com/ee/ci/yaml/README.html#artifacts

Another one is using the release keyword, which creates a new release and, since Gitlab 13.5, accepts generic packages: https://docs.gitlab.com/ee/ci/yaml/README.html#release https://gitlab.com/gitlab-org/release-cli/-/tree/master/docs/examples/release-assets-as-generic-package/

1 Like

Thanks for the quick and useful response.

I read fast through artifacts and release-cli. It didnt hit me because release-cli was a docker image, and I moved away from it. It appears that it is a Go application - I can go down the hole and try to make it work from shell.

I could get the binaries collected as artifacts and use the release-cli to get it to the release page. I’ll try to get it to work.

Thanks.