Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/finders/todos_finder.rb8
-rw-r--r--app/views/ci/variables/_url_query_variable_row.html.haml28
-rw-r--r--app/views/projects/pipelines/new.html.haml7
-rw-r--r--changelogs/unreleased/24146-query-string-params.yml5
-rw-r--r--changelogs/unreleased/30161-expose-merge-request-status-in-api.yml5
-rw-r--r--doc/api/merge_requests.md12
-rw-r--r--lib/api/entities.rb4
-rw-r--r--qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb5
-rw-r--r--spec/features/populate_new_pipeline_vars_with_params_spec.rb32
-rw-r--r--spec/finders/todos_finder_spec.rb23
-rw-r--r--spec/requests/api/merge_requests_spec.rb2
11 files changed, 119 insertions, 12 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb
index 2b46e51290f..82acb5e9d45 100644
--- a/app/finders/todos_finder.rb
+++ b/app/finders/todos_finder.rb
@@ -188,11 +188,9 @@ class TodosFinder
end
def by_state(items)
- if params[:state].to_s == 'done'
- items.done
- else
- items.pending
- end
+ return items.pending if params[:state].blank?
+
+ items.with_states(params[:state])
end
def by_type(items)
diff --git a/app/views/ci/variables/_url_query_variable_row.html.haml b/app/views/ci/variables/_url_query_variable_row.html.haml
new file mode 100644
index 00000000000..6672a8e5ea0
--- /dev/null
+++ b/app/views/ci/variables/_url_query_variable_row.html.haml
@@ -0,0 +1,28 @@
+- form_field = local_assigns.fetch(:form_field, nil)
+- variable = local_assigns.fetch(:variable, nil)
+
+- key = variable[0]
+- value = variable[1]
+- variable_type = variable[2] || "env_var"
+
+- destroy_input_name = "#{form_field}[variables_attributes][][_destroy]"
+- variable_type_input_name = "#{form_field}[variables_attributes][][variable_type]"
+- key_input_name = "#{form_field}[variables_attributes][][key]"
+- value_input_name = "#{form_field}[variables_attributes][][secret_value]"
+
+%li.js-row.ci-variable-row
+ .ci-variable-row-body.border-bottom
+ %input.js-ci-variable-input-destroy{ type: "hidden", name: destroy_input_name }
+ %select.js-ci-variable-input-variable-type.ci-variable-body-item.form-control.select-control.custom-select.table-section.section-15{ name: variable_type_input_name }
+ = options_for_select(ci_variable_type_options, variable_type)
+ %input.js-ci-variable-input-key.ci-variable-body-item.qa-ci-variable-input-key.form-control.table-section.section-15{ type: "text",
+ name: key_input_name,
+ value: key,
+ placeholder: s_('CiVariables|Input variable key') }
+ .ci-variable-body-item.gl-show-field-errors.table-section.section-15.border-top-0.p-0
+ %textarea.js-ci-variable-input-value.js-secret-value.qa-ci-variable-input-value.form-control{ rows: 1,
+ name: value_input_name,
+ placeholder: s_('CiVariables|Input variable value') }
+ = value
+ %button.js-row-remove-button.ci-variable-row-remove-button.table-section.section-5.border-top-0{ type: 'button', 'aria-label': s_('CiVariables|Remove variable row') }
+ = icon('minus-circle')
diff --git a/app/views/projects/pipelines/new.html.haml b/app/views/projects/pipelines/new.html.haml
index bfcaa09ae8c..a3e46a0939c 100644
--- a/app/views/projects/pipelines/new.html.haml
+++ b/app/views/projects/pipelines/new.html.haml
@@ -23,6 +23,13 @@
%label
= s_('Pipeline|Variables')
%ul.ci-variable-list
+ - if params[:var]
+ - params[:var].each do |variable|
+ = render 'ci/variables/url_query_variable_row', form_field: 'pipeline', variable: variable
+ - if params[:file_var]
+ - params[:file_var].each do |variable|
+ - variable.push("file")
+ = render 'ci/variables/url_query_variable_row', form_field: 'pipeline', variable: variable
= render 'ci/variables/variable_row', form_field: 'pipeline', only_key_value: true
.form-text.text-muted
= (s_("Pipeline|Specify variable values to be used in this run. The values specified in %{settings_link} will be used by default.") % {settings_link: settings_link}).html_safe
diff --git a/changelogs/unreleased/24146-query-string-params.yml b/changelogs/unreleased/24146-query-string-params.yml
new file mode 100644
index 00000000000..80cab30e255
--- /dev/null
+++ b/changelogs/unreleased/24146-query-string-params.yml
@@ -0,0 +1,5 @@
+---
+title: Populate new pipeline CI vars from params
+merge_request: 19023
+author:
+type: added
diff --git a/changelogs/unreleased/30161-expose-merge-request-status-in-api.yml b/changelogs/unreleased/30161-expose-merge-request-status-in-api.yml
new file mode 100644
index 00000000000..aaac2d31b0c
--- /dev/null
+++ b/changelogs/unreleased/30161-expose-merge-request-status-in-api.yml
@@ -0,0 +1,5 @@
+---
+title: Expose mergeable state of a merge request
+merge_request: 18888
+author: briankabiro
+type: added
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md
index 4bc46c3030d..ef5cbeb015e 100644
--- a/doc/api/merge_requests.md
+++ b/doc/api/merge_requests.md
@@ -304,7 +304,9 @@ Parameters:
"task_completion_status":{
"count":0,
"completed_count":0
- }
+ },
+ "has_conflicts": false,
+ "blocking_discussions_resolved": true
}
]
```
@@ -453,7 +455,9 @@ Parameters:
"task_completion_status":{
"count":0,
"completed_count":0
- }
+ },
+ "has_conflicts": false,
+ "blocking_discussions_resolved": true
}
]
```
@@ -606,7 +610,9 @@ Parameters:
"task_completion_status":{
"count":0,
"completed_count":0
- }
+ },
+ "has_conflicts": false,
+ "blocking_discussions_resolved": true
}
```
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index de12695af37..444031fd68d 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -777,6 +777,10 @@ module API
expose :squash
expose :task_completion_status
+
+ expose :cannot_be_merged?, as: :has_conflicts
+
+ expose :mergeable_discussions_state?, as: :blocking_discussions_resolved
end
class MergeRequest < MergeRequestBasic
diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
index 13e205352de..9dc4bcc8a03 100644
--- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
+++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
@@ -5,10 +5,6 @@ require 'digest/sha1'
module QA
context 'Release', :docker do
describe 'Git clone using a deploy key' do
- after do
- Runtime::Feature.enable('job_log_json') if @job_log_json_flag_enabled
- end
-
before do
# Handle WIP Job Logs flag - https://gitlab.com/gitlab-org/gitlab/issues/31162
@job_log_json_flag_enabled = Runtime::Feature.enabled?('job_log_json')
@@ -34,6 +30,7 @@ module QA
end
after do
+ Runtime::Feature.enable('job_log_json') if @job_log_json_flag_enabled
Service::DockerRun::GitlabRunner.new(@runner_name).remove!
end
diff --git a/spec/features/populate_new_pipeline_vars_with_params_spec.rb b/spec/features/populate_new_pipeline_vars_with_params_spec.rb
new file mode 100644
index 00000000000..5fe80e73e38
--- /dev/null
+++ b/spec/features/populate_new_pipeline_vars_with_params_spec.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe "Populate new pipeline CI variables with url params", :js do
+ let(:user) { create(:user) }
+ let(:project) { create(:project) }
+ let(:page_path) { new_project_pipeline_path(project) }
+
+ before do
+ sign_in(user)
+ project.add_maintainer(user)
+
+ visit "#{page_path}?var[key1]=value1&file_var[key2]=value2"
+ end
+
+ it "var[key1]=value1 populates env_var variable correctly" do
+ page.within('.ci-variable-list .js-row:nth-child(1)') do
+ expect(find('.js-ci-variable-input-variable-type').value).to eq('env_var')
+ expect(find('.js-ci-variable-input-key').value).to eq('key1')
+ expect(find('.js-ci-variable-input-value').text).to eq('value1')
+ end
+ end
+
+ it "file_var[key2]=value2 populates file variable correctly" do
+ page.within('.ci-variable-list .js-row:nth-child(2)') do
+ expect(find('.js-ci-variable-input-variable-type').value).to eq('file')
+ expect(find('.js-ci-variable-input-key').value).to eq('key2')
+ expect(find('.js-ci-variable-input-value').text).to eq('value2')
+ end
+ end
+end
diff --git a/spec/finders/todos_finder_spec.rb b/spec/finders/todos_finder_spec.rb
index a4b076bc367..6234d596745 100644
--- a/spec/finders/todos_finder_spec.rb
+++ b/spec/finders/todos_finder_spec.rb
@@ -140,6 +140,29 @@ describe TodosFinder do
end
end
end
+
+ context 'by state' do
+ let!(:todo1) { create(:todo, user: user, group: group, target: issue, state: :done) }
+ let!(:todo2) { create(:todo, user: user, group: group, target: issue, state: :pending) }
+
+ it 'returns the expected items when no state is provided' do
+ todos = finder.new(user, {}).execute
+
+ expect(todos).to match_array([todo2])
+ end
+
+ it 'returns the expected items when a state is provided' do
+ todos = finder.new(user, { state: :done }).execute
+
+ expect(todos).to match_array([todo1])
+ end
+
+ it 'returns the expected items when multiple states are provided' do
+ todos = finder.new(user, { state: [:pending, :done] }).execute
+
+ expect(todos).to match_array([todo1, todo2])
+ end
+ end
end
context 'external authorization' do
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 721998ede6a..443682cd34c 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -775,6 +775,8 @@ describe API::MergeRequests do
expect(json_response['merge_error']).to eq(merge_request.merge_error)
expect(json_response['user']['can_merge']).to be_truthy
expect(json_response).not_to include('rebase_in_progress')
+ expect(json_response['has_conflicts']).to be_falsy
+ expect(json_response['blocking_discussions_resolved']).to be_truthy
end
it 'exposes description and title html when render_html is true' do