중복 된 부분이있는 gitlab-ci yaml 파일이 있습니다.YAML 병합 수준
test:client:
before_script:
- node -v
- yarn install
cache:
untracked: true
key: client
paths:
- node_modules/
script:
- npm test
build:client:
before_script:
- node -v
- yarn install
cache:
untracked: true
key: client
paths:
- node_modules/
policy: pull
script:
- npm build
나는이 두 부분의 맥락에서 효율적으로 재사용 할 공통의 부분을 추출 할 수있는 경우, 병합 구문을 알고 싶습니다
.
.node_install_common: &node_install_common
before_script:
- node -v
- yarn install
cache:
untracked: true
key: client
paths:
- node_modules/
하지만 진짜 문제는 : 들여 쓰기하는 수준에서 나는 정책을 보장하기 위해 블록을 병합해야합니까 : 풀 캐시 섹션에 적용됩니다. 나는 그걸하려고 :
test:client:
<<: *node_install_common
script:
- npm test
test:build:
<<: *node_install_common
policy: pull
script:
- npm build
하지만 잘못된 yaml 오류가 발생합니다. 올바른 병합 동작을 얻기 위해 들여 쓰기하는 방법?
도움 주셔서 감사합니다. 나는 당신의 충고에 따라'cache_common'에서 값을 분리했다. – BlackHoleGalaxy