Gitlab – simple array breaks include in a file

  Kiến thức lập trình

I have an array of simple paths to use in changes when rules for job are defined. I used approach with anchors. The code looks like this:

.default-changes: &default-changes
  - /src/test1
  - /src/test2

build-test:
  stage: build
  rules:
    - if: '$CI_COMMIT_BRANCH == "develop"'
      changes: *default-changes
  tags: 
    - linux
  script: echo 'build'
  interruptible: true
  artifacts:
    when: always
    expire_in: 1 day
    paths:
      - _artifacts/publish/*

this file is included in .gitlab-ci.yml. When I have that array defined in the file then my full configuration looks like that:

---
".default-changes":
  - "/src/test1"
  - "/src/test2"
stages:
- ".pre"
- build
- test
- deploy
- ".post"

The rest of the file is missing and gitlab does not report any errors in yml configuration.
Even if I remove anchor to default changes but .default-changes stays in the file and in changes those paths are copied then the final configuration looks like above.

Where I made a mistake. I cannot see it at all.

Thanks in advance

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT