小编Pat*_*ric的帖子

尽管 .gitignore 存在,Gitlab-runner 仍会删除远程文件

我试图找到解决这个问题的方法,但没有找到。

问题:

我们有图像文件/public/img/InfoNews/example.png,每次推送更新时 gitlab-runner 都会删除远程上的这些文件。

我们/public/img/InfoNews.gitignore这可以防止 git 上传本地文件,但不能出于某种原因删除该文件夹中的远程文件。

我尝试将此路径添加到缓存和工件中,但.gitlab-ci.yml没有成功

朝着正确的方向推动是值得赞赏的。

我们的.gitlab-ci.yml

cache:
  paths:
    - vendor/
    - public/img/

deploy:
  stage: deploy
  script:
    - php artisan cache:clear
    - rm -rf vendor/
    - composer install
    - echo "$env" > "$(pwd)/.env"
    - php artisan migrate

  artifacts:
    paths:
      - .env
      - public/img/
Run Code Online (Sandbox Code Playgroud)

编辑:

我也尝试过

cache:
  untracked: true
  paths:
    - vendor/
    - public/img/
Run Code Online (Sandbox Code Playgroud)

但它仍然删除文件。

git gitlab gitlab-ci-runner

1
推荐指数
1
解决办法
2111
查看次数

标签 统计

git ×1

gitlab ×1

gitlab-ci-runner ×1