diff options
Diffstat (limited to 'spec/frontend/editor/schema/ci/yaml_tests')
9 files changed, 93 insertions, 31 deletions
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/artifacts.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/artifacts.yml new file mode 100644 index 00000000000..f5670376efc --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/artifacts.yml @@ -0,0 +1,18 @@ +# invalid artifact:reports:cyclonedx + +cyclonedx no paths: + artifacts: + reports: + cyclonedx: + +cyclonedx not a report: + artifacts: + cyclonedx: foo + +cyclonedx not an array or string: + artifacts: + reports: + cyclonedx: + paths: + - foo + - bar diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml index ee533f54d3b..04020c06753 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml @@ -1,15 +1,13 @@ -# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779 stages: - prepare -# invalid cache:when value -job1: +# invalid cache:when values +when no integer: stage: prepare cache: when: 0 -# invalid cache:when value -job2: +when must be a reserved word: stage: prepare cache: when: 'never' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml index 287150a765f..1e16bb55405 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml @@ -1,16 +1,14 @@ -# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779 stages: - prepare -# missing file property -childPipeline: +# invalid trigger:include +trigger missing file property: stage: prepare trigger: include: - project: 'my-group/my-pipeline-library' -# missing project property -childPipeline2: +trigger missing project property: stage: prepare trigger: include: diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml new file mode 100644 index 00000000000..d74a681b23b --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml @@ -0,0 +1,14 @@ +# invalid rules:changes +unnecessary ref declaration: + script: exit 0 + rules: + - changes: + paths: + - README.md + compare_to: { ref: 'main' } + +wrong path declaration: + script: exit 0 + rules: + - changes: + paths: { file: 'DOCKER' } diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/artifacts.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/artifacts.yml new file mode 100644 index 00000000000..20c1fc2c50f --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/artifacts.yml @@ -0,0 +1,25 @@ +# valid artifact:reports:cyclonedx + +cyclonedx string path: + artifacts: + reports: + cyclonedx: foo + +cyclonedx glob path: + artifacts: + reports: + cyclonedx: "*.foo" + +cylonedx list of string paths: + artifacts: + reports: + cyclonedx: + - foo + - ./bar/baz + +cylonedx mixed list of string paths and globs: + artifacts: + reports: + cyclonedx: + - ./foo + - "bar/*.baz" diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml index 436c7d72699..d83e14fdc6a 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml @@ -1,8 +1,7 @@ -# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779 stages: - prepare -# test for cache:when values +# valid cache:when values job1: stage: prepare script: diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml index 2b29c24fa3c..f82ea71dcf3 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml @@ -1,5 +1,5 @@ -# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79335 -deploy-template: +# valid only/except values +only and except as array of strings: script: - echo "hello world" only: @@ -7,12 +7,10 @@ deploy-template: except: - bar -# null value allowed -deploy-without-only: +only as null value: extends: deploy-template only: -# null value allowed -deploy-without-except: +except as null value: extends: deploy-template except: diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml index 3497be28058..c00ab0d464a 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml @@ -1,17 +1,15 @@ -# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779 +stages: + - prepare -# test for include:rules +# valid include:rules include: - local: builds.yml rules: - if: '$INCLUDE_BUILDS == "true"' when: always -stages: - - prepare - -# test for trigger:include -childPipeline: +# valid trigger:include +trigger:include accepts project and file properties: stage: prepare script: - echo 'creating pipeline...' @@ -20,8 +18,7 @@ childPipeline: - project: 'my-group/my-pipeline-library' file: '.gitlab-ci.yml' -# accepts optional ref property -childPipeline2: +trigger:include accepts optional ref property: stage: prepare script: - echo 'creating pipeline...' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml index 27a199cff13..37cae6b4264 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml @@ -1,13 +1,28 @@ -# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74164 +# valid workflow:rules:changes +rules:changes with paths and compare_to properties: + script: exit 0 + rules: + - changes: + paths: + - README.md + compare_to: main + +rules:changes as array of strings: + script: exit 0 + rules: + - changes: + - README.md -# test for workflow:rules:changes and workflow:rules:exists +# valid workflow:rules:exists +# valid rules:changes:path workflow: rules: + - changes: + paths: + - README.md - if: '$CI_PIPELINE_SOURCE == "schedule"' exists: - Dockerfile - changes: - - Dockerfile variables: IS_A_FEATURE: 'true' when: always |