I have a job which creates builds with "sudo" or root privileges. Hence, when directory cleanup occurs at the start of a job run in GitLab CI-CD pipeline, I get the error as "Permission denied" while cleaning repository items.
I tried implementing a command with sudo rm -r *
in after_script
, but turns out the artifacts are uploaded after scripts are executed in following order:
before_script
script
after_script
artifacts uploading
What am I trying to achive:
I am in search of a way to clean the project directory after the artifacts are uploaded.
OR
If I could specify cloning of the repository into a particular(custom) directory.
I am fairly new to Gitlab Pipelines. Any help will be appreciated!