diff options
Diffstat (limited to 'spec/frontend/editor/schema/ci/yaml_tests')
24 files changed, 261 insertions, 67 deletions
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 04020c06753..3979c9ae2ac 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,13 +1,62 @@ -stages: - - prepare +cache-key-files-not-an-array: + script: echo "This job uses a cache." + cache: + key: + files: package.json + paths: + - vendor/ruby + - node_modules + +cache-key-prefix-array: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: + - binaries-cache-$CI_JOB_NAME + paths: + - binaries/ + +cache-key-with-.: + script: echo "This job uses a cache." + cache: + key: . + paths: + - binaries/ + +cache-key-with-multiple-.: + stage: test + script: echo "This job uses a cache." + cache: + key: .. + paths: + - binaries/ + +cache-key-with-/: + script: echo "This job uses a cache." + cache: + key: binaries-ca/che + paths: + - binaries/ + +cache-path-not-an-array: + script: echo "This job uses a cache." + cache: + key: binaries-cache + paths: binaries/*.apk + +cache-untracked-string: + script: echo "This job uses a cache." + cache: + untracked: 'true' -# invalid cache:when values -when no integer: - stage: prepare +when_integer: + script: echo "This job uses a cache." cache: when: 0 -when must be a reserved word: - stage: prepare +when_not_reserved_keyword: + script: echo "This job uses a cache." 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 1e16bb55405..6afd8baa0e8 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,6 +1,3 @@ -stages: - - prepare - # invalid trigger:include trigger missing file property: stage: prepare diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/job_when.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/job_when.yml new file mode 100644 index 00000000000..d4e3911ff60 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/job_when.yml @@ -0,0 +1,11 @@ +job_with_wrong_when: + script: exit 0 + when: on_xyz + +job_with_boolean_when: + script: exit 0 + when: true + +job_with_array_when: + script: exit 0 + when: [on_success] diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/empty.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/empty.yml deleted file mode 100644 index ee2bb3e8ace..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/empty.yml +++ /dev/null @@ -1,5 +0,0 @@ -trigger-include: - trigger: - include: - - file: '/path/to/child-pipeline.yml' - project: '' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml deleted file mode 100644 index 770305be0dc..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml +++ /dev/null @@ -1,5 +0,0 @@ -trigger-include: - trigger: - include: - - file: '/path/to/child-pipeline.yml' - project: 'slug#' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml deleted file mode 100644 index 82fd77cf0d3..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml +++ /dev/null @@ -1,5 +0,0 @@ -trigger-include: - trigger: - include: - - file: '/path/to/child-pipeline.yml' - project: '/slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml deleted file mode 100644 index f4ea59c7945..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml +++ /dev/null @@ -1,5 +0,0 @@ -trigger-include: - trigger: - include: - - file: '/path/to/child-pipeline.yml' - project: 'slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml deleted file mode 100644 index a0195c03352..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml +++ /dev/null @@ -1,5 +0,0 @@ -trigger-include: - trigger: - include: - - file: '/path/to/child-pipeline.yml' - project: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml deleted file mode 100644 index cad8dbbf430..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml +++ /dev/null @@ -1,2 +0,0 @@ -trigger-minimal: - trigger: '' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml deleted file mode 100644 index 6ca37666d09..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml +++ /dev/null @@ -1,2 +0,0 @@ -trigger-minimal: - trigger: 'slug#' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml deleted file mode 100644 index 9d7c6b44125..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml +++ /dev/null @@ -1,2 +0,0 @@ -trigger-minimal: - trigger: '/slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml deleted file mode 100644 index acd047477c8..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml +++ /dev/null @@ -1,2 +0,0 @@ -trigger-minimal: - trigger: 'slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml deleted file mode 100644 index 0fdd00da3de..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml +++ /dev/null @@ -1,2 +0,0 @@ -trigger-minimal: - trigger: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/empty.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/empty.yml deleted file mode 100644 index 0aa2330cecb..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/empty.yml +++ /dev/null @@ -1,3 +0,0 @@ -trigger-project: - trigger: - project: '' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml deleted file mode 100644 index 3c17ec62039..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml +++ /dev/null @@ -1,3 +0,0 @@ -trigger-project: - trigger: - project: 'slug#' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml deleted file mode 100644 index f9884603171..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml +++ /dev/null @@ -1,3 +0,0 @@ -trigger-project: - trigger: - project: '/slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml deleted file mode 100644 index d89e09756eb..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml +++ /dev/null @@ -1,3 +0,0 @@ -trigger-project: - trigger: - project: 'slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml deleted file mode 100644 index 3c39d6be4cb..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml +++ /dev/null @@ -1,3 +0,0 @@ -trigger-project: - trigger: - project: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/trigger.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/trigger.yml new file mode 100644 index 00000000000..73cc82f2f1c --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/trigger.yml @@ -0,0 +1,64 @@ +trigger-minimal-empty: + trigger: '' + +trigger-minimal-invalid-variable: + trigger: 'slug#' + +trigger-minimal-leading-slash: + trigger: '/slug' + +trigger-minimal-no-slash: + trigger: 'slug' + +trigger-minimal-trailing-slash: + trigger: 'slug/' + +trigger-project-empty: + trigger: + project: '' + +trigger-project-invalid-variable: + trigger: + project: 'slug#' + +trigger-project-leading-slash: + trigger: + project: '/slug' + +trigger-project-no-slash: + trigger: + project: 'slug' + +trigger-project-trailing-slash: + trigger: + project: 'slug/' + +trigger-include-empty: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: '' + +trigger-include-invalid: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug#' + +trigger-include-leading-slash: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: '/slug' + +trigger-include-no-slash: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug' + +trigger-include-trailing-slash: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/invalid_syntax_desc.yml index a7f23cf0d73..4916a6b354e 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/invalid_syntax_desc.yml @@ -1,4 +1,3 @@ -# invalid variable (unknown keyword is used) variables: FOO: value: BAR diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml new file mode 100644 index 00000000000..62bebfa57e7 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml @@ -0,0 +1,4 @@ +variables: + RAW_VAR: + value: Hello $FOO + expand: okay 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 d83e14fdc6a..75918cd2a1b 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,24 +1,124 @@ -stages: - - prepare - # valid cache:when values job1: - stage: prepare script: - echo 'running job' cache: when: 'on_success' job2: - stage: prepare script: - echo 'running job' cache: when: 'on_failure' job3: - stage: prepare script: - echo 'running job' cache: when: 'always' + +# valid cache:paths +cache-paths: + script: echo "This job uses a cache." + cache: + key: binaries-cache + paths: + - binaries/*.apk + - .config + +# valid cache:key +cache-key-string: + script: echo "This job uses a cache." + cache: + key: random-string + paths: + - binaries/ + +cache-key-string-with-dots: + script: echo "This job uses a cache." + cache: + key: random-..string + paths: + - binaries/ + +cache-key-string-beginning-with-dot: + script: echo "This job uses a cache." + cache: + key: .random-string + paths: + - binaries/ + +cache-key-string-ending-with-dot: + script: echo "This job uses a cache." + cache: + key: random-string. + paths: + - binaries/ + +cache-key-predefined-variable: + script: echo "This job uses a cache." + cache: + key: $CI_COMMIT_REF_SLUG + paths: + - binaries/ + +cache-key-combination: + script: echo "This job uses a cache." + cache: + key: binaries-cache-$CI_COMMIT_REF_SLUG + paths: + - binaries/ + +# valid cache:key:files +cache-key-files: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + - package.json + paths: + - vendor/ruby + - node_modules + +# valide cache:key:prefix +cache-key-prefix-string: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: random-string + paths: + - binaries/ + +cache-key-prefix-predefined-variable: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: $CI_JOB_NAME + paths: + - binaries/ + +cache-key-prefix-combination: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: binaries-cache-$CI_JOB_NAME + paths: + - binaries/ + +# valid cache:untracked +cache-untracked-true: + script: test + cache: + untracked: true + +cache-untracked-false: + script: test + cache: + untracked: false diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/job_when.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/job_when.yml new file mode 100644 index 00000000000..2a684a78f4e --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/job_when.yml @@ -0,0 +1,10 @@ +job_with_no_when: + script: exit 0 + +job_with_when_always: + script: exit 0 + when: always + +job_with_when_on_failure: + script: exit 0 + when: on_failure diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml index ee71087a72e..53d020c432f 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml @@ -6,3 +6,13 @@ variables: description: "A single value variable" DEPLOY_ENVIRONMENT: description: "A multi-value variable" + RAW_VAR: + value: "Hello $FOO" + expand: false + +rspec: + script: rspec + variables: + RAW_VAR2: + value: "Hello $DEPLOY_ENVIRONMENT" + expand: false
\ No newline at end of file |