summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-07-01 19:23:41 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-05 18:36:19 +0900
commitb6f41544d8a9ca4b13045b8f9d063367be17404f (patch)
tree8f11c1461efb69289584f7c65cc9bc2fb6454ba6
parent23f3c7335549861f4064e4b3696cc9de18ba8c96 (diff)
downloadgitlab-ce-b6f41544d8a9ca4b13045b8f9d063367be17404f.tar.gz
Fix spec. Add PipelineScheduleVariable for import_export
-rw-r--r--app/models/ci/pipeline_schedule_variable.rb2
-rw-r--r--doc/ci/variables/README.md2
-rw-r--r--lib/gitlab/import_export/import_export.yml3
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml3
-rw-r--r--spec/models/ci/build_spec.rb4
5 files changed, 10 insertions, 4 deletions
diff --git a/app/models/ci/pipeline_schedule_variable.rb b/app/models/ci/pipeline_schedule_variable.rb
index ee5b8733fac..6c9c8d990f9 100644
--- a/app/models/ci/pipeline_schedule_variable.rb
+++ b/app/models/ci/pipeline_schedule_variable.rb
@@ -5,6 +5,6 @@ module Ci
belongs_to :pipeline_schedule
- validates :key, uniqueness: { scope: :pipeline_schedule_id }
+ validates :key, uniqueness: { scope: :pipeline_schedule_id }, presence: { unless: :importing? }
end
end
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md
index f1c35700d15..3bdcdba7a2d 100644
--- a/doc/ci/variables/README.md
+++ b/doc/ci/variables/README.md
@@ -9,7 +9,7 @@ and a list of **user-defined variables**.
The variables can be overwritten and they take precedence over each other in
this order:
-1. [Trigger variables][triggers] or [scheduled pipeline variables](../../user/project/pipelines/schedules#making-use-of-scheduled-pipeline-variables) (take precedence over all)
+1. [Trigger variables][triggers] or [scheduled pipeline variables](../../user/project/pipelines/schedules.md#making-use-of-scheduled-pipeline-variables) (take precedence over all)
1. [Secret variables](#secret-variables) or [protected secret variables](#protected-secret-variables)
1. YAML-defined [job-level variables](../yaml/README.md#job-variables)
1. YAML-defined [global variables](../yaml/README.md#variables)
diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml
index 1860352c96d..2d443aa731f 100644
--- a/lib/gitlab/import_export/import_export.yml
+++ b/lib/gitlab/import_export/import_export.yml
@@ -42,7 +42,8 @@ project_tree:
- :stages
- :statuses
- :triggers
- - :pipeline_schedules
+ - pipeline_schedules:
+ - :variables
- :services
- :hooks
- protected_branches:
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index a5f09f1856e..40ae0a1846b 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -132,6 +132,9 @@ pipeline_schedules:
- last_pipeline
pipeline_schedule:
- pipelines
+- pipeline_schedule_variables
+pipeline_schedule_variables:
+- pipeline_schedule
deploy_keys:
- user
- deploy_keys_projects
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 4ed2635fb07..66784607835 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -1375,8 +1375,10 @@ describe Ci::Build, :models do
context 'when a job was triggered by a pipeline schedule' do
let(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project) }
+
let!(:pipeline_schedule_variable) do
- create(:ci_pipeline_schedule_variable, key: 'SCHEDULE_VARIABLE_KEY',
+ create(:ci_pipeline_schedule_variable,
+ key: 'SCHEDULE_VARIABLE_KEY',
pipeline_schedule: pipeline_schedule)
end