2

I have a project in gitlab. The project gets built for every check-in in the repo and build artifacts are created when the gitlab pipeline is successful.

I want to get these build artifacts in my jenkins pipeline job. Is there any way to do that? I couldn't find any plugin in Jenkins to do this.

Any help is appreciated.

SP.
  • 85
  • 3
  • 13
  • https://docs.gitlab.com/ee/api/jobs.html#download-the-artifacts-archive – 1615903 Apr 11 '18 at 06:20
  • @1615903 I tried to download directly by accessing the artifacts url as in the documentation using http request plugin. But I'm facing few issues in providing an authorization header in the request. There are other SO questions revolving around header setting issues with the plugin which did not solve my issue with headers. Any thoughts or suggestions? – SP. Apr 11 '18 at 07:10
  • Open another question with that other issue / or update your question with this new issue as we/I can't mind read what header setting issue you have :) – Rekovni Apr 11 '18 at 08:52

1 Answers1

2

The GitLab API offers this with both complete artifacts package (zip) and single files. You need a GitLab token which you can add as a Credential (secret text) and the project number for the pipline you want to copy from. Project ID example of GanttLab Live.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test"
E. Liland
  • 21
  • 1
  • 4