0

From my question "Gitlab CI: get list of files changed since last run" I discovered that Gitlab CI has no variable that tracks the SHA-ID of the last commit on which the pipeline has been executed.

I'm trying to save the commit ID on a .txt that will be sourced by a shell script (variable is like LAST_EXECUTED_SHA_ID=XYZ). Now, after a pipeline execution I have to update such text file in order to track the current HEAD, changing LAST_EXECUTED_SHA_ID to ZYX. Now I have to: add the file, commit and push. I tried to do so using gitlab-runner both with a shell script and .gitlab-ci.yml file itself but I encounter several errors like "remote: You are not allowed to upload code."

Is there any way to fix this error? It seems like an ssh / auth token error or similar

EagleOne
  • 541
  • 1
  • 10
  • 28
  • 1
    Can't you tag the current commit every time the pipeline is run instead of storing it in a txt file? For the next pipeline, you delete the tag and recreate it on the future current HEAD. Am I missing something? – Marco Luzzara Jul 20 '21 at 16:18
  • Yes, it is a more elegant solution and can be used instead of txt file handling. The problem about "remote: You are not allowed to upload code" still persists even with "git push --tags" – EagleOne Jul 21 '21 at 07:08
  • Solved added an ad-hoc auth token with more permissions that the standard CI auth token – EagleOne Jul 21 '21 at 09:56

0 Answers0