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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
2ad7753d
Commit
2ad7753d
authored
Sep 16, 2016
by
Grzegorz Bizon
Committed by
Kamil Trzcinski
Sep 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CI job environment configuration attributes
parent
3fbfc30f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
5 deletions
+7
-5
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+1
-1
lib/gitlab/ci/config/node/environment.rb
lib/gitlab/ci/config/node/environment.rb
+2
-2
lib/gitlab/ci/config/node/job.rb
lib/gitlab/ci/config/node/job.rb
+1
-0
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+3
-2
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
2ad7753d
...
@@ -60,7 +60,7 @@ module Ci
...
@@ -60,7 +60,7 @@ module Ci
name:
job
[
:name
].
to_s
,
name:
job
[
:name
].
to_s
,
allow_failure:
job
[
:allow_failure
]
||
false
,
allow_failure:
job
[
:allow_failure
]
||
false
,
when:
job
[
:when
]
||
'on_success'
,
when:
job
[
:when
]
||
'on_success'
,
environment:
job
.
fetch
(
:environment
,
{})[
:
name
],
environment:
job
[
:environment_
name
],
yaml_variables:
yaml_variables
(
name
),
yaml_variables:
yaml_variables
(
name
),
options:
{
options:
{
image:
job
[
:image
],
image:
job
[
:image
],
...
...
lib/gitlab/ci/config/node/environment.rb
View file @
2ad7753d
...
@@ -11,14 +11,14 @@ module Gitlab
...
@@ -11,14 +11,14 @@ module Gitlab
ALLOWED_KEYS
=
%i[name url]
ALLOWED_KEYS
=
%i[name url]
validations
do
validations
do
validates
:name
,
presence:
true
validate
do
validate
do
unless
hash
?
||
string?
unless
hash
?
||
string?
errors
.
add
(:
config
,
'should be a hash or a string'
)
errors
.
add
(:
config
,
'should be a hash or a string'
)
end
end
end
end
validates
:name
,
presence:
true
with_options
if: :hash?
do
with_options
if: :hash?
do
validates
:config
,
allowed_keys:
ALLOWED_KEYS
validates
:config
,
allowed_keys:
ALLOWED_KEYS
...
...
lib/gitlab/ci/config/node/job.rb
View file @
2ad7753d
...
@@ -129,6 +129,7 @@ module Gitlab
...
@@ -129,6 +129,7 @@ module Gitlab
except:
except
,
except:
except
,
variables:
variables_defined?
?
variables
:
nil
,
variables:
variables_defined?
?
variables
:
nil
,
environment:
environment_defined?
?
environment
:
nil
,
environment:
environment_defined?
?
environment
:
nil
,
environment_name:
environment_defined?
?
environment
[
:name
]
:
nil
,
artifacts:
artifacts
,
artifacts:
artifacts
,
after_script:
after_script
}
after_script:
after_script
}
end
end
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
2ad7753d
...
@@ -767,7 +767,7 @@ module Ci
...
@@ -767,7 +767,7 @@ module Ci
it
'does return production and URL'
do
it
'does return production and URL'
do
expect
(
builds
.
size
).
to
eq
(
1
)
expect
(
builds
.
size
).
to
eq
(
1
)
expect
(
builds
.
first
[
:environment
]).
to
eq
(
environment
[
:name
])
expect
(
builds
.
first
[
:environment
]).
to
eq
(
environment
[
:name
])
expect
(
builds
.
first
[
:options
]).
to
include
(
environment
)
expect
(
builds
.
first
[
:options
]).
to
include
(
environment
:
environment
)
end
end
end
end
...
@@ -784,7 +784,8 @@ module Ci
...
@@ -784,7 +784,8 @@ module Ci
let
(
:environment
)
{
1
}
let
(
:environment
)
{
1
}
it
'raises error'
do
it
'raises error'
do
expect
{
builds
}.
to
raise_error
(
"jobs:deploy_to_production environment
#{
Gitlab
::
Regex
.
environment_name_regex_message
}
"
)
expect
{
builds
}.
to
raise_error
(
'jobs:deploy_to_production:environment config should be a hash or a string'
)
end
end
end
end
...
...
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