Retrieve the commit hash
<p>I'm currently working on a deployment script to run as part of my GitLab CI setup. What I want is to copy a file from one location to another and rename it.</p>

<p>Now I want to be able to find what commit that file was generated with, so I'd like to add the hash of the commit to it.</p>

<p>For that to work I'd like to use something like this:</p>

<pre><code>cp myLogFile.log /var/log/gitlab-runs/$COMMITHASH.log
</code></pre>

<p>The output should be a file named eg.</p>

<pre><code>/var/log/gitlab-runs/9b43adf.log
</code></pre>

<p>How is this possible to achieve using GitLab CI?</p>