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
0764add3
Commit
0764add3
authored
May 31, 2019
by
Francisco Javier López
Committed by
Grzegorz Bizon
May 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose services in the web ide terminal entity
parent
ca74ce38
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
0 deletions
+64
-0
ee/app/models/web_ide_terminal.rb
ee/app/models/web_ide_terminal.rb
+4
-0
ee/app/serializers/web_ide_terminal_entity.rb
ee/app/serializers/web_ide_terminal_entity.rb
+1
-0
ee/changelogs/unreleased/fj-11845-expose-web-ide-terminal-services.yml
.../unreleased/fj-11845-expose-web-ide-terminal-services.yml
+5
-0
ee/spec/models/web_ide_terminal_spec.rb
ee/spec/models/web_ide_terminal_spec.rb
+53
-0
ee/spec/serializers/web_ide_terminal_entity_spec.rb
ee/spec/serializers/web_ide_terminal_entity_spec.rb
+1
-0
No files found.
ee/app/models/web_ide_terminal.rb
View file @
0764add3
...
...
@@ -32,6 +32,10 @@ class WebIdeTerminal
proxy_project_job_path
(
project
,
build
,
format: :ws
)
end
def
services
build
.
services
.
map
(
&
:alias
).
compact
+
Array
(
build
.
image
&
.
alias
)
end
private
def
web_ide_terminal_route_generator
(
action
,
options
=
{})
...
...
ee/app/serializers/web_ide_terminal_entity.rb
View file @
0764add3
...
...
@@ -7,5 +7,6 @@ class WebIdeTerminalEntity < Grape::Entity
expose
:cancel_path
expose
:retry_path
expose
:terminal_path
expose
:services
expose
:proxy_websocket_path
,
if:
->
(
_
)
{
Feature
.
enabled?
(
:build_service_proxy
)
}
end
ee/changelogs/unreleased/fj-11845-expose-web-ide-terminal-services.yml
0 → 100644
View file @
0764add3
---
title
:
Expose services in the web ide terminal entity
merge_request
:
13665
author
:
type
:
other
ee/spec/models/web_ide_terminal_spec.rb
View file @
0764add3
...
...
@@ -26,4 +26,57 @@ describe WebIdeTerminal do
it
'returns the proxy_websocket_path of the build'
do
expect
(
subject
.
proxy_websocket_path
).
to
end_with
(
"/jobs/
#{
build
.
id
}
/proxy.ws"
)
end
describe
'services'
do
let
(
:services_with_aliases
)
do
{
services:
[{
name:
'postgres'
,
alias:
'postgres'
},
{
name:
'docker:stable-dind'
,
alias:
'docker'
}]
}
end
before
do
allow
(
build
).
to
receive
(
:options
).
and_return
(
config
)
end
context
'when image does not have an alias'
do
let
(
:config
)
do
{
image:
'ruby:2.1'
}.
merge
(
services_with_aliases
)
end
it
'returns services aliases'
do
expect
(
subject
.
services
).
to
eq
%w(postgres docker)
end
end
context
'when both image and services have aliases'
do
let
(
:config
)
do
{
image:
{
name:
'ruby:2.1'
,
alias:
'ruby'
}
}.
merge
(
services_with_aliases
)
end
it
'returns all aliases'
do
expect
(
subject
.
services
).
to
eq
%w(postgres docker ruby)
end
end
context
'when image and services does not have any alias'
do
let
(
:config
)
do
{
image:
'ruby:2.1'
,
services:
[
'postgres'
]
}
end
it
'returns an empty array'
do
expect
(
subject
.
services
).
to
be_empty
end
end
context
'when no image nor services'
do
let
(
:config
)
do
{
script:
%w(echo)
}
end
it
'returns an empty array'
do
expect
(
subject
.
services
).
to
be_empty
end
end
end
end
ee/spec/serializers/web_ide_terminal_entity_spec.rb
View file @
0764add3
...
...
@@ -14,6 +14,7 @@ describe WebIdeTerminalEntity do
it
{
is_expected
.
to
have_key
(
:cancel_path
)
}
it
{
is_expected
.
to
have_key
(
:retry_path
)
}
it
{
is_expected
.
to
have_key
(
:terminal_path
)
}
it
{
is_expected
.
to
have_key
(
:services
)
}
context
'when feature flag build_service_proxy is enabled'
do
before
do
...
...
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