Commit 0ba793c6 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'ce-to-ee-2018-05-23' into 'master'

CE upstream - 2018-05-23 12:34 UTC

See merge request gitlab-org/gitlab-ee!5822
parents f0486994 10e1077f
...@@ -413,6 +413,8 @@ cloud-native-image: ...@@ -413,6 +413,8 @@ cloud-native-image:
before_script: [] before_script: []
stage: build stage: build
allow_failure: true allow_failure: true
variables:
GIT_DEPTH: "1"
cache: {} cache: {}
before_script: before_script:
- gem install gitlab --no-rdoc --no-ri - gem install gitlab --no-rdoc --no-ri
......
...@@ -3,6 +3,7 @@ require "gemnasium/gitlab_service" ...@@ -3,6 +3,7 @@ require "gemnasium/gitlab_service"
class GemnasiumService < Service class GemnasiumService < Service
prop_accessor :token, :api_key prop_accessor :token, :api_key
validates :token, :api_key, presence: true, if: :activated? validates :token, :api_key, presence: true, if: :activated?
validate :deprecation_validation
def title def title
'Gemnasium' 'Gemnasium'
...@@ -27,6 +28,18 @@ class GemnasiumService < Service ...@@ -27,6 +28,18 @@ class GemnasiumService < Service
%w(push) %w(push)
end end
def deprecated?
true
end
def deprecation_message
"Gemnasium has been acquired by GitLab in January 2018. Since May 15, 2018, the service provided by Gemnasium is no longer available."
end
def deprecation_validation
errors[:base] << deprecation_message
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
......
...@@ -254,7 +254,6 @@ class Service < ActiveRecord::Base ...@@ -254,7 +254,6 @@ class Service < ActiveRecord::Base
emails_on_push emails_on_push
external_wiki external_wiki
flowdock flowdock
gemnasium
hipchat hipchat
irker irker
jira jira
......
---
title: Deprecate Gemnasium project service
merge_request: 18954
author:
type: deprecated
---
title: Don't trim incoming emails that create new issues
merge_request:
author: Cameron Crockett
type: fixed
class RemoveGemnasiumService < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
disable_statement_timeout
execute("DELETE FROM services WHERE type='GemnasiumService';")
end
def down
# noop
end
end
...@@ -405,6 +405,13 @@ GET /projects/:id/services/flowdock ...@@ -405,6 +405,13 @@ GET /projects/:id/services/flowdock
Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities. Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities.
CAUTION: **Warning:**
Gemnasium service integration has been deprecated in GitLab 11.0. Gemnasium has been
[acquired by GitLab](https://about.gitlab.com/press/releases/2018-01-30-gemnasium-acquisition.html)
in January 2018 and since May 15, 2018, the service provided by Gemnasium is no longer available.
You can [migrate from Gemnasium to GitLab](https://docs.gitlab.com/ee/user/project/import/gemnasium.html)
to keep monitoring your dependencies.
### Create/Edit Gemnasium service ### Create/Edit Gemnasium service
Set Gemnasium service for a project. Set Gemnasium service for a project.
......
...@@ -34,7 +34,7 @@ Click on the service links to see further configuration instructions and details ...@@ -34,7 +34,7 @@ Click on the service links to see further configuration instructions and details
| [Emails on push](emails_on_push.md) | Email the commits and diff of each push to a list of recipients | | [Emails on push](emails_on_push.md) | Email the commits and diff of each push to a list of recipients |
| External Wiki | Replaces the link to the internal wiki with a link to an external wiki | | External Wiki | Replaces the link to the internal wiki with a link to an external wiki |
| Flowdock | Flowdock is a collaboration web app for technical teams | | Flowdock | Flowdock is a collaboration web app for technical teams |
| Gemnasium | Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities | | Gemnasium _(Has been deprecated in GitLab 11.0)_ | Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities |
| [GitHub](github.md) | Sends pipeline notifications to GitHub | | [GitHub](github.md) | Sends pipeline notifications to GitHub |
| [HipChat](hipchat.md) | Private group chat and IM | | [HipChat](hipchat.md) | Private group chat and IM |
| [Irker (IRC gateway)](irker.md) | Send IRC messages, on update, to a list of recipients through an Irker gateway | | [Irker (IRC gateway)](irker.md) | Send IRC messages, on update, to a list of recipients through an Irker gateway |
......
...@@ -47,7 +47,7 @@ module Gitlab ...@@ -47,7 +47,7 @@ module Gitlab
project, project,
author, author,
title: mail.subject, title: mail.subject,
description: message description: message_including_reply
).execute ).execute
end end
end end
......
...@@ -16,8 +16,12 @@ module Gitlab ...@@ -16,8 +16,12 @@ module Gitlab
@message ||= process_message @message ||= process_message
end end
def process_message def message_including_reply
message = ReplyParser.new(mail).execute.strip @message_with_reply ||= process_message(trim_reply: false)
end
def process_message(**kwargs)
message = ReplyParser.new(mail, **kwargs).execute.strip
add_attachments(message) add_attachments(message)
end end
......
...@@ -4,8 +4,9 @@ module Gitlab ...@@ -4,8 +4,9 @@ module Gitlab
class ReplyParser class ReplyParser
attr_accessor :message attr_accessor :message
def initialize(message) def initialize(message, trim_reply: true)
@message = message @message = message
@trim_reply = trim_reply
end end
def execute def execute
...@@ -13,7 +14,9 @@ module Gitlab ...@@ -13,7 +14,9 @@ module Gitlab
encoding = body.encoding encoding = body.encoding
body = EmailReplyTrimmer.trim(body) if @trim_reply
body = EmailReplyTrimmer.trim(body)
end
return '' unless body return '' unless body
......
...@@ -53,7 +53,7 @@ module Gitlab ...@@ -53,7 +53,7 @@ module Gitlab
# Import project via git clone --bare # Import project via git clone --bare
# URL must be publicly cloneable # URL must be publicly cloneable
def import_project(source, timeout) def import_project(source, timeout)
Gitlab::GitalyClient.migrate(:import_repository) do |is_enabled| Gitlab::GitalyClient.migrate(:import_repository, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled if is_enabled
gitaly_import_repository(source) gitaly_import_repository(source)
else else
......
...@@ -1052,7 +1052,7 @@ module Gitlab ...@@ -1052,7 +1052,7 @@ module Gitlab
return @info_attributes if @info_attributes return @info_attributes if @info_attributes
content = content =
gitaly_migrate(:get_info_attributes) do |is_enabled| gitaly_migrate(:get_info_attributes, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled if is_enabled
gitaly_repository_client.info_attributes gitaly_repository_client.info_attributes
else else
...@@ -1338,7 +1338,7 @@ module Gitlab ...@@ -1338,7 +1338,7 @@ module Gitlab
end end
def squash_in_progress?(squash_id) def squash_in_progress?(squash_id)
gitaly_migrate(:squash_in_progress) do |is_enabled| gitaly_migrate(:squash_in_progress, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled if is_enabled
gitaly_repository_client.squash_in_progress?(squash_id) gitaly_repository_client.squash_in_progress?(squash_id)
else else
......
...@@ -131,7 +131,7 @@ module Gitlab ...@@ -131,7 +131,7 @@ module Gitlab
def page_formatted_data(title:, dir: nil, version: nil) def page_formatted_data(title:, dir: nil, version: nil)
version = version&.id version = version&.id
@repository.gitaly_migrate(:wiki_page_formatted_data) do |is_enabled| @repository.gitaly_migrate(:wiki_page_formatted_data, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled if is_enabled
gitaly_wiki_client.get_formatted_data(title: title, dir: dir, version: version) gitaly_wiki_client.get_formatted_data(title: title, dir: dir, version: version)
else else
......
Return-Path: <jake@adventuretime.ooo>
Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 17:03:50 -0400
Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 14:03:48 -0700
Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
Date: Thu, 13 Jun 2013 17:03:48 -0400
From: Jake the Dog <jake@adventuretime.ooo>
To: incoming+gitlabhq/gitlabhq+auth_token@appmail.adventuretime.ooo
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
Subject: New Issue by email
Mime-Version: 1.0
Content-Type: text/plain;
charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Sieve: CMU Sieve 2.2
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
13 Jun 2013 14:03:48 -0700 (PDT)
X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
The reply by email functionality should be extended to allow creating a new issue by email.
even when the email is forwarded to the project which may include lines that begin with ">"
there should be a quote below this line:
> this is a quote
\ No newline at end of file
...@@ -46,6 +46,20 @@ describe Gitlab::Email::Handler::CreateIssueHandler do ...@@ -46,6 +46,20 @@ describe Gitlab::Email::Handler::CreateIssueHandler do
expect(issue.description).to eq('') expect(issue.description).to eq('')
end end
end end
context "when there are quotes in email" do
let(:email_raw) { fixture_file("emails/valid_new_issue_with_quote.eml") }
it "creates a new issue" do
expect { receiver.execute }.to change { project.issues.count }.by(1)
issue = project.issues.last
expect(issue.author).to eq(user)
expect(issue.title).to eq('New Issue by email')
expect(issue.description).to include('reply by email')
expect(issue.description).to include('> this is a quote')
end
end
end end
context "something is wrong" do context "something is wrong" do
......
...@@ -3,8 +3,8 @@ require "spec_helper" ...@@ -3,8 +3,8 @@ require "spec_helper"
# Inspired in great part by Discourse's Email::Receiver # Inspired in great part by Discourse's Email::Receiver
describe Gitlab::Email::ReplyParser do describe Gitlab::Email::ReplyParser do
describe '#execute' do describe '#execute' do
def test_parse_body(mail_string) def test_parse_body(mail_string, params = {})
described_class.new(Mail::Message.new(mail_string)).execute described_class.new(Mail::Message.new(mail_string), params).execute
end end
it "returns an empty string if the message is blank" do it "returns an empty string if the message is blank" do
...@@ -212,5 +212,19 @@ describe Gitlab::Email::ReplyParser do ...@@ -212,5 +212,19 @@ describe Gitlab::Email::ReplyParser do
it "does not wrap links with no href in unnecessary brackets" do it "does not wrap links with no href in unnecessary brackets" do
expect(test_parse_body(fixture_file("emails/html_empty_link.eml"))).to eq("no brackets!") expect(test_parse_body(fixture_file("emails/html_empty_link.eml"))).to eq("no brackets!")
end end
it "does not trim reply if trim_reply option is false" do
expect(test_parse_body(fixture_file("emails/valid_new_issue_with_quote.eml"), { trim_reply: false }))
.to eq(
<<-BODY.strip_heredoc.chomp
The reply by email functionality should be extended to allow creating a new issue by email.
even when the email is forwarded to the project which may include lines that begin with ">"
there should be a quote below this line:
> this is a quote
BODY
)
end
end end
end end
...@@ -6760,26 +6760,6 @@ ...@@ -6760,26 +6760,6 @@
"default": false, "default": false,
"wiki_page_events": true "wiki_page_events": true
}, },
{
"id": 92,
"title": "Gemnasium",
"project_id": 5,
"created_at": "2016-06-14T15:01:51.202Z",
"updated_at": "2016-06-14T15:01:51.202Z",
"active": false,
"properties": {},
"template": false,
"push_events": true,
"issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"job_events": true,
"type": "GemnasiumService",
"category": "common",
"default": false,
"wiki_page_events": true
},
{ {
"id": 91, "id": 91,
"title": "Flowdock", "title": "Flowdock",
......
...@@ -26,24 +26,49 @@ describe GemnasiumService do ...@@ -26,24 +26,49 @@ describe GemnasiumService do
end end
end end
describe "deprecated?" do
let(:project) { create(:project, :repository) }
let(:gemnasium_service) { described_class.new }
before do
allow(gemnasium_service).to receive_messages(
project_id: project.id,
project: project,
service_hook: true,
token: 'verySecret',
api_key: 'GemnasiumUserApiKey'
)
end
it "is true" do
expect(gemnasium_service.deprecated?).to be true
end
it "can't create a new service" do
expect(gemnasium_service.save).to be false
expect(gemnasium_service.errors[:base].first)
.to eq('Gemnasium has been acquired by GitLab in January 2018. Since May 15, 2018, the service provided by Gemnasium is no longer available.')
end
end
describe "Execute" do describe "Execute" do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:gemnasium_service) { described_class.new }
let(:sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
before do before do
@gemnasium_service = described_class.new allow(gemnasium_service).to receive_messages(
allow(@gemnasium_service).to receive_messages(
project_id: project.id, project_id: project.id,
project: project, project: project,
service_hook: true, service_hook: true,
token: 'verySecret', token: 'verySecret',
api_key: 'GemnasiumUserApiKey' api_key: 'GemnasiumUserApiKey'
) )
@sample_data = Gitlab::DataBuilder::Push.build_sample(project, user)
end end
it "calls Gemnasium service" do it "calls Gemnasium service" do
expect(Gemnasium::GitlabService).to receive(:execute).with(an_instance_of(Hash)).once expect(Gemnasium::GitlabService).to receive(:execute).with(an_instance_of(Hash)).once
@gemnasium_service.execute(@sample_data) gemnasium_service.execute(sample_data)
end end
end end
end end
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