Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-08-04 00:08:51 +00:00
parent 4bf395cded
commit 099deb2725
6 changed files with 45 additions and 75 deletions

View file

@ -1 +1 @@
780588a55b9219f3157cc984f7e1b7aa9f9124f2
c2ad49fbbf325f45bd31e307451cbf2982a4f647

View file

@ -7,7 +7,7 @@ module Ci
Ci::ExpirePipelineCacheService.new.execute(pipeline, delete: true)
pipeline.cancel_running if pipeline.cancelable? && ::Feature.enabled?(:cancel_pipelines_prior_to_destroy, pipeline.project, default_enabled: :yaml)
pipeline.cancel_running if pipeline.cancelable?
pipeline.reset.destroy!

View file

@ -1,8 +0,0 @@
---
name: cancel_pipelines_prior_to_destroy
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65586
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335338
milestone: '14.1'
type: development
group: group::continuous integration
default_enabled: false

View file

@ -9,31 +9,35 @@ type: reference
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53016) in GitLab 13.9.
Group repositories can be moved between storages. This can be useful when
Group repositories can be moved between storages. This API can help you when
[migrating to Gitaly Cluster](../administration/gitaly/praefect.md#migrate-to-gitaly-cluster), for
example, or to migrate a Group Wiki.
example, or to migrate a [group wiki](../user/project/wiki/index.md#group-wikis).
As group repository storage moves are processed, they transition through different states. Values
of `state` are:
- `initial`: The record has been created but the background job has not yet been scheduled.
- `initial`: The record has been created, but the background job has not yet been scheduled.
- `scheduled`: The background job has been scheduled.
- `started`: The group repositories are being copied to the destination storage.
- `replicated`: The group has been moved.
- `failed`: The group repositories failed to copy or the checksums did not match.
- `finished`: The group has been moved and the repositories on the source storage have been deleted.
- `cleanup failed`: The group has been moved but the repositories on the source storage could not be deleted.
- `failed`: The group repositories failed to copy, or the checksums did not match.
- `finished`: The group has been moved, and the repositories on the source storage have been deleted.
- `cleanup failed`: The group has been moved, but the repositories on the source storage could not be deleted.
To ensure data integrity, groups are put in a temporary read-only state for the
duration of the move. During this time, users receive a `The repository is temporarily
read-only. Please try again later.` message if they try to push new commits.
duration of the move. During this time, users receive this message if they try to
push new commits:
```plaintext
The repository is temporarily read-only. Please try again later.
```
This API requires you to [authenticate yourself](index.md#authentication) as an administrator.
For other type of repositories you can read:
APIs are also available to move other types of repositories:
- [Project repository storage moves API](project_repository_storage_moves.md)
- [Snippet repository storage moves API](snippet_repository_storage_moves.md)
- [Project repository storage moves API](project_repository_storage_moves.md).
- [Snippet repository storage moves API](snippet_repository_storage_moves.md).
## Retrieve all group repository storage moves
@ -41,7 +45,7 @@ For other type of repositories you can read:
GET /group_repository_storage_moves
```
By default, `GET` requests return 20 results at a time because the API results
By default, `GET` requests return 20 results at a time, because the API results
are [paginated](index.md#pagination).
Example request:
@ -71,13 +75,13 @@ Example response:
## Retrieve all repository storage moves for a single group
In order to retrieve all the repository storage moves for a single group you can use the following endpoint:
To retrieve all the repository storage moves for a single group you can use the following endpoint:
```plaintext
GET /groups/:group_id/repository_storage_moves
```
By default, `GET` requests return 20 results at a time because the API results
By default, `GET` requests return 20 results at a time, because the API results
are [paginated](index.md#pagination).
Supported attributes:
@ -113,7 +117,8 @@ Example response:
## Get a single group repository storage move
In order to retrieve a single repository storage move throughout all the existing repository storage moves, you can use the following endpoint:
To retrieve a single repository storage move throughout all the existing repository
storage moves, you can use the following endpoint:
```plaintext
GET /group_repository_storage_moves/:repository_storage_id
@ -150,7 +155,8 @@ Example response:
## Get a single repository storage move for a group
Given a group, you can retrieve a specific repository storage move for that group, through the following endpoint:
Given a group, you can retrieve a specific repository storage move for that group,
through the following endpoint:
```plaintext
GET /groups/:group_id/repository_storage_moves/:repository_storage_id
@ -197,7 +203,7 @@ Supported attributes:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `group_id` | integer | yes | ID of the group. |
| `destination_storage_name` | string | no | Name of the destination storage shard. In [GitLab 13.5 and later](https://gitlab.com/gitlab-org/gitaly/-/issues/3209), the storage is selected [automatically based on storage weights](../administration/repository_storage_paths.md#configure-where-new-repositories-are-stored) if not provided. |
| `destination_storage_name` | string | no | Name of the destination storage shard. In [GitLab 13.5 and later](https://gitlab.com/gitlab-org/gitaly/-/issues/3209), the storage is selected [based on storage weights](../administration/repository_storage_paths.md#configure-where-new-repositories-are-stored) if not provided. |
Example request:
@ -238,7 +244,7 @@ Supported attributes:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `source_storage_name` | string | yes | Name of the source storage shard. |
| `destination_storage_name` | string | no | Name of the destination storage shard. The storage is selected [automatically based on storage weights](../administration/repository_storage_paths.md#configure-where-new-repositories-are-stored) if not provided. |
| `destination_storage_name` | string | no | Name of the destination storage shard. The storage is selected [based on storage weights](../administration/repository_storage_paths.md#configure-where-new-repositories-are-stored) if not provided. |
Example request:

View file

@ -437,44 +437,28 @@ RSpec.describe 'Pipeline', :js do
end
end
shared_context 'delete pipeline' do
context 'deleting pipeline' do
context 'when user can not delete' do
before do
visit_pipeline
end
it { expect(page).not_to have_button('Delete') }
end
context 'when deleting' do
before do
group.add_owner(user)
visit_pipeline
click_button 'Delete'
click_button 'Delete pipeline'
end
it 'redirects to pipeline overview page', :sidekiq_inline do
expect(page).to have_content('The pipeline has been deleted')
expect(current_path).to eq(project_pipelines_path(project))
end
end
end
end
context 'when cancel_pipelines_prior_to_destroy is enabled' do
include_context 'delete pipeline'
end
context 'when cancel_pipelines_prior_to_destroy is disabled' do
context 'when user can not delete' do
before do
stub_feature_flags(cancel_pipelines_prior_to_destroy: false)
visit_pipeline
end
include_context 'delete pipeline'
it { expect(page).not_to have_button('Delete') }
end
context 'when deleting' do
before do
group.add_owner(user)
visit_pipeline
click_button 'Delete'
click_button 'Delete pipeline'
end
it 'redirects to pipeline overview page', :sidekiq_inline do
expect(page).to have_content('The pipeline has been deleted')
expect(current_path).to eq(project_pipelines_path(project))
end
end
context 'when pipeline ref does not exist in repository anymore' do

View file

@ -78,18 +78,6 @@ RSpec.describe ::Ci::DestroyPipelineService do
subject
end
context 'when cancel_pipelines_prior_to_destroy is disabled' do
before do
stub_feature_flags(cancel_pipelines_prior_to_destroy: false)
end
it "doesn't cancel the pipeline" do
expect(pipeline).not_to receive(:cancel_running)
subject
end
end
end
end