Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab/issue_templates/Feature Flag Roll Out.md6
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue12
-rw-r--r--app/models/ci/job_artifact.rb6
-rw-r--r--app/models/project.rb2
-rw-r--r--app/models/project_services/pipelines_email_service.rb6
-rw-r--r--app/serializers/merge_requests/pipeline_entity.rb2
-rw-r--r--app/services/pages/delete_service.rb2
-rw-r--r--app/services/projects/update_pages_configuration_service.rb2
-rw-r--r--app/services/projects/update_pages_service.rb2
-rw-r--r--app/views/shared/access_tokens/_table.html.haml2
-rw-r--r--app/workers/pages_update_configuration_worker.rb2
-rw-r--r--changelogs/unreleased/301159-add-local-storage.yml5
-rw-r--r--changelogs/unreleased/btn-default-mirror-update.yml5
-rw-r--r--changelogs/unreleased/btn-sm-revoke.yml5
-rw-r--r--changelogs/unreleased/kp-show-pipeline-finish-timestamp.yml5
-rw-r--r--changelogs/unreleased/rollout-pat-revoke-gma.yml5
-rw-r--r--changelogs/unreleased/ui-text-pipelines-email.yml5
-rw-r--r--config/feature_flags/development/erase_traces_from_already_archived_jobs_when_archiving_again.yml8
-rw-r--r--config/gitlab.yml.example7
-rw-r--r--config/initializers/1_settings.rb3
-rw-r--r--config/initializers/pages_storage_check.rb14
-rw-r--r--danger/product_intelligence/Dangerfile7
-rw-r--r--doc/administration/index.md58
-rw-r--r--doc/development/documentation/index.md22
-rw-r--r--doc/development/testing_guide/end_to_end/index.md13
-rw-r--r--doc/update/restore_after_failure.md3
-rw-r--r--doc/user/group/saml_sso/group_managed_accounts.md10
-rw-r--r--lib/gitlab/ci/trace.rb25
-rw-r--r--lib/gitlab/pages/settings.rb16
-rw-r--r--lib/gitlab/pages/stores/local_store.rb15
-rw-r--r--lib/gitlab/pages_transfer.rb4
-rw-r--r--lib/gitlab/usage/metric_definition.rb4
-rw-r--r--lib/gitlab/utils.rb2
-rw-r--r--locale/gitlab.pot20
-rw-r--r--spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js8
-rw-r--r--spec/initializers/pages_storage_check_spec.rb94
-rw-r--r--spec/lib/gitlab/ci/trace_spec.rb2
-rw-r--r--spec/lib/gitlab/pages/settings_spec.rb42
-rw-r--r--spec/lib/gitlab/pages/stores/local_store_spec.rb25
-rw-r--r--spec/lib/gitlab/pages_transfer_spec.rb4
-rw-r--r--spec/lib/gitlab/usage/metric_definition_spec.rb21
-rw-r--r--spec/lib/gitlab/utils_spec.rb2
-rw-r--r--spec/models/ci/job_artifact_spec.rb16
-rw-r--r--spec/models/project_spec.rb2
-rw-r--r--spec/serializers/merge_requests/pipeline_entity_spec.rb2
-rw-r--r--spec/services/ci/archive_trace_service_spec.rb46
-rw-r--r--spec/services/pages/delete_service_spec.rb (renamed from spec/services/pages/delete_services_spec.rb)14
-rw-r--r--spec/services/projects/update_pages_configuration_service_spec.rb2
-rw-r--r--spec/services/projects/update_pages_service_spec.rb2
-rw-r--r--spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb11
-rw-r--r--spec/workers/pages_update_configuration_worker_spec.rb2
51 files changed, 487 insertions, 113 deletions
diff --git a/.gitlab/issue_templates/Feature Flag Roll Out.md b/.gitlab/issue_templates/Feature Flag Roll Out.md
index 16d7446fc21..fd2edd45dc8 100644
--- a/.gitlab/issue_templates/Feature Flag Roll Out.md
+++ b/.gitlab/issue_templates/Feature Flag Roll Out.md
@@ -64,17 +64,13 @@ Are there any other stages or teams involved that need to be kept in the loop?
**Initial Rollout**
-*Preperation Phase*
+*Preparation Phase*
- [ ] Enable on staging (`/chatops run feature set feature_name true --staging`)
- [ ] Test on staging
- [ ] Ensure that documentation has been updated ([More info](https://docs.gitlab.com/ee/development/documentation/feature_flags.html#features-that-became-enabled-by-default))
-- [ ] Coordinate a time to enable the flag with the SRE oncall and release managers
- - In `#production` by pinging `@sre-oncall`
- - In `#g_delivery` by pinging `@release-managers`
-
- [ ] Announce on the issue an estimated time this will be enabled on GitLab.com
*Partial Rollout Phase*
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue
index 370e2f62275..1248a891ed9 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue
@@ -14,6 +14,7 @@ import { s__, n__ } from '~/locale';
import PipelineMiniGraph from '~/pipelines/components/pipelines_list/pipeline_mini_graph.vue';
import PipelineArtifacts from '~/pipelines/components/pipelines_list/pipelines_artifacts.vue';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
+import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue';
import { MT_MERGE_STRATEGY } from '../constants';
@@ -28,6 +29,7 @@ export default {
GlTooltip,
PipelineArtifacts,
PipelineMiniGraph,
+ TimeAgoTooltip,
TooltipOnTruncate,
LinkedPipelinesMiniList: () =>
import('ee_component/vue_shared/components/linked_pipelines_mini_list.vue'),
@@ -114,6 +116,9 @@ export default {
showSourceBranch() {
return Boolean(this.pipeline.ref.branch);
},
+ finishedAt() {
+ return this.pipeline?.details?.finished_at;
+ },
coverageDeltaClass() {
const delta = this.pipelineCoverageDelta;
if (delta && parseFloat(delta) > 0) {
@@ -226,6 +231,13 @@ export default {
class="label-branch label-truncate gl-font-weight-normal"
/>
</template>
+ <template v-if="finishedAt">
+ <time-ago-tooltip
+ :time="finishedAt"
+ tooltip-placement="bottom"
+ data-testid="finished-at"
+ />
+ </template>
</div>
<div v-if="pipeline.coverage" class="coverage" data-testid="pipeline-coverage">
{{ s__('Pipeline|Test coverage') }} {{ pipeline.coverage }}%
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb
index b2c1423c3cb..50e21a1c323 100644
--- a/app/models/ci/job_artifact.rb
+++ b/app/models/ci/job_artifact.rb
@@ -290,8 +290,12 @@ module Ci
end
end
+ def archived_trace_exists?
+ file&.file&.exists?
+ end
+
def self.archived_trace_exists_for?(job_id)
- where(job_id: job_id).trace.take&.file&.file&.exists?
+ where(job_id: job_id).trace.take&.archived_trace_exists?
end
def self.max_artifact_size(type:, project:)
diff --git a/app/models/project.rb b/app/models/project.rb
index 2431b40a8be..3a136e5fe1f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1814,7 +1814,7 @@ class Project < ApplicationRecord
# TODO: remove this method https://gitlab.com/gitlab-org/gitlab/-/issues/320775
# rubocop: disable CodeReuse/ServiceClass
def legacy_remove_pages
- return unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+ return unless ::Settings.pages.local_store.enabled
# Projects with a missing namespace cannot have their pages removed
return unless namespace
diff --git a/app/models/project_services/pipelines_email_service.rb b/app/models/project_services/pipelines_email_service.rb
index 8af4cd952c9..90e5533ab7f 100644
--- a/app/models/project_services/pipelines_email_service.rb
+++ b/app/models/project_services/pipelines_email_service.rb
@@ -25,11 +25,11 @@ class PipelinesEmailService < Service
end
def title
- _('Pipelines emails')
+ _('Pipeline status emails')
end
def description
- _('Email the pipelines status to a list of recipients.')
+ _('Email the pipeline status to a list of recipients.')
end
def self.to_param
@@ -64,7 +64,7 @@ class PipelinesEmailService < Service
[
{ type: 'textarea',
name: 'recipients',
- placeholder: _('Emails separated by comma'),
+ help: _('Comma-separated list of email addresses.'),
required: true },
{ type: 'checkbox',
name: 'notify_only_broken_pipelines' },
diff --git a/app/serializers/merge_requests/pipeline_entity.rb b/app/serializers/merge_requests/pipeline_entity.rb
index 21180ab82ab..bdf5cb160b2 100644
--- a/app/serializers/merge_requests/pipeline_entity.rb
+++ b/app/serializers/merge_requests/pipeline_entity.rb
@@ -36,6 +36,8 @@ class MergeRequests::PipelineEntity < Grape::Entity
end
expose :stages, using: StageEntity
+
+ expose :finished_at
end
# Coverage isn't always necessary (e.g. when displaying project pipelines in
diff --git a/app/services/pages/delete_service.rb b/app/services/pages/delete_service.rb
index 3dc9254718e..c4009dcc4ec 100644
--- a/app/services/pages/delete_service.rb
+++ b/app/services/pages/delete_service.rb
@@ -9,7 +9,7 @@ module Pages
DestroyPagesDeploymentsWorker.perform_async(project.id)
# TODO: remove this call https://gitlab.com/gitlab-org/gitlab/-/issues/320775
- PagesRemoveWorker.perform_async(project.id) if Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+ PagesRemoveWorker.perform_async(project.id) if ::Settings.pages.local_store.enabled
end
end
end
diff --git a/app/services/projects/update_pages_configuration_service.rb b/app/services/projects/update_pages_configuration_service.rb
index 01539d58545..b63903c6c61 100644
--- a/app/services/projects/update_pages_configuration_service.rb
+++ b/app/services/projects/update_pages_configuration_service.rb
@@ -11,7 +11,7 @@ module Projects
end
def execute
- return success unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+ return success unless ::Settings.pages.local_store.enabled
# If the pages were never deployed, we can't write out the config, as the
# directory would not exist.
diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb
index 2b59fdd539d..3915b62aa65 100644
--- a/app/services/projects/update_pages_service.rb
+++ b/app/services/projects/update_pages_service.rb
@@ -83,7 +83,7 @@ module Projects
def deploy_to_legacy_storage(artifacts_path)
# path today used by one project can later be used by another
# so we can't really scope this feature flag by project or group
- return unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+ return unless ::Settings.pages.local_store.enabled
# Create temporary directory in which we will extract the artifacts
make_secure_tmp_dir(tmp_path) do |tmp_path|
diff --git a/app/views/shared/access_tokens/_table.html.haml b/app/views/shared/access_tokens/_table.html.haml
index d7c74255578..2a2a1a911af 100644
--- a/app/views/shared/access_tokens/_table.html.haml
+++ b/app/views/shared/access_tokens/_table.html.haml
@@ -43,7 +43,7 @@
- else
%span.token-never-expires-label= _('Never')
%td= token.scopes.present? ? token.scopes.join(', ') : _('no scopes selected')
- %td= link_to _('Revoke'), revoke_route_helper.call(token), method: :put, class: 'gl-button btn btn-danger float-right qa-revoke-button', data: { confirm: _('Are you sure you want to revoke this %{type}? This action cannot be undone.') % { type: type } }
+ %td= link_to _('Revoke'), revoke_route_helper.call(token), method: :put, class: 'gl-button btn btn-danger btn-sm float-right qa-revoke-button', data: { confirm: _('Are you sure you want to revoke this %{type}? This action cannot be undone.') % { type: type } }
- else
.settings-message.text-center
= no_active_tokens_message
diff --git a/app/workers/pages_update_configuration_worker.rb b/app/workers/pages_update_configuration_worker.rb
index 6e82e2099c7..ca5016dc782 100644
--- a/app/workers/pages_update_configuration_worker.rb
+++ b/app/workers/pages_update_configuration_worker.rb
@@ -7,7 +7,7 @@ class PagesUpdateConfigurationWorker
feature_category :pages
def self.perform_async(*args)
- return unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+ return unless ::Settings.pages.local_store.enabled
super(*args)
end
diff --git a/changelogs/unreleased/301159-add-local-storage.yml b/changelogs/unreleased/301159-add-local-storage.yml
new file mode 100644
index 00000000000..23a83cbe906
--- /dev/null
+++ b/changelogs/unreleased/301159-add-local-storage.yml
@@ -0,0 +1,5 @@
+---
+title: Added local_store to Pages settings in gitlab.yml file
+merge_request: 55470
+author:
+type: added
diff --git a/changelogs/unreleased/btn-default-mirror-update.yml b/changelogs/unreleased/btn-default-mirror-update.yml
new file mode 100644
index 00000000000..5b416c33405
--- /dev/null
+++ b/changelogs/unreleased/btn-default-mirror-update.yml
@@ -0,0 +1,5 @@
+---
+title: Add btn-default for mirror update button
+merge_request: 57978
+author: Yogi (@yo)
+type: changed
diff --git a/changelogs/unreleased/btn-sm-revoke.yml b/changelogs/unreleased/btn-sm-revoke.yml
new file mode 100644
index 00000000000..7f8f74568a5
--- /dev/null
+++ b/changelogs/unreleased/btn-sm-revoke.yml
@@ -0,0 +1,5 @@
+---
+title: Reduce button size for revoke button in PAT page
+merge_request: 57989
+author: Yogi (@yo)
+type: changed
diff --git a/changelogs/unreleased/kp-show-pipeline-finish-timestamp.yml b/changelogs/unreleased/kp-show-pipeline-finish-timestamp.yml
new file mode 100644
index 00000000000..bc2eb39b274
--- /dev/null
+++ b/changelogs/unreleased/kp-show-pipeline-finish-timestamp.yml
@@ -0,0 +1,5 @@
+---
+title: Show pipeline finished timestamp on MR widget
+merge_request: 58618
+author:
+type: added
diff --git a/changelogs/unreleased/rollout-pat-revoke-gma.yml b/changelogs/unreleased/rollout-pat-revoke-gma.yml
new file mode 100644
index 00000000000..06b6ac7c67f
--- /dev/null
+++ b/changelogs/unreleased/rollout-pat-revoke-gma.yml
@@ -0,0 +1,5 @@
+---
+title: Personal access token revoke for managed accounts (feature flag removed)
+merge_request: 56427
+author:
+type: added
diff --git a/changelogs/unreleased/ui-text-pipelines-email.yml b/changelogs/unreleased/ui-text-pipelines-email.yml
new file mode 100644
index 00000000000..2a02962ee51
--- /dev/null
+++ b/changelogs/unreleased/ui-text-pipelines-email.yml
@@ -0,0 +1,5 @@
+---
+title: Update pipeline email service UI text
+merge_request: 58377
+author:
+type: other
diff --git a/config/feature_flags/development/erase_traces_from_already_archived_jobs_when_archiving_again.yml b/config/feature_flags/development/erase_traces_from_already_archived_jobs_when_archiving_again.yml
new file mode 100644
index 00000000000..ed6d86df37b
--- /dev/null
+++ b/config/feature_flags/development/erase_traces_from_already_archived_jobs_when_archiving_again.yml
@@ -0,0 +1,8 @@
+---
+name: erase_traces_from_already_archived_jobs_when_archiving_again
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56353
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326679
+milestone: "13.11"
+type: development
+group: group::continuous integration
+default_enabled: true
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index d36c9d215a8..18d91407b20 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -408,6 +408,10 @@ production: &base
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
region: us-east-1
+ local_store:
+ enabled: true
+ # The location where pages are stored (default: shared/pages).
+ # path: shared/pages
## Mattermost
## For enabling Add to Mattermost button
@@ -1395,6 +1399,9 @@ test:
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
region: us-east-1
+ local_store:
+ enabled: true
+ path: tmp/tests/pages
repositories:
storages:
default:
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 4683d2a3161..19b43a8c084 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -310,6 +310,9 @@ Settings.pages['secret_file'] ||= Rails.root.join('.gitlab_pages_secret')
# this will allow us to easier migrate existing instances with NFS
Settings.pages['storage_path'] = Settings.pages['path']
Settings.pages['object_store'] = ObjectStoreSettings.legacy_parse(Settings.pages['object_store'])
+Settings.pages['local_store'] ||= Settingslogic.new({})
+Settings.pages['local_store']['path'] = Settings.absolute(Settings.pages['local_store']['path'] || File.join(Settings.shared['path'], "pages"))
+Settings.pages['local_store']['enabled'] = true if Settings.pages['local_store']['enabled'].nil?
#
# GitLab documentation
diff --git a/config/initializers/pages_storage_check.rb b/config/initializers/pages_storage_check.rb
new file mode 100644
index 00000000000..8e0e0464ed6
--- /dev/null
+++ b/config/initializers/pages_storage_check.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+# This is to make sure at least one storage strategy for Pages is enabled.
+
+pages = Settings.pages
+
+return unless pages['enabled'] && pages['local_store']
+
+local_store_enabled = Gitlab::Utils.to_boolean(pages['local_store']['enabled'])
+object_store_enabled = Gitlab::Utils.to_boolean(pages['object_store']['enabled'])
+
+if !local_store_enabled && !object_store_enabled
+ raise "Please enable at least one of the two Pages storage strategy (local_store or object_store) in your config/gitlab.yml."
+end
diff --git a/danger/product_intelligence/Dangerfile b/danger/product_intelligence/Dangerfile
index d2ce2b31e64..d2bed7629ff 100644
--- a/danger/product_intelligence/Dangerfile
+++ b/danger/product_intelligence/Dangerfile
@@ -3,15 +3,13 @@
CHANGED_FILES_MESSAGE = <<~MSG
For the following files, a review from the [Data team and Product Intelligence team](https://gitlab.com/groups/gitlab-org/growth/product-intelligence/engineers/-/group_members?with_inherited_permissions=exclude) is recommended
-Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/development/usage_ping.html) and reach out to %<engineers_group>s group for a review.
+Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/development/usage_ping.html).
%<changed_files>s
MSG
-ENGINEERS_GROUP = '@gitlab-org/growth/product-intelligence/engineers'
-
UPDATE_DICTIONARY_MESSAGE = <<~MSG
When adding, changing, or updating metrics, please update the [Metrics Dictionary](https://docs.gitlab.com/ee/development/usage_ping/dictionary.html)
@@ -84,8 +82,7 @@ matching_changed_files = usage_data_changed_files +
if matching_changed_files.any?
- mention = "`#{ENGINEERS_GROUP}`"
- warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files), engineers_group: mention)
+ warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files))
fail format(UPDATE_DICTIONARY_MESSAGE) if required_dictionary_update_changed_files.any? && dictionary_changed_file.empty?
diff --git a/doc/administration/index.md b/doc/administration/index.md
index 15a3bee4004..a7d81ca1543 100644
--- a/doc/administration/index.md
+++ b/doc/administration/index.md
@@ -7,7 +7,12 @@ description: 'Learn how to install, configure, update, and maintain your GitLab
# Administrator documentation **(FREE SELF)**
-Learn how to administer your self-managed GitLab instance.
+If you use GitLab.com, only GitLab team members have access to administration tools and settings.
+If you use a self-managed GitLab instance, learn how to administer it.
+
+Only administrator users can access GitLab administration tools and settings.
+
+## Available distributions
GitLab has two product distributions available through [different subscriptions](https://about.gitlab.com/pricing/):
@@ -15,17 +20,10 @@ GitLab has two product distributions available through [different subscriptions]
- The open core [GitLab Enterprise Edition (EE)](https://gitlab.com/gitlab-org/gitlab).
You can [install either GitLab CE or GitLab EE](https://about.gitlab.com/install/ce-or-ee/).
-However, the features you have access to depend on your chosen [subscription](https://about.gitlab.com/pricing/).
+However, the features you have access to depend on your chosen subscription.
GitLab Community Edition installations have access only to Free features.
-Non-administrator users can't access GitLab administration tools and settings.
-
-GitLab.com is administered by GitLab, Inc., and only GitLab team members have
-access to its administration tools and settings. Users of GitLab.com should
-instead refer to the [User documentation](../user/index.md) for GitLab
-configuration and usage documentation.
-
## Installing and maintaining GitLab
Learn how to install, configure, update, and maintain your GitLab instance.
@@ -70,8 +68,8 @@ Learn how to install, configure, update, and maintain your GitLab instance.
- [Broadcast Messages](../user/admin_area/broadcast_messages.md): Send messages
to GitLab users through the UI.
- [Elasticsearch](../integration/elasticsearch.md): Enable Elasticsearch to
- empower Advanced Search. Useful when you deal with a huge amount of data.
-- [External Classification Policy Authorization](../user/admin_area/settings/external_authorization.md).
+ empower Advanced Search. Use when you deal with a huge amount of data.
+- [External Classification Policy Authorization](../user/admin_area/settings/external_authorization.md)
- [Upload a license](../user/admin_area/license.md): Upload a license to unlock
features that are in paid tiers of GitLab.
- [Admin Area](../user/admin_area/index.md): for self-managed instance-wide
@@ -109,15 +107,15 @@ Learn how to install, configure, update, and maintain your GitLab instance.
### Upgrading or downgrading GitLab
-- [Upgrade from GitLab CE to GitLab EE](../update/index.md#upgrading-between-editions): learn how to upgrade GitLab Community Edition to GitLab Enterprise Editions.
+- [Upgrade from GitLab CE to GitLab EE](../update/index.md#upgrading-between-editions): Learn how to upgrade GitLab Community Edition to GitLab Enterprise Editions.
- [Downgrade from GitLab EE to GitLab CE](../downgrade_ee_to_ce/index.md): Learn how to downgrade GitLab Enterprise Editions to Community Edition.
### GitLab platform integrations
- [Mattermost](https://docs.gitlab.com/omnibus/gitlab-mattermost/): Integrate with [Mattermost](https://mattermost.com), an open source, private cloud workplace for web messaging.
-- [PlantUML](integration/plantuml.md): Create simple diagrams in AsciiDoc and Markdown documents
+- [PlantUML](integration/plantuml.md): Create diagrams in AsciiDoc and Markdown documents
created in snippets, wikis, and repositories.
-- [Web terminals](integration/terminal.md): Provide terminal access to your applications deployed to Kubernetes from within GitLab CI/CD [environments](../ci/environments/index.md#web-terminals).
+- [Web terminals](integration/terminal.md): Provide terminal access to your applications deployed to Kubernetes from GitLab CI/CD [environments](../ci/environments/index.md#web-terminals).
## User settings and permissions
@@ -126,12 +124,12 @@ Learn how to install, configure, update, and maintain your GitLab instance.
- [Sign-up restrictions](../user/admin_area/settings/sign_up_restrictions.md): block email addresses of specific domains, or whitelist only specific domains.
- [Access restrictions](../user/admin_area/settings/visibility_and_access_controls.md#enabled-git-access-protocols): Define which Git access protocols can be used to talk to GitLab (SSH, HTTP, HTTPS).
- [Authentication and Authorization](auth/README.md): Configure external authentication with LDAP, SAML, CAS, and additional providers.
- - [Sync LDAP](auth/ldap/index.md).
- - [Kerberos authentication](../integration/kerberos.md).
+ - [Sync LDAP](auth/ldap/index.md)
+ - [Kerberos authentication](../integration/kerberos.md)
- See also other [authentication](../topics/authentication/index.md#gitlab-administrators) topics (for example, enforcing 2FA).
-- [Email users](../tools/email.md): Email GitLab users from within GitLab.
+- [Email users](../tools/email.md): Email GitLab users from GitLab.
- [User Cohorts](../user/admin_area/user_cohorts.md): Display the monthly cohorts of new users and their activities over time.
-- [Audit events](audit_events.md): View the changes made within the GitLab server for:
+- [Audit events](audit_events.md): View the changes made on the GitLab server for:
- Groups and projects.
- Instances.
- [Auditor users](auditor_users.md): Users with read-only access to all projects, groups, and other resources on the GitLab instance.
@@ -160,7 +158,7 @@ Learn how to install, configure, update, and maintain your GitLab instance.
### Repository settings
-- [Repository checks](repository_checks.md): Periodic Git repository checks.
+- [Repository checks](repository_checks.md): Check your repository for data corruption.
- [Repository storage paths](repository_storage_paths.md): Manage the paths used to store repositories.
- [Repository storage types](repository_storage_types.md): Information about the different repository storage types.
- [Repository storage Rake tasks](raketasks/storage.md): A collection of Rake tasks to list and migrate existing projects and attachments associated with it from Legacy storage to Hashed storage.
@@ -171,7 +169,7 @@ Learn how to install, configure, update, and maintain your GitLab instance.
- [Enable/disable GitLab CI/CD](../ci/enable_or_disable_ci.md#site-wide-admin-setting): Enable or disable GitLab CI/CD for your instance.
- [GitLab CI/CD administration settings](../user/admin_area/settings/continuous_integration.md): Enable or disable Auto DevOps site-wide and define the artifacts' max size and expiration time.
-- [External Pipeline Validation](external_pipeline_validation.md): Enable, disable and configure external pipeline validation.
+- [External Pipeline Validation](external_pipeline_validation.md): Enable, disable, and configure external pipeline validation.
- [Job artifacts](job_artifacts.md): Enable, disable, and configure job artifacts (a set of files and directories which are outputted by a job when it completes successfully).
- [Job logs](job_logs.md): Information about the job logs.
- [Register runners](../ci/runners/README.md#types-of-runners): Learn how to register and configure runners.
@@ -216,7 +214,7 @@ Learn how to install, configure, update, and maintain your GitLab instance.
## Troubleshooting
-- [Debugging tips](troubleshooting/debug.md): Tips to debug problems when things go wrong
+- [Debugging tips](troubleshooting/debug.md): Tips to debug problems when things go wrong.
- [Log system](logs.md): Where to look for logs.
- [Sidekiq Troubleshooting](troubleshooting/sidekiq.md): Debug when Sidekiq appears hung and is not processing jobs.
- [Troubleshooting Elasticsearch](troubleshooting/elasticsearch.md)
@@ -225,27 +223,27 @@ Learn how to install, configure, update, and maintain your GitLab instance.
### Support Team Docs
-The GitLab Support Team has collected a lot of information about troubleshooting GitLab
-instances. These documents are normally used by the Support Team itself, or by customers
+The GitLab Support Team has collected a lot of information about troubleshooting GitLab.
+The following documents are used by the Support Team or by customers
with direct guidance from a Support Team member. GitLab administrators may find the
-information useful for troubleshooting, but if you are experiencing trouble with your
+information useful for troubleshooting. However, if you are experiencing trouble with your
GitLab instance, you should check your [support options](https://about.gitlab.com/support/)
before referring to these documents.
WARNING:
-Using the commands listed in the documentation below could result in data loss or
-other damage to a GitLab instance, and should only be used by experienced administrators
+The commands in the following documentation might result in data loss or
+other damage to a GitLab instance. They should be used only by experienced administrators
who are aware of the risks.
-- [Useful diagnostics tools](troubleshooting/diagnostics_tools.md)
-- [Useful Linux commands](troubleshooting/linux_cheat_sheet.md)
+- [Diagnostics tools](troubleshooting/diagnostics_tools.md)
+- [Linux commands](troubleshooting/linux_cheat_sheet.md)
- [Troubleshooting Kubernetes](troubleshooting/kubernetes_cheat_sheet.md)
- [Troubleshooting PostgreSQL](troubleshooting/postgresql.md)
- [Guide to test environments](troubleshooting/test_environments.md) (for Support Engineers)
- [GitLab Rails console commands](troubleshooting/gitlab_rails_cheat_sheet.md) (for Support Engineers)
- [Troubleshooting SSL](troubleshooting/ssl.md)
-- Useful links:
- - [GitLab Developer Docs](../development/README.md)
+- Related links:
+ - [GitLab Developer Documentation](../development/README.md)
- [Repairing and recovering broken Git repositories](https://git.seveas.net/repairing-and-recovering-broken-git-repositories.html)
- [Testing with OpenSSL](https://www.feistyduck.com/library/openssl-cookbook/online/ch-testing-with-openssl.html)
- [`strace` zine](https://wizardzines.com/zines/strace/)
diff --git a/doc/development/documentation/index.md b/doc/development/documentation/index.md
index a36f899ac02..f10396570a2 100644
--- a/doc/development/documentation/index.md
+++ b/doc/development/documentation/index.md
@@ -218,7 +218,7 @@ To add a redirect:
If you don't want to use the Rake task, you can use the following template.
However, the file paths must be relative to the `doc` or `docs` directory.
-
+
Replace the value of `redirect_to` with the new file path and `YYYY-MM-DD`
with the date the file should be removed.
@@ -421,8 +421,6 @@ The live preview is currently enabled for the following projects:
If your merge request has docs changes, you can use the manual `review-docs-deploy` job
to deploy the docs review app for your merge request.
-As the job creates a pipeline in `gitlab-org/gitlab-docs`, you need at least Maintainer
-permission in the `gitlab-org/gitlab-docs` project in order to successfully run the job.
![Manual trigger a docs build](img/manual_build_docs.png)
@@ -461,19 +459,11 @@ If you want to know the in-depth details, here's what's really happening:
1. You manually run the `review-docs-deploy` job in a merge request.
1. The job runs the [`scripts/trigger-build`](https://gitlab.com/gitlab-org/gitlab/blob/master/scripts/trigger-build)
- script with the `docs deploy` flag, which in turn:
- 1. Takes your branch name and applies the following:
- - The `docs-preview-` prefix is added.
- - The product slug is used to know the project the review app originated
- from.
- - The number of the merge request is added so that you can know by the
- `gitlab-docs` branch name the merge request it originated from.
- 1. The remote branch is then created if it doesn't exist (meaning you can
- re-run the manual job as many times as you want and this step is skipped).
- 1. A new cross-project pipeline is triggered in the docs project.
- 1. The preview URL is shown both at the job output and in the merge request
- widget. You also get the link to the remote pipeline.
-1. In the docs project, the pipeline is created and it
+ script with the `docs deploy` flag, which triggers the "Triggered from `gitlab-org/gitlab` 'review-docs-deploy' job"
+ pipeline trigger in the `gitlab-org/gitlab-docs` project for the `$DOCS_BRANCH` (defaults to `master`).
+1. The preview URL is shown both at the job output and in the merge request
+ widget. You also get the link to the remote pipeline.
+1. In the `gitlab-org/gitlab-docs` project, the pipeline is created and it
[skips the test jobs](https://gitlab.com/gitlab-org/gitlab-docs/blob/8d5d5c750c602a835614b02f9db42ead1c4b2f5e/.gitlab-ci.yml#L50-55)
to lower the build time.
1. Once the docs site is built, the HTML files are uploaded as artifacts.
diff --git a/doc/development/testing_guide/end_to_end/index.md b/doc/development/testing_guide/end_to_end/index.md
index c03b744a908..e6da4771e55 100644
--- a/doc/development/testing_guide/end_to_end/index.md
+++ b/doc/development/testing_guide/end_to_end/index.md
@@ -94,6 +94,19 @@ subgraph "`gitlab-org/gitlab-qa-mirror` pipeline"
Please note, we plan to [add more specific information](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/156)
about the tests included in each job/scenario that runs in `gitlab-org/gitlab-qa-mirror`.
+NOTE:
+You may have noticed that we use `gitlab-org/build/omnibus-gitlab-mirror` instead of
+`gitlab-org/omnibus-gitlab`, and `gitlab-org/gitlab-qa-mirror` instead of `gitlab-org/gitlab-qa`.
+This is due to technical limitations in the GitLab permission model: the ability to run a pipeline
+against a protected branch is controlled by the ability to push/merge to this branch.
+This means that for developers to be able to trigger a pipeline for the default branch in
+`gitlab-org/omnibus-gitlab`/`gitlab-org/gitlab-qa`, they would need to have Maintainer permission in those projects.
+For security reasons and implications, we couldn't open up the default branch to all the Developers.
+Hence we created these mirrors where Developers and Maintainers are allowed to push/merge to the default branch.
+This problem was discovered in <https://gitlab.com/gitlab-org/gitlab-qa/-/issues/63#note_107175160> and the "mirror"
+work-around was suggested in <https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4717>.
+A feature proposal to segregate access control regarding running pipelines from ability to push/merge was also created at <https://gitlab.com/gitlab-org/gitlab/-/issues/24585>.
+
#### With Pipeline for Merged Results
In a Pipeline for Merged Results, the pipeline runs on a new ref that contains the merge result of the source and target branch.
diff --git a/doc/update/restore_after_failure.md b/doc/update/restore_after_failure.md
index 64e92c802f2..6da9f11509a 100644
--- a/doc/update/restore_after_failure.md
+++ b/doc/update/restore_after_failure.md
@@ -12,7 +12,8 @@ However, it's important to know how to recover when problems do arise.
## Roll back to an earlier version and restore a backup
In some cases after a failed upgrade, the fastest solution is to roll back to
-the previous version you were using.
+the previous version you were using. We recommend this path because the failed
+upgrade will likely have made database changes that can not be readily reverted.
First, roll back the code or package. For source installations this involves
checking out the older version (branch or tag). For Omnibus installations this
diff --git a/doc/user/group/saml_sso/group_managed_accounts.md b/doc/user/group/saml_sso/group_managed_accounts.md
index 9f2cafd456b..a9b1901bc8c 100644
--- a/doc/user/group/saml_sso/group_managed_accounts.md
+++ b/doc/user/group/saml_sso/group_managed_accounts.md
@@ -84,6 +84,16 @@ To access the Credentials inventory of a group, navigate to **{shield}** **Secur
This feature is similar to the [Credentials inventory for self-managed instances](../../admin_area/credentials_inventory.md).
+### Revoke a group-managed account's personal access token
+
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214811) in GitLab 13.5.
+> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/267184) in GitLab 13.10.
+
+Group owners can revoke the personal access tokens of accounts in their group. To do so, select
+the Personal Access Tokens tab, and select Revoke.
+
+When a personal access token is revoked, the group-managed account user is notified by email.
+
## Limiting lifetime of personal access tokens of users in Group-managed accounts **(ULTIMATE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/118893) in GitLab 12.10.
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb
index 94f7da8eebe..c25c4339c35 100644
--- a/lib/gitlab/ci/trace.rb
+++ b/lib/gitlab/ci/trace.rb
@@ -93,6 +93,10 @@ module Gitlab
end
end
+ def erase_trace_chunks!
+ job.trace_chunks.fast_destroy_all # Destroy chunks of a live trace
+ end
+
def erase!
##
# Erase the archived trace
@@ -100,7 +104,7 @@ module Gitlab
##
# Erase the live trace
- job.trace_chunks.fast_destroy_all # Destroy chunks of a live trace
+ erase_trace_chunks!
FileUtils.rm_f(current_path) if current_path # Remove a trace file of a live trace
job.erase_old_trace! if job.has_old_trace? # Remove a trace in database of a live trace
ensure
@@ -180,9 +184,14 @@ module Gitlab
end
def unsafe_archive!
- raise AlreadyArchivedError, 'Could not archive again' if trace_artifact
raise ArchiveError, 'Job is not finished yet' unless job.complete?
+ if trace_artifact
+ unsafe_trace_cleanup! if Feature.enabled?(:erase_traces_from_already_archived_jobs_when_archiving_again, job.project, default_enabled: :yaml)
+
+ raise AlreadyArchivedError, 'Could not archive again'
+ end
+
if job.trace_chunks.any?
Gitlab::Ci::Trace::ChunkedIO.new(job) do |stream|
archive_stream!(stream)
@@ -201,6 +210,18 @@ module Gitlab
end
end
+ def unsafe_trace_cleanup!
+ return unless trace_artifact
+
+ if trace_artifact.archived_trace_exists?
+ # An archive already exists, so make sure to remove the trace chunks
+ erase_trace_chunks!
+ else
+ # An archive already exists, but its associated file does not, so remove it
+ trace_artifact.destroy!
+ end
+ end
+
def in_write_lock(&blk)
lock_key = "trace:write:lock:#{job.id}"
in_lock(lock_key, ttl: LOCK_TTL, retries: LOCK_RETRIES, sleep_sec: LOCK_SLEEP, &blk)
diff --git a/lib/gitlab/pages/settings.rb b/lib/gitlab/pages/settings.rb
index 8650a80a85e..0e77259a0de 100644
--- a/lib/gitlab/pages/settings.rb
+++ b/lib/gitlab/pages/settings.rb
@@ -6,12 +6,22 @@ module Gitlab
DiskAccessDenied = Class.new(StandardError)
def path
- if ::Gitlab::Runtime.web_server? && !::Gitlab::Runtime.test_suite?
- raise DiskAccessDenied
- end
+ ::Gitlab::ErrorTracking.track_exception(DiskAccessDenied.new) if disk_access_denied?
super
end
+
+ def local_store
+ @local_store ||= ::Gitlab::Pages::Stores::LocalStore.new(super)
+ end
+
+ private
+
+ def disk_access_denied?
+ return true unless ::Settings.pages.local_store&.enabled
+
+ ::Gitlab::Runtime.web_server? && !::Gitlab::Runtime.test_suite?
+ end
end
end
end
diff --git a/lib/gitlab/pages/stores/local_store.rb b/lib/gitlab/pages/stores/local_store.rb
new file mode 100644
index 00000000000..68a7ebaceff
--- /dev/null
+++ b/lib/gitlab/pages/stores/local_store.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Pages
+ module Stores
+ class LocalStore < ::SimpleDelegator
+ def enabled
+ return false unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+
+ super
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/pages_transfer.rb b/lib/gitlab/pages_transfer.rb
index c1ccfae3e1f..ae5539c03b1 100644
--- a/lib/gitlab/pages_transfer.rb
+++ b/lib/gitlab/pages_transfer.rb
@@ -12,7 +12,7 @@ module Gitlab
class Async
METHODS.each do |meth|
define_method meth do |*args|
- next unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+ next unless Settings.pages.local_store.enabled
PagesTransferWorker.perform_async(meth, args)
end
@@ -21,7 +21,7 @@ module Gitlab
METHODS.each do |meth|
define_method meth do |*args|
- next unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
+ next unless Settings.pages.local_store.enabled
super(*args)
end
diff --git a/lib/gitlab/usage/metric_definition.rb b/lib/gitlab/usage/metric_definition.rb
index 98b9d2a42b4..05b06227039 100644
--- a/lib/gitlab/usage/metric_definition.rb
+++ b/lib/gitlab/usage/metric_definition.rb
@@ -5,7 +5,7 @@ module Gitlab
class MetricDefinition
METRIC_SCHEMA_PATH = Rails.root.join('config', 'metrics', 'schema.json')
BASE_REPO_PATH = 'https://gitlab.com/gitlab-org/gitlab/-/blob/master'
- DEPRECATED_METRIC_STATUSES = %w[deprecated removed].to_set.freeze
+ SKIP_VALIDATION_STATUSES = %w[deprecated removed].to_set.freeze
attr_reader :path
attr_reader :attributes
@@ -107,7 +107,7 @@ module Gitlab
end
def skip_validation?
- !!attributes[:skip_validation] || @skip_validation || DEPRECATED_METRIC_STATUSES.include?(attributes[:status])
+ !!attributes[:skip_validation] || @skip_validation || SKIP_VALIDATION_STATUSES.include?(attributes[:status])
end
end
end
diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb
index 29f02a5912a..c1a57566640 100644
--- a/lib/gitlab/utils.rb
+++ b/lib/gitlab/utils.rb
@@ -99,6 +99,8 @@ module Gitlab
end
def to_boolean(value, default: nil)
+ value = value.to_s if [0, 1].include?(value)
+
return value if [true, false].include?(value)
return true if value =~ /^(true|t|yes|y|1|on)$/i
return false if value =~ /^(false|f|no|n|0|off)$/i
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 75054e1b9af..436fe7549c3 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -7665,6 +7665,9 @@ msgstr ""
msgid "ComboSearch is not defined"
msgstr ""
+msgid "Comma-separated list of email addresses."
+msgstr ""
+
msgid "Comma-separated, e.g. '1.1.1.1, 2.2.2.0/24'"
msgstr ""
@@ -11469,7 +11472,7 @@ msgstr ""
msgid "Email sent"
msgstr ""
-msgid "Email the pipelines status to a list of recipients."
+msgid "Email the pipeline status to a list of recipients."
msgstr ""
msgid "Email updates (optional)"
@@ -11520,9 +11523,6 @@ msgstr ""
msgid "Emails sent to %{email} are also supported."
msgstr ""
-msgid "Emails separated by comma"
-msgstr ""
-
msgid "EmailsOnPushService|Disable code diffs"
msgstr ""
@@ -22625,6 +22625,9 @@ msgstr ""
msgid "Pipeline ran in fork of project"
msgstr ""
+msgid "Pipeline status emails"
+msgstr ""
+
msgid "Pipeline subscriptions"
msgstr ""
@@ -22712,9 +22715,6 @@ msgstr ""
msgid "Pipelines charts"
msgstr ""
-msgid "Pipelines emails"
-msgstr ""
-
msgid "Pipelines for merge requests are configured. A detached pipeline runs in the context of the merge request, and not against the merged result. Learn more in the documentation for Pipelines for Merged Results."
msgstr ""
@@ -25439,6 +25439,9 @@ msgstr ""
msgid "Recent searches"
msgstr ""
+msgid "Recently used"
+msgstr ""
+
msgid "Reconfigure"
msgstr ""
@@ -28713,6 +28716,9 @@ msgstr ""
msgid "Something went wrong while fetching description changes. Please try again."
msgstr ""
+msgid "Something went wrong while fetching details"
+msgstr ""
+
msgid "Something went wrong while fetching group member contributions"
msgstr ""
diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js
index 918b0973ff5..924dc37aab9 100644
--- a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js
+++ b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js
@@ -27,6 +27,7 @@ describe('MRWidgetPipeline', () => {
const findPipelineID = () => wrapper.findByTestId('pipeline-id');
const findPipelineInfoContainer = () => wrapper.findByTestId('pipeline-info-container');
const findCommitLink = () => wrapper.findByTestId('commit-link');
+ const findPipelineFinishedAt = () => wrapper.findByTestId('finished-at');
const findPipelineMiniGraph = () => wrapper.findComponent(PipelineMiniGraph);
const findAllPipelineStages = () => wrapper.findAllComponents(PipelineStage);
const findPipelineCoverage = () => wrapper.findByTestId('pipeline-coverage');
@@ -91,6 +92,13 @@ describe('MRWidgetPipeline', () => {
expect(findCommitLink().attributes('href')).toBe(mockData.pipeline.commit.commit_path);
});
+ it('should render pipeline finished timestamp', () => {
+ expect(findPipelineFinishedAt().attributes()).toMatchObject({
+ title: 'Apr 7, 2017 2:00pm GMT+0000',
+ datetime: mockData.pipeline.details.finished_at,
+ });
+ });
+
it('should render pipeline graph', () => {
expect(findPipelineMiniGraph().exists()).toBe(true);
expect(findAllPipelineStages()).toHaveLength(mockData.pipeline.details.stages.length);
diff --git a/spec/initializers/pages_storage_check_spec.rb b/spec/initializers/pages_storage_check_spec.rb
new file mode 100644
index 00000000000..a76002dbdcf
--- /dev/null
+++ b/spec/initializers/pages_storage_check_spec.rb
@@ -0,0 +1,94 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'pages storage check' do
+ let(:main_error_message) { "Please enable at least one of the two Pages storage strategy (local_store or object_store) in your config/gitlab.yml." }
+
+ subject(:initializer) { load Rails.root.join('config/initializers/pages_storage_check.rb') }
+
+ context 'when local store does not exist yet' do
+ before do
+ Settings.pages['local_store'] = nil
+ end
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when pages is not enabled' do
+ before do
+ Settings.pages['enabled'] = false
+ end
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when pages is enabled' do
+ before do
+ Settings.pages['enabled'] = true
+ Settings.pages['local_store'] = Settingslogic.new({})
+ end
+
+ context 'when pages object storage is not enabled' do
+ before do
+ Settings.pages['object_store']['enabled'] = false
+ end
+
+ context 'when pages local storage is not enabled' do
+ it 'raises an exception' do
+ Settings.pages['local_store']['enabled'] = false
+
+ expect { subject }.to raise_error(main_error_message)
+ end
+ end
+
+ context 'when pages local storage is enabled' do
+ it 'is true' do
+ Settings.pages['local_store']['enabled'] = true
+
+ expect(subject).to be_truthy
+ end
+ end
+ end
+
+ context 'when pages object storage is enabled' do
+ before do
+ Settings.pages['object_store']['enabled'] = true
+ end
+
+ context 'when pages local storage is not enabled' do
+ it 'is true' do
+ Settings.pages['local_store']['enabled'] = false
+
+ expect(subject).to be_truthy
+ end
+ end
+
+ context 'when pages local storage is enabled' do
+ it 'is true' do
+ Settings.pages['local_store']['enabled'] = true
+
+ expect(subject).to be_truthy
+ end
+ end
+ end
+
+ context 'when using integers instead of booleans' do
+ it 'is true' do
+ Settings.pages['local_store']['enabled'] = 1
+ Settings.pages['object_store']['enabled'] = 0
+
+ expect(subject).to be_truthy
+ end
+ end
+
+ context 'when both enabled attributes are not set' do
+ it 'raises an exception' do
+ Settings.pages['local_store']['enabled'] = nil
+ Settings.pages['object_store']['enabled'] = nil
+
+ expect { subject }.to raise_error(main_error_message)
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ci/trace_spec.rb b/spec/lib/gitlab/ci/trace_spec.rb
index fe1ea454055..0fe7c731f27 100644
--- a/spec/lib/gitlab/ci/trace_spec.rb
+++ b/spec/lib/gitlab/ci/trace_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::Ci::Trace, :clean_gitlab_redis_shared_state, factory_default: :keep do
let_it_be(:project) { create_default(:project).freeze }
- let_it_be_with_reload(:build) { create(:ci_build) }
+ let_it_be_with_reload(:build) { create(:ci_build, :success) }
let(:trace) { described_class.new(build) }
describe "associations" do
diff --git a/spec/lib/gitlab/pages/settings_spec.rb b/spec/lib/gitlab/pages/settings_spec.rb
index f5424a98153..c89bf9ff206 100644
--- a/spec/lib/gitlab/pages/settings_spec.rb
+++ b/spec/lib/gitlab/pages/settings_spec.rb
@@ -3,11 +3,11 @@
require 'spec_helper'
RSpec.describe Gitlab::Pages::Settings do
+ let(:settings) { double(path: 'the path', local_store: 'local store') }
+
describe '#path' do
subject { described_class.new(settings).path }
- let(:settings) { double(path: 'the path') }
-
it { is_expected.to eq('the path') }
context 'when running under a web server outside of test mode' do
@@ -16,9 +16,43 @@ RSpec.describe Gitlab::Pages::Settings do
allow(::Gitlab::Runtime).to receive(:web_server?).and_return(true)
end
- it 'raises a DiskAccessDenied exception' do
- expect { subject }.to raise_error(described_class::DiskAccessDenied)
+ it 'logs a DiskAccessDenied error' do
+ expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
+ instance_of(described_class::DiskAccessDenied)
+ )
+
+ subject
+ end
+ end
+
+ context 'when local_store settings does not exist yet' do
+ before do
+ allow(Settings.pages).to receive(:local_store).and_return(nil)
end
+
+ it { is_expected.to eq('the path') }
+ end
+
+ context 'when local store exists but legacy storage is disabled' do
+ before do
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
+ end
+
+ it 'logs a DiskAccessDenied error' do
+ expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
+ instance_of(described_class::DiskAccessDenied)
+ )
+
+ subject
+ end
+ end
+ end
+
+ describe '#local_store' do
+ subject(:local_store) { described_class.new(settings).local_store }
+
+ it 'is an instance of Gitlab::Pages::Stores::LocalStore' do
+ expect(local_store).to be_a(Gitlab::Pages::Stores::LocalStore)
end
end
end
diff --git a/spec/lib/gitlab/pages/stores/local_store_spec.rb b/spec/lib/gitlab/pages/stores/local_store_spec.rb
new file mode 100644
index 00000000000..adab81b2589
--- /dev/null
+++ b/spec/lib/gitlab/pages/stores/local_store_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Pages::Stores::LocalStore do
+ describe '#enabled' do
+ let(:local_store) { double(enabled: true) }
+
+ subject(:local_store_enabled) { described_class.new(local_store).enabled }
+
+ context 'when the pages_update_legacy_storage FF is disabled' do
+ before do
+ stub_feature_flags(pages_update_legacy_storage: false)
+ end
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when the pages_update_legacy_storage FF is enabled' do
+ it 'is equal to the original value' do
+ expect(local_store_enabled).to eq(local_store.enabled)
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/pages_transfer_spec.rb b/spec/lib/gitlab/pages_transfer_spec.rb
index 552a2e0701c..021d9cb7318 100644
--- a/spec/lib/gitlab/pages_transfer_spec.rb
+++ b/spec/lib/gitlab/pages_transfer_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Gitlab::PagesTransfer do
end
it 'does nothing if legacy storage is disabled' do
- stub_feature_flags(pages_update_legacy_storage: false)
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
described_class::METHODS.each do |meth|
expect(PagesTransferWorker)
@@ -72,7 +72,7 @@ RSpec.describe Gitlab::PagesTransfer do
end
it 'does nothing if legacy storage is disabled' do
- stub_feature_flags(pages_update_legacy_storage: false)
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
subject.public_send(meth, *args)
diff --git a/spec/lib/gitlab/usage/metric_definition_spec.rb b/spec/lib/gitlab/usage/metric_definition_spec.rb
index 8dcb9ac0536..445a4ce972b 100644
--- a/spec/lib/gitlab/usage/metric_definition_spec.rb
+++ b/spec/lib/gitlab/usage/metric_definition_spec.rb
@@ -87,26 +87,21 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
describe 'statuses' do
using RSpec::Parameterized::TableSyntax
- where(:status, :raise_exception) do
- 'deprecated' | false
- 'removed' | false
+ where(:status, :skip_validation?) do
+ 'deprecated' | true
+ 'removed' | true
'data_available' | false
- 'random' | true
+ 'implemented' | false
+ 'not_used' | false
end
with_them do
subject(:validation) do
- described_class.new(path, attributes.merge( { status: status } )).validate!
+ described_class.new(path, attributes.merge( { status: status } )).send(:skip_validation?)
end
- it "checks for valid/invalid statuses" do
- if raise_exception
- expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).at_least(:once).with(instance_of(Gitlab::Usage::Metric::InvalidMetricError))
- else
- expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception)
- end
-
- validation
+ it 'returns true/false for skip_validation' do
+ expect(validation).to eq(skip_validation?)
end
end
end
diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb
index 2f6900e5118..11dba610faf 100644
--- a/spec/lib/gitlab/utils_spec.rb
+++ b/spec/lib/gitlab/utils_spec.rb
@@ -192,6 +192,7 @@ RSpec.describe Gitlab::Utils do
expect(to_boolean('YeS')).to be(true)
expect(to_boolean('t')).to be(true)
expect(to_boolean('1')).to be(true)
+ expect(to_boolean(1)).to be(true)
expect(to_boolean('ON')).to be(true)
expect(to_boolean('FaLse')).to be(false)
@@ -199,6 +200,7 @@ RSpec.describe Gitlab::Utils do
expect(to_boolean('NO')).to be(false)
expect(to_boolean('n')).to be(false)
expect(to_boolean('0')).to be(false)
+ expect(to_boolean(0)).to be(false)
expect(to_boolean('oFF')).to be(false)
end
diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb
index 796947be4c8..cdb123573f1 100644
--- a/spec/models/ci/job_artifact_spec.rb
+++ b/spec/models/ci/job_artifact_spec.rb
@@ -195,6 +195,22 @@ RSpec.describe Ci::JobArtifact do
end
end
+ describe '#archived_trace_exists?' do
+ subject { artifact.archived_trace_exists? }
+
+ context 'when the file exists' do
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when the file does not exist' do
+ before do
+ artifact.file.remove!
+ end
+
+ it { is_expected.to be_falsy }
+ end
+ end
+
describe '.for_sha' do
let(:first_pipeline) { create(:ci_pipeline) }
let(:second_pipeline) { create(:ci_pipeline, project: first_pipeline.project, sha: Digest::SHA1.hexdigest(SecureRandom.hex)) }
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index b99ae8f0642..263ab6526a0 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -4228,7 +4228,7 @@ RSpec.describe Project, factory_default: :keep do
end
it 'does nothing if updates on legacy storage are disabled' do
- stub_feature_flags(pages_update_legacy_storage: false)
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
expect(Gitlab::PagesTransfer).not_to receive(:new)
expect(PagesWorker).not_to receive(:perform_in)
diff --git a/spec/serializers/merge_requests/pipeline_entity_spec.rb b/spec/serializers/merge_requests/pipeline_entity_spec.rb
index b91d5e7679f..03a049401c1 100644
--- a/spec/serializers/merge_requests/pipeline_entity_spec.rb
+++ b/spec/serializers/merge_requests/pipeline_entity_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe MergeRequests::PipelineEntity do
)
expect(subject[:commit]).to include(:short_id, :commit_path)
expect(subject[:ref]).to include(:branch)
- expect(subject[:details]).to include(:artifacts, :name, :status, :stages)
+ expect(subject[:details]).to include(:artifacts, :name, :status, :stages, :finished_at)
expect(subject[:details][:status]).to include(:icon, :favicon, :text, :label, :tooltip)
expect(subject[:flags]).to include(:merge_request_pipeline)
end
diff --git a/spec/services/ci/archive_trace_service_spec.rb b/spec/services/ci/archive_trace_service_spec.rb
index 07ea314debc..a4f498f17c3 100644
--- a/spec/services/ci/archive_trace_service_spec.rb
+++ b/spec/services/ci/archive_trace_service_spec.rb
@@ -24,6 +24,52 @@ RSpec.describe Ci::ArchiveTraceService, '#execute' do
it 'does not create an archived trace' do
expect { subject }.not_to change { Ci::JobArtifact.trace.count }
end
+
+ context 'when live trace chunks still exist' do
+ before do
+ create(:ci_build_trace_chunk, build: job)
+ end
+
+ context 'when the feature flag `erase_traces_from_already_archived_jobs_when_archiving_again` is enabled' do
+ before do
+ stub_feature_flags(erase_traces_from_already_archived_jobs_when_archiving_again: true)
+ end
+
+ it 'removes the trace chunks' do
+ expect { subject }.to change { job.trace_chunks.count }.to(0)
+ end
+
+ context 'when associated data does not exist' do
+ before do
+ job.job_artifacts_trace.file.remove!
+ end
+
+ it 'removes the trace artifact' do
+ expect { subject }.to change { job.reload.job_artifacts_trace }.to(nil)
+ end
+ end
+ end
+
+ context 'when the feature flag `erase_traces_from_already_archived_jobs_when_archiving_again` is disabled' do
+ before do
+ stub_feature_flags(erase_traces_from_already_archived_jobs_when_archiving_again: false)
+ end
+
+ it 'does not remove the trace chunks' do
+ expect { subject }.not_to change { job.trace_chunks.count }
+ end
+
+ context 'when associated data does not exist' do
+ before do
+ job.job_artifacts_trace.file.remove!
+ end
+
+ it 'does not remove the trace artifact' do
+ expect { subject }.not_to change { job.reload.job_artifacts_trace }
+ end
+ end
+ end
+ end
end
context 'when job does not have trace' do
diff --git a/spec/services/pages/delete_services_spec.rb b/spec/services/pages/delete_service_spec.rb
index f1edf93b0c1..a79c89a1c35 100644
--- a/spec/services/pages/delete_services_spec.rb
+++ b/spec/services/pages/delete_service_spec.rb
@@ -16,7 +16,10 @@ RSpec.describe Pages::DeleteService do
it 'deletes published pages', :sidekiq_inline do
expect(project.pages_deployed?).to be(true)
- expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return true
+ expect_next_instance_of(Gitlab::PagesTransfer) do |pages_transfer|
+ expect(pages_transfer).to receive(:rename_project).and_return true
+ end
+
expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, project.namespace.full_path, anything)
service.execute
@@ -24,11 +27,10 @@ RSpec.describe Pages::DeleteService do
expect(project.pages_deployed?).to be(false)
end
- it "doesn't remove anything from the legacy storage if updates on it are disabled", :sidekiq_inline do
- stub_feature_flags(pages_update_legacy_storage: false)
+ it "doesn't remove anything from the legacy storage", :sidekiq_inline do
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
expect(project.pages_deployed?).to be(true)
-
expect(PagesWorker).not_to receive(:perform_in)
service.execute
@@ -69,7 +71,9 @@ RSpec.describe Pages::DeleteService do
expect(project.pages_deployed?).to eq(false)
expect(project.pages_domains.count).to eq(0)
- expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return true
+ expect_next_instance_of(Gitlab::PagesTransfer) do |pages_transfer|
+ expect(pages_transfer).to receive(:rename_project).and_return true
+ end
Sidekiq::Worker.drain_all
end
diff --git a/spec/services/projects/update_pages_configuration_service_spec.rb b/spec/services/projects/update_pages_configuration_service_spec.rb
index 9ef66a10f0d..58939ef4ada 100644
--- a/spec/services/projects/update_pages_configuration_service_spec.rb
+++ b/spec/services/projects/update_pages_configuration_service_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe Projects::UpdatePagesConfigurationService do
end
it "doesn't update configuration files if updates on legacy storage are disabled" do
- stub_feature_flags(pages_update_legacy_storage: false)
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
expect(service).not_to receive(:update_file)
diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb
index b735f4b6bc2..afdb4c3115a 100644
--- a/spec/services/projects/update_pages_service_spec.rb
+++ b/spec/services/projects/update_pages_service_spec.rb
@@ -56,7 +56,7 @@ RSpec.describe Projects::UpdatePagesService do
end
it "doesn't deploy to legacy storage if it's disabled" do
- stub_feature_flags(pages_update_legacy_storage: false)
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
expect(execute).to eq(:success)
expect(project.pages_deployed?).to be_truthy
diff --git a/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb
index 0df1af3b10a..9c95d1ff9d9 100644
--- a/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb
@@ -843,6 +843,17 @@ RSpec.shared_examples 'trace with enabled live trace feature' do
expect { subject }.to raise_error(Gitlab::Ci::Trace::AlreadyArchivedError)
expect(build.job_artifacts_trace.file.exists?).to be_truthy
end
+
+ context 'when live trace chunks still exist' do
+ before do
+ create(:ci_build_trace_chunk, build: build)
+ end
+
+ it 'removes the traces' do
+ expect { subject }.to raise_error(Gitlab::Ci::Trace::AlreadyArchivedError)
+ expect(build.trace_chunks).to be_empty
+ end
+ end
end
context 'when job is not finished yet' do
diff --git a/spec/workers/pages_update_configuration_worker_spec.rb b/spec/workers/pages_update_configuration_worker_spec.rb
index ff3727646c7..7cceeaa52d6 100644
--- a/spec/workers/pages_update_configuration_worker_spec.rb
+++ b/spec/workers/pages_update_configuration_worker_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe PagesUpdateConfigurationWorker do
end
it "doesn't schedule a worker if updates on legacy storage are disabled", :sidekiq_inline do
- stub_feature_flags(pages_update_legacy_storage: false)
+ allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
expect(Projects::UpdatePagesConfigurationService).not_to receive(:new)