How to store releases/binaries in GitLab?

2019-01-21 16:13发布

问题:

I am building a workflow with Gitlab, Jenkins and - probably - Nexus (I need an artifact storage). I would like to have GitLab to store releases/binaries - is it possible in a convenient way?

I would not like to have another service from which a release (and documentation) could be downloaded but to have it somehow integrated with repository manager, just like releases are handled in e.g. GitHub. Any clues?

回答1:

Update Nov. 2015: GitLab 8.2 now supports releases.

With its API, you now can create and update a relase associated to a tag.
For now, it is only the ability to add release notes (markdown text and attachments) to git tags (aka Releases).

  • first upload the release binary
  • create a new release and place a link to the uploaded binary in the description

Original answer March 2015

This is in progress, and suggested in suggestions 4156755:

We’re accepting merge requests for the minimal proposal by Ciro:

  1. For each repository tag under https://github.com/cirosantilli/test/releases/tag/3.0, allow to upload and download a list of files.
  2. The upload and download can be done directly from the tag list view.
  3. If a tag gets removed, the uploads are destroyed. (we’re not accepting the tag message edit mentioned in recent comments)

The comments to that suggestion include:

What makes it more interesting is the next step.
I would really like a way to let public download artifacts from "releases" without being able to access source code (i.e. make sources private for project team only except anything else like wiki, "releases", issue tracker).

However, such additional feature looks more generic and I submitted a separate feature request for that.

Nevertheless, I repeat my point here:
While the simplistic version of "releases" is still nice to have, many people can easily set up external file server and point URLs in release/tag description to this server outside GitLab.
In other words, "releases" may not look attractive now without some future picture of integration.



回答2:

Gitlab (server) itself is for git repositories. You are not supposed to store binaries in git. Nexus would here the way to go. You might add a link to nexus in your repositories description or readme file (like you can point there to your jenkins build, too).

You might want to take a look into GitLab Continuous Integration which integrates with Gitlab. That seems to be more something like Jenkins. I do not know if it comes with a data storage like Nexus.



回答3:

We're using scp to copy files, such as binaries or reports, generated in GitlabCI.

# capture test exit code
set +e
bash build/ci/test.sh; TESTS_EXIT_CODE=$?
set -e

# copy reports
sshpass -p "$SFTP_PASS" ssh -o StrictHostKeyChecking=no sftp@192.168.1.60 "mkdir -p ${CI_REPORTS_PATH}"
sshpass -p "$SFTP_PASS" scp -r ${CI_APP_VOLUME}/tests/_output/* sftp@192.168.23.17:${CI_REPORTS_PATH}

# return test exit-code
exit ${TESTS_EXIT_CODE}