Commit 90859e80 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 7530cf5a
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33" image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33"
stages: stages:
- sync - sync
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
- .default-before_script - .default-before_script
- .assets-compile-cache - .assets-compile-cache
- .only:changes-code-backstage-qa - .only:changes-code-backstage-qa
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1 image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1
stage: test stage: test
dependencies: ["setup-test-env"] dependencies: ["setup-test-env"]
needs: ["setup-test-env"] needs: ["setup-test-env"]
......
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
- name: redis:alpine - name: redis:alpine
.use-pg10: .use-pg10:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33" image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33"
services: services:
- name: postgres:10.9 - name: postgres:10.9
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
- name: docker.elastic.co/elasticsearch/elasticsearch:5.6.12 - name: docker.elastic.co/elasticsearch/elasticsearch:5.6.12
.use-pg10-ee: .use-pg10-ee:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33" image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33"
services: services:
- name: postgres:10.9 - name: postgres:10.9
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
......
...@@ -232,9 +232,3 @@ dast: ...@@ -232,9 +232,3 @@ dast:
- gl-dast-report.json - gl-dast-report.json
reports: reports:
dast: gl-dast-report.json dast: gl-dast-report.json
only:
variables:
- $GITLAB_FEATURES =~ /\bdast\b/
except:
variables:
- $DAST_DISABLED
...@@ -828,6 +828,13 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -828,6 +828,13 @@ Please view this file on the master branch, on stable branches it's out of date.
- Don't send CI usage email notifications for self-hosted instances. !14809 - Don't send CI usage email notifications for self-hosted instances. !14809
## 12.0.10
### Fixed (1 change)
- Backport the new reliable fetcher to 12.0.9. !20532
## 12.0.7 ## 12.0.7
### Security (3 changes) ### Security (3 changes)
......
...@@ -8,6 +8,7 @@ entry. ...@@ -8,6 +8,7 @@ entry.
- Update maven_file_name_regex for full string match. - Update maven_file_name_regex for full string match.
## 12.5.3 ## 12.5.3
### Fixed (4 changes) ### Fixed (4 changes)
...@@ -768,6 +769,7 @@ entry. ...@@ -768,6 +769,7 @@ entry.
- Update maven_file_name_regex for full string match. - Update maven_file_name_regex for full string match.
## 12.3.7 ## 12.3.7
### Security (12 changes) ### Security (12 changes)
...@@ -1091,10 +1093,6 @@ entry. ...@@ -1091,10 +1093,6 @@ entry.
- Updates tooltip of 'detached' label/state. - Updates tooltip of 'detached' label/state.
## 12.2.10
- No changes.
## 12.2.8 ## 12.2.8
### Security (1 change) ### Security (1 change)
......
...@@ -242,7 +242,7 @@ gem 'slack-notifier', '~> 1.5.1' ...@@ -242,7 +242,7 @@ gem 'slack-notifier', '~> 1.5.1'
gem 'hangouts-chat', '~> 0.0.5' gem 'hangouts-chat', '~> 0.0.5'
# Asana integration # Asana integration
gem 'asana', '~> 0.8.1' gem 'asana', '~> 0.9'
# FogBugz integration # FogBugz integration
gem 'ruby-fogbugz', '~> 0.2.1' gem 'ruby-fogbugz', '~> 0.2.1'
......
...@@ -63,11 +63,11 @@ GEM ...@@ -63,11 +63,11 @@ GEM
graphql (>= 1.8) graphql (>= 1.8)
rails (>= 4.2) rails (>= 4.2)
arel (9.0.0) arel (9.0.0)
asana (0.8.1) asana (0.9.3)
faraday (~> 0.9) faraday (~> 0.9)
faraday_middleware (~> 0.9) faraday_middleware (~> 0.9)
faraday_middleware-multi_json (~> 0.0) faraday_middleware-multi_json (~> 0.0)
oauth2 (~> 1.0) oauth2 (~> 1.4)
asciidoctor (2.0.10) asciidoctor (2.0.10)
asciidoctor-include-ext (0.3.1) asciidoctor-include-ext (0.3.1)
asciidoctor (>= 1.5.6, < 3.0.0) asciidoctor (>= 1.5.6, < 3.0.0)
...@@ -1119,7 +1119,7 @@ DEPENDENCIES ...@@ -1119,7 +1119,7 @@ DEPENDENCIES
addressable (~> 2.5.2) addressable (~> 2.5.2)
akismet (~> 2.0) akismet (~> 2.0)
apollo_upload_server (~> 2.0.0.beta3) apollo_upload_server (~> 2.0.0.beta3)
asana (~> 0.8.1) asana (~> 0.9)
asciidoctor (~> 2.0.10) asciidoctor (~> 2.0.10)
asciidoctor-include-ext (~> 0.3.1) asciidoctor-include-ext (~> 0.3.1)
asciidoctor-plantuml (= 0.0.9) asciidoctor-plantuml (= 0.0.9)
......
...@@ -43,7 +43,7 @@ const Api = { ...@@ -43,7 +43,7 @@ const Api = {
releasesPath: '/api/:version/projects/:id/releases', releasesPath: '/api/:version/projects/:id/releases',
releasePath: '/api/:version/projects/:id/releases/:tag_name', releasePath: '/api/:version/projects/:id/releases/:tag_name',
mergeRequestsPipeline: '/api/:version/projects/:id/merge_requests/:merge_request_iid/pipelines', mergeRequestsPipeline: '/api/:version/projects/:id/merge_requests/:merge_request_iid/pipelines',
adminStatisticsPath: 'api/:version/application/statistics', adminStatisticsPath: '/api/:version/application/statistics',
group(groupId, callback) { group(groupId, callback) {
const url = Api.buildUrl(Api.groupPath).replace(':id', groupId); const url = Api.buildUrl(Api.groupPath).replace(':id', groupId);
......
...@@ -44,12 +44,14 @@ export default { ...@@ -44,12 +44,14 @@ export default {
'Serverless|Your repository does not have a corresponding %{startTag}serverless.yml%{endTag} file.', 'Serverless|Your repository does not have a corresponding %{startTag}serverless.yml%{endTag} file.',
), ),
{ startTag: '<code>', endTag: '</code>' }, { startTag: '<code>', endTag: '</code>' },
false,
); );
}, },
noGitlabYamlConfigured() { noGitlabYamlConfigured() {
return sprintf( return sprintf(
s__('Serverless|Your %{startTag}.gitlab-ci.yml%{endTag} file is not properly configured.'), s__('Serverless|Your %{startTag}.gitlab-ci.yml%{endTag} file is not properly configured.'),
{ startTag: '<code>', endTag: '</code>' }, { startTag: '<code>', endTag: '</code>' },
false,
); );
}, },
mismatchedServerlessFunctions() { mismatchedServerlessFunctions() {
...@@ -58,6 +60,7 @@ export default { ...@@ -58,6 +60,7 @@ export default {
"Serverless|The functions listed in the %{startTag}serverless.yml%{endTag} file don't match the namespace of your cluster.", "Serverless|The functions listed in the %{startTag}serverless.yml%{endTag} file don't match the namespace of your cluster.",
), ),
{ startTag: '<code>', endTag: '</code>' }, { startTag: '<code>', endTag: '</code>' },
false,
); );
}, },
}, },
...@@ -111,15 +114,9 @@ export default { ...@@ -111,15 +114,9 @@ export default {
}} }}
</p> </p>
<ul> <ul>
<li> <li v-html="noServerlessConfigFile"></li>
{{ noServerlessConfigFile }} <li v-html="noGitlabYamlConfigured"></li>
</li> <li v-html="mismatchedServerlessFunctions"></li>
<li>
{{ noGitlabYamlConfigured }}
</li>
<li>
{{ mismatchedServerlessFunctions }}
</li>
<li>{{ s__('Serverless|The deploy job has not finished.') }}</li> <li>{{ s__('Serverless|The deploy job has not finished.') }}</li>
</ul> </ul>
......
...@@ -32,14 +32,13 @@ export default { ...@@ -32,14 +32,13 @@ export default {
}; };
</script> </script>
<template> <template>
<div class="title hide-collapsed" data-qa-selector="assignee_title"> <div class="title hide-collapsed">
{{ assigneeTitle }} {{ assigneeTitle }}
<i v-if="loading" aria-hidden="true" class="fa fa-spinner fa-spin block-loading"></i> <i v-if="loading" aria-hidden="true" class="fa fa-spinner fa-spin block-loading"></i>
<a <a
v-if="editable" v-if="editable"
class="js-sidebar-dropdown-toggle edit-link float-right" class="js-sidebar-dropdown-toggle edit-link float-right"
href="#" href="#"
data-qa-selector="assignee_edit_link"
data-track-event="click_edit_button" data-track-event="click_edit_button"
data-track-label="right_sidebar" data-track-label="right_sidebar"
data-track-property="assignee" data-track-property="assignee"
......
...@@ -81,12 +81,12 @@ http://app.asana.com/-/account_api' ...@@ -81,12 +81,12 @@ http://app.asana.com/-/account_api'
def check_commit(message, push_msg) def check_commit(message, push_msg)
# matches either: # matches either:
# - #1234 # - #1234
# - https://app.asana.com/0/0/1234 # - https://app.asana.com/0/{project_gid}/{task_gid}
# optionally preceded with: # optionally preceded with:
# - fix/ed/es/ing # - fix/ed/es/ing
# - close/s/d # - close/s/d
# - closing # - closing
issue_finder = %r{(fix\w*|clos[ei]\w*+)?\W*(?:https://app\.asana\.com/\d+/\d+/(\d+)|#(\d+))}i issue_finder = %r{(fix\w*|clos[ei]\w*+)?\W*(?:https://app\.asana\.com/\d+/\w+/(\w+)|#(\w+))}i
message.scan(issue_finder).each do |tuple| message.scan(issue_finder).each do |tuple|
# tuple will be # tuple will be
...@@ -94,7 +94,7 @@ http://app.asana.com/-/account_api' ...@@ -94,7 +94,7 @@ http://app.asana.com/-/account_api'
taskid = tuple[2] || tuple[1] taskid = tuple[2] || tuple[1]
begin begin
task = Asana::Task.find_by_id(client, taskid) task = Asana::Resources::Task.find_by_id(client, taskid)
task.add_comment(text: "#{push_msg} #{message}") task.add_comment(text: "#{push_msg} #{message}")
if tuple[0] if tuple[0]
......
...@@ -13,30 +13,29 @@ module Issues ...@@ -13,30 +13,29 @@ module Issues
if can_add_link? && (link = parse_link(link)) if can_add_link? && (link = parse_link(link))
begin begin
add_zoom_meeting(link) add_zoom_meeting(link)
success(_('Zoom meeting added'))
rescue ActiveRecord::RecordNotUnique rescue ActiveRecord::RecordNotUnique
error(_('Failed to add a Zoom meeting')) error(message: _('Failed to add a Zoom meeting'))
end end
else else
error(_('Failed to add a Zoom meeting')) error(message: _('Failed to add a Zoom meeting'))
end end
end end
def remove_link def remove_link
if can_remove_link? if can_remove_link?
remove_zoom_meeting remove_zoom_meeting
success(_('Zoom meeting removed')) success(message: _('Zoom meeting removed'))
else else
error(_('Failed to remove a Zoom meeting')) error(message: _('Failed to remove a Zoom meeting'))
end end
end end
def can_add_link? def can_add_link?
can_update_issue? && !@added_meeting can_change_link? && !@added_meeting
end end
def can_remove_link? def can_remove_link?
can_update_issue? && !!@added_meeting can_change_link? && @issue.persisted? && !!@added_meeting
end end
def parse_link(link) def parse_link(link)
...@@ -56,14 +55,29 @@ module Issues ...@@ -56,14 +55,29 @@ module Issues
end end
def add_zoom_meeting(link) def add_zoom_meeting(link)
ZoomMeeting.create( zoom_meeting = new_zoom_meeting(link)
response =
if @issue.persisted?
# Save the meeting directly since we only want to update one meeting, not all
zoom_meeting.save
success(message: _('Zoom meeting added'))
else
success(message: _('Zoom meeting added'), payload: { zoom_meetings: [zoom_meeting] })
end
track_meeting_added_event
SystemNoteService.zoom_link_added(@issue, @project, current_user)
response
end
def new_zoom_meeting(link)
ZoomMeeting.new(
issue: @issue, issue: @issue,
project: @issue.project, project: @project,
issue_status: :added, issue_status: :added,
url: link url: link
) )
track_meeting_added_event
SystemNoteService.zoom_link_added(@issue, @project, current_user)
end end
def remove_zoom_meeting def remove_zoom_meeting
...@@ -72,16 +86,20 @@ module Issues ...@@ -72,16 +86,20 @@ module Issues
SystemNoteService.zoom_link_removed(@issue, @project, current_user) SystemNoteService.zoom_link_removed(@issue, @project, current_user)
end end
def success(message) def success(message:, payload: nil)
ServiceResponse.success(message: message) ServiceResponse.success(message: message, payload: payload)
end end
def error(message) def error(message:)
ServiceResponse.error(message: message) ServiceResponse.error(message: message)
end end
def can_update_issue? def can_change_link?
can?(current_user, :update_issue, project) if @issue.persisted?
can?(current_user, :update_issue, @project)
else
can?(current_user, :create_issue, @project)
end
end end
end end
end end
---
title: Collect the date a SaaS trial starts on
merge_request: 20384
author:
type: added
---
title: Fix Zoom Quick Action server error when creating a GitLab Issue
merge_request: 21262
author:
type: fixed
---
title: Change Puma log format to JSON
merge_request: 21101
author:
type: other
---
title: Fix Asana integration
merge_request: 21501
author:
type: fixed
# frozen_string_literal: true
# Gitlab.com uses Snowplow for identifying users and events.
# https://gitlab.com/gitlab-org/gitlab/issues/6329
#
# SnowplowTracker write log into STDERR
# https://github.com/snowplow/snowplow-ruby-tracker/blob/39fcfa2be793f2e25e73087a9700abc93f43b5e8/lib/snowplow-tracker/emitters.rb#L23
# `LOGGER = Logger.new(STDERR)`
#
# In puma.rb, if `stdout_redirect` specify stderr, Puma will overwrite STDERR in:
# https://github.com/puma/puma/blob/b41205f5cacbc2ad0060472bdce68ba636f42175/lib/puma/runner.rb#L134
# `STDERR.reopen stderr, (append ? "a" : "w")`
# As a result, SnowplowTracker will log into Puma stderr, when Puma enabled.
#
# By default, SnowplowTracker uses default log formatter.
# When enable Puma, SnowplowTracker log is expected to be JSON format, as part of puma_stderr.log.
# Hence overwrite ::SnowplowTracker::LOGGER.formatter to JSON formatter
if defined?(::Puma) && defined?(::SnowplowTracker::LOGGER)
::SnowplowTracker::LOGGER.formatter = proc do |severity, datetime, progname, msg|
{ severity: severity, timestamp: datetime.utc.iso8601(3), pid: $$, progname: progname, message: msg }.to_json << "\n"
end
end
...@@ -78,3 +78,11 @@ tag 'gitlab-puma-worker' ...@@ -78,3 +78,11 @@ tag 'gitlab-puma-worker'
# value is 60 seconds. # value is 60 seconds.
# #
worker_timeout 60 worker_timeout 60
# Use json formatter
require_relative "/home/git/gitlab/lib/gitlab/puma_logging/json_formatter"
json_formatter = Gitlab::PumaLogging::JSONFormatter.new
log_formatter do |str|
json_formatter.call(str)
end
...@@ -68,3 +68,11 @@ tag 'gitlab-puma-worker' ...@@ -68,3 +68,11 @@ tag 'gitlab-puma-worker'
# value is 60 seconds. # value is 60 seconds.
# #
worker_timeout 60 worker_timeout 60
# Use json formatter
require_relative "/home/git/gitlab/lib/gitlab/puma_logging/json_formatter"
json_formatter = Gitlab::PumaLogging::JSONFormatter.new
log_formatter do |str|
json_formatter.call(str)
end
\ No newline at end of file
# frozen_string_literal: true
class AddTrialStartsOnToGitlabSubscriptions < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
add_column :gitlab_subscriptions, :trial_starts_on, :date, null: true
add_column :gitlab_subscription_histories, :trial_starts_on, :date, null: true
end
end
...@@ -1882,6 +1882,7 @@ ActiveRecord::Schema.define(version: 2019_12_08_071112) do ...@@ -1882,6 +1882,7 @@ ActiveRecord::Schema.define(version: 2019_12_08_071112) do
t.integer "change_type", limit: 2 t.integer "change_type", limit: 2
t.bigint "gitlab_subscription_id", null: false t.bigint "gitlab_subscription_id", null: false
t.datetime_with_timezone "created_at" t.datetime_with_timezone "created_at"
t.date "trial_starts_on"
t.index ["gitlab_subscription_id"], name: "index_gitlab_subscription_histories_on_gitlab_subscription_id" t.index ["gitlab_subscription_id"], name: "index_gitlab_subscription_histories_on_gitlab_subscription_id"
end end
...@@ -1896,6 +1897,7 @@ ActiveRecord::Schema.define(version: 2019_12_08_071112) do ...@@ -1896,6 +1897,7 @@ ActiveRecord::Schema.define(version: 2019_12_08_071112) do
t.integer "max_seats_used", default: 0 t.integer "max_seats_used", default: 0
t.integer "seats", default: 0 t.integer "seats", default: 0
t.boolean "trial", default: false t.boolean "trial", default: false
t.date "trial_starts_on"
t.index ["hosted_plan_id"], name: "index_gitlab_subscriptions_on_hosted_plan_id" t.index ["hosted_plan_id"], name: "index_gitlab_subscriptions_on_hosted_plan_id"
t.index ["namespace_id"], name: "index_gitlab_subscriptions_on_namespace_id", unique: true t.index ["namespace_id"], name: "index_gitlab_subscriptions_on_namespace_id", unique: true
end end
......
...@@ -393,6 +393,23 @@ It is stored at: ...@@ -393,6 +393,23 @@ It is stored at:
- `/var/log/gitlab/gitlab-rails/database_load_balancing.log` for Omnibus GitLab packages. - `/var/log/gitlab/gitlab-rails/database_load_balancing.log` for Omnibus GitLab packages.
- `/home/git/gitlab/log/database_load_balancing.log` for installations from source. - `/home/git/gitlab/log/database_load_balancing.log` for installations from source.
## `elasticsearch.log`
Introduced in GitLab 12.6. This file lives in
`/var/log/gitlab/gitlab-rails/elasticsearch.log` for Omnibus GitLab
packages or in `/home/git/gitlab/log/elasticsearch.log` for installations
from source.
It logs information related to the Elasticsearch Integration including
errors during indexing or searching Elasticsearch.
Each line contains a JSON line that can be ingested by Elasticsearch, Splunk,
etc. For example:
```json
{"severity":"DEBUG","time":"2019-10-17T06:23:13.227Z","correlation_id":null,"message":"redacted_search_result","class_name":"Milestone","id":2,"ability":"read_milestone","current_user_id":2,"query":"project"}
```
[repocheck]: repository_checks.md [repocheck]: repository_checks.md
[Rack Attack]: ../security/rack_attack.md [Rack Attack]: ../security/rack_attack.md
[Rate Limit]: ../user/admin_area/settings/rate_limits_on_raw_endpoints.md [Rate Limit]: ../user/admin_area/settings/rate_limits_on_raw_endpoints.md
......
...@@ -42,9 +42,9 @@ The current stages are: ...@@ -42,9 +42,9 @@ The current stages are:
## Default image ## Default image
The default image is currently The default image is currently
`registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33`. `registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33`.
It includes Ruby 2.6.3, Go 1.12, Git 2.22, Chrome 73, Node 12, Yarn 1.16, It includes Ruby 2.6.3, Go 1.12, Git 2.24, Git LFS 2.9, Chrome 73, Node 12, Yarn 1.16,
PostgreSQL 9.6, and Graphics Magick 1.3.33. PostgreSQL 9.6, and Graphics Magick 1.3.33.
The images used in our pipelines are configured in the The images used in our pipelines are configured in the
......
...@@ -134,7 +134,7 @@ Make sure you have the right version of Git installed: ...@@ -134,7 +134,7 @@ Make sure you have the right version of Git installed:
# Install Git # Install Git
sudo apt-get install -y git-core sudo apt-get install -y git-core
# Make sure Git is version 2.22.0 or higher # Make sure Git is version 2.24.1 or higher (minimal supported version is 2.22.0)
git --version git --version
``` ```
...@@ -171,9 +171,9 @@ sudo make install ...@@ -171,9 +171,9 @@ sudo make install
# Download and compile from source # Download and compile from source
cd /tmp cd /tmp
curl --remote-name --location --progress https://www.kernel.org/pub/software/scm/git/git-2.22.0.tar.gz curl --remote-name --location --progress https://www.kernel.org/pub/software/scm/git/git-2.24.1.tar.gz
echo 'a4b7e4365bee43caa12a38d646d2c93743d755d1cea5eab448ffb40906c9da0b git-2.22.0.tar.gz' | shasum -a256 -c - && tar -xzf git-2.22.0.tar.gz echo 'ad5334956301c86841eb1e5b1bb20884a6bad89a10a6762c958220c7cf64da02 git-2.24.1.tar.gz' | shasum -a256 -c - && tar -xzf git-2.24.1.tar.gz
cd git-2.22.0/ cd git-2.24.1/
./configure --with-libpcre ./configure --with-libpcre
make prefix=/usr/local all make prefix=/usr/local all
......
# frozen_string_literal: true
module Gitlab
module Elasticsearch
class Logger < ::Gitlab::JsonLogger
def self.file_name_noext
'elasticsearch'
end
end
end
end
# frozen_string_literal: true
require 'json'
module Gitlab
module PumaLogging
class JSONFormatter
def call(str)
{ timestamp: Time.now.utc.iso8601(3), pid: $$, message: str }.to_json
end
end
end
end
...@@ -183,6 +183,7 @@ module Gitlab ...@@ -183,6 +183,7 @@ module Gitlab
command :zoom do |link| command :zoom do |link|
result = @zoom_service.add_link(link) result = @zoom_service.add_link(link)
@execution_message[:zoom] = result.message @execution_message[:zoom] = result.message
@updates.merge!(result.payload) if result.payload
end end
desc _('Remove Zoom meeting') desc _('Remove Zoom meeting')
......
...@@ -26,11 +26,6 @@ module QA ...@@ -26,11 +26,6 @@ module QA
element :avatar_image element :avatar_image
end end
view 'app/assets/javascripts/sidebar/components/assignees/assignee_title.vue' do
element :assignee_edit_link
element :assignee_title
end
view 'app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue' do view 'app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue' do
element :more_assignees_link element :more_assignees_link
end end
...@@ -61,16 +56,6 @@ module QA ...@@ -61,16 +56,6 @@ module QA
element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern
end end
def assign(user)
click_element(:assignee_edit_link)
select_user(user.username)
click_body
end
def assignee_title
find_element(:assignee_title)
end
def avatar_image_count def avatar_image_count
wait_assignees_block_finish_loading do wait_assignees_block_finish_loading do
all_elements(:avatar_image).count all_elements(:avatar_image).count
...@@ -168,19 +153,6 @@ module QA ...@@ -168,19 +153,6 @@ module QA
end end
end end
def select_user(username)
find("#{element_selector_css(:assignee_block)} input").set(username)
dropdown_menu_user_link_selector = '.dropdown-menu-user-link'
at_username = "@#{username}"
ten_seconds = 10
wait(reload: false, max: ten_seconds, interval: 1) do
has_css?(dropdown_menu_user_link_selector, wait: ten_seconds, text: at_username)
end
find(dropdown_menu_user_link_selector, text: at_username).click
end
def wait_assignees_block_finish_loading def wait_assignees_block_finish_loading
within_element(:assignee_block) do within_element(:assignee_block) do
wait(reload: false, max: 10, interval: 1) do wait(reload: false, max: 10, interval: 1) do
......
...@@ -34,7 +34,7 @@ export const utilsMockData = [ ...@@ -34,7 +34,7 @@ export const utilsMockData = [
content: [ content: [
{ {
text: text:
'Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33', 'Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33',
}, },
], ],
section: 'prepare-executor', section: 'prepare-executor',
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::PumaLogging::JSONFormatter do
it "generate json format with timestamp and pid" do
Timecop.freeze( Time.utc(2019, 12, 04, 9, 10, 11, 123456)) do
expect(subject.call('log message')).to eq "{\"timestamp\":\"2019-12-04T09:10:11.123Z\",\"pid\":#{Process.pid},\"message\":\"log message\"}"
end
end
end
...@@ -21,6 +21,7 @@ describe AsanaService do ...@@ -21,6 +21,7 @@ describe AsanaService do
describe 'Execute' do describe 'Execute' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:gid) { "123456789ABCD" }
def create_data_for_commits(*messages) def create_data_for_commits(*messages)
{ {
...@@ -48,32 +49,32 @@ describe AsanaService do ...@@ -48,32 +49,32 @@ describe AsanaService do
end end
it 'calls Asana service to create a story' do it 'calls Asana service to create a story' do
data = create_data_for_commits('Message from commit. related to #123456') data = create_data_for_commits("Message from commit. related to ##{gid}")
expected_message = "#{data[:user_name]} pushed to branch #{data[:ref]} of #{project.full_name} ( #{data[:commits][0][:url]} ): #{data[:commits][0][:message]}" expected_message = "#{data[:user_name]} pushed to branch #{data[:ref]} of #{project.full_name} ( #{data[:commits][0][:url]} ): #{data[:commits][0][:message]}"
d1 = double('Asana::Task') d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment).with(text: expected_message) expect(d1).to receive(:add_comment).with(text: expected_message)
expect(Asana::Task).to receive(:find_by_id).with(anything, '123456').once.and_return(d1) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, gid).once.and_return(d1)
@asana.execute(data) @asana.execute(data)
end end
it 'calls Asana service to create a story and close a task' do it 'calls Asana service to create a story and close a task' do
data = create_data_for_commits('fix #456789') data = create_data_for_commits('fix #456789')
d1 = double('Asana::Task') d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment) expect(d1).to receive(:add_comment)
expect(d1).to receive(:update).with(completed: true) expect(d1).to receive(:update).with(completed: true)
expect(Asana::Task).to receive(:find_by_id).with(anything, '456789').once.and_return(d1) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '456789').once.and_return(d1)
@asana.execute(data) @asana.execute(data)
end end
it 'is able to close via url' do it 'is able to close via url' do
data = create_data_for_commits('closes https://app.asana.com/19292/956299/42') data = create_data_for_commits('closes https://app.asana.com/19292/956299/42')
d1 = double('Asana::Task') d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment) expect(d1).to receive(:add_comment)
expect(d1).to receive(:update).with(completed: true) expect(d1).to receive(:update).with(completed: true)
expect(Asana::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d1) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d1)
@asana.execute(data) @asana.execute(data)
end end
...@@ -84,28 +85,28 @@ describe AsanaService do ...@@ -84,28 +85,28 @@ describe AsanaService do
ref https://app.asana.com/19292/956299/42 and closing https://app.asana.com/19292/956299/12 ref https://app.asana.com/19292/956299/42 and closing https://app.asana.com/19292/956299/12
EOF EOF
data = create_data_for_commits(message) data = create_data_for_commits(message)
d1 = double('Asana::Task') d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment) expect(d1).to receive(:add_comment)
expect(d1).to receive(:update).with(completed: true) expect(d1).to receive(:update).with(completed: true)
expect(Asana::Task).to receive(:find_by_id).with(anything, '123').once.and_return(d1) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '123').once.and_return(d1)
d2 = double('Asana::Task') d2 = double('Asana::Resources::Task')
expect(d2).to receive(:add_comment) expect(d2).to receive(:add_comment)
expect(d2).to receive(:update).with(completed: true) expect(d2).to receive(:update).with(completed: true)
expect(Asana::Task).to receive(:find_by_id).with(anything, '456').once.and_return(d2) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '456').once.and_return(d2)
d3 = double('Asana::Task') d3 = double('Asana::Resources::Task')
expect(d3).to receive(:add_comment) expect(d3).to receive(:add_comment)
expect(Asana::Task).to receive(:find_by_id).with(anything, '789').once.and_return(d3) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '789').once.and_return(d3)
d4 = double('Asana::Task') d4 = double('Asana::Resources::Task')
expect(d4).to receive(:add_comment) expect(d4).to receive(:add_comment)
expect(Asana::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d4) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d4)
d5 = double('Asana::Task') d5 = double('Asana::Resources::Task')
expect(d5).to receive(:add_comment) expect(d5).to receive(:add_comment)
expect(d5).to receive(:update).with(completed: true) expect(d5).to receive(:update).with(completed: true)
expect(Asana::Task).to receive(:find_by_id).with(anything, '12').once.and_return(d5) expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '12').once.and_return(d5)
@asana.execute(data) @asana.execute(data)
end end
......
...@@ -27,12 +27,18 @@ describe Issues::ZoomLinkService do ...@@ -27,12 +27,18 @@ describe Issues::ZoomLinkService do
end end
end end
shared_context 'insufficient permissions' do shared_context 'insufficient issue update permissions' do
before do before do
project.add_guest(user) project.add_guest(user)
end end
end end
shared_context 'insufficient issue create permissions' do
before do
expect(service).to receive(:can?).with(user, :create_issue, project).and_return(false)
end
end
describe '#add_link' do describe '#add_link' do
shared_examples 'can add meeting' do shared_examples 'can add meeting' do
it 'appends the new meeting to zoom_meetings' do it 'appends the new meeting to zoom_meetings' do
...@@ -69,16 +75,38 @@ describe Issues::ZoomLinkService do ...@@ -69,16 +75,38 @@ describe Issues::ZoomLinkService do
subject(:result) { service.add_link(zoom_link) } subject(:result) { service.add_link(zoom_link) }
context 'without existing Zoom meeting' do context 'without existing Zoom meeting' do
context 'when updating an issue' do
before do
allow(issue).to receive(:persisted?).and_return(true)
end
include_examples 'can add meeting' include_examples 'can add meeting'
context 'with invalid Zoom url' do context 'with insufficient issue update permissions' do
let(:zoom_link) { 'https://not-zoom.link' } include_context 'insufficient issue update permissions'
include_examples 'cannot add meeting'
end
end
context 'when creating an issue' do
before do
allow(issue).to receive(:persisted?).and_return(false)
end
it 'creates a new zoom meeting' do
expect(result).to be_success
expect(result.payload[:zoom_meetings][0].url).to eq(zoom_link)
end
context 'with insufficient issue create permissions' do
include_context 'insufficient issue create permissions'
include_examples 'cannot add meeting' include_examples 'cannot add meeting'
end end
end
context 'with invalid Zoom url' do
let(:zoom_link) { 'https://not-zoom.link' }
context 'with insufficient permissions' do
include_context 'insufficient permissions'
include_examples 'cannot add meeting' include_examples 'cannot add meeting'
end end
end end
...@@ -92,6 +120,7 @@ describe Issues::ZoomLinkService do ...@@ -92,6 +120,7 @@ describe Issues::ZoomLinkService do
include_context '"added" Zoom meeting' include_context '"added" Zoom meeting'
before do before do
allow(service).to receive(:can_add_link?).and_return(true) allow(service).to receive(:can_add_link?).and_return(true)
allow(issue).to receive(:persisted?).and_return(true)
end end
include_examples 'cannot add meeting' include_examples 'cannot add meeting'
...@@ -104,8 +133,8 @@ describe Issues::ZoomLinkService do ...@@ -104,8 +133,8 @@ describe Issues::ZoomLinkService do
context 'without "added" zoom meeting' do context 'without "added" zoom meeting' do
it { is_expected.to eq(true) } it { is_expected.to eq(true) }
context 'with insufficient permissions' do context 'with insufficient issue update permissions' do
include_context 'insufficient permissions' include_context 'insufficient issue update permissions'
it { is_expected.to eq(false) } it { is_expected.to eq(false) }
end end
...@@ -156,12 +185,24 @@ describe Issues::ZoomLinkService do ...@@ -156,12 +185,24 @@ describe Issues::ZoomLinkService do
context 'with Zoom meeting' do context 'with Zoom meeting' do
include_context '"added" Zoom meeting' include_context '"added" Zoom meeting'
context 'removes the link' do context 'with existing issue' do
before do
allow(issue).to receive(:persisted?).and_return(true)
end
include_examples 'can remove meeting' include_examples 'can remove meeting'
end end
context 'with insufficient permissions' do context 'without existing issue' do
include_context 'insufficient permissions' before do
allow(issue).to receive(:persisted?).and_return(false)
end
include_examples 'cannot remove meeting'
end
context 'with insufficient issue update permissions' do
include_context 'insufficient issue update permissions'
include_examples 'cannot remove meeting' include_examples 'cannot remove meeting'
end end
end end
...@@ -193,8 +234,8 @@ describe Issues::ZoomLinkService do ...@@ -193,8 +234,8 @@ describe Issues::ZoomLinkService do
it { is_expected.to eq(true) } it { is_expected.to eq(true) }
end end
context 'with insufficient permissions' do context 'with insufficient issue update permissions' do
include_context 'insufficient permissions' include_context 'insufficient issue update permissions'
it { is_expected.to eq(false) } it { is_expected.to eq(false) }
end end
end end
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment