Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
42102b43
Commit
42102b43
authored
Apr 18, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'after-script' into make-before-after-overridable
parents
38b15e35
63bd1f92
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
29 deletions
+38
-29
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+3
-0
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+33
-27
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+2
-2
No files found.
doc/ci/yaml/README.md
View file @
42102b43
...
@@ -126,6 +126,9 @@ builds, including deploy builds. This can be an array or a multi-line string.
...
@@ -126,6 +126,9 @@ builds, including deploy builds. This can be an array or a multi-line string.
### after_script
### after_script
>**Note:**
Introduced in GitLab 8.7 and GitLab Runner v1.2.
`after_script`
is used to define the command that will be run after for all
`after_script`
is used to define the command that will be run after for all
builds. This has to be an array or a multi-line string.
builds. This has to be an array or a multi-line string.
...
...
lib/ci/gitlab_ci_yaml_processor.rb
View file @
42102b43
...
@@ -92,6 +92,29 @@ module Ci
...
@@ -92,6 +92,29 @@ module Ci
end
end
def
validate!
def
validate!
validate_global!
@jobs
.
each
do
|
name
,
job
|
validate_job!
(
name
,
job
)
end
true
end
def
validate_job!
(
name
,
job
)
validate_job_name!
(
name
)
validate_job_keys!
(
name
,
job
)
validate_job_types!
(
name
,
job
)
validate_job_stage!
(
name
,
job
)
if
job
[
:stage
]
validate_job_cache!
(
name
,
job
)
if
job
[
:cache
]
validate_job_artifacts!
(
name
,
job
)
if
job
[
:artifacts
]
validate_job_dependencies!
(
name
,
job
)
if
job
[
:dependencies
]
end
private
def
validate_global!
unless
validate_array_of_strings
(
@before_script
)
unless
validate_array_of_strings
(
@before_script
)
raise
ValidationError
,
"before_script should be an array of strings"
raise
ValidationError
,
"before_script should be an array of strings"
end
end
...
@@ -116,7 +139,10 @@ module Ci
...
@@ -116,7 +139,10 @@ module Ci
raise
ValidationError
,
"variables should be a map of key-valued strings"
raise
ValidationError
,
"variables should be a map of key-valued strings"
end
end
if
@cache
validate_global_cache!
if
@cache
end
def
validate_global_cache!
if
@cache
[
:key
]
&&
!
validate_string
(
@cache
[
:key
])
if
@cache
[
:key
]
&&
!
validate_string
(
@cache
[
:key
])
raise
ValidationError
,
"cache:key parameter should be a string"
raise
ValidationError
,
"cache:key parameter should be a string"
end
end
...
@@ -130,26 +156,6 @@ module Ci
...
@@ -130,26 +156,6 @@ module Ci
end
end
end
end
@jobs
.
each
do
|
name
,
job
|
validate_job!
(
name
,
job
)
end
true
end
def
validate_job!
(
name
,
job
)
validate_job_name!
(
name
)
validate_job_keys!
(
name
,
job
)
validate_job_types!
(
name
,
job
)
validate_job_stage!
(
name
,
job
)
if
job
[
:stage
]
validate_job_cache!
(
name
,
job
)
if
job
[
:cache
]
validate_job_artifacts!
(
name
,
job
)
if
job
[
:artifacts
]
validate_job_dependencies!
(
name
,
job
)
if
job
[
:dependencies
]
end
private
def
validate_job_name!
(
name
)
def
validate_job_name!
(
name
)
if
name
.
blank?
||
!
validate_string
(
name
)
if
name
.
blank?
||
!
validate_string
(
name
)
raise
ValidationError
,
"job name should be non-empty string"
raise
ValidationError
,
"job name should be non-empty string"
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
42102b43
...
@@ -335,12 +335,12 @@ module Ci
...
@@ -335,12 +335,12 @@ module Ci
describe
"after_script"
do
describe
"after_script"
do
context
"in global context"
do
context
"in global context"
do
let
(
:config
)
{
let
(
:config
)
do
{
{
after_script:
[
"after_script"
],
after_script:
[
"after_script"
],
test:
{
script:
[
"script"
]
}
test:
{
script:
[
"script"
]
}
}
}
}
end
it
"return after_script in options"
do
it
"return after_script in options"
do
expect
(
subject
[
:options
][
:after_script
]).
to
eq
([
"after_script"
])
expect
(
subject
[
:options
][
:after_script
]).
to
eq
([
"after_script"
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment