Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab markdown links to artifacts

Tags:

gitlab

Is it possible in Gitlab to have source controlled markdown that contains a link to an artifact?

My runner generates metrics that are saved to a file. This output, of course, does not belong in version control. If it was in version control, I could just link to it, no problem. Instead, I mark the output as an artifact so that it is saved after the build is complete.

Currently, our devs can click the [passed] icon for the build that generates the metrics, then click 'Build Artifacts'|'Browse'|dir1|... down to the generated output metric. This is complicated, and you have to know exactly where to look.

It would be way more convenient to have a link to the artifact in the README.md.

These docs say that I can choose to store my artifacts in a different location, but that seems like a heavy solution, and it does not generalize to artifacts from different projects.

These docs say that I can embed build numbers in the artifact filename, but that's not really what I'm after. I just want the artifacts from the most recent build.

What I want is a persistent URL for the artifact, but I am unable to find anything of this nature.

like image 548
jsp Avatar asked Jul 01 '16 16:07

jsp


People also ask

Can we store artifacts in GitLab?

The artifacts are stored by default in /home/git/gitlab/shared/artifacts . Save the file and restart GitLab for the changes to take effect.

Does GitLab use markdown?

GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few significant ways to add some useful functionality. It was inspired by GitHub Flavored Markdown. You can also use other rich text files in GitLab.

How artifacts work in GitLab?

Artifacts are files created as part of a build process that often contain metadata about that build's jobs like test results, security scans, etc. These can be used for reports that are displayed directly in GitLab or can be published to GitLab Pages or in some other way for users to review.

How do I download artifacts from GitLab?

Introduced in GitLab 12.4, artifacts in internal and private projects can be previewed when GitLab Pages access control is enabled. Jobs can output an archive of files and directories. This output is known as a job artifact. You can download job artifacts by using the GitLab UI or the API.


1 Answers

Update February 2018:

Since Gitlab 8.12, the link is https://gitlabInstance/myNamespace/repository/master/archive.zip. (e.g: https://gitlab.com/rpadovani/my-gitlab-ci/repository/master/archive.zip).

There are also other formats.

You can see all the formats clicking on the little cloud in the top right of the homepage of your project. download link

ORIGINAL ANSWER

They are working on it right now.

Since GitLab 8.10, there is an API to do that:

curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds/artifacts/master/download?job=test"

Unfortunately you still cannot use the web interface, but there is already a MR to implement it (and a related bug with discussion).

After that MR you can link the build in your README

like image 151
rpadovani Avatar answered Sep 29 '22 06:09

rpadovani