summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-06-21 18:25:01 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-05 18:37:36 +0900
commit06f01073696199da980a2101bc3eb77922131a8a (patch)
tree669da13c2c184bbfa4433f3c50291fc072de59f5 /app/models
parent8bc8e01fcf6502888f1088a5b72a8ae936c628fc (diff)
downloadgitlab-ce-06f01073696199da980a2101bc3eb77922131a8a.tar.gz
pipeline_schedule_variables model/db
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb14
-rw-r--r--app/models/ci/pipeline_schedule_variable.rb1
2 files changed, 7 insertions, 8 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 6c5b27a7ac5..6878f055667 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -176,12 +176,9 @@ module Ci
# * Lowercased
# * Anything not matching [a-z0-9-] is replaced with a -
# * Maximum length is 63 bytes
- # * First/Last Character is not a hyphen
def ref_slug
- ref.to_s
- .downcase
- .gsub(/[^a-z0-9]/, '-')[0..62]
- .gsub(/(\A-+|-+\z)/, '')
+ slugified = ref.to_s.downcase
+ slugified.gsub(/[^a-z0-9]/, '-')[0..62]
end
# Variables whose value does not depend on environment
@@ -195,8 +192,11 @@ module Ci
variables += yaml_variables
variables += user_variables
variables += project.secret_variables_for(ref).map(&:to_runner_variable)
- variables += trigger_request.user_variables if trigger_request
- variables += pipeline.pipeline_schedule.job_variables if pipeline.pipeline_schedule
+ if trigger_request
+ variables += trigger_request.user_variables
+ elsif pipeline.pipeline_schedule
+ variables += pipeline.pipeline_schedule.variables.map(&:to_runner_variable)
+ end
variables
end
diff --git a/app/models/ci/pipeline_schedule_variable.rb b/app/models/ci/pipeline_schedule_variable.rb
index ee5b8733fac..2d681446d00 100644
--- a/app/models/ci/pipeline_schedule_variable.rb
+++ b/app/models/ci/pipeline_schedule_variable.rb
@@ -4,7 +4,6 @@ module Ci
include HasVariable
belongs_to :pipeline_schedule
-
validates :key, uniqueness: { scope: :pipeline_schedule_id }
end
end