I'm trying to setup a pipeline on my django project with a shell runner.
I have 2 jobs :
The first build succeeded but when during my second job I have an ownership issue on my jobs folder :
warning: failed to remove api/__pycache__/resolvers.cpython-37.pyc
Here is my gitlab runner config :
[[runners]]
name = "Shell Runner"
url = "https://gitlab.com"
token = "<my-token>"
executor = "shell"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
Is there a way to have separate jobs for build and test without this problem ?
So after struggling with this I finally found a solution.
When python install modules in __pycache__
the owner is root
so the runner can not delete those files between each jobs.
To fix this I added ENV PYTHONDONTWRITEBYTECODE 1
in my Dockerfile
to prevent the creation of __pycache__
files.