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
Tatuya Kamada
gitlab-ce
Commits
7dfb204e
Commit
7dfb204e
authored
Sep 20, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose jobs to view
parent
e26953bc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
33 deletions
+28
-33
app/controllers/ci/lints_controller.rb
app/controllers/ci/lints_controller.rb
+1
-0
app/services/ci/create_pipeline_builds_service.rb
app/services/ci/create_pipeline_builds_service.rb
+0
-6
app/views/ci/lints/_create.html.haml
app/views/ci/lints/_create.html.haml
+3
-3
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+1
-3
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+7
-21
spec/views/ci/lints/show.html.haml_spec.rb
spec/views/ci/lints/show.html.haml_spec.rb
+16
-0
No files found.
app/controllers/ci/lints_controller.rb
View file @
7dfb204e
...
@@ -14,6 +14,7 @@ module Ci
...
@@ -14,6 +14,7 @@ module Ci
@config_processor
=
Ci
::
GitlabCiYamlProcessor
.
new
(
@content
)
@config_processor
=
Ci
::
GitlabCiYamlProcessor
.
new
(
@content
)
@stages
=
@config_processor
.
stages
@stages
=
@config_processor
.
stages
@builds
=
@config_processor
.
builds
@builds
=
@config_processor
.
builds
@jobs
=
@config_processor
.
jobs
end
end
rescue
rescue
@error
=
'Undefined error'
@error
=
'Undefined error'
...
...
app/services/ci/create_pipeline_builds_service.rb
View file @
7dfb204e
...
@@ -13,11 +13,6 @@ module Ci
...
@@ -13,11 +13,6 @@ module Ci
private
private
def
create_build
(
build_attributes
)
def
create_build
(
build_attributes
)
build_attributes
=
build_attributes
.
slice
(
:stage_idx
,
:stage
,
:commands
,
:tag_list
,
:name
,
:when
,
:allow_failure
,
:environment
,
:yaml_variables
,
:options
)
build_attributes
=
build_attributes
.
merge
(
build_attributes
=
build_attributes
.
merge
(
pipeline:
pipeline
,
pipeline:
pipeline
,
project:
pipeline
.
project
,
project:
pipeline
.
project
,
...
@@ -26,7 +21,6 @@ module Ci
...
@@ -26,7 +21,6 @@ module Ci
user:
current_user
,
user:
current_user
,
trigger_request:
trigger_request
trigger_request:
trigger_request
)
)
pipeline
.
builds
.
create
(
build_attributes
)
pipeline
.
builds
.
create
(
build_attributes
)
end
end
...
...
app/views/ci/lints/_create.html.haml
View file @
7dfb204e
...
@@ -21,13 +21,13 @@
...
@@ -21,13 +21,13 @@
%br
%br
%b
Tag list:
%b
Tag list:
=
build
[
:tag_list
]
&&
build
[
:tag_list
].
join
(
", "
)
=
build
[
:tag_list
]
&&
build
[
:tag_list
].
to_a
.
join
(
", "
)
%br
%br
%b
Refs only:
%b
Refs only:
=
build
[
:only
]
&&
build
[
:only
]
.
join
(
", "
)
=
@jobs
[
build
[
:name
].
to_sym
][
:only
]
&&
@jobs
[
build
[
:name
].
to_sym
][
:only
].
to_a
.
join
(
", "
)
%br
%br
%b
Refs except:
%b
Refs except:
=
build
[
:except
]
&&
build
[
:except
]
.
join
(
", "
)
=
@jobs
[
build
[
:name
].
to_sym
][
:except
]
&&
@jobs
[
build
[
:name
].
to_sym
][
:except
].
to_a
.
join
(
", "
)
%br
%br
%b
Environment:
%b
Environment:
=
build
[
:environment
]
=
build
[
:environment
]
...
...
lib/ci/gitlab_ci_yaml_processor.rb
View file @
7dfb204e
...
@@ -4,7 +4,7 @@ module Ci
...
@@ -4,7 +4,7 @@ module Ci
include
Gitlab
::
Ci
::
Config
::
Node
::
LegacyValidationHelpers
include
Gitlab
::
Ci
::
Config
::
Node
::
LegacyValidationHelpers
attr_reader
:path
,
:cache
,
:stages
attr_reader
:path
,
:cache
,
:stages
,
:jobs
def
initialize
(
config
,
path
=
nil
)
def
initialize
(
config
,
path
=
nil
)
@ci_config
=
Gitlab
::
Ci
::
Config
.
new
(
config
)
@ci_config
=
Gitlab
::
Ci
::
Config
.
new
(
config
)
...
@@ -59,8 +59,6 @@ module Ci
...
@@ -59,8 +59,6 @@ module Ci
tag_list:
job
[
:tags
]
||
[],
tag_list:
job
[
:tags
]
||
[],
name:
job
[
:name
].
to_s
,
name:
job
[
:name
].
to_s
,
allow_failure:
job
[
:allow_failure
]
||
false
,
allow_failure:
job
[
:allow_failure
]
||
false
,
only:
job
[
:only
],
except:
job
[
:except
],
when:
job
[
:when
]
||
'on_success'
,
when:
job
[
:when
]
||
'on_success'
,
environment:
job
[
:environment_name
],
environment:
job
[
:environment_name
],
yaml_variables:
yaml_variables
(
name
),
yaml_variables:
yaml_variables
(
name
),
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
7dfb204e
...
@@ -26,9 +26,7 @@ module Ci
...
@@ -26,9 +26,7 @@ module Ci
allow_failure:
false
,
allow_failure:
false
,
when:
"on_success"
,
when:
"on_success"
,
environment:
nil
,
environment:
nil
,
yaml_variables:
[],
yaml_variables:
[]
only:
nil
,
except:
nil
})
})
end
end
...
@@ -445,9 +443,7 @@ module Ci
...
@@ -445,9 +443,7 @@ module Ci
allow_failure:
false
,
allow_failure:
false
,
when:
"on_success"
,
when:
"on_success"
,
environment:
nil
,
environment:
nil
,
yaml_variables:
[],
yaml_variables:
[]
only:
nil
,
except:
nil
})
})
end
end
...
@@ -475,9 +471,7 @@ module Ci
...
@@ -475,9 +471,7 @@ module Ci
allow_failure:
false
,
allow_failure:
false
,
when:
"on_success"
,
when:
"on_success"
,
environment:
nil
,
environment:
nil
,
yaml_variables:
[],
yaml_variables:
[]
only:
nil
,
except:
nil
})
})
end
end
end
end
...
@@ -722,9 +716,7 @@ module Ci
...
@@ -722,9 +716,7 @@ module Ci
when:
"on_success"
,
when:
"on_success"
,
allow_failure:
false
,
allow_failure:
false
,
environment:
nil
,
environment:
nil
,
yaml_variables:
[],
yaml_variables:
[]
only:
nil
,
except:
nil
})
})
end
end
...
@@ -867,9 +859,7 @@ module Ci
...
@@ -867,9 +859,7 @@ module Ci
when:
"on_success"
,
when:
"on_success"
,
allow_failure:
false
,
allow_failure:
false
,
environment:
nil
,
environment:
nil
,
yaml_variables:
[],
yaml_variables:
[]
only:
nil
,
except:
nil
})
})
end
end
end
end
...
@@ -914,9 +904,7 @@ module Ci
...
@@ -914,9 +904,7 @@ module Ci
when:
"on_success"
,
when:
"on_success"
,
allow_failure:
false
,
allow_failure:
false
,
environment:
nil
,
environment:
nil
,
yaml_variables:
[],
yaml_variables:
[]
only:
nil
,
except:
nil
})
})
expect
(
subject
.
second
).
to
eq
({
expect
(
subject
.
second
).
to
eq
({
stage:
"build"
,
stage:
"build"
,
...
@@ -928,9 +916,7 @@ module Ci
...
@@ -928,9 +916,7 @@ module Ci
when:
"on_success"
,
when:
"on_success"
,
allow_failure:
false
,
allow_failure:
false
,
environment:
nil
,
environment:
nil
,
yaml_variables:
[],
yaml_variables:
[]
only:
nil
,
except:
nil
})
})
end
end
end
end
...
...
spec/views/ci/lints/show.html.haml_spec.rb
View file @
7dfb204e
...
@@ -20,6 +20,7 @@ describe 'ci/lints/show' do
...
@@ -20,6 +20,7 @@ describe 'ci/lints/show' do
assign
(
:status
,
true
)
assign
(
:status
,
true
)
assign
(
:builds
,
config_processor
.
builds
)
assign
(
:builds
,
config_processor
.
builds
)
assign
(
:stages
,
config_processor
.
stages
)
assign
(
:stages
,
config_processor
.
stages
)
assign
(
:jobs
,
config_processor
.
jobs
)
end
end
it
'shows the correct values'
do
it
'shows the correct values'
do
...
@@ -32,4 +33,19 @@ describe 'ci/lints/show' do
...
@@ -32,4 +33,19 @@ describe 'ci/lints/show' do
expect
(
rendered
).
to
have_content
(
'When: on_success'
)
expect
(
rendered
).
to
have_content
(
'When: on_success'
)
end
end
end
end
context
'when the content is invalid'
do
before
do
assign
(
:status
,
false
)
assign
(
:error
,
'Undefined error'
)
end
it
'shows error message'
do
render
expect
(
rendered
).
to
have_content
(
'Status: syntax is incorrec'
)
expect
(
rendered
).
to
have_content
(
'Error: Undefined error'
)
expect
(
rendered
).
not_to
have_content
(
'Tag list:'
)
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