Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-12-21 21:15:53 +00:00
parent a67ddb1c4f
commit e5f909c8ce
4 changed files with 42 additions and 6 deletions

View file

@ -67,7 +67,7 @@ GitLab creates a squash commit message with this template:
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/20263) in GitLab 14.5.
> - [Added](https://gitlab.com/gitlab-org/gitlab/-/issues/346805) `first_commit` and `first_multiline_commit` variables in GitLab 14.6.
> - [Added](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75639) `url`, `approved_by`, and `merged_by` variables in GitLab 14.6.
> - [Added](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75639) `url`, `approved_by`, and `merged_by` variables in GitLab 14.7.
Commit message templates support these variables:
@ -82,8 +82,8 @@ Commit message templates support these variables:
| `%{first_commit}` | Full message of the first commit in merge request diff. | `Update README.md` |
| `%{first_multiline_commit}` | Full message of the first commit that's not a merge commit and has more than one line in message body. Merge Request title if all commits aren't multiline. | `Update README.md`<br><br>`Improved project description in readme file.` |
| `%{url}` | Full URL to the merge request. | `https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1` |
| `%{approved_by}` | Line-separated list of the merge request approvers. This value is not updated until the first page refresh after an approval. | `Approved-by: User A <user@example.com>` <br> `Approved-by: User B <user@gitlab.com>` |
| `%{merged_by}` | User who merged the merge request. | `Some User <user@example.com>` |
| `%{approved_by}` | Line-separated list of the merge request approvers. This value is not updated until the first page refresh after an approval. | `Approved-by: Sidney Jones <sjones@example.com>` <br> `Approved-by: Zhang Wei <zwei@example.com>` |
| `%{merged_by}` | User who merged the merge request. | `Alex Garcia <agarcia@example.com>` |
Empty variables that are the only word in a line are removed, along with all newline characters preceding it.

View file

@ -401,7 +401,7 @@ module QA
end
def gitlab_agentk_version
ENV.fetch('GITLAB_AGENTK_VERSION', 'v14.4.0')
ENV.fetch('GITLAB_AGENTK_VERSION', 'v14.5.0')
end
def transient_trials

View file

@ -418,6 +418,30 @@ module QA
shell "docker exec #{@praefect} bash -c '#{cmd}'"
end
# set_replication_factor assigns or unassigns random storage nodes as necessary to reach the desired replication factor for a repository
def set_replication_factor(relative_path, virtual_storage, factor)
cmd = "/opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml set-replication-factor -repository #{relative_path} -virtual-storage #{virtual_storage} -replication-factor #{factor}"
shell "docker exec #{@praefect} bash -c '#{cmd}'"
end
# get_replication_storages retrieves a list of currently assigned storages for a repository
def get_replication_storages(relative_path, virtual_storage)
storage_repositories = []
query = "SELECT storage FROM repository_assignments WHERE relative_path='#{relative_path}' AND virtual_storage='#{virtual_storage}';"
shell(sql_to_docker_exec_cmd(query)) { |line| storage_repositories << line.strip }
# Returned data from query will be in format
# storage
# --------
# gitaly1
# gitaly3
# gitaly2
# (3 rows)
#
# remove 2 header rows and last 2 rows from query response (including blank line)
storage_repositories[2..-3]
end
def add_repo_to_disk(node, repo_path)
cmd = "GIT_DIR=. git init --initial-branch=main /var/opt/gitlab/git-data/repositories/#{repo_path}"
shell "docker exec --user git #{node} bash -c '#{cmd}'"

View file

@ -2,7 +2,7 @@
module QA
RSpec.describe 'Create' do
context 'Praefect repository commands', :orchestrated, :gitaly_cluster, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/347415', type: :investigating } do
context 'Praefect repository commands', :orchestrated, :gitaly_cluster do
let(:praefect_manager) { Service::PraefectManager.new }
let(:repo1) { { "relative_path" => "@hashed/repo1.git", "storage" => "gitaly1", "virtual_storage" => "default" } }
@ -22,7 +22,7 @@ module QA
praefect_manager.remove_repository_from_praefect_database(repo2["relative_path"])
end
it 'allows admin to manage difference between praefect database and disk state', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347606' do
it 'allows admin to manage difference between praefect database and disk state', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347606', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/347415', type: :investigating } do
# Some repos are on disk that praefect is not aware of
untracked_repositories = praefect_manager.list_untracked_repositories
expect(untracked_repositories).to include(repo1)
@ -59,6 +59,18 @@ module QA
untracked_repositories = praefect_manager.list_untracked_repositories
expect(untracked_repositories).not_to include(repo1)
end
it 'allows admin to control the number of replicas of data', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2434' do
praefect_manager.track_repository_in_praefect(repo1['relative_path'], repo1['storage'], repo1['virtual_storage'])
praefect_manager.set_replication_factor(repo1['relative_path'], repo1['virtual_storage'], 2)
replication_storages = praefect_manager.get_replication_storages(repo1['relative_path'], repo1['virtual_storage'])
expect(replication_storages).to have_attributes(size: 2)
praefect_manager.set_replication_factor(repo1['relative_path'], repo1['virtual_storage'], 3)
replication_storages = praefect_manager.get_replication_storages(repo1['relative_path'], repo1['virtual_storage'])
expect(replication_storages).to eq(%w(gitaly1 gitaly2 gitaly3))
end
end
end
end