title: How can I download gitlab CI/CD artifacts with curl?
body: <p>Our gitlab CI/CD web interface lets us download "artifacts" (e.g. executables, shared libraries) after a successful run, as in the screenshot below:</p>
  
  <p><a href="https://i.stack.imgur.com/eVM7E.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eVM7E.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p><strong>Question: Is there a way the artifact can be downloaded from a shell?</strong>  (solution using curl is preferred)</p>
  
  <p>The "<code>Copy Link Location</code>" right-click menu option gives me something like <code>https://git.my_company.com/namespace/project/-/jobs/987134/artifacts/download</code> so I tried the following:</p>
  
  <pre><code>$ curl -O -L https://git.my_company.com/namespace/project/-/jobs/987134/artifacts/download
  </code></pre>
  
  <p>But that doesn't download the right thing: it gives me a vomit of html, but I'm expecting a .zip file.</p>
  
  <p>If I try to download the file from the web UI, the filename defaults to <code>artifacts.zip</code>, so I also tried:</p>
  
  <pre><code>$ curl -O -L https://git.my_company.com/namespace/project/-/jobs/987134/artifacts/download/artifacts.zip
  </code></pre>
  
  <p>That does <em>create</em> a file named <code>artifacts.zip</code> but it's still not the expected file: it's still html, though different from the first described attempt.</p>