Commit 9a784bcf authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents a8d04c5f 866465f6
---
title: Update merge train documentation
merge_request: 32218
author:
type: changed
---
title: Prevent empty external authorization classification labels from overriding
the default label
merge_request: 32517
author: Will Chandler
type: fixed
...@@ -61,6 +61,20 @@ CAUTION: **Warning:** ...@@ -61,6 +61,20 @@ CAUTION: **Warning:**
Make sure your `gitlab-ci.yml` file is [configured properly for pipelines for merge requests](../index.md#configuring-pipelines-for-merge-requests), Make sure your `gitlab-ci.yml` file is [configured properly for pipelines for merge requests](../index.md#configuring-pipelines-for-merge-requests),
otherwise pipelines for merged results won't run and your merge requests will be stuck in an unresolved state. otherwise pipelines for merged results won't run and your merge requests will be stuck in an unresolved state.
## Automatic pipeline cancelation
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/12996) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.3.
GitLab CI can detect the presence of redundant pipelines,
and will cancel them automatically in order to conserve CI resources.
When a user merges a merge request immediately within an ongoing merge
train, the train will be reconstructed, as it will recreate the expected
post-merge commit and pipeline. In this case, the merge train may already
have pipelines running against the previous expected post-merge commit.
These pipelines are considered redundant and will be automatically
canceled.
## Troubleshooting ## Troubleshooting
### Pipelines for merged results not created even with new change pushed to merge request ### Pipelines for merged results not created even with new change pushed to merge request
......
...@@ -107,7 +107,7 @@ module Gitlab ...@@ -107,7 +107,7 @@ module Gitlab
def project_params def project_params
@project_params ||= begin @project_params ||= begin
attrs = json_params.merge(override_params).merge(visibility_level) attrs = json_params.merge(override_params).merge(visibility_level, external_label)
# Cleaning all imported and overridden params # Cleaning all imported and overridden params
Gitlab::ImportExport::AttributeCleaner.clean(relation_hash: attrs, Gitlab::ImportExport::AttributeCleaner.clean(relation_hash: attrs,
...@@ -135,6 +135,13 @@ module Gitlab ...@@ -135,6 +135,13 @@ module Gitlab
{ 'visibility_level' => level } { 'visibility_level' => level }
end end
def external_label
label = override_params['external_authorization_classification_label'].presence ||
json_params['external_authorization_classification_label'].presence
{ 'external_authorization_classification_label' => label }
end
# Given a relation hash containing one or more models and its relationships, # Given a relation hash containing one or more models and its relationships,
# loops through each model and each object from a model type and # loops through each model and each object from a model type and
# and assigns its correspondent attributes hash from +tree_hash+ # and assigns its correspondent attributes hash from +tree_hash+
......
...@@ -512,6 +512,24 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -512,6 +512,24 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(Milestone.find_by_title('Group-level milestone').iid).to eq(2) expect(Milestone.find_by_title('Group-level milestone').iid).to eq(2)
end end
end end
context 'with external authorization classification labels' do
it 'converts empty external classification authorization labels to nil' do
project.create_import_data(data: { override_params: { external_authorization_classification_label: "" } })
restored_project_json
expect(project.external_authorization_classification_label).to be_nil
end
it 'preserves valid external classification authorization labels' do
project.create_import_data(data: { override_params: { external_authorization_classification_label: "foobar" } })
restored_project_json
expect(project.external_authorization_classification_label).to eq("foobar")
end
end
end end
describe '#restored_project' do describe '#restored_project' do
......
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