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
3df912ce
Commit
3df912ce
authored
Oct 21, 2019
by
allison.browne
Browse files
Options
Browse Files
Download
Plain Diff
Fix merge conflicts
parents
c77bb71c
fc967011
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
19 deletions
+78
-19
app/helpers/environments_helper.rb
app/helpers/environments_helper.rb
+1
-0
app/models/environment.rb
app/models/environment.rb
+4
-0
app/services/issues/zoom_link_service.rb
app/services/issues/zoom_link_service.rb
+1
-3
changelogs/unreleased/show-prometheus-is-updating.yml
changelogs/unreleased/show-prometheus-is-updating.yml
+5
-0
db/schema.rb
db/schema.rb
+10
-10
spec/helpers/environments_helper_spec.rb
spec/helpers/environments_helper_spec.rb
+1
-0
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+45
-0
spec/services/issues/zoom_link_service_spec.rb
spec/services/issues/zoom_link_service_spec.rb
+11
-6
No files found.
app/helpers/environments_helper.rb
View file @
3df912ce
...
...
@@ -34,6 +34,7 @@ module EnvironmentsHelper
"project-path"
=>
project_path
(
project
),
"tags-path"
=>
project_tags_path
(
project
),
"has-metrics"
=>
"
#{
environment
.
has_metrics?
}
"
,
"prometheus-status"
=>
"
#{
environment
.
prometheus_status
}
"
,
"external-dashboard-url"
=>
project
.
metrics_setting_external_dashboard_url
}
end
...
...
app/models/environment.rb
View file @
3df912ce
...
...
@@ -188,6 +188,10 @@ class Environment < ApplicationRecord
prometheus_adapter
.
query
(
:environment
,
self
)
if
has_metrics?
end
def
prometheus_status
deployment_platform
&
.
cluster
&
.
application_prometheus
&
.
status_name
end
def
additional_metrics
(
*
args
)
return
unless
has_metrics?
...
...
app/services/issues/zoom_link_service.rb
View file @
3df912ce
...
...
@@ -11,7 +11,7 @@ module Issues
def
add_link
(
link
)
if
can_add_link?
&&
(
link
=
parse_link
(
link
))
success
(
_
(
'Zoom meeting added'
),
create
_zoom_meeting
(
link
))
success
(
_
(
'Zoom meeting added'
),
add
_zoom_meeting
(
link
))
else
error
(
_
(
'Failed to add a Zoom meeting'
))
end
...
...
@@ -43,8 +43,6 @@ module Issues
def
fetch_added_meeting
ZoomMeeting
.
canonical_meeting
(
@issue
)
def
issue_description
issue
.
description
||
''
end
def
track_meeting_added_event
...
...
changelogs/unreleased/show-prometheus-is-updating.yml
0 → 100644
View file @
3df912ce
---
title
:
Expose prometheus status to monitor dashboard
merge_request
:
18289
author
:
type
:
fixed
db/schema.rb
View file @
3df912ce
...
...
@@ -3834,24 +3834,24 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do
t
.
bigint
"author_id"
,
null:
false
t
.
bigint
"updated_by_id"
t
.
bigint
"last_edited_by_id"
t
.
date
"start_date"
t
.
date
"due_date"
t
.
datetime_with_timezone
"last_edited_at"
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
string
"title"
,
limit:
255
,
null:
false
t
.
text
"title_html"
,
null:
false
t
.
text
"description"
t
.
text
"description_html"
t
.
bigint
"start_date_sourcing_milestone_id"
t
.
bigint
"due_date_sourcing_milestone_id"
t
.
bigint
"closed_by_id"
t
.
datetime_with_timezone
"last_edited_at"
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
datetime_with_timezone
"closed_at"
t
.
date
"start_date"
t
.
date
"due_date"
t
.
integer
"state"
,
limit:
2
,
default:
1
,
null:
false
t
.
integer
"severity"
,
limit:
2
,
null:
false
t
.
boolean
"severity_overridden"
,
default:
false
t
.
integer
"confidence"
,
limit:
2
,
null:
false
t
.
boolean
"severity_overridden"
,
default:
false
t
.
boolean
"confidence_overridden"
,
default:
false
t
.
string
"title"
,
limit:
255
,
null:
false
t
.
text
"title_html"
,
null:
false
t
.
text
"description"
t
.
text
"description_html"
t
.
index
[
"author_id"
],
name:
"index_vulnerabilities_on_author_id"
t
.
index
[
"closed_by_id"
],
name:
"index_vulnerabilities_on_closed_by_id"
t
.
index
[
"due_date_sourcing_milestone_id"
],
name:
"index_vulnerabilities_on_due_date_sourcing_milestone_id"
...
...
spec/helpers/environments_helper_spec.rb
View file @
3df912ce
...
...
@@ -32,6 +32,7 @@ describe EnvironmentsHelper do
'project-path'
=>
project_path
(
project
),
'tags-path'
=>
project_tags_path
(
project
),
'has-metrics'
=>
"
#{
environment
.
has_metrics?
}
"
,
'prometheus-status'
=>
"
#{
environment
.
prometheus_status
}
"
,
'external-dashboard-url'
=>
nil
)
end
...
...
spec/models/environment_spec.rb
View file @
3df912ce
...
...
@@ -727,6 +727,51 @@ describe Environment, :use_clean_rails_memory_store_caching do
end
end
describe
'#prometheus_status'
do
context
'when a cluster is present'
do
context
'when a deployment platform is present'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_user
,
:project
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
cluster
.
project
)
}
subject
{
environment
.
prometheus_status
}
context
'when the prometheus application status is :updating'
do
let!
(
:prometheus
)
{
create
(
:clusters_applications_prometheus
,
:updating
,
cluster:
cluster
)
}
it
{
is_expected
.
to
eq
(
:updating
)
}
end
context
'when the prometheus application state is :updated'
do
let!
(
:prometheus
)
{
create
(
:clusters_applications_prometheus
,
:updated
,
cluster:
cluster
)
}
it
{
is_expected
.
to
eq
(
:updated
)
}
end
context
'when the prometheus application is not installed'
do
it
{
is_expected
.
to
be_nil
}
end
end
context
'when a deployment platform is not present'
do
let
(
:cluster
)
{
create
(
:cluster
,
:project
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
cluster
.
project
)
}
subject
{
environment
.
prometheus_status
}
it
{
is_expected
.
to
be_nil
}
end
end
context
'when a cluster is not present'
do
let
(
:project
)
{
create
(
:project
,
:stubbed_repository
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
subject
{
environment
.
prometheus_status
}
it
{
is_expected
.
to
be_nil
}
end
end
describe
'#additional_metrics'
do
let
(
:project
)
{
create
(
:prometheus_project
)
}
let
(
:metric_params
)
{
[]
}
...
...
spec/services/issues/zoom_link_service_spec.rb
View file @
3df912ce
...
...
@@ -35,7 +35,7 @@ describe Issues::ZoomLinkService do
describe
'#add_link'
do
shared_examples
'can add meeting'
do
it
'appends the link
to issue description
'
do
it
'appends the link
zoom_meetings
'
do
expect
(
result
).
to
be_success
expect
(
result
.
payload
[
:zoom_meetings
].
map
(
&
:url
))
.
to
include
(
zoom_link
)
...
...
@@ -46,6 +46,12 @@ describe Issues::ZoomLinkService do
.
with
(
'IncidentManagement::ZoomIntegration'
,
'add_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
end
it
'tracks the add event'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
.
with
(
'IncidentManagement::ZoomIntegration'
,
'add_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
end
end
shared_examples
'cannot add meeting'
do
...
...
@@ -122,13 +128,12 @@ describe Issues::ZoomLinkService do
context
'removes the link'
do
include_examples
'can remove meeting'
end
it
'tracks the remove event'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
it
'tracks the remove event'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
.
with
(
'IncidentManagement::ZoomIntegration'
,
'remove_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
result
end
end
context
'with insufficient permissions'
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