Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-04-09 06:09:30 +00:00
parent b724fa8431
commit 760822a537
41 changed files with 300 additions and 229 deletions

View file

@ -1 +1 @@
434d5055aa05cc40197bbffc4a3c6ce325fa7027
2b9f2f35e178b8b56b5f657420aa72c6a77c62eb

View file

@ -81,7 +81,7 @@ export default {
return this.hasError && !this.isLoading;
},
/**
* The Run Pipeline button can only be rendered when:
* The "Run pipeline" button can only be rendered when:
* - In MR view - we use `canCreatePipelineInTargetProject` for that purpose
* - If the latest pipeline has the `detached_merge_request_pipeline` flag
*
@ -148,7 +148,7 @@ export default {
}
},
/**
* When the user clicks on the Run Pipeline button
* When the user clicks on the "Run pipeline" button
* we need to make a post request and
* to update the table content once the request is finished.
*
@ -177,7 +177,7 @@ export default {
<div class="content-list pipelines">
<gl-loading-icon
v-if="isLoading"
:label="s__('Pipelines|Loading Pipelines')"
:label="s__('Pipelines|Loading pipelines')"
size="lg"
class="prepend-top-20"
/>
@ -197,12 +197,12 @@ export default {
block
class="gl-mt-3 gl-mb-3"
:class="pipelineButtonClass"
variant="success"
variant="confirm"
data-testid="run_pipeline_button_mobile"
:loading="state.isRunningMergeRequestPipeline"
@click="tryRunPipeline"
>
{{ s__('Pipelines|Run Pipeline') }}
{{ s__('Pipeline|Run pipeline') }}
</gl-button>
<pipelines-table-component
@ -213,12 +213,12 @@ export default {
<template #table-header-actions>
<div v-if="canRenderPipelineButton" class="gl-text-right">
<gl-button
variant="success"
variant="confirm"
data-testid="run_pipeline_button"
:loading="state.isRunningMergeRequestPipeline"
@click="tryRunPipeline"
>
{{ s__('Pipelines|Run Pipeline') }}
{{ s__('Pipeline|Run pipeline') }}
</gl-button>
</div>
</template>
@ -231,7 +231,7 @@ export default {
ref="modal"
:modal-id="modalId"
:title="s__('Pipelines|Are you sure you want to run this pipeline?')"
:ok-title="s__('Pipelines|Run Pipeline')"
:ok-title="s__('Pipeline|Run pipeline')"
ok-variant="danger"
@ok="onClickRunPipeline"
>

View file

@ -10,7 +10,7 @@ const typeWithPlaceholder = {
};
const placeholderForType = {
[typeWithPlaceholder.SLACK]: __('Slack channels (e.g. general, development)'),
[typeWithPlaceholder.SLACK]: __('general, development'),
[typeWithPlaceholder.MATTERMOST]: __('my-channel'),
};

View file

@ -444,18 +444,16 @@ export default {
</gl-sprintf></template
>
</gl-form-group>
<div
class="gl-border-t-solid gl-border-gray-100 gl-border-t-1 gl-p-5 gl-bg-gray-10 gl-display-flex gl-justify-content-space-between"
>
<div class="gl-pt-5 gl-display-flex">
<gl-button
type="submit"
category="primary"
variant="confirm"
class="js-no-auto-disable"
class="js-no-auto-disable gl-mr-3"
data-qa-selector="run_pipeline_button"
data-testid="run_pipeline_button"
:disabled="submitted"
>{{ s__('Pipeline|Run Pipeline') }}</gl-button
>{{ s__('Pipeline|Run pipeline') }}</gl-button
>
<gl-button :href="pipelinesPath">{{ __('Cancel') }}</gl-button>
</div>

View file

@ -40,18 +40,6 @@ export default {
</script>
<template>
<div class="nav-controls">
<gl-button
v-if="newPipelinePath"
:href="newPipelinePath"
variant="success"
category="primary"
class="js-run-pipeline"
data-testid="run-pipeline-button"
data-qa-selector="run_pipeline_button"
>
{{ s__('Pipelines|Run Pipeline') }}
</gl-button>
<gl-button
v-if="resetCachePath"
:loading="isResetCacheButtonLoading"
@ -59,11 +47,23 @@ export default {
data-testid="clear-cache-button"
@click="onClickResetCache"
>
{{ s__('Pipelines|Clear Runner Caches') }}
{{ s__('Pipelines|Clear runner caches') }}
</gl-button>
<gl-button v-if="ciLintPath" :href="ciLintPath" class="js-ci-lint" data-testid="ci-lint-button">
{{ s__('Pipelines|CI Lint') }}
{{ s__('Pipelines|CI lint') }}
</gl-button>
<gl-button
v-if="newPipelinePath"
:href="newPipelinePath"
variant="confirm"
category="primary"
class="js-run-pipeline"
data-testid="run-pipeline-button"
data-qa-selector="run_pipeline_button"
>
{{ s__('Pipeline|Run pipeline') }}
</gl-button>
</div>
</template>

View file

@ -20,7 +20,11 @@ class ChaosController < ActionController::Base
end
def kill
do_chaos :kill, Chaos::KillWorker
do_chaos :kill, Chaos::KillWorker, 'KILL'
end
def quit
do_chaos :kill, Chaos::KillWorker, 'QUIT'
end
def gc

View file

@ -17,13 +17,23 @@ module Mutations
required: false,
description: 'Indicates if the latest artifact should be kept for this project.'
field :ci_cd_settings,
Types::Ci::CiCdSettingType,
null: false,
description: 'The CI/CD settings after mutation.'
def resolve(full_path:, **args)
project = authorized_find!(full_path)
settings = project.ci_cd_settings
settings.update(args)
{ errors: errors_on_object(settings) }
{
ci_cd_settings: settings,
errors: errors_on_object(settings)
}
end
end
end
end
Mutations::Ci::CiCdSettingsUpdate.prepend_if_ee('::EE::Mutations::Ci::CiCdSettingsUpdate')

View file

@ -16,7 +16,7 @@ class SlackService < ChatNotificationService
end
def description
'Receive event notifications in Slack'
'Send notifications about project events to Slack.'
end
def self.to_param
@ -24,7 +24,7 @@ class SlackService < ChatNotificationService
end
def default_channel_placeholder
_('Slack channels (e.g. general, development)')
_('general, development')
end
def webhook_placeholder

View file

@ -1,2 +1,2 @@
= loading_icon(css_class: "gl-vertical-align-text-bottom")
Analyzing file…
= _("Analyzing file…")

View file

@ -1,9 +1,9 @@
- breadcrumb_title _('Pipelines')
- page_title s_('Pipeline|Run Pipeline')
- page_title s_('Pipeline|Run pipeline')
- settings_link = link_to _('CI/CD settings'), project_settings_ci_cd_path(@project)
%h3.page-title
= s_('Pipeline|Run Pipeline')
= s_('Pipeline|Run pipeline')
%hr
- if Feature.enabled?(:new_pipeline_form, @project, default_enabled: :yaml)
@ -49,7 +49,7 @@
= (s_("Pipeline|Specify variable values to be used in this run. The values specified in %{settings_link} will be used by default.") % {settings_link: settings_link}).html_safe
.form-actions
= f.submit s_('Pipeline|Run Pipeline'), class: 'btn btn-success js-variables-save-button'
= link_to _('Cancel'), project_pipelines_path(@project), class: 'btn btn-default float-right'
= f.submit s_('Pipeline|Run pipeline'), class: 'btn gl-button btn-confirm gl-mr-3 js-variables-save-button'
= link_to _('Cancel'), project_pipelines_path(@project), class: 'btn gl-button btn-default'
%script#availableRefs{ type: "application/json" }= @project.repository.ref_names.to_json.html_safe

View file

@ -1,16 +1,4 @@
- webhooks_link_url = 'https://slack.com/apps/A0F7XDUAZ-incoming-webhooks'
- webhooks_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: webhooks_link_url }
.info-well
.well-segment
%p= s_('SlackIntegration|This service sends notifications about project events to Slack channels. To set up this service:')
%ol
%li
= html_escape(s_('SlackIntegration|%{webhooks_link_start}Add an incoming webhook%{webhooks_link_end} in your Slack team. The default channel can be overridden for each event.')) % { webhooks_link_start: webhooks_link_start.html_safe, webhooks_link_end: '</a>'.html_safe }
%li
= html_escape(s_('SlackIntegration|Paste the %{strong_open}Webhook URL%{strong_close} into the field below.')) % { strong_open: '<strong>'.html_safe, strong_close: '</strong>'.html_safe }
%li
= html_escape(s_('SlackIntegration|Select events below to enable notifications. The %{strong_open}Slack channel names%{strong_close} and %{strong_open}Slack username%{strong_close} fields are optional.')) % { strong_open: '<strong>'.html_safe, strong_close: '</strong>'.html_safe }
%p.mt-3.mb-0
= html_escape(s_('SlackIntegration|%{strong_open}Note:%{strong_close} Usernames and private channels are not supported.')) % { strong_open: '<strong>'.html_safe, strong_close: '</strong>'.html_safe }
= link_to _('Learn more'), help_page_path('user/project/integrations/slack')
%p= s_('SlackIntegration|Sends notifications about project events to Slack channels.')
= link_to _('How do I set up this service?'), help_page_path('user/project/integrations/slack')

View file

@ -7,8 +7,8 @@ module Chaos
sidekiq_options retry: false
def perform
Gitlab::Chaos.kill
def perform(signal)
Gitlab::Chaos.kill(signal)
end
end
end

View file

@ -0,0 +1,6 @@
---
title: Updating success button to confirm variant and reordering buttons per Pajamas
Design System guidelines for buttons
merge_request: 58112
author:
type: other

View file

@ -0,0 +1,5 @@
---
title: Externalize strings in viewers/_loading_auxiliary.html.haml
merge_request: 58454
author: nuwe1
type: other

View file

@ -0,0 +1,5 @@
---
title: Move to btn-confirm from btn-success in geo directory
merge_request: 58031
author: Yogi (@yo)
type: changed

View file

@ -0,0 +1,5 @@
---
title: Add a chaos endpoint that signals QUIT
merge_request: 58755
author:
type: changed

View file

@ -0,0 +1,5 @@
---
title: Update UI text for slack notifications integration
merge_request: 58845
author:
type: other

View file

@ -179,6 +179,7 @@ Rails.application.routes.draw do
get :db_spin
get :sleep
get :kill
get :quit
post :gc
end
end

View file

@ -1055,6 +1055,7 @@ Autogenerated return type of CiCdSettingsUpdate.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `ciCdSettings` | [`ProjectCiCdSetting!`](#projectcicdsetting) | The CI/CD settings after mutation. |
| `clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| `errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |

View file

@ -197,7 +197,7 @@ could mistakenly trust the merge request because it passed a faked pipeline.
Parent project members with at least [Developer permissions](../../user/permissions.md)
can create pipelines in the parent project for merge requests
from a forked project. In the merge request, go to the **Pipelines** and click
**Run Pipeline** button.
**Run pipeline** button.
WARNING:
Fork merge requests could contain malicious code that tries to steal secrets in the

View file

@ -133,8 +133,8 @@ operation of the pipeline.
To execute a pipeline manually:
1. Navigate to your project's **CI/CD > Pipelines**.
1. Select the **Run Pipeline** button.
1. On the **Run Pipeline** page:
1. Select the **Run pipeline** button.
1. On the **Run pipeline** page:
1. Select the branch or tag to run the pipeline for in the **Run for branch name or tag** field.
1. Enter any [environment variables](../variables/README.md) required for the pipeline run.
You can set specific variables to have their [values prefilled in the form](#prefill-variables-in-manual-pipelines).

View file

@ -146,10 +146,10 @@ curl "http://localhost:3000/-/chaos/sleep?duration_s=60&token=secret"
## Kill
This endpoint simulates the unexpected death of a worker process using a `kill` signal.
This endpoint simulates the unexpected death of a worker process using the `KILL` signal.
Because this endpoint uses the `KILL` signal, the worker isn't given an
opportunity to cleanup or shutdown.
Because this endpoint uses the `KILL` signal, the process isn't given an
opportunity to clean up or shut down.
```plaintext
GET /-/chaos/kill
@ -158,13 +158,33 @@ GET /-/chaos/kill?async=true
| Attribute | Type | Required | Description |
| ------------ | ------- | -------- | ---------------------------------------------------------------------- |
| `async` | boolean | no | Set to true to kill a Sidekiq background worker process |
| `async` | boolean | no | Set to true to signal a Sidekiq background worker process |
```shell
curl "http://localhost:3000/-/chaos/kill" --header 'X-Chaos-Secret: secret'
curl "http://localhost:3000/-/chaos/kill?token=secret"
```
## Quit
This endpoint simulates the unexpected death of a worker process using the `QUIT` signal.
Unlike `KILL`, the `QUIT` signal will also attempt to write a core dump.
See [core(5)](https://man7.org/linux/man-pages/man5/core.5.html) for more information.
```plaintext
GET /-/chaos/quit
GET /-/chaos/quit?async=true
```
| Attribute | Type | Required | Description |
| ------------ | ------- | -------- | ---------------------------------------------------------------------- |
| `async` | boolean | no | Set to true to signal a Sidekiq background worker process |
```shell
curl "http://localhost:3000/-/chaos/quit" --header 'X-Chaos-Secret: secret'
curl "http://localhost:3000/-/chaos/quit?token=secret"
```
## Run garbage collector
This endpoint triggers a GC run on the worker handling the request and returns its worker ID

View file

@ -23,7 +23,7 @@ On the left side we have the events that can trigger a pipeline based on various
- A `git push` is the most common event that triggers a pipeline.
- The [Web API](../../api/pipelines.md#create-a-new-pipeline).
- A user clicking the "Run Pipeline" button in the UI.
- A user clicking the "Run pipeline" button in the UI.
- When a [merge request is created or updated](../../ci/merge_request_pipelines/index.md#pipelines-for-merge-requests).
- When an MR is added to a [Merge Train](../../ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md#merge-trains).
- A [scheduled pipeline](../../ci/pipelines/schedules.md#pipeline-schedules).

View file

@ -418,7 +418,7 @@ If the MR source branch is more than 100 commits behind the target branch, ask t
Review links and images, especially in documentation MRs.
When in doubt, ask someone from `@gitlab-com/gl-security/appsec` to review the merge request **before starting any merge request pipeline**.
- Start a new merge request pipeline with the `Run Pipeline` button in the merge
- Start a new merge request pipeline with the `Run pipeline` button in the merge
request's "Pipelines" tab, and enable "Merge When Pipeline Succeeds" (MWPS).
Note that:
- If **[master is broken](https://about.gitlab.com/handbook/engineering/workflow/#broken-master),

View file

@ -119,7 +119,7 @@ pipeline in the main `gitlab` repository as well as in `gitlab-docs`. Create an
a different name first and test it to ensure you do not break the pipelines.
1. In [`gitlab-docs`](https://gitlab.com/gitlab-org/gitlab-docs), go to **{rocket}** **CI/CD > Pipelines**.
1. Click the **Run Pipeline** button.
1. Click the **Run pipeline** button.
1. See that a new pipeline is running. The jobs that build the images are in the first
stage, `build-images`. You can click the pipeline number to see the larger pipeline
graph, or click the first (`build-images`) stage in the mini pipeline graph to

View file

@ -732,7 +732,7 @@ To use Auto Monitoring:
1. [Install and configure the Auto DevOps requirements](requirements.md).
1. [Enable Auto DevOps](index.md#enable-or-disable-auto-devops), if you haven't done already.
1. Navigate to your project's **{rocket}** **CI/CD > Pipelines** and click **Run Pipeline**.
1. Navigate to your project's **{rocket}** **CI/CD > Pipelines** and click **Run pipeline**.
1. After the pipeline finishes successfully, open the
[monitoring dashboard for a deployed environment](../../ci/environments/index.md#monitoring-environments)
to view the metrics of your deployed application. To view the metrics of the

View file

@ -246,7 +246,7 @@ This can be done:
- For a single pipeline run:
1. Go to **CI/CD > Pipelines**
1. Click **Run Pipeline**
1. Click **Run pipeline**
1. Add `CODE_QUALITY_DISABLED` as the variable key, with any value.
### Using with merge request pipelines

View file

@ -43,9 +43,9 @@ module Gitlab
Kernel.sleep(duration_s)
end
# Kill will send a SIGKILL signal to the current process
def self.kill
Process.kill("KILL", Process.pid)
# Kill will send the given signal to the current process.
def self.kill(signal)
Process.kill(signal, Process.pid)
end
def self.run_gc

View file

@ -87,7 +87,7 @@ module Gitlab
# rubocop: disable Metrics/AbcSize
# rubocop: disable CodeReuse/ActiveRecord
def system_usage_data
issues_created_manually_from_alerts = count(Issue.with_alert_management_alerts.not_authored_by(::User.alert_bot), start: issue_minimum_id, finish: issue_maximum_id)
issues_created_manually_from_alerts = count(Issue.with_alert_management_alerts.not_authored_by(::User.alert_bot), start: minimum_id(Issue), finish: maximum_id(Issue))
{
counts: {
@ -138,7 +138,7 @@ module Gitlab
in_review_folder: count(::Environment.in_review_folder),
grafana_integrated_projects: count(GrafanaIntegration.enabled),
groups: count(Group),
issues: count(Issue, start: issue_minimum_id, finish: issue_maximum_id),
issues: count(Issue, start: minimum_id(Issue), finish: maximum_id(Issue)),
issues_created_from_gitlab_error_tracking_ui: count(SentryIssue),
issues_with_associated_zoom_link: count(ZoomMeeting.added_to_issue),
issues_using_zoom_quick_actions: distinct_count(ZoomMeeting, :issue_id),
@ -146,9 +146,9 @@ module Gitlab
issues_created_from_alerts: total_alert_issues,
issues_created_gitlab_alerts: issues_created_manually_from_alerts,
issues_created_manually_from_alerts: issues_created_manually_from_alerts,
incident_issues: count(::Issue.incident, start: issue_minimum_id, finish: issue_maximum_id),
alert_bot_incident_issues: count(::Issue.authored(::User.alert_bot), start: issue_minimum_id, finish: issue_maximum_id),
incident_labeled_issues: count(::Issue.with_label_attributes(::IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES), start: issue_minimum_id, finish: issue_maximum_id),
incident_issues: count(::Issue.incident, start: minimum_id(Issue), finish: maximum_id(Issue)),
alert_bot_incident_issues: count(::Issue.authored(::User.alert_bot), start: minimum_id(Issue), finish: maximum_id(Issue)),
incident_labeled_issues: count(::Issue.with_label_attributes(::IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES), start: minimum_id(Issue), finish: maximum_id(Issue)),
keys: count(Key),
label_lists: count(List.label),
lfs_objects: count(LfsObject),
@ -389,8 +389,8 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def container_expiration_policies_usage
results = {}
start = ::Project.minimum(:id)
finish = ::Project.maximum(:id)
start = minimum_id(Project)
finish = maximum_id(Project)
results[:projects_with_expiration_policy_disabled] = distinct_count(::ContainerExpirationPolicy.where(enabled: false), :project_id, start: start, finish: finish)
# rubocop: disable UsageData/LargeTable
@ -591,7 +591,7 @@ module Gitlab
{
events: distinct_count(::Event.where(time_period), :author_id),
groups: distinct_count(::GroupMember.where(time_period), :user_id),
users_created: count(::User.where(time_period), start: user_minimum_id, finish: user_maximum_id),
users_created: count(::User.where(time_period), start: minimum_id(User), finish: maximum_id(User)),
omniauth_providers: filtered_omniauth_provider_names.reject { |name| name == 'group_saml' },
user_auth_by_provider: distinct_count_user_auth_by_provider(time_period),
unique_users_all_imports: unique_users_all_imports(time_period),
@ -636,8 +636,8 @@ module Gitlab
clusters: distinct_count(::Clusters::Cluster.where(time_period), :user_id),
clusters_applications_prometheus: cluster_applications_user_distinct_count(::Clusters::Applications::Prometheus, time_period),
operations_dashboard_default_dashboard: count(::User.active.with_dashboard('operations').where(time_period),
start: user_minimum_id,
finish: user_maximum_id),
start: minimum_id(User),
finish: maximum_id(User)),
projects_with_tracing_enabled: distinct_count(::Project.with_tracing_enabled.where(time_period), :creator_id),
projects_with_error_tracking_enabled: distinct_count(::Project.with_enabled_error_tracking.where(time_period), :creator_id),
projects_with_incidents: distinct_count(::Issue.incident.where(time_period), :project_id),
@ -691,12 +691,12 @@ module Gitlab
def usage_activity_by_stage_verify(time_period)
{
ci_builds: distinct_count(::Ci::Build.where(time_period), :user_id),
ci_external_pipelines: distinct_count(::Ci::Pipeline.external.where(time_period), :user_id, start: user_minimum_id, finish: user_maximum_id),
ci_internal_pipelines: distinct_count(::Ci::Pipeline.internal.where(time_period), :user_id, start: user_minimum_id, finish: user_maximum_id),
ci_pipeline_config_auto_devops: distinct_count(::Ci::Pipeline.auto_devops_source.where(time_period), :user_id, start: user_minimum_id, finish: user_maximum_id),
ci_pipeline_config_repository: distinct_count(::Ci::Pipeline.repository_source.where(time_period), :user_id, start: user_minimum_id, finish: user_maximum_id),
ci_external_pipelines: distinct_count(::Ci::Pipeline.external.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),
ci_internal_pipelines: distinct_count(::Ci::Pipeline.internal.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),
ci_pipeline_config_auto_devops: distinct_count(::Ci::Pipeline.auto_devops_source.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),
ci_pipeline_config_repository: distinct_count(::Ci::Pipeline.repository_source.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),
ci_pipeline_schedules: distinct_count(::Ci::PipelineSchedule.where(time_period), :owner_id),
ci_pipelines: distinct_count(::Ci::Pipeline.where(time_period), :user_id, start: user_minimum_id, finish: user_maximum_id),
ci_pipelines: distinct_count(::Ci::Pipeline.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),
ci_triggers: distinct_count(::Ci::Trigger.where(time_period), :owner_id),
clusters_applications_runner: cluster_applications_user_distinct_count(::Clusters::Applications::Runner, time_period)
}
@ -801,8 +801,8 @@ module Gitlab
end
def distinct_count_service_desk_enabled_projects(time_period)
project_creator_id_start = user_minimum_id
project_creator_id_finish = user_maximum_id
project_creator_id_start = minimum_id(User)
project_creator_id_finish = maximum_id(User)
distinct_count(::Project.service_desk_enabled.where(time_period), :creator_id, start: project_creator_id_start, finish: project_creator_id_finish) # rubocop: disable CodeReuse/ActiveRecord
end
@ -834,57 +834,9 @@ module Gitlab
def total_alert_issues
# Remove prometheus table queries once they are deprecated
# To be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/217407.
add count(Issue.with_alert_management_alerts, start: issue_minimum_id, finish: issue_maximum_id),
count(::Issue.with_self_managed_prometheus_alert_events, start: issue_minimum_id, finish: issue_maximum_id),
count(::Issue.with_prometheus_alert_events, start: issue_minimum_id, finish: issue_maximum_id)
end
def user_minimum_id
strong_memoize(:user_minimum_id) do
::User.minimum(:id)
end
end
def user_maximum_id
strong_memoize(:user_maximum_id) do
::User.maximum(:id)
end
end
def issue_minimum_id
strong_memoize(:issue_minimum_id) do
::Issue.minimum(:id)
end
end
def issue_maximum_id
strong_memoize(:issue_maximum_id) do
::Issue.maximum(:id)
end
end
def deployment_minimum_id
strong_memoize(:deployment_minimum_id) do
::Deployment.minimum(:id)
end
end
def deployment_maximum_id
strong_memoize(:deployment_maximum_id) do
::Deployment.maximum(:id)
end
end
def project_minimum_id
strong_memoize(:project_minimum_id) do
::Project.minimum(:id)
end
end
def project_maximum_id
strong_memoize(:project_maximum_id) do
::Project.maximum(:id)
end
add count(Issue.with_alert_management_alerts, start: minimum_id(Issue), finish: maximum_id(Issue)),
count(::Issue.with_self_managed_prometheus_alert_events, start: minimum_id(Issue), finish: maximum_id(Issue)),
count(::Issue.with_prometheus_alert_events, start: minimum_id(Issue), finish: maximum_id(Issue))
end
def self_monitoring_project
@ -918,7 +870,7 @@ module Gitlab
end
def deployment_count(relation)
count relation, start: deployment_minimum_id, finish: deployment_maximum_id
count relation, start: minimum_id(Deployment), finish: maximum_id(Deployment)
end
def project_imports(time_period)

View file

@ -36,6 +36,12 @@ module Gitlab
'SELECT ' + args.map {|arg| "(#{arg})" }.join(' + ')
end
def maximum_id(model)
end
def minimum_id(model)
end
private
def raw_sql(relation, column, distinct = nil)

View file

@ -36,6 +36,7 @@
module Gitlab
module Utils
module UsageData
include Gitlab::Utils::StrongMemoize
extend self
FALLBACK = -1
@ -209,6 +210,20 @@ module Gitlab
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name.to_s, values: values)
end
def maximum_id(model)
key = :"#{model.name.downcase}_maximum_id"
strong_memoize(key) do
model.maximum(:id)
end
end
def minimum_id(model)
key = :"#{model.name.downcase}_minimum_id"
strong_memoize(key) do
model.minimum(:id)
end
end
private
def prometheus_client(verify:)

View file

@ -3740,6 +3740,9 @@ msgstr ""
msgid "Analyze your source code for known vulnerabilities."
msgstr ""
msgid "Analyzing file…"
msgstr ""
msgid "Ancestors"
msgstr ""
@ -15738,6 +15741,9 @@ msgstr ""
msgid "How do I mirror repositories?"
msgstr ""
msgid "How do I set up this service?"
msgstr ""
msgid "How does cleanup work?"
msgstr ""
@ -22893,13 +22899,13 @@ msgstr ""
msgid "Pipelines|By revoking a trigger you will break any processes making use of it. Are you sure?"
msgstr ""
msgid "Pipelines|CI Lint"
msgid "Pipelines|CI lint"
msgstr ""
msgid "Pipelines|Child pipeline"
msgstr ""
msgid "Pipelines|Clear Runner Caches"
msgid "Pipelines|Clear runner caches"
msgstr ""
msgid "Pipelines|Continuous deployment template to test and deploy your %{name} project."
@ -22947,6 +22953,9 @@ msgstr ""
msgid "Pipelines|Loading Pipelines"
msgstr ""
msgid "Pipelines|Loading pipelines"
msgstr ""
msgid "Pipelines|Merged YAML is view only"
msgstr ""
@ -22968,9 +22977,6 @@ msgstr ""
msgid "Pipelines|Revoke"
msgstr ""
msgid "Pipelines|Run Pipeline"
msgstr ""
msgid "Pipelines|Something went wrong while cleaning runners cache."
msgstr ""
@ -23124,15 +23130,15 @@ msgstr ""
msgid "Pipeline|Raw text search is not currently supported. Please use the available search tokens."
msgstr ""
msgid "Pipeline|Run Pipeline"
msgstr ""
msgid "Pipeline|Run for"
msgstr ""
msgid "Pipeline|Run for branch name or tag"
msgstr ""
msgid "Pipeline|Run pipeline"
msgstr ""
msgid "Pipeline|Running"
msgstr ""
@ -28738,25 +28744,10 @@ msgstr ""
msgid "Slack application"
msgstr ""
msgid "Slack channels (e.g. general, development)"
msgstr ""
msgid "Slack integration allows you to interact with GitLab via slash commands in a chat window."
msgstr ""
msgid "SlackIntegration|%{strong_open}Note:%{strong_close} Usernames and private channels are not supported."
msgstr ""
msgid "SlackIntegration|%{webhooks_link_start}Add an incoming webhook%{webhooks_link_end} in your Slack team. The default channel can be overridden for each event."
msgstr ""
msgid "SlackIntegration|Paste the %{strong_open}Webhook URL%{strong_close} into the field below."
msgstr ""
msgid "SlackIntegration|Select events below to enable notifications. The %{strong_open}Slack channel names%{strong_close} and %{strong_open}Slack username%{strong_close} fields are optional."
msgstr ""
msgid "SlackIntegration|This service sends notifications about project events to Slack channels. To set up this service:"
msgid "SlackIntegration|Sends notifications about project events to Slack channels."
msgstr ""
msgid "SlackService|2. Paste the %{strong_open}Token%{strong_close} into the field below"
@ -36585,6 +36576,9 @@ msgid_plural "from %d jobs"
msgstr[0] ""
msgstr[1] ""
msgid "general, development"
msgstr ""
msgid "group"
msgstr ""

View file

@ -31,7 +31,7 @@ module QA
end
def wait_for_latest_pipeline_status
wait_until(max_duration: 30, reload: true, sleep_interval: 5) { has_pipeline? }
wait_until(max_duration: 90, reload: true, sleep_interval: 5) { has_pipeline? }
wait_until(reload: false, max_duration: 360) do
within_element_by_index(:pipeline_commit_status, 0) { yield }

View file

@ -109,7 +109,7 @@ RSpec.describe ChaosController do
describe '#kill' do
it 'calls synchronously' do
expect(Gitlab::Chaos).to receive(:kill).with(no_args)
expect(Gitlab::Chaos).to receive(:kill).with('KILL')
get :kill
@ -117,7 +117,7 @@ RSpec.describe ChaosController do
end
it 'calls asynchronously' do
expect(Chaos::KillWorker).to receive(:perform_async).with(no_args)
expect(Chaos::KillWorker).to receive(:perform_async).with('KILL')
get :kill, params: { async: 1 }
@ -125,6 +125,24 @@ RSpec.describe ChaosController do
end
end
describe '#quit' do
it 'calls synchronously' do
expect(Gitlab::Chaos).to receive(:kill).with('QUIT')
get :quit
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
expect(Chaos::KillWorker).to receive(:perform_async).with('QUIT')
get :quit, params: { async: 1 }
expect(response).to have_gitlab_http_status(:ok)
end
end
describe '#gc' do
let(:gc_stat) { GC.stat.stringify_keys }

View file

@ -41,7 +41,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
context 'with a detached merge request pipeline' do
let(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline) }
it 'displays the Run Pipeline button' do
it 'displays the "Run pipeline" button' do
visit project_merge_request_path(project, merge_request)
page.within('.merge-request-tabs') do
@ -50,14 +50,14 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
wait_for_requests
expect(page.find('[data-testid="run_pipeline_button"]')).to have_text('Run Pipeline')
expect(page.find('[data-testid="run_pipeline_button"]')).to have_text('Run pipeline')
end
end
context 'with a merged results pipeline' do
let(:merge_request) { create(:merge_request, :with_merge_request_pipeline) }
it 'displays the Run Pipeline button' do
it 'displays the "Run pipeline" button' do
visit project_merge_request_path(project, merge_request)
page.within('.merge-request-tabs') do
@ -66,7 +66,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
wait_for_requests
expect(page.find('[data-testid="run_pipeline_button"]')).to have_text('Run Pipeline')
expect(page.find('[data-testid="run_pipeline_button"]')).to have_text('Run pipeline')
end
end
end
@ -131,7 +131,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
visit project_merge_request_path(parent_project, merge_request)
create_merge_request_pipeline
act_on_security_warning(action: 'Run Pipeline')
act_on_security_warning(action: 'Run pipeline')
check_pipeline(expected_project: parent_project)
check_head_pipeline(expected_project: parent_project)
@ -175,7 +175,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do
def create_merge_request_pipeline
page.within('.merge-request-tabs') { click_link('Pipelines') }
click_button('Run Pipeline')
click_button('Run pipeline')
end
def check_pipeline(expected_project:)

View file

@ -93,12 +93,12 @@ RSpec.describe 'Pipelines', :js do
wait_for_requests
end
it 'renders run pipeline link' do
expect(page).to have_link('Run Pipeline')
it 'renders "CI lint" link' do
expect(page).to have_link('CI lint')
end
it 'renders ci lint link' do
expect(page).to have_link('CI Lint')
it 'renders "Run pipeline" link' do
expect(page).to have_link('Run pipeline')
end
end
@ -676,7 +676,7 @@ RSpec.describe 'Pipelines', :js do
end
it 'creates a new pipeline' do
expect { click_on 'Run Pipeline' }
expect { click_on 'Run pipeline' }
.to change { Ci::Pipeline.count }.by(1)
expect(Ci::Pipeline.last).to be_web
@ -689,7 +689,7 @@ RSpec.describe 'Pipelines', :js do
fill_in "Input variable value", with: "value"
end
expect { click_on 'Run Pipeline' }
expect { click_on 'Run pipeline' }
.to change { Ci::Pipeline.count }.by(1)
expect(Ci::Pipeline.last.variables.map { |var| var.slice(:key, :secret_value) })
@ -700,7 +700,7 @@ RSpec.describe 'Pipelines', :js do
context 'without gitlab-ci.yml' do
before do
click_on 'Run Pipeline'
click_on 'Run pipeline'
end
it { expect(page).to have_content('Missing CI config file') }
@ -713,13 +713,49 @@ RSpec.describe 'Pipelines', :js do
click_link 'master'
end
expect { click_on 'Run Pipeline' }
expect { click_on 'Run pipeline' }
.to change { Ci::Pipeline.count }.by(1)
end
end
end
end
describe 'Reset runner caches' do
let(:project) { create(:project, :repository) }
before do
create(:ci_empty_pipeline, status: 'success', project: project, sha: project.commit.id, ref: 'master')
project.add_maintainer(user)
visit project_pipelines_path(project)
end
it 'has a clear caches button' do
expect(page).to have_button 'Clear runner caches'
end
describe 'user clicks the button' do
context 'when project already has jobs_cache_index' do
before do
project.update!(jobs_cache_index: 1)
end
it 'increments jobs_cache_index' do
click_button 'Clear runner caches'
wait_for_requests
expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.'
end
end
context 'when project does not have jobs_cache_index' do
it 'sets jobs_cache_index to 1' do
click_button 'Clear runner caches'
wait_for_requests
expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.'
end
end
end
end
describe 'Run Pipelines' do
let(:project) { create(:project, :repository) }
@ -751,42 +787,6 @@ RSpec.describe 'Pipelines', :js do
end
end
describe 'Reset runner caches' do
let(:project) { create(:project, :repository) }
before do
create(:ci_empty_pipeline, status: 'success', project: project, sha: project.commit.id, ref: 'master')
project.add_maintainer(user)
visit project_pipelines_path(project)
end
it 'has a clear caches button' do
expect(page).to have_button 'Clear Runner Caches'
end
describe 'user clicks the button' do
context 'when project already has jobs_cache_index' do
before do
project.update!(jobs_cache_index: 1)
end
it 'increments jobs_cache_index' do
click_button 'Clear Runner Caches'
wait_for_requests
expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.'
end
end
context 'when project does not have jobs_cache_index' do
it 'sets jobs_cache_index to 1' do
click_button 'Clear Runner Caches'
wait_for_requests
expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.'
end
end
end
end
describe 'Empty State' do
let(:project) { create(:project, :repository) }

View file

@ -138,11 +138,11 @@ describe('TriggerFields', () => {
const expectedResults = [
{
name: 'service[push_channel]',
placeholder: 'Slack channels (e.g. general, development)',
placeholder: 'general, development',
},
{
name: 'service[merge_request_channel]',
placeholder: 'Slack channels (e.g. general, development)',
placeholder: 'general, development',
},
];

View file

@ -29,7 +29,7 @@ describe('Pipelines Nav Controls', () => {
createComponent(mockData);
const runPipeline = findRunPipeline();
expect(runPipeline.text()).toContain('Run Pipeline');
expect(runPipeline.text()).toContain('Run pipeline');
expect(runPipeline.attributes('href')).toBe(mockData.newPipelinePath);
});
@ -55,7 +55,7 @@ describe('Pipelines Nav Controls', () => {
createComponent(mockData);
expect(wrapper.find('.js-ci-lint').text().trim()).toContain('CI Lint');
expect(wrapper.find('.js-ci-lint').text().trim()).toContain('CI lint');
expect(wrapper.find('.js-ci-lint').attributes('href')).toBe(mockData.ciLintPath);
});
@ -70,7 +70,7 @@ describe('Pipelines Nav Controls', () => {
});
it('should render button for resetting runner caches', () => {
expect(wrapper.find('.js-clear-cache').text().trim()).toContain('Clear Runner Caches');
expect(wrapper.find('.js-clear-cache').text().trim()).toContain('Clear runner caches');
});
it('should emit postAction event when reset runner cache button is clicked', async () => {

View file

@ -191,16 +191,16 @@ describe('Pipelines', () => {
expect(findNavigationControls().exists()).toBe(true);
});
it('renders Run Pipeline link', () => {
it('renders Run pipeline link', () => {
expect(findRunPipelineButton().attributes('href')).toBe(paths.newPipelinePath);
});
it('renders CI Lint link', () => {
it('renders CI lint link', () => {
expect(findCiLintButton().attributes('href')).toBe(paths.ciLintPath);
});
it('renders Clear Runner Cache button', () => {
expect(findCleanCacheButton().text()).toBe('Clear Runner Caches');
it('renders Clear runner cache button', () => {
expect(findCleanCacheButton().text()).toBe('Clear runner caches');
});
it('renders pipelines in a table', () => {
@ -499,16 +499,16 @@ describe('Pipelines', () => {
expect(findTab('all').text()).toMatchInterpolatedText('All 0');
});
it('renders Run Pipeline link', () => {
it('renders Run pipeline link', () => {
expect(findRunPipelineButton().attributes('href')).toBe(paths.newPipelinePath);
});
it('renders CI Lint link', () => {
it('renders CI lint link', () => {
expect(findCiLintButton().attributes('href')).toBe(paths.ciLintPath);
});
it('renders Clear Runner Cache button', () => {
expect(findCleanCacheButton().text()).toBe('Clear Runner Caches');
it('renders Clear runner cache button', () => {
expect(findCleanCacheButton().text()).toBe('Clear runner caches');
});
it('renders empty state', () => {
@ -714,7 +714,7 @@ describe('Pipelines', () => {
expect(findRunPipelineButton().attributes('href')).toBe(paths.newPipelinePath);
expect(findCiLintButton().attributes('href')).toBe(paths.ciLintPath);
expect(findCleanCacheButton().text()).toBe('Clear Runner Caches');
expect(findCleanCacheButton().text()).toBe('Clear runner caches');
});
it('shows error state', () => {

View file

@ -58,4 +58,24 @@ RSpec.describe Gitlab::UsageDataQueries do
.to eq('SELECT (SELECT COUNT("users"."id") FROM "users") + (SELECT COUNT("issues"."id") FROM "issues")')
end
end
describe 'min/max methods' do
it 'returns nil' do
# user min/max
expect(described_class.minimum_id(User)).to eq(nil)
expect(described_class.maximum_id(User)).to eq(nil)
# issue min/max
expect(described_class.minimum_id(Issue)).to eq(nil)
expect(described_class.maximum_id(Issue)).to eq(nil)
# deployment min/max
expect(described_class.minimum_id(Deployment)).to eq(nil)
expect(described_class.maximum_id(Deployment)).to eq(nil)
# project min/max
expect(described_class.minimum_id(Project)).to eq(nil)
expect(described_class.maximum_id(Project)).to eq(nil)
end
end
end

View file

@ -479,4 +479,22 @@ RSpec.describe Gitlab::Utils::UsageData do
expect { described_class.track_usage_event(unknown_event, value) }.to raise_error(Gitlab::UsageDataCounters::HLLRedisCounter::UnknownEvent)
end
end
describe 'min/max' do
let(:model) { double(:relation) }
it 'returns min from the model' do
allow(model).to receive(:minimum).and_return(2)
allow(model).to receive(:name).and_return('sample_min_model')
expect(described_class.minimum_id(model)).to eq(2)
end
it 'returns max from the model' do
allow(model).to receive(:maximum).and_return(100)
allow(model).to receive(:name).and_return('sample_max_model')
expect(described_class.maximum_id(model)).to eq(100)
end
end
end