summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-16 18:46:18 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-16 19:22:48 +0200
commitb340b59743e8cd47fc1f4fa2020b400d82bfd86e (patch)
treeb5944d4dc7fc09b2c158d3853f05b1c12d119a02 /lib
parent8c9cc6d26c2936b6f759979fa959fdca88e282a7 (diff)
downloadgitlab-ce-b340b59743e8cd47fc1f4fa2020b400d82bfd86e.tar.gz
Implement finally_script which allows to do cleanups as part of the build process
Diffstat (limited to 'lib')
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index b7209c14148..be2462949f1 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -4,12 +4,12 @@ module Ci
DEFAULT_STAGES = %w(build test deploy)
DEFAULT_STAGE = 'test'
- ALLOWED_YAML_KEYS = [:before_script, :image, :services, :types, :stages, :variables, :cache]
+ ALLOWED_YAML_KEYS = [:before_script, :finally_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]
- attr_reader :before_script, :image, :services, :variables, :path, :cache
+ attr_reader :before_script, :finally_script, :image, :services, :variables, :path, :cache
def initialize(config, path = nil)
@config = YAML.safe_load(config, [Symbol], [], true)
@@ -44,6 +44,7 @@ module Ci
def initial_parsing
@before_script = @config[:before_script] || []
+ @finally_script = @config[:finally_script]
@image = @config[:image]
@services = @config[:services]
@stages = @config[:stages] || @config[:types]
@@ -85,6 +86,7 @@ module Ci
artifacts: job[:artifacts],
cache: job[:cache] || @cache,
dependencies: job[:dependencies],
+ finally_script: @finally_script,
}.compact
}
end
@@ -102,6 +104,10 @@ module Ci
raise ValidationError, "before_script should be an array of strings"
end
+ unless @finally_script.nil? || validate_array_of_strings(@finally_script)
+ raise ValidationError, "finally_script should be an array of strings"
+ end
+
unless @image.nil? || @image.is_a?(String)
raise ValidationError, "image should be a string"
end