diff options
-rw-r--r-- | Gemfile | 4 | ||||
-rw-r--r-- | Gemfile.lock | 10 | ||||
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/project_services/asana_service.rb | 6 | ||||
-rw-r--r-- | changelogs/unreleased/sh-fix-asana-integration.yml | 5 | ||||
-rw-r--r-- | changelogs/unreleased/sh-fix-issue-34366.yml | 5 | ||||
-rw-r--r-- | changelogs/unreleased/sh-upgrade-akismet-gem.yml | 5 | ||||
-rw-r--r-- | spec/features/merge_request/user_suggests_changes_on_diff_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/gitaly_client/cleanup_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/ci/build_runner_session_spec.rb | 20 | ||||
-rw-r--r-- | spec/models/project_services/asana_service_spec.rb | 35 | ||||
-rwxr-xr-x[-rw-r--r--] | vendor/gitignore/C++.gitignore | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | vendor/gitignore/Java.gitignore | 0 |
13 files changed, 72 insertions, 28 deletions
@@ -53,7 +53,7 @@ gem 'gssapi', group: :kerberos # Spam and anti-bot protection gem 'recaptcha', '~> 4.11', require: 'recaptcha/rails' -gem 'akismet', '~> 2.0' +gem 'akismet', '~> 3.0' gem 'invisible_captcha', '~> 0.12.1' # Two-factor authentication @@ -242,7 +242,7 @@ gem 'slack-notifier', '~> 1.5.1' gem 'hangouts-chat', '~> 0.0.5' # Asana integration -gem 'asana', '~> 0.8.1' +gem 'asana', '~> 0.9' # FogBugz integration gem 'ruby-fogbugz', '~> 0.2.1' diff --git a/Gemfile.lock b/Gemfile.lock index 15465cd6b03..469bea9d4fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,16 +58,16 @@ GEM addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) aes_key_wrap (1.0.1) - akismet (2.0.0) + akismet (3.0.0) apollo_upload_server (2.0.0.beta.3) graphql (>= 1.8) rails (>= 4.2) arel (9.0.0) - asana (0.8.1) + asana (0.9.3) faraday (~> 0.9) faraday_middleware (~> 0.9) faraday_middleware-multi_json (~> 0.0) - oauth2 (~> 1.0) + oauth2 (~> 1.4) asciidoctor (2.0.10) asciidoctor-include-ext (0.3.1) asciidoctor (>= 1.5.6, < 3.0.0) @@ -1117,9 +1117,9 @@ DEPENDENCIES activerecord-explain-analyze (~> 0.1) acts-as-taggable-on (~> 6.0) addressable (~> 2.5.2) - akismet (~> 2.0) + akismet (~> 3.0) apollo_upload_server (~> 2.0.0.beta3) - asana (~> 0.8.1) + asana (~> 0.9) asciidoctor (~> 2.0.10) asciidoctor-include-ext (~> 0.3.1) asciidoctor-plantuml (= 0.0.9) diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 59a2c09bd28..49c5b67d600 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -53,7 +53,7 @@ module Ci has_one :runner_session, class_name: 'Ci::BuildRunnerSession', validate: true, inverse_of: :build - accepts_nested_attributes_for :runner_session + accepts_nested_attributes_for :runner_session, update_only: true accepts_nested_attributes_for :job_variables delegate :url, to: :runner_session, prefix: true, allow_nil: true diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb index 3e28dc23782..757b2f17fb9 100644 --- a/app/models/project_services/asana_service.rb +++ b/app/models/project_services/asana_service.rb @@ -81,12 +81,12 @@ http://app.asana.com/-/account_api' def check_commit(message, push_msg) # matches either: # - #1234 - # - https://app.asana.com/0/0/1234 + # - https://app.asana.com/0/{project_gid}/{task_gid} # optionally preceded with: # - fix/ed/es/ing # - close/s/d # - 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| # tuple will be @@ -94,7 +94,7 @@ http://app.asana.com/-/account_api' taskid = tuple[2] || tuple[1] 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}") if tuple[0] diff --git a/changelogs/unreleased/sh-fix-asana-integration.yml b/changelogs/unreleased/sh-fix-asana-integration.yml new file mode 100644 index 00000000000..34c2f9f48e1 --- /dev/null +++ b/changelogs/unreleased/sh-fix-asana-integration.yml @@ -0,0 +1,5 @@ +--- +title: Fix Asana integration +merge_request: 21501 +author: +type: fixed diff --git a/changelogs/unreleased/sh-fix-issue-34366.yml b/changelogs/unreleased/sh-fix-issue-34366.yml new file mode 100644 index 00000000000..efc19f8392e --- /dev/null +++ b/changelogs/unreleased/sh-fix-issue-34366.yml @@ -0,0 +1,5 @@ +--- +title: Fix error in updating runner session +merge_request: 20902 +author: +type: fixed diff --git a/changelogs/unreleased/sh-upgrade-akismet-gem.yml b/changelogs/unreleased/sh-upgrade-akismet-gem.yml new file mode 100644 index 00000000000..c6a545e2bba --- /dev/null +++ b/changelogs/unreleased/sh-upgrade-akismet-gem.yml @@ -0,0 +1,5 @@ +--- +title: Upgrade Akismet gem to v3.0.0 +merge_request: 21786 +author: +type: security diff --git a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb index e2bcdfd1e2b..859638f1a52 100644 --- a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb +++ b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb @@ -139,6 +139,10 @@ describe 'User comments on a diff', :js do # Making sure it's not a Front-end cache. visit(diffs_project_merge_request_path(project, merge_request)) + page.within '.line-resolve-all-container' do + page.find('.discussion-next-btn').click + end + expect_appliable_suggestions(2) page.within("[id='#{hash}']") do diff --git a/spec/lib/gitlab/gitaly_client/cleanup_service_spec.rb b/spec/lib/gitlab/gitaly_client/cleanup_service_spec.rb index c6c7fa1c38a..3430fbb71f1 100644 --- a/spec/lib/gitlab/gitaly_client/cleanup_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/cleanup_service_spec.rb @@ -9,6 +9,10 @@ describe Gitlab::GitalyClient::CleanupService do let(:client) { described_class.new(project.repository) } describe '#apply_bfg_object_map_stream' do + before do + ::Gitlab::GitalyClient.clear_stubs! + end + it 'sends an apply_bfg_object_map_stream message' do expect_any_instance_of(Gitaly::CleanupService::Stub) .to receive(:apply_bfg_object_map_stream) diff --git a/spec/models/ci/build_runner_session_spec.rb b/spec/models/ci/build_runner_session_spec.rb index e51fd009f50..cdf56f24cd7 100644 --- a/spec/models/ci/build_runner_session_spec.rb +++ b/spec/models/ci/build_runner_session_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' describe Ci::BuildRunnerSession, model: true do let!(:build) { create(:ci_build, :with_runner_session) } + let(:url) { 'https://new.example.com' } subject { build.runner_session } @@ -12,6 +13,25 @@ describe Ci::BuildRunnerSession, model: true do it { is_expected.to validate_presence_of(:build) } it { is_expected.to validate_presence_of(:url).with_message('must be a valid URL') } + context 'nested attribute assignment' do + it 'creates a new session' do + simple_build = create(:ci_build) + simple_build.runner_session_attributes = { url: url } + simple_build.save! + + session = simple_build.reload.runner_session + expect(session).to be_a(Ci::BuildRunnerSession) + expect(session.url).to eq(url) + end + + it 'updates session with new attributes' do + build.runner_session_attributes = { url: url } + build.save! + + expect(build.reload.runner_session.url).to eq(url) + end + end + describe '#terminal_specification' do let(:specification) { subject.terminal_specification } diff --git a/spec/models/project_services/asana_service_spec.rb b/spec/models/project_services/asana_service_spec.rb index 18e839bcc64..8b6f2888c0a 100644 --- a/spec/models/project_services/asana_service_spec.rb +++ b/spec/models/project_services/asana_service_spec.rb @@ -21,6 +21,7 @@ describe AsanaService do describe 'Execute' do let(:user) { create(:user) } let(:project) { create(:project) } + let(:gid) { "123456789ABCD" } def create_data_for_commits(*messages) { @@ -48,32 +49,32 @@ describe AsanaService do end 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]}" - d1 = double('Asana::Task') + d1 = double('Asana::Resources::Task') 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) end it 'calls Asana service to create a story and close a task' do 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(: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) end it 'is able to close via url' do 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(: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) end @@ -84,28 +85,28 @@ describe AsanaService do ref https://app.asana.com/19292/956299/42 and closing https://app.asana.com/19292/956299/12 EOF 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(: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(: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(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(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(: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) end diff --git a/vendor/gitignore/C++.gitignore b/vendor/gitignore/C++.gitignore index 259148fa18f..259148fa18f 100644..100755 --- a/vendor/gitignore/C++.gitignore +++ b/vendor/gitignore/C++.gitignore diff --git a/vendor/gitignore/Java.gitignore b/vendor/gitignore/Java.gitignore index a1c2a238a96..a1c2a238a96 100644..100755 --- a/vendor/gitignore/Java.gitignore +++ b/vendor/gitignore/Java.gitignore |