Gitlab runner removes build folder

Viewed 783

On the gitlab-runner with version 12.6.0 always my needed .Build folder gets removed. I use literally the same setup like this here: https://github.com/TYPO3-Documentation/tea/blob/main/.gitlab/pipeline/.gitlab-ci.yml

For them, the files were not removed but for me always. I need the artifacts for linting.

Checking out ffc908d4 as ci-cd...
Removing .Build/
Removing .composer/
Removing composer.lock

That is what is happening. I have the hypothesis that it has something to do with Reinitialized existing Git repository in ... because the owner of the mentioned project always have a fresh repository somehow.

I tried to use dependencies as well as needs. Neither of them worked.

My current CI config:

stages:
  - build
  - lint

.default:
  image: php:7.4
  before_script:
    - bash .gitlab/build/docker_install.sh > /dev/null


build-composer-dependencies:
  extends: .default
  stage: build
  needs: [ ]
  variables:
    COMPOSER_CACHE_DIR: '.composer'
  script:
    - composer --version
    - COMPOSER_CACHE_DIR=.composer
      composer install --prefer-dist --no-progress --optimize-autoloader
  artifacts:
    when: on_success
    expire_in: 2 weeks
    paths:
      - .Build
  cache:
    paths:
      - .composer
      - .Build

json-lint:
  extends: .default
  stage: lint
  dependencies:
    - build-composer-dependencies
  script:
    - composer ci:json:lint
1 Answers

I think you can still use the artifacts under .Build dir in job json-lint. I use docker executor type runner and also use artifacts built from upstream job.

Related