Closed hverlin closed 1 day ago
Minimal .gitlab-ci.yml illustrating the issue
--- default: cache: key: 'my-key' paths: - my-file .some-shared-yaml: if: "$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH" my-job: script: 'echo test' rules: - !reference [.some-shared-yaml]
fails validation.
Invalid .gitlab-ci.yml configuration! • 'cache' property is not expected to be here at my-job.rules.0 • '0' property type must be string at my-job.rules.0
Indeed, gitlab-ci-local generates an invalid internal pipeline definition
gitlab-ci-local
stages: - .pre - build - test - deploy - .post default: cache: key: my-key paths: - my-file .some-shared-yaml: &ref_0 if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH cache: - &ref_1 key: my-key paths: - my-file policy: pull-push when: on_success my-job: script: - echo test rules: - *ref_0 cache: - *ref_1
Expected behavior
The expected behavior is that the shared-yaml object should not extend default as it's not a job actually:
shared-yaml
default
.some-shared-yaml: if: "$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
This issue was not an issue before json-schema-validation got introduced, as using --json-schema-validation=false does run the job correctly
json-schema-validation
--json-schema-validation=false
❯ gcl my-job --json-schema-validation=false parsing and downloads finished in 49 ms. [19:45:42 1.45 ms] my-job starting shell (test) [19:45:42 8.31 ms] my-job $ echo test [19:45:42 8.48 ms] my-job > test [19:45:42 9.27 ms] my-job finished in 9.27 ms PASS [9.27 ms] my-job
Minimal .gitlab-ci.yml illustrating the issue
fails validation.
Indeed,![image](https://github.com/firecow/gitlab-ci-local/assets/9151470/fd70b100-c55c-428a-9857-171eaa5731cf)
gitlab-ci-local
generates an invalid internal pipeline definitionExpected behavior![image](https://github.com/firecow/gitlab-ci-local/assets/9151470/3b9a46ed-0690-43c5-a903-48eb017a842d)
The expected behavior is that the
shared-yaml
object should not extenddefault
as it's not a job actually:Additional context
This issue was not an issue before
json-schema-validation
got introduced, as using--json-schema-validation=false
does run the job correctly