title: How can I download a binary file submitted to gitlab over a trigger?
body: <p>I want to push a file to a Gitlab pipeline from an external process using <code>curl</code> or a similar tool.</p>
  <p>Uploading the file can be accomplished with a <a href="https://docs.gitlab.com/ee/ci/triggers" rel="nofollow noreferrer">Gitlab Trigger API request</a>:</p>
  <pre><code>curl -X POST \
       -F &quot;token=$(cat .gitlab-trigger)&quot; \
       -F &quot;ref=develop&quot; \
       -F &quot;variables[env]=qua&quot; \
       -F &quot;bundle=@bundle.zip&quot; \
       https://gitlab.company.com/api/v4/projects/1234/trigger/pipeline
  </code></pre>
  <p>The pipeline job can then access a <a href="https://docs.gitlab.com/ee/ci/triggers/#using-webhook-payload-in-the-triggered-pipeline" rel="nofollow noreferrer">TRIGGER_PAYLOAD</a> file similar to:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;ref&quot;: &quot;develop&quot;,
    &quot;variables&quot;: {
      &quot;env&quot;: &quot;qua&quot;
    },
    &quot;bundle&quot;: {
      &quot;filename&quot;: &quot;bundle.zip&quot;,
      &quot;type&quot;: &quot;application/octet-stream&quot;,
      &quot;name&quot;: &quot;bundle&quot;,
      &quot;tempfile&quot;: &quot;#\u003cFile:0x00007fcc8b7581e0\u003e&quot;,
      &quot;head&quot;: &quot;Content-Disposition: form-data; name=\&quot;bundle\&quot;; filename=\&quot;bundle.zip\&quot;\r\nContent-Type: application/octet-stream\r\n&quot;
    },
    &quot;id&quot;: &quot;1228&quot;
  }
  </code></pre>
  <p>Judging from the file content it would appear that the <code>bundle.zip</code> file is uploaded to the Gitlab server.</p>
  <p><strong>How can I get hold of the <code>bundle.zip</code> file? Is it even possible?</strong></p>
  <p>Please note that</p>
  <ul>
  <li>Neither the bundle nor the temp file is found in the current dir or in the temporary parent dir of the TRIGGER_PAYLOAD file.</li>
  <li>Specifying the payload file as a <code>variables[bundle]</code> form param makes Gitlab reject the request as only strings and map variables are supported.</li>
  <li>Submitting the <code>token</code> and <code>variables[env]</code> variables as query params and adding the ZIP file as the binary only payload (no form params) makes the upload fail.</li>
  </ul>