Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-04-29 06:09:06 +00:00
parent 7a78c31f67
commit 401607eed7
18 changed files with 177 additions and 72 deletions

View File

@ -345,6 +345,7 @@ gem 'warning', '~> 1.2.0'
group :development do
gem 'lefthook', '~> 0.7.0', require: false
gem 'rubocop'
gem 'solargraph', '~> 0.44.3', require: false
gem 'letter_opener_web', '~> 2.0.0'

View File

@ -1644,6 +1644,7 @@ DEPENDENCIES
rspec-retry (~> 0.6.1)
rspec_junit_formatter
rspec_profiling (~> 0.0.6)
rubocop
ruby-fogbugz (~> 0.2.1)
ruby-magic (~> 0.5)
ruby-prof (~> 1.3.0)

View File

@ -1093,8 +1093,8 @@
"description": "The name of a job to execute when the environment is about to be stopped."
},
"action": {
"enum": ["start", "prepare", "stop"],
"description": "Specifies what this job will do. 'start' (default) indicates the job will start the deployment. 'prepare' indicates this will not affect the deployment. 'stop' indicates this will stop the deployment.",
"enum": ["start", "prepare", "stop", "verify"],
"description": "Specifies what this job will do. 'start' (default) indicates the job will start the deployment. 'prepare'/'verify' indicates this will not affect the deployment. 'stop' indicates this will stop the deployment.",
"default": "start"
},
"auto_stop_in": {

View File

@ -1,5 +1,11 @@
<script>
import { GlButton, GlLoadingIcon, GlIntersectionObserver, GlModal, GlFormInput } from '@gitlab/ui';
import {
GlButton,
GlLoadingIcon,
GlIntersectionObserver,
GlModal,
GlSearchBoxByClick,
} from '@gitlab/ui';
import { mapActions, mapState, mapGetters } from 'vuex';
import { n__, __, sprintf } from '~/locale';
import ProviderRepoTableRow from './provider_repo_table_row.vue';
@ -12,7 +18,7 @@ export default {
GlButton,
GlModal,
GlIntersectionObserver,
GlFormInput,
GlSearchBoxByClick,
},
props: {
providerTitle: {
@ -134,13 +140,13 @@ export default {
<slot name="actions"></slot>
<form v-if="filterable" class="gl-ml-auto" novalidate @submit.prevent>
<gl-form-input
<gl-search-box-by-click
data-qa-selector="githubish_import_filter_field"
name="filter"
:placeholder="__('Filter by name')"
autofocus
size="lg"
@keyup.enter="setFilter($event.target.value)"
@submit="setFilter"
@clear="setFilter('')"
/>
</form>
</div>

View File

@ -5,7 +5,7 @@ module Ci
extend ActiveSupport::Concern
def count_user_deployment?
Feature.enabled?(:job_deployment_count) && deployment_name?
deployment_name?
end
def deployment_name?

View File

@ -1,8 +0,0 @@
---
name: job_deployment_count
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79272
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/351591
milestone: '14.8'
type: development
group: group::release
default_enabled: false

View File

@ -72,7 +72,7 @@ the current status of these issues, please refer to the referenced issues and ep
| Issue | Summary | How to avoid |
|:--------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------|
| Gitaly Cluster + Geo - Issues retrying failed syncs | If Gitaly Cluster is used on a Geo secondary site, repositories that have failed to sync could continue to fail when Geo tries to resync them. Recovering from this state requires assistance from support to run manual steps. Work is in-progress to update Gitaly Cluster to [identify repositories with a unique and persistent identifier](https://gitlab.com/gitlab-org/gitaly/-/issues/3485), which is expected to resolve the issue. | No known solution at this time. |
| Praefect unable to insert data into the database due to migrations not being applied after an upgrade | If the database is not kept up to date with completed migrations, then the Praefect node is unable to perform normal operation. | Make sure the Praefect database is up and running with all migrations completed (For example: `/opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml sql-migrate-status` should show a list of all applied migrations). Consider [requesting live upgrade assistance](https://about.gitlab.com/support/scheduling-live-upgrade-assistance.html) so your upgrade plan can be reviewed by support. |
| Praefect unable to insert data into the database due to migrations not being applied after an upgrade | If the database is not kept up to date with completed migrations, then the Praefect node is unable to perform normal operation. | Make sure the Praefect database is up and running with all migrations completed (For example: `/opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml sql-migrate-status` should show a list of all applied migrations). Consider [requesting live upgrade assistance](https://about.gitlab.com/support/scheduling-upgrade-assistance.html) so your upgrade plan can be reviewed by support. |
| Restoring a Gitaly Cluster node from a snapshot in a running cluster | Because the Gitaly Cluster runs with consistent state, introducing a single node that is behind will result in the cluster not being able to reconcile the nodes data and other nodes data | Don't restore a single Gitaly Cluster node from a backup snapshot. If you must restore from backup, it's best to snapshot all Gitaly Cluster nodes at the same time and take a database dump of the Praefect database. |
### Snapshot backup and recovery limitations

View File

@ -645,17 +645,14 @@ To delete a stopped environment in the GitLab UI:
1. Next to the environment you want to delete, select **Delete environment**.
1. On the confirmation dialog box, select **Delete environment**.
### Prepare an environment without creating a deployment
### Access an environment for preparation or verification purposes
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/208655) in GitLab 13.2.
By default, when GitLab CI/CD runs a job for a specific environment, it
triggers a deployment and [(optionally) cancels outdated
deployments](deployment_safety.md#ensure-only-one-deployment-job-runs-at-a-time).
You can define a job that accesses an environment for various purposes, such as verification or preparation. This
effectively bypasses deployment creation, so that you can adjust your CD workflow more accurately.
To use an environment without creating a new deployment, and without
cancelling outdated deployments, append the keyword `action: prepare` to your
job:
To do so, add either `action: prepare` or `action: verify` to the `environment` section of your job:
```yaml
build:
@ -668,8 +665,8 @@ build:
url: https://staging.example.com
```
This gives you access to [environment-scoped variables](#scope-environments-with-specs),
and can be used to [protect builds from unauthorized access](protected_environments.md).
This gives you access to environment-scoped variables, and can be used to protect builds from unauthorized access. Also,
it's effective to avoid the [skip outdated deployment jobs](deployment_safety.md#skip-outdated-deployment-jobs) feature.
### Group similar environments

View File

@ -1559,7 +1559,7 @@ environment.
#### `environment:action`
Use the `action` keyword to specify jobs that prepare, start, or stop environments.
Use the `action` keyword to specify jobs that prepare, start, stop, or verify environments.
**Keyword type**: Job keyword. You can use it only as part of a job.
@ -1568,8 +1568,9 @@ Use the `action` keyword to specify jobs that prepare, start, or stop environmen
| **Value** | **Description** |
|:----------|:----------------|
| `start` | Default value. Indicates that the job starts the environment. The deployment is created after the job starts. |
| `prepare` | Indicates that the job is only preparing the environment. It does not trigger deployments. [Read more about preparing environments](../environments/index.md#prepare-an-environment-without-creating-a-deployment). |
| `prepare` | Indicates that the job is only preparing the environment. It does not trigger deployments. [Read more about preparing environments](../environments/index.md#access-an-environment-for-preparation-or-verification-purposes). |
| `stop` | Indicates that the job stops a deployment. For more detail, read [Stop an environment](../environments/index.md#stop-an-environment). |
| `verify` | Indicates that the job is only verifying the environment. It does not trigger deployments. [Read more about verifying environments](../environments/index.md#access-an-environment-for-preparation-or-verification-purposes). |
**Example of `environment:action`**:

View File

@ -14,7 +14,7 @@ General notes:
- If possible, we recommend you test out the upgrade in a test environment before
updating your production instance. Ideally, your test environment should mimic
your production environment as closely as possible.
- If [working with Support](https://about.gitlab.com/support/scheduling-live-upgrade-assistance.html)
- If [working with Support](https://about.gitlab.com/support/scheduling-upgrade-assistance.html)
to create your plan, share details of your architecture, including:
- How is GitLab installed?
- What is the operating system of the node?

View File

@ -44,7 +44,7 @@ module Gitlab
validates :action,
type: String,
inclusion: { in: %w[start stop prepare], message: 'should be start, stop or prepare' },
inclusion: { in: %w[start stop prepare verify], message: 'should be start, stop, prepare, or verify' },
allow_nil: true
validates :deployment_tier,

View File

@ -2,4 +2,4 @@
category: ci_users
redis_slot: ci_users
aggregation: weekly
feature_flag: job_deployment_count
feature_flag:

View File

@ -25105,21 +25105,6 @@ msgstr ""
msgid "Network:"
msgstr ""
msgid "NetworkPolicies|.yaml mode"
msgstr ""
msgid "NetworkPolicies|Are you sure you want to delete this policy? This action cannot be undone."
msgstr ""
msgid "NetworkPolicies|Create policy"
msgstr ""
msgid "NetworkPolicies|Delete policy"
msgstr ""
msgid "NetworkPolicies|Delete policy: %{policy}"
msgstr ""
msgid "NetworkPolicies|Environment does not have deployment platform"
msgstr ""
@ -25135,21 +25120,9 @@ msgstr ""
msgid "NetworkPolicies|Policy %{policyName} was successfully changed"
msgstr ""
msgid "NetworkPolicies|Rule mode"
msgstr ""
msgid "NetworkPolicies|Rule mode is unavailable for this policy. In some cases, we cannot parse the YAML file back into the rules editor."
msgstr ""
msgid "NetworkPolicies|Save changes"
msgstr ""
msgid "NetworkPolicies|Something went wrong, failed to update policy"
msgstr ""
msgid "NetworkPolicies|Something went wrong, unable to fetch policies"
msgstr ""
msgid "NetworkPolicy|Policy"
msgstr ""
@ -33579,6 +33552,9 @@ msgstr ""
msgid "SecurityOrchestration|%{scanners} %{severities} in an open merge request targeting %{branches}."
msgstr ""
msgid "SecurityOrchestration|.yaml mode"
msgstr ""
msgid "SecurityOrchestration|.yaml preview"
msgstr ""
@ -33609,27 +33585,36 @@ msgstr ""
msgid "SecurityOrchestration|Any scanner finds"
msgstr ""
msgid "SecurityOrchestration|Are you sure you want to delete this policy? This action cannot be undone."
msgstr ""
msgid "SecurityOrchestration|Choose a project"
msgstr ""
msgid "SecurityOrchestration|Create more robust vulnerability rules and apply them to all your projects."
msgstr ""
msgid "SecurityOrchestration|Create policy"
msgstr ""
msgid "SecurityOrchestration|Create security policy"
msgstr ""
msgid "SecurityOrchestration|Define this policy's location, conditions and actions."
msgstr ""
msgid "SecurityOrchestration|Delete policy"
msgstr ""
msgid "SecurityOrchestration|Delete policy: %{policy}"
msgstr ""
msgid "SecurityOrchestration|Description"
msgstr ""
msgid "SecurityOrchestration|Don't show the alert anymore"
msgstr ""
msgid "SecurityOrchestration|Edit network policy"
msgstr ""
msgid "SecurityOrchestration|Edit policy"
msgstr ""
@ -33660,12 +33645,6 @@ msgstr ""
msgid "SecurityOrchestration|Latest scan run against %{agent}"
msgstr ""
msgid "SecurityOrchestration|Network"
msgstr ""
msgid "SecurityOrchestration|New network policy"
msgstr ""
msgid "SecurityOrchestration|New policy"
msgstr ""
@ -33723,6 +33702,12 @@ msgstr ""
msgid "SecurityOrchestration|Require %{approvals} %{plural} from %{approvers} if any of the following occur:"
msgstr ""
msgid "SecurityOrchestration|Rule mode"
msgstr ""
msgid "SecurityOrchestration|Rule mode is unavailable for this policy. In some cases, we cannot parse the YAML file back into the rules editor."
msgstr ""
msgid "SecurityOrchestration|Rules"
msgstr ""
@ -33735,6 +33720,9 @@ msgstr ""
msgid "SecurityOrchestration|Runs a %{action} scan"
msgstr ""
msgid "SecurityOrchestration|Save changes"
msgstr ""
msgid "SecurityOrchestration|Scan Execution"
msgstr ""
@ -33789,6 +33777,9 @@ msgstr ""
msgid "SecurityOrchestration|Select security project"
msgstr ""
msgid "SecurityOrchestration|Something went wrong, unable to fetch policies"
msgstr ""
msgid "SecurityOrchestration|Sorry, your filter produced no results."
msgstr ""

View File

@ -210,6 +210,10 @@ module QA
"#{api_get_path}/wikis"
end
def api_releases_path
"#{api_get_path}/releases"
end
def api_post_body
post_body = {
name: name,
@ -394,9 +398,22 @@ module QA
api_post_to(api_wikis_path, title: title, content: content)
end
def releases
response = api_get_from(api_releases_path)
parse_body(response)
end
def create_release(tag, ref = default_branch, **params)
api_post_to(api_releases_path, tag_name: tag, ref: ref, **params)
end
# Uses the API to wait until a pull mirroring update is successful (pull mirroring is treated as an import)
def wait_for_pull_mirroring
mirror_succeeded = Support::Retrier.retry_until(max_duration: 180, raise_on_failure: false, sleep_interval: 1) do
mirror_succeeded = Support::Retrier.retry_until(
max_duration: 180,
raise_on_failure: false,
sleep_interval: 1
) do
reload!
api_resource[:import_status] == "finished"
end
@ -407,7 +424,11 @@ module QA
def remove_via_api!
super
Support::Retrier.retry_until(max_duration: 60, sleep_interval: 1, message: "Waiting for #{self.class.name} to be removed") do
Support::Retrier.retry_until(
max_duration: 60,
sleep_interval: 1,
message: "Waiting for #{self.class.name} to be removed"
) do
!exists?
rescue InternalServerError
# Retry on transient errors that are likely to be due to race conditions between concurrent delete operations

View File

@ -0,0 +1,71 @@
# frozen_string_literal: true
require_relative 'gitlab_project_migration_common'
module QA
RSpec.describe 'Manage' do
describe 'Gitlab migration' do
include_context 'with gitlab project migration'
context 'with release' do
let(:tag) { 'v0.0.1' }
let(:source_project_with_readme) { true }
let(:milestone) do
Resource::ProjectMilestone.fabricate_via_api! do |resource|
resource.project = source_project
resource.api_client = api_client
end
end
let(:source_release) { comparable_release(source_project.releases.find { |r| r[:tag_name] == tag }) }
let(:imported_release) { comparable_release(imported_releases.find { |r| r[:tag_name] == tag }) }
let(:imported_releases) { imported_project.releases }
# Update release object to be comparable
#
# Convert objects with project specific attributes like paths and urls to be comparable
#
# @param [Hash] release
# @return [Hash]
def comparable_release(release)
release&.except(:_links, :evidences)&.merge(
{
author: release[:author].except(:web_url),
commit: release[:commit].except(:web_url),
commit_path: release[:commit_path].split("/-/").last,
tag_path: release[:tag_path].split("/-/").last,
assets: release[:assets].merge({
sources: release.dig(:assets, :sources).map do |source|
source.merge({ url: source[:url].split("/-/").last })
end
}),
milestones: release[:milestones].map do |milestone|
milestone.except(:id, :project_id).merge({ web_url: milestone[:web_url].split("/-/").last })
end
# TODO: Add back evidence testing once implemented
# https://gitlab.com/gitlab-org/gitlab/-/issues/360567
# evidences: release[:evidences].map do |evidence|
# evidence.merge({ filepath: evidence[:filepath].split("/-/").last })
# end
}
)
end
before do
source_project.create_release(tag, milestones: [milestone.title])
end
it(
'successfully imports project release',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/360243'
) do
expect_import_finished
expect(imported_releases.size).to eq(1), "Expected to have 1 migrated release"
expect(imported_release).to eq(source_release)
end
end
end
end
end

View File

@ -1,4 +1,4 @@
import { GlLoadingIcon, GlButton, GlIntersectionObserver, GlFormInput } from '@gitlab/ui';
import { GlLoadingIcon, GlButton, GlIntersectionObserver, GlSearchBoxByClick } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Vue, { nextTick } from 'vue';
import Vuex from 'vuex';
@ -15,7 +15,7 @@ describe('ImportProjectsTable', () => {
const findFilterField = () =>
wrapper
.findAllComponents(GlFormInput)
.findAllComponents(GlSearchBoxByClick)
.wrappers.find((w) => w.attributes('placeholder') === 'Filter by name');
const providerTitle = 'THE PROVIDER';

View File

@ -113,6 +113,17 @@ RSpec.describe Gitlab::Ci::Config::Entry::Environment do
end
end
context 'when verify action is used' do
let(:config) do
{ name: 'production',
action: 'verify' }
end
it 'is valid' do
expect(entry).to be_valid
end
end
context 'when wrong action type is used' do
let(:config) do
{ name: 'production',
@ -148,7 +159,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Environment do
describe '#errors' do
it 'contains error about invalid action' do
expect(entry.errors)
.to include 'environment action should be start, stop or prepare'
.to include 'environment action should be start, stop, prepare, or verify'
end
end
end

View File

@ -116,6 +116,19 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Deployment do
end
end
context 'when job has environment attribute with verify action' do
let(:attributes) do
{
environment: 'production',
options: { environment: { name: 'production', action: 'verify' } }
}
end
it 'returns nothing' do
is_expected.to be_nil
end
end
context 'when job does not have environment attribute' do
let(:attributes) { { name: 'test' } }