Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-03-07 00:15:23 +00:00
parent d074e68dd1
commit 5ced7473bb
4 changed files with 53 additions and 21 deletions

View File

@ -352,15 +352,15 @@ class Project < ApplicationRecord
has_many :pending_builds, class_name: 'Ci::PendingBuild'
has_many :builds, class_name: 'Ci::Build', inverse_of: :project
has_many :processables, class_name: 'Ci::Processable', inverse_of: :project
has_many :build_trace_chunks, class_name: 'Ci::BuildTraceChunk', through: :builds, source: :trace_chunks
has_many :build_trace_chunks, class_name: 'Ci::BuildTraceChunk', through: :builds, source: :trace_chunks, dependent: :restrict_with_error
has_many :build_report_results, class_name: 'Ci::BuildReportResult', inverse_of: :project
has_many :job_artifacts, class_name: 'Ci::JobArtifact'
has_many :pipeline_artifacts, class_name: 'Ci::PipelineArtifact', inverse_of: :project
has_many :job_artifacts, class_name: 'Ci::JobArtifact', dependent: :restrict_with_error
has_many :pipeline_artifacts, class_name: 'Ci::PipelineArtifact', inverse_of: :project, dependent: :restrict_with_error
has_many :runner_projects, class_name: 'Ci::RunnerProject', inverse_of: :project
has_many :runners, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
has_many :variables, class_name: 'Ci::Variable'
has_many :triggers, class_name: 'Ci::Trigger'
has_many :secure_files, class_name: 'Ci::SecureFile'
has_many :secure_files, class_name: 'Ci::SecureFile', dependent: :restrict_with_error
has_many :environments
has_many :environments_for_dashboard, -> { from(with_rank.unfoldered.available, :environments).where('rank <= 3') }, class_name: 'Environment'
has_many :deployments

View File

@ -163,21 +163,6 @@ WARNING:
The Unleash client **must** be given a user ID for the feature to be enabled for
target users. See the [Ruby example](#ruby-application-example) below.
## Search for Code References **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/300299) in GitLab 14.4.
Search your project and find any references of a feature flag in your
code so that you can clean it up when it's time to remove the feature flag.
To search for code references of a feature flag:
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Deployments > Feature Flags**.
1. Edit the feature flag you want to remove.
1. Select **More actions** (**{ellipsis_v}**).
1. Select **Search code references**.
### User List
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35930) in GitLab 13.1.
@ -235,6 +220,21 @@ To remove users from a user list:
1. Select **Edit** (**{pencil}**) next to the list you want to change.
1. Select **Remove** (**{remove}**) next to the ID you want to remove.
## Search for Code References **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/300299) in GitLab 14.4.
Search your project and find any references of a feature flag in your
code so that you can clean it up when it's time to remove the feature flag.
To search for code references of a feature flag:
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Deployments > Feature Flags**.
1. Edit the feature flag you want to remove.
1. Select **More actions** (**{ellipsis_v}**).
1. Select **Search code references**.
## Rollout strategy (legacy)
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/8240) in GitLab 12.2.

View File

@ -113,7 +113,7 @@ You can filter the **Issues** list to individual instances by their ID. For exam
> Moved to GitLab Premium in 13.9.
To filter merge requests by an individual approver, you can type (or select from
To filter merge requests by an individual eligible approver ([Codeowner](../project/code_owners.md)), you can type (or select from
the dropdown list) **Approver** and select the user.
![Filter MRs by an approver](img/filter_approver_merge_requests_v14_6.png)

View File

@ -134,7 +134,7 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to have_many(:packages).class_name('Packages::Package') }
it { is_expected.to have_many(:package_files).class_name('Packages::PackageFile') }
it { is_expected.to have_many(:debian_distributions).class_name('Packages::Debian::ProjectDistribution').dependent(:destroy) }
it { is_expected.to have_many(:pipeline_artifacts) }
it { is_expected.to have_many(:pipeline_artifacts).dependent(:restrict_with_error) }
it { is_expected.to have_many(:terraform_states).class_name('Terraform::State').inverse_of(:project) }
it { is_expected.to have_many(:timelogs) }
it { is_expected.to have_many(:error_tracking_errors).class_name('ErrorTracking::Error') }
@ -142,6 +142,9 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to have_many(:pending_builds).class_name('Ci::PendingBuild') }
it { is_expected.to have_many(:ci_feature_usages).class_name('Projects::CiFeatureUsage') }
it { is_expected.to have_many(:bulk_import_exports).class_name('BulkImports::Export') }
it { is_expected.to have_many(:job_artifacts).dependent(:restrict_with_error) }
it { is_expected.to have_many(:build_trace_chunks).through(:builds).dependent(:restrict_with_error) }
it { is_expected.to have_many(:secure_files).class_name('Ci::SecureFile').dependent(:restrict_with_error) }
# GitLab Pages
it { is_expected.to have_many(:pages_domains) }
@ -202,6 +205,35 @@ RSpec.describe Project, factory_default: :keep do
end
end
context 'when project has object storage attached to it' do
let_it_be(:project) { create(:project) }
before do
create(:ci_job_artifact, project: project)
end
context 'when associated object storage object is not deleted before the project' do
it 'adds an error to project', :aggregate_failures do
expect { project.destroy! }.to raise_error(ActiveRecord::RecordNotDestroyed)
expect(project.errors).not_to be_empty
expect(project.errors.first.message).to eq("Cannot delete record because dependent job artifacts exist")
end
end
context 'when associated object storage object is deleted before the project' do
before do
project.job_artifacts.first.destroy!
end
it 'deletes the project' do
project.destroy!
expect { project.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
context 'when creating a new project' do
let_it_be(:project) { create(:project) }