Shell Runner 的所有权问题

Ownership issue with Shell Runner

我正在尝试使用 shell 运行ner 在我的 django 项目上设置管道。

我有 2 份工作:

第一次构建成功,但在我的第二份工作中,我的工作文件夹出现 所有权 问题:

warning: failed to remove api/__pycache__/resolvers.cpython-37.pyc

这是我的 gitlab 运行ner 配置:

[[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]

有没有办法在没有这个问题的情况下为构建和测试创建单独的作业?

所以在与这个问题斗争之后,我终于找到了解决方案。

当 python 在 __pycache__ 中安装模块时,所有者是 root,因此运行器无法在每个作业之间删除这些文件。

为了解决这个问题,我在 Dockerfile 中添加了 ENV PYTHONDONTWRITEBYTECODE 1 以防止创建 __pycache__ 个文件。