summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-21 12:16:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-21 12:16:22 +0000
commitcb6f08be88608936fbeafa535cf725e1eaa3ffeb (patch)
tree79a5474206546033b6fe428a0944a4b49c22a42e /app
parent62b0d21a48b2adbfd4ac63159fe0efac73ada922 (diff)
downloadgitlab-ce-cb6f08be88608936fbeafa535cf725e1eaa3ffeb.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/cycle_analytics/components/value_stream_metrics.vue11
-rw-r--r--app/assets/javascripts/cycle_analytics/constants.js19
-rw-r--r--app/assets/javascripts/cycle_analytics/utils.js10
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue6
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/extensions/accessibility/index.js120
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/extensions/terraform/index.js30
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue13
-rw-r--r--app/experiments/new_project_readme_content_experiment.rb30
-rw-r--r--app/experiments/templates/new_project_readme_content/readme_basic.md.tt3
-rw-r--r--app/graphql/types/user_interface.rb4
-rw-r--r--app/helpers/avatars_helper.rb4
-rw-r--r--app/models/clusters/concerns/elasticsearch_client.rb2
-rw-r--r--app/models/namespaces/traversal/linear_scopes.rb9
-rw-r--r--app/models/project.rb3
-rw-r--r--app/serializers/analytics_summary_entity.rb1
-rw-r--r--app/services/projects/create_service.rb2
-rw-r--r--app/services/projects/readme_renderer_service.rb27
-rw-r--r--app/views/projects/readme_templates/default.md.tt93
-rw-r--r--app/workers/container_expiration_policy_worker.rb2
19 files changed, 324 insertions, 65 deletions
diff --git a/app/assets/javascripts/cycle_analytics/components/value_stream_metrics.vue b/app/assets/javascripts/cycle_analytics/components/value_stream_metrics.vue
index 9671742e564..b090c245559 100644
--- a/app/assets/javascripts/cycle_analytics/components/value_stream_metrics.vue
+++ b/app/assets/javascripts/cycle_analytics/components/value_stream_metrics.vue
@@ -92,9 +92,14 @@ export default {
<template>
<div class="gl-display-flex gl-flex-wrap" data-testid="vsa-time-metrics">
<gl-skeleton-loading v-if="isLoading" class="gl-h-auto gl-py-3 gl-pr-9 gl-my-6" />
- <div v-for="metric in metrics" v-show="!isLoading" :key="metric.key" class="gl-my-6 gl-pr-9">
+ <div
+ v-for="metric in metrics"
+ v-show="!isLoading"
+ :key="metric.identifier"
+ class="gl-my-6 gl-pr-9"
+ >
<gl-single-stat
- :id="metric.key"
+ :id="metric.identifier"
:value="`${metric.value}`"
:title="metric.label"
:unit="metric.unit || ''"
@@ -104,7 +109,7 @@ export default {
tabindex="0"
@click="clickHandler(metric)"
/>
- <metric-popover :metric="metric" :target="metric.key" />
+ <metric-popover :metric="metric" :target="metric.identifier" />
</div>
</div>
</template>
diff --git a/app/assets/javascripts/cycle_analytics/constants.js b/app/assets/javascripts/cycle_analytics/constants.js
index 7d5822b0824..911e729dfc6 100644
--- a/app/assets/javascripts/cycle_analytics/constants.js
+++ b/app/assets/javascripts/cycle_analytics/constants.js
@@ -36,26 +36,45 @@ export const OVERVIEW_METRICS = {
RECENT_ACTIVITY: 'RECENT_ACTIVITY',
};
+// Some content is duplicated due to backward compatibility.
+// It will be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/350614 in 14.9
export const METRICS_POPOVER_CONTENT = {
'lead-time': {
description: s__('ValueStreamAnalytics|Median time from issue created to issue closed.'),
},
+ lead_time: {
+ description: s__('ValueStreamAnalytics|Median time from issue created to issue closed.'),
+ },
'cycle-time': {
description: s__(
"ValueStreamAnalytics|Median time from the earliest commit of a linked issue's merge request to when that issue is closed.",
),
},
+ cycle_time: {
+ description: s__(
+ "ValueStreamAnalytics|Median time from the earliest commit of a linked issue's merge request to when that issue is closed.",
+ ),
+ },
'lead-time-for-changes': {
description: s__(
'ValueStreamAnalytics|Median time between merge request merge and deployment to a production environment for all MRs deployed in the given time period.',
),
},
+ lead_time_for_changes: {
+ description: s__(
+ 'ValueStreamAnalytics|Median time between merge request merge and deployment to a production environment for all MRs deployed in the given time period.',
+ ),
+ },
+ issues: { description: s__('ValueStreamAnalytics|Number of new issues created.') },
'new-issue': { description: s__('ValueStreamAnalytics|Number of new issues created.') },
'new-issues': { description: s__('ValueStreamAnalytics|Number of new issues created.') },
deploys: { description: s__('ValueStreamAnalytics|Total number of deploys to production.') },
'deployment-frequency': {
description: s__('ValueStreamAnalytics|Average number of deployments to production per day.'),
},
+ deployment_frequency: {
+ description: s__('ValueStreamAnalytics|Average number of deployments to production per day.'),
+ },
commits: {
description: s__('ValueStreamAnalytics|Number of commits pushed to the default branch'),
},
diff --git a/app/assets/javascripts/cycle_analytics/utils.js b/app/assets/javascripts/cycle_analytics/utils.js
index 9af63f5f9cc..4d78ad814e0 100644
--- a/app/assets/javascripts/cycle_analytics/utils.js
+++ b/app/assets/javascripts/cycle_analytics/utils.js
@@ -80,7 +80,7 @@ export const filterStagesByHiddenStatus = (stages = [], isHidden = true) =>
* @typedef {Object} TransformedMetricData
* @property {String} label - Title of the metric measured
* @property {String} value - String representing the decimal point value, e.g '1.5'
- * @property {String} key - Slugified string based on the 'title'
+ * @property {String} identifier - Slugified string based on the 'title' or the provided 'identifier' attribute
* @property {String} description - String to display for a description
* @property {String} unit - String representing the decimal point value, e.g '1.5'
*/
@@ -94,13 +94,13 @@ export const filterStagesByHiddenStatus = (stages = [], isHidden = true) =>
*/
export const prepareTimeMetricsData = (data = [], popoverContent = {}) =>
- data.map(({ title: label, ...rest }) => {
- const key = slugify(label);
+ data.map(({ title: label, identifier, ...rest }) => {
+ const metricIdentifier = identifier || slugify(label);
return {
...rest,
label,
- key,
- description: popoverContent[key]?.description || '',
+ identifier: metricIdentifier,
+ description: popoverContent[metricIdentifier]?.description || '',
};
});
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
index 7322958e6df..96ee46c3b27 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
@@ -139,7 +139,7 @@ export default {
fetchData: () => this.fetchCollapsedData(this.$props),
},
method: 'fetchData',
- successCallback: (data) => {
+ successCallback: ({ data }) => {
if (Object.keys(data).length > 0) {
poll.stop();
this.setCollapsedData(data);
@@ -317,9 +317,13 @@ export default {
<div v-if="data.link">
<gl-link :href="data.link.href">{{ data.link.text }}</gl-link>
</div>
+ <div v-if="data.supportingText">
+ <p v-safe-html="generateText(data.supportingText)" class="gl-m-0"></p>
+ </div>
<gl-badge v-if="data.badge" :variant="data.badge.variant || 'info'">
{{ data.badge.text }}
</gl-badge>
+
<actions
:widget="$options.label || $options.name"
:tertiary-buttons="data.actions"
diff --git a/app/assets/javascripts/vue_merge_request_widget/extensions/accessibility/index.js b/app/assets/javascripts/vue_merge_request_widget/extensions/accessibility/index.js
new file mode 100644
index 00000000000..168f10bd148
--- /dev/null
+++ b/app/assets/javascripts/vue_merge_request_widget/extensions/accessibility/index.js
@@ -0,0 +1,120 @@
+import { uniqueId } from 'lodash';
+import { __, n__, s__, sprintf } from '~/locale';
+import axios from '~/lib/utils/axios_utils';
+import { EXTENSION_ICONS } from '../../constants';
+
+export default {
+ name: 'WidgetAccessibility',
+ enablePolling: true,
+ i18n: {
+ loading: s__('Reports|Accessibility scanning results are being parsed'),
+ error: s__('Reports|Accessibility scanning failed loading results'),
+ },
+ props: ['accessibilityReportPath'],
+ computed: {
+ statusIcon() {
+ return this.collapsedData.status === 'failed'
+ ? EXTENSION_ICONS.warning
+ : EXTENSION_ICONS.success;
+ },
+ },
+ methods: {
+ summary() {
+ const numOfResults = this.collapsedData?.summary?.errored || 0;
+
+ const successText = s__(
+ 'Reports|Accessibility scanning detected no issues for the source branch only',
+ );
+ const warningText = sprintf(
+ n__(
+ 'Reports|Accessibility scanning detected %{strong_start}%{number}%{strong_end} issue for the source branch only',
+ 'Reports|Accessibility scanning detected %{strong_start}%{number}%{strong_end} issues for the source branch only',
+ numOfResults,
+ ),
+ {
+ number: numOfResults,
+ },
+ false,
+ );
+
+ return numOfResults === 0 ? successText : warningText;
+ },
+ fetchCollapsedData() {
+ return axios.get(this.accessibilityReportPath);
+ },
+ fetchFullData() {
+ return Promise.resolve(this.prepareReports());
+ },
+ parsedTECHSCode(code) {
+ /*
+ * In issue code looks like "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail"
+ * or "WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.NoContent"
+ *
+ * The TECHS code is the "G18", "G168", "H91", etc. from the code which is used for the documentation.
+ * Here we simply split the string on `.` and get the code in the 5th position
+ */
+ return code?.split('.')[4];
+ },
+ formatLearnMoreUrl(code) {
+ const parsed = this.parsedTECHSCode(code);
+ // eslint-disable-next-line @gitlab/require-i18n-strings
+ return `https://www.w3.org/TR/WCAG20-TECHS/${parsed || 'Overview'}.html`;
+ },
+ formatText(code) {
+ return sprintf(
+ s__(
+ 'AccessibilityReport|The accessibility scanning found an error of the following type: %{code}',
+ ),
+ { code },
+ );
+ },
+ formatMessage(message) {
+ return sprintf(s__('AccessibilityReport|Message: %{message}'), { message });
+ },
+ prepareReports() {
+ const { new_errors, existing_errors, resolved_errors } = this.collapsedData;
+
+ const newErrors = new_errors.map((error) => {
+ return {
+ header: __('New'),
+ id: uniqueId('new-error-'),
+ text: this.formatText(error.code),
+ icon: { name: EXTENSION_ICONS.failed },
+ link: {
+ href: this.formatLearnMoreUrl(error.code),
+ text: __('Learn more'),
+ },
+ supportingText: this.formatMessage(error.message),
+ };
+ });
+
+ const existingErrors = existing_errors.map((error) => {
+ return {
+ id: uniqueId('existing-error-'),
+ text: this.formatText(error.code),
+ icon: { name: EXTENSION_ICONS.failed },
+ link: {
+ href: this.formatLearnMoreUrl(error.code),
+ text: __('Learn more'),
+ },
+ supportingText: this.formatMessage(error.message),
+ };
+ });
+
+ const resolvedErrors = resolved_errors.map((error) => {
+ return {
+ id: uniqueId('resolved-error-'),
+ text: this.formatText(error.code),
+ icon: { name: EXTENSION_ICONS.success },
+ link: {
+ href: this.formatLearnMoreUrl(error.code),
+ text: __('Learn more'),
+ },
+ supportingText: this.formatMessage(error.message),
+ };
+ });
+
+ return [...newErrors, ...existingErrors, ...resolvedErrors];
+ },
+ },
+};
diff --git a/app/assets/javascripts/vue_merge_request_widget/extensions/terraform/index.js b/app/assets/javascripts/vue_merge_request_widget/extensions/terraform/index.js
index a564acada02..8fcc4f818ec 100644
--- a/app/assets/javascripts/vue_merge_request_widget/extensions/terraform/index.js
+++ b/app/assets/javascripts/vue_merge_request_widget/extensions/terraform/index.js
@@ -73,26 +73,30 @@ export default {
return `${title}${subtitle}`;
},
fetchCollapsedData() {
- return Promise.resolve(this.fetchPlans().then(this.prepareReports));
- },
- fetchFullData() {
- const { valid, invalid } = this.collapsedData;
- return Promise.resolve([...valid, ...invalid]);
- },
- // Custom methods
- fetchPlans() {
return axios
.get(this.terraformReportsPath)
- .then(({ data }) => {
- return Object.keys(data).map((key) => {
- return data[key];
+ .then((res) => {
+ const reports = Object.keys(res.data).map((key) => {
+ return res.data[key];
});
+
+ const formattedData = this.prepareReports(reports);
+
+ return {
+ ...res,
+ data: formattedData,
+ };
})
.catch(() => {
- const invalidData = { tf_report_error: 'api_error' };
- return [invalidData];
+ const formattedData = this.prepareReports([{ tf_report_error: 'api_error' }]);
+
+ return { data: formattedData };
});
},
+ fetchFullData() {
+ const { valid, invalid } = this.collapsedData;
+ return Promise.resolve([...valid, ...invalid]);
+ },
createReportRow(report, iconName) {
const addNum = Number(report.create);
const changeNum = Number(report.update);
diff --git a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue
index 83a07240403..6f61afe6e68 100644
--- a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue
@@ -45,6 +45,7 @@ import eventHub from './event_hub';
import mergeRequestQueryVariablesMixin from './mixins/merge_request_query_variables';
import getStateQuery from './queries/get_state.query.graphql';
import terraformExtension from './extensions/terraform';
+import accessibilityExtension from './extensions/accessibility';
export default {
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/25
@@ -205,7 +206,7 @@ export default {
);
},
shouldShowAccessibilityReport() {
- return this.mr.accessibilityReportPath;
+ return Boolean(this.mr?.accessibilityReportPath);
},
formattedHumanAccess() {
return (this.mr.humanAccess || '').toLowerCase();
@@ -240,6 +241,11 @@ export default {
this.registerTerraformPlans();
}
},
+ shouldShowAccessibilityReport(newVal) {
+ if (newVal) {
+ this.registerAccessibilityExtension();
+ }
+ },
},
mounted() {
MRWidgetService.fetchInitialData()
@@ -478,6 +484,11 @@ export default {
registerExtension(terraformExtension);
}
},
+ registerAccessibilityExtension() {
+ if (this.shouldShowAccessibilityReport && this.shouldShowExtension) {
+ registerExtension(accessibilityExtension);
+ }
+ },
},
};
</script>
diff --git a/app/experiments/new_project_readme_content_experiment.rb b/app/experiments/new_project_readme_content_experiment.rb
deleted file mode 100644
index 1de7632268d..00000000000
--- a/app/experiments/new_project_readme_content_experiment.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class NewProjectReadmeContentExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass
- TEMPLATE_PATH = Rails.root.join('app', 'experiments', 'templates', 'new_project_readme_content')
- include Rails.application.routes.url_helpers
-
- def run_with(project, variant: nil)
- @project = project
- publish_to_database
- run(variant)
- end
-
- def control_behavior
- template('readme_basic.md')
- end
-
- def advanced_behavior
- template('readme_advanced.md')
- end
-
- def redirect(to_url)
- experiment_redirect_url(self, url: to_url)
- end
-
- private
-
- def template(name)
- ERB.new(File.read(TEMPLATE_PATH.join("#{name}.tt")), trim_mode: '<>').result(binding)
- end
-end
diff --git a/app/experiments/templates/new_project_readme_content/readme_basic.md.tt b/app/experiments/templates/new_project_readme_content/readme_basic.md.tt
deleted file mode 100644
index 1e68eaf2f05..00000000000
--- a/app/experiments/templates/new_project_readme_content/readme_basic.md.tt
+++ /dev/null
@@ -1,3 +0,0 @@
-# <%= @project.name %>
-
-<%= @project.description %>
diff --git a/app/graphql/types/user_interface.rb b/app/graphql/types/user_interface.rb
index 6bb4cb29cdd..24fca80d5a9 100644
--- a/app/graphql/types/user_interface.rb
+++ b/app/graphql/types/user_interface.rb
@@ -31,7 +31,7 @@ module Types
null: false,
resolver_method: :redacted_name,
description: 'Human-readable name of the user. ' \
- 'Will return `****` if the user is a project bot and the requester does not have permission to read resource access tokens.'
+ 'Returns `****` if the user is a project bot and the requester does not have permission to view the project.'
field :state,
type: Types::UserStateEnum,
@@ -127,7 +127,7 @@ module Types
def redacted_name
return object.name unless object.project_bot?
- return object.name if context[:current_user]&.can?(:read_resource_access_tokens, object.projects.first)
+ return object.name if context[:current_user]&.can?(:read_project, object.projects.first)
# If the requester does not have permission to read the project bot name,
# the API returns an arbitrary string. UI changes will be addressed in a follow up issue:
diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb
index dd852a68682..2d754bd99e9 100644
--- a/app/helpers/avatars_helper.rb
+++ b/app/helpers/avatars_helper.rb
@@ -103,8 +103,8 @@ module AvatarsHelper
end
def avatar_without_link(resource, options = {})
- if resource.is_a?(User)
- user_avatar_without_link(options.merge(user: resource))
+ if resource.is_a?(Namespaces::UserNamespace)
+ user_avatar_without_link(options.merge(user: resource.first_owner))
elsif resource.is_a?(Group)
group_icon(resource, options.merge(class: 'avatar'))
end
diff --git a/app/models/clusters/concerns/elasticsearch_client.rb b/app/models/clusters/concerns/elasticsearch_client.rb
index 7b0b6bdae02..e9aab7897a8 100644
--- a/app/models/clusters/concerns/elasticsearch_client.rb
+++ b/app/models/clusters/concerns/elasticsearch_client.rb
@@ -15,7 +15,7 @@ module Clusters
proxy_url = kube_client.proxy_url('service', service_name, ELASTICSEARCH_PORT, ELASTICSEARCH_NAMESPACE)
- Elasticsearch::Client.new(url: proxy_url) do |faraday|
+ Elasticsearch::Client.new(url: proxy_url, adapter: :net_http) do |faraday|
# ensures headers containing auth data are appended to original client options
faraday.headers.merge!(kube_client.headers)
# ensure TLS certs are properly verified
diff --git a/app/models/namespaces/traversal/linear_scopes.rb b/app/models/namespaces/traversal/linear_scopes.rb
index 9f0f49e729c..cfc993efd9a 100644
--- a/app/models/namespaces/traversal/linear_scopes.rb
+++ b/app/models/namespaces/traversal/linear_scopes.rb
@@ -53,7 +53,7 @@ module Namespaces
end
def self_and_descendants(include_self: true)
- return super unless use_traversal_ids?
+ return super unless use_traversal_ids_for_descendants_scopes?
if Feature.enabled?(:traversal_ids_btree, default_enabled: :yaml)
self_and_descendants_with_comparison_operators(include_self: include_self)
@@ -65,7 +65,7 @@ module Namespaces
end
def self_and_descendant_ids(include_self: true)
- return super unless use_traversal_ids?
+ return super unless use_traversal_ids_for_descendants_scopes?
if Feature.enabled?(:traversal_ids_btree, default_enabled: :yaml)
self_and_descendants_with_comparison_operators(include_self: include_self).as_ids
@@ -109,6 +109,11 @@ module Namespaces
use_traversal_ids?
end
+ def use_traversal_ids_for_descendants_scopes?
+ Feature.enabled?(:use_traversal_ids_for_descendants_scopes, default_enabled: :yaml) &&
+ use_traversal_ids?
+ end
+
def self_and_descendants_with_comparison_operators(include_self: true)
base = all.select(
:traversal_ids,
diff --git a/app/models/project.rb b/app/models/project.rb
index 1ab6e0575c3..1070bb6db4f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1513,6 +1513,9 @@ class Project < ApplicationRecord
# rubocop: enable CodeReuse/ServiceClass
def owner
+ # This will be phased out and replaced with `owners` relationship
+ # backed by memberships with direct/inherited Owner access roles
+ # See https://gitlab.com/groups/gitlab-org/-/epics/7405
group || namespace.try(:owner)
end
diff --git a/app/serializers/analytics_summary_entity.rb b/app/serializers/analytics_summary_entity.rb
index dc42d7f52ad..a92214d0efa 100644
--- a/app/serializers/analytics_summary_entity.rb
+++ b/app/serializers/analytics_summary_entity.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
class AnalyticsSummaryEntity < Grape::Entity
+ expose :identifier
expose :value, safe: true
expose :title
expose :unit, if: { with_unit: true }
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index 153be58f8ad..c885369dfec 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -167,7 +167,7 @@ module Projects
end
def readme_content
- @readme_template.presence || experiment(:new_project_readme_content, namespace: @project.namespace).run_with(@project)
+ @readme_template.presence || ReadmeRendererService.new(@project, current_user).execute
end
def skip_wiki?
diff --git a/app/services/projects/readme_renderer_service.rb b/app/services/projects/readme_renderer_service.rb
new file mode 100644
index 00000000000..6871976aded
--- /dev/null
+++ b/app/services/projects/readme_renderer_service.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+module Projects
+ class ReadmeRendererService < BaseService
+ include Rails.application.routes.url_helpers
+
+ TEMPLATE_PATH = Rails.root.join('app', 'views', 'projects', 'readme_templates')
+
+ def execute
+ render(params[:template_name] || :default)
+ end
+
+ private
+
+ def render(template_name)
+ ERB.new(File.read(sanitized_filename(template_name)), trim_mode: '<>').result(binding)
+ end
+
+ def sanitized_filename(template_name)
+ path = Gitlab::Utils.check_path_traversal!("#{template_name}.md.tt")
+ path = TEMPLATE_PATH.join(path).to_s
+ Gitlab::Utils.check_allowed_absolute_path!(path, [TEMPLATE_PATH.to_s])
+
+ path
+ end
+ end
+end
diff --git a/app/views/projects/readme_templates/default.md.tt b/app/views/projects/readme_templates/default.md.tt
new file mode 100644
index 00000000000..d5fef29b290
--- /dev/null
+++ b/app/views/projects/readme_templates/default.md.tt
@@ -0,0 +1,93 @@
+# <%= project.name %>
+
+<%= project.description %>
+
+
+## Getting started
+
+To make it easy for you to get started with GitLab, here's a list of recommended next steps.
+
+Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
+
+## Add your files
+
+- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
+- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
+
+```
+cd existing_repo
+git remote add origin <%= project.http_url_to_repo %>
+git branch -M <%= project.default_branch_or_main %>
+git push -uf origin <%= project.default_branch_or_main %>
+```
+
+## Integrate with your tools
+
+- [ ] [Set up project integrations](<%= project_settings_integrations_url(project) %>)
+
+## Collaborate with your team
+
+- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
+- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
+- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
+- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
+- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
+
+## Test and Deploy
+
+Use the built-in continuous integration in GitLab.
+
+- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
+- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
+- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
+- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
+- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
+
+***
+
+# Editing this README
+
+When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
+
+## Suggestions for a good README
+Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
+
+## Name
+Choose a self-explaining name for your project.
+
+## Description
+Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
+
+## Badges
+On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
+
+## Visuals
+Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
+
+## Installation
+Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
+
+## Usage
+Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
+
+## Support
+Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
+
+## Roadmap
+If you have ideas for releases in the future, it is a good idea to list them in the README.
+
+## Contributing
+State if you are open to contributions and what your requirements are for accepting them.
+
+For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
+
+You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
+
+## Authors and acknowledgment
+Show your appreciation to those who have contributed to the project.
+
+## License
+For open source projects, say how it is licensed.
+
+## Project status
+If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
diff --git a/app/workers/container_expiration_policy_worker.rb b/app/workers/container_expiration_policy_worker.rb
index 5fcbd74ddad..16ac61976eb 100644
--- a/app/workers/container_expiration_policy_worker.rb
+++ b/app/workers/container_expiration_policy_worker.rb
@@ -57,7 +57,7 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo
def perform_unthrottled
with_runnable_policy(preloaded: true) do |policy|
with_context(project: policy.project,
- user: policy.project.owner) do |project:, user:|
+ user: nil) do |project:, user:|
ContainerExpirationPolicyService.new(project, user)
.execute(policy)
end