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
bf2faf39
Commit
bf2faf39
authored
Mar 24, 2021
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use headPipeline in GraphQL widget queries
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/323913
parent
fe2022ba
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
14 deletions
+43
-14
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
...merge_request_widget/components/states/ready_to_merge.vue
+1
-1
app/assets/javascripts/vue_merge_request_widget/queries/get_state.query.graphql
.../vue_merge_request_widget/queries/get_state.query.graphql
+4
-5
app/assets/javascripts/vue_merge_request_widget/queries/states/ready_to_merge.fragment.graphql
...est_widget/queries/states/ready_to_merge.fragment.graphql
+5
-7
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+1
-1
ee/spec/features/merge_trains/user_adds_merge_request_to_merge_train_spec.rb
...rge_trains/user_adds_merge_request_to_merge_train_spec.rb
+7
-0
spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb
...s/merge_request/user_sees_merge_request_pipelines_spec.rb
+25
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
View file @
bf2faf39
...
@@ -124,7 +124,7 @@ export default {
...
@@ -124,7 +124,7 @@ export default {
},
},
pipeline
()
{
pipeline
()
{
if
(
this
.
glFeatures
.
mergeRequestWidgetGraphql
)
{
if
(
this
.
glFeatures
.
mergeRequestWidgetGraphql
)
{
return
this
.
state
.
pipelines
?.
nodes
?.[
0
]
;
return
this
.
state
.
headPipeline
;
}
}
return
this
.
mr
.
pipeline
;
return
this
.
mr
.
pipeline
;
...
...
app/assets/javascripts/vue_merge_request_widget/queries/get_state.query.graphql
View file @
bf2faf39
...
@@ -11,12 +11,11 @@ query getState($projectPath: ID!, $iid: String!) {
...
@@ -11,12 +11,11 @@ query getState($projectPath: ID!, $iid: String!) {
mergeError
mergeError
mergeStatus
mergeStatus
mergeableDiscussionsState
mergeableDiscussionsState
pipelines
(
first
:
1
)
{
headPipeline
{
nodes
{
id
status
status
warnings
warnings
}
}
}
shouldBeRebased
shouldBeRebased
sourceBranchExists
sourceBranchExists
state
state
...
...
app/assets/javascripts/vue_merge_request_widget/queries/states/ready_to_merge.fragment.graphql
View file @
bf2faf39
...
@@ -30,13 +30,11 @@ fragment ReadyToMerge on Project {
...
@@ -30,13 +30,11 @@ fragment ReadyToMerge on Project {
message
message
}
}
}
}
pipelines
(
first
:
1
)
{
headPipeline
{
nodes
{
id
id
status
status
path
path
active
active
}
}
}
}
}
}
}
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
bf2faf39
...
@@ -163,7 +163,7 @@ export default class MergeRequestStore {
...
@@ -163,7 +163,7 @@ export default class MergeRequestStore {
setGraphqlData
(
project
)
{
setGraphqlData
(
project
)
{
const
{
mergeRequest
}
=
project
;
const
{
mergeRequest
}
=
project
;
const
pipeline
=
mergeRequest
.
pipelines
?.
nodes
?.[
0
]
;
const
pipeline
=
mergeRequest
.
headPipeline
;
this
.
projectArchived
=
project
.
archived
;
this
.
projectArchived
=
project
.
archived
;
this
.
onlyAllowMergeIfPipelineSucceeds
=
project
.
onlyAllowMergeIfPipelineSucceeds
;
this
.
onlyAllowMergeIfPipelineSucceeds
=
project
.
onlyAllowMergeIfPipelineSucceeds
;
...
...
ee/spec/features/merge_trains/user_adds_merge_request_to_merge_train_spec.rb
View file @
bf2faf39
...
@@ -17,6 +17,7 @@ RSpec.describe 'User adds a merge request to a merge train', :js do
...
@@ -17,6 +17,7 @@ RSpec.describe 'User adds a merge request to a merge train', :js do
end
end
before
do
before
do
stub_const
(
'Gitlab::QueryLimiting::Transaction::THRESHOLD'
,
200
)
stub_feature_flags
(
disable_merge_trains:
false
)
stub_feature_flags
(
disable_merge_trains:
false
)
stub_licensed_features
(
merge_pipelines:
true
,
merge_trains:
true
)
stub_licensed_features
(
merge_pipelines:
true
,
merge_trains:
true
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
...
@@ -84,6 +85,12 @@ RSpec.describe 'User adds a merge request to a merge train', :js do
...
@@ -84,6 +85,12 @@ RSpec.describe 'User adds a merge request to a merge train', :js do
context
"when user clicks 'Remove from merge train' button"
do
context
"when user clicks 'Remove from merge train' button"
do
before
do
before
do
click_link
'Remove from merge train'
click_link
'Remove from merge train'
# Currently, this page shows "Add to merge train" button instead of "Start merge train",
# even though the merge train is empty.
# This likely is caused by the stale cache in client side. Frontend
# would need to refresh the mergiability data, specifically `stateData.mergeTrainsCount` periodically e.g. polling.
# As a workaround, we're doing a hard reload by executing `visit` here.
visit
project_merge_request_path
(
project
,
merge_request
)
end
end
it
'cancels automatic merge'
do
it
'cancels automatic merge'
do
...
...
spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb
View file @
bf2faf39
...
@@ -333,6 +333,31 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
...
@@ -333,6 +333,31 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
end
end
end
end
context
'when the latest pipeline is running in the parent project'
do
before
do
Ci
::
CreatePipelineService
.
new
(
project
,
user
,
ref:
'feature'
)
.
execute
(
:merge_request_event
,
merge_request:
merge_request
)
end
context
'when the previous pipeline failed in the fork project'
do
before
do
detached_merge_request_pipeline
.
drop!
end
context
'when the parent project enables pipeline must succeed'
do
before
do
project
.
update!
(
only_allow_merge_if_pipeline_succeeds:
true
)
end
it
'shows MWPS button'
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
to
have_button
(
'Merge when pipeline succeeds'
)
end
end
end
end
context
'when a user merges a merge request from a forked project to the parent project'
do
context
'when a user merges a merge request from a forked project to the parent project'
do
before
do
before
do
click_link
(
"Overview"
)
click_link
(
"Overview"
)
...
...
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