summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-10 23:36:54 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-10 23:36:54 +0200
commit907c0e6796b69f9577c147dd489cf55748c749ac (patch)
treec4db6a3d3785fa845be98447eb4303b548ab7809 /lib
parentcf7da039bedcad5163ce9deedccc94206d4c485a (diff)
downloadgitlab-ce-907c0e6796b69f9577c147dd489cf55748c749ac.tar.gz
Added initial version of deployments
Diffstat (limited to 'lib')
-rw-r--r--lib/api/builds.rb2
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb
index 0ff8fa74a84..6bf59afab53 100644
--- a/lib/api/builds.rb
+++ b/lib/api/builds.rb
@@ -142,7 +142,7 @@ module API
return not_found!(build) unless build
return forbidden!('Build is not retryable') unless build.retryable?
- build = Ci::Build.retry(build)
+ build = Ci::Build.retry(build, current_user)
present build, with: Entities::Build,
user_can_download_artifacts: can?(current_user, :read_build, user_project)
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 130f5b0892e..5aacb59dc5c 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -7,7 +7,8 @@ module Ci
ALLOWED_YAML_KEYS = [:before_script, :after_script, :image, :services, :types, :stages, :variables, :cache]
ALLOWED_JOB_KEYS = [:tags, :script, :only, :except, :type, :image, :services,
:allow_failure, :type, :stage, :when, :artifacts, :cache,
- :dependencies, :before_script, :after_script, :variables]
+ :dependencies, :before_script, :after_script, :variables,
+ :environment]
attr_reader :before_script, :after_script, :image, :services, :path, :cache
@@ -85,6 +86,7 @@ module Ci
except: job[:except],
allow_failure: job[:allow_failure] || false,
when: job[:when] || 'on_success',
+ environment: job[:environment],
options: {
image: job[:image] || @image,
services: job[:services] || @services,
@@ -203,6 +205,10 @@ module Ci
if job[:when] && !job[:when].in?(%w(on_success on_failure always))
raise ValidationError, "#{name} job: when parameter should be on_success, on_failure or always"
end
+
+ if job[:environment] && !validate_string(job[:environment])
+ raise ValidationError, "#{name} job: environment should be a string"
+ end
end
def validate_job_script!(name, job)