Commit 0364c112 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 6f973369 c711c6fb
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import { escape } from 'lodash';
import { GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { GlButton, GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { sprintf } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash';
......@@ -19,6 +19,7 @@ export default {
components: {
DiffFileHeader,
DiffContent,
GlButton,
GlLoadingIcon,
},
directives: {
......@@ -267,16 +268,21 @@ export default {
<div v-safe-html="errorMessage" class="nothing-here-block"></div>
</div>
<template v-else>
<div v-show="showWarning" class="nothing-here-block diff-collapsed">
{{ $options.i18n.collapsed }}
<a
class="click-to-expand"
data-testid="toggle-link"
href="#"
<div
v-show="showWarning"
class="collapsed-file-warning gl-p-7 gl-bg-orange-50 gl-text-center gl-rounded-bottom-left-base gl-rounded-bottom-right-base"
>
<p class="gl-mb-8">
{{ $options.i18n.autoCollapsed }}
</p>
<gl-button
data-testid="expand-button"
category="secondary"
variant="warning"
@click.prevent="handleToggle"
>
{{ $options.i18n.expand }}
</a>
</gl-button>
</div>
<diff-content
v-show="showContent"
......
......@@ -13,6 +13,6 @@ export const DIFF_FILE = {
),
fork: __('Fork'),
cancel: __('Cancel'),
collapsed: __('This diff is collapsed.'),
expand: __('Click to expand it.'),
autoCollapsed: __('Files with large changes are collapsed by default.'),
expand: __('Expand file'),
};
......@@ -15,22 +15,22 @@ module Types
field :edit_url, GraphQL::STRING_TYPE, null: true,
description: "HTTP URL of the release's edit page",
authorize: :update_release
field :open_merge_requests_url, GraphQL::STRING_TYPE, null: true,
field :opened_merge_requests_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the merge request page, filtered by this release and `state=open`'
field :merged_merge_requests_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the merge request page , filtered by this release and `state=merged`'
field :closed_merge_requests_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the merge request page , filtered by this release and `state=closed`'
field :open_issues_url, GraphQL::STRING_TYPE, null: true,
field :opened_issues_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the issues page, filtered by this release and `state=open`'
field :closed_issues_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the issues page, filtered by this release and `state=closed`'
field :merge_requests_url, GraphQL::STRING_TYPE, null: true, method: :open_merge_requests_url,
field :merge_requests_url, GraphQL::STRING_TYPE, null: true, method: :opened_merge_requests_url,
description: 'HTTP URL of the merge request page filtered by this release',
deprecated: { reason: 'Use `open_merge_requests_url`', milestone: '13.6' }
field :issues_url, GraphQL::STRING_TYPE, null: true, method: :open_issues_url,
deprecated: { reason: 'Use `openedMergeRequestsUrl`', milestone: '13.6' }
field :issues_url, GraphQL::STRING_TYPE, null: true, method: :opened_issues_url,
description: 'HTTP URL of the issues page filtered by this release',
deprecated: { reason: 'Use `open_issues_url`', milestone: '13.6' }
deprecated: { reason: 'Use `openedIssuesUrl`', milestone: '13.6' }
end
end
......@@ -23,7 +23,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
project_release_url(project, release)
end
def open_merge_requests_url
def opened_merge_requests_url
return unless release_mr_issue_urls_available?
project_merge_requests_url(project, params_for_issues_and_mrs)
......@@ -41,7 +41,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
project_merge_requests_url(project, params_for_issues_and_mrs(state: 'closed'))
end
def open_issues_url
def opened_issues_url
return unless release_mr_issue_urls_available?
project_issues_url(project, params_for_issues_and_mrs)
......
......@@ -14,7 +14,7 @@ module Ci
def remaining_work_count(*args)
@remaining_work_count ||= service
.remaining_batches_count(max_batch_count: remaining_capacity)
.remaining_batches_count(max_batch_count: max_running_jobs)
end
def max_running_jobs
......
---
title: Expand Diff File collapsed UI to be significantly more obvious
merge_request: 46286
author:
type: changed
---
name: ci_new_artifact_file_reader
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46552
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/273755
milestone: '13.6'
type: development
group: group::pipeline authoring
default_enabled: false
......@@ -17273,14 +17273,14 @@ type ReleaseLinks {
editUrl: String
"""
HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `open_issues_url`
HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `openedIssuesUrl`
"""
issuesUrl: String @deprecated(reason: "Use `open_issues_url`. Deprecated in 13.6")
issuesUrl: String @deprecated(reason: "Use `openedIssuesUrl`. Deprecated in 13.6")
"""
HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `open_merge_requests_url`
HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `openedMergeRequestsUrl`
"""
mergeRequestsUrl: String @deprecated(reason: "Use `open_merge_requests_url`. Deprecated in 13.6")
mergeRequestsUrl: String @deprecated(reason: "Use `openedMergeRequestsUrl`. Deprecated in 13.6")
"""
HTTP URL of the merge request page , filtered by this release and `state=merged`
......@@ -17290,12 +17290,12 @@ type ReleaseLinks {
"""
HTTP URL of the issues page, filtered by this release and `state=open`
"""
openIssuesUrl: String
openedIssuesUrl: String
"""
HTTP URL of the merge request page, filtered by this release and `state=open`
"""
openMergeRequestsUrl: String
openedMergeRequestsUrl: String
"""
HTTP URL of the release
......
......@@ -49821,7 +49821,7 @@
},
{
"name": "issuesUrl",
"description": "HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `open_issues_url`",
"description": "HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `openedIssuesUrl`",
"args": [
],
......@@ -49831,11 +49831,11 @@
"ofType": null
},
"isDeprecated": true,
"deprecationReason": "Use `open_issues_url`. Deprecated in 13.6"
"deprecationReason": "Use `openedIssuesUrl`. Deprecated in 13.6"
},
{
"name": "mergeRequestsUrl",
"description": "HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `open_merge_requests_url`",
"description": "HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `openedMergeRequestsUrl`",
"args": [
],
......@@ -49845,7 +49845,7 @@
"ofType": null
},
"isDeprecated": true,
"deprecationReason": "Use `open_merge_requests_url`. Deprecated in 13.6"
"deprecationReason": "Use `openedMergeRequestsUrl`. Deprecated in 13.6"
},
{
"name": "mergedMergeRequestsUrl",
......@@ -49862,7 +49862,7 @@
"deprecationReason": null
},
{
"name": "openIssuesUrl",
"name": "openedIssuesUrl",
"description": "HTTP URL of the issues page, filtered by this release and `state=open`",
"args": [
......@@ -49876,7 +49876,7 @@
"deprecationReason": null
},
{
"name": "openMergeRequestsUrl",
"name": "openedMergeRequestsUrl",
"description": "HTTP URL of the merge request page, filtered by this release and `state=open`",
"args": [
......@@ -2304,11 +2304,11 @@ Evidence for a release.
| `closedIssuesUrl` | String | HTTP URL of the issues page, filtered by this release and `state=closed` |
| `closedMergeRequestsUrl` | String | HTTP URL of the merge request page , filtered by this release and `state=closed` |
| `editUrl` | String | HTTP URL of the release's edit page |
| `issuesUrl` **{warning-solid}** | String | **Deprecated:** Use `open_issues_url`. Deprecated in 13.6 |
| `mergeRequestsUrl` **{warning-solid}** | String | **Deprecated:** Use `open_merge_requests_url`. Deprecated in 13.6 |
| `issuesUrl` **{warning-solid}** | String | **Deprecated:** Use `openedIssuesUrl`. Deprecated in 13.6 |
| `mergeRequestsUrl` **{warning-solid}** | String | **Deprecated:** Use `openedMergeRequestsUrl`. Deprecated in 13.6 |
| `mergedMergeRequestsUrl` | String | HTTP URL of the merge request page , filtered by this release and `state=merged` |
| `openIssuesUrl` | String | HTTP URL of the issues page, filtered by this release and `state=open` |
| `openMergeRequestsUrl` | String | HTTP URL of the merge request page, filtered by this release and `state=open` |
| `openedIssuesUrl` | String | HTTP URL of the issues page, filtered by this release and `state=open` |
| `openedMergeRequestsUrl` | String | HTTP URL of the merge request page, filtered by this release and `state=open` |
| `selfUrl` | String | HTTP URL of the release |
### ReleaseSource
......
......@@ -302,6 +302,58 @@ build:
- docker run my-docker-image /script/to/run/tests
```
#### Enable registry mirror for `docker:dind` service
When the Docker daemon starts inside of the service container, it uses
the default configuration. You may want to configure a [registry
mirror](https://docs.docker.com/registry/recipes/mirror/) for
performance improvements and ensuring you don't reach DockerHub rate limits.
##### Inside `.gitlab-ci.yml`
You can append extra CLI flags to the `dind` service to set the registry
mirror:
```yaml
services:
- name: docker:19.03.13-dind
command: ["--registry-mirror", "https://registry-mirror.example.com"] # Specify the registry mirror to use.
```
##### Docker executor inside GitLab Runner configuration
If you are an administrator of GitLab Runner and you always want to use
the mirror for every `dind` service, update the
[configuration](https://docs.gitlab.com/runner/configuration/advanced-configuration.html)
to specify a [volume
mount](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#volumes-in-the-runnersdocker-section).
Given we have a file `/opt/docker/daemon.json` with the following
content:
```json
{
"registry-mirrors": [
"https://registry-mirror.example.com"
]
}
```
Update the `config.toml` for GitLab Runner to mount the file to
`/etc/docker/daemon.json`. This would mount the file for **every**
container that is created by GitLab Runner. The configuration will be
picked up by the `dind` service.
```toml
[[runners]]
...
executor = "docker"
[runners.docker]
image = "alpine:3.12"
privileged = true
volumes = ["/opt/docker/daemon.json:/etc/docker/daemon.json:ro"]
```
### Use Docker socket binding
The third approach is to bind-mount `/var/run/docker.sock` into the
......
......@@ -30,8 +30,8 @@ module API
expose :evidences, using: Entities::Releases::Evidence, expose_nil: false, if: ->(_, _) { can_download_code? }
expose :_links do
expose :self_url, as: :self, expose_nil: false
expose :open_merge_requests_url, as: :merge_requests_url, expose_nil: false
expose :open_issues_url, as: :issues_url, expose_nil: false
expose :opened_merge_requests_url, as: :merge_requests_url, expose_nil: false
expose :opened_issues_url, as: :issues_url, expose_nil: false
expose :edit_url, expose_nil: false
end
......
......@@ -45,6 +45,14 @@ module Gitlab
end
def read_zip_file!(file_path)
if ::Feature.enabled?(:ci_new_artifact_file_reader, job.project, default_enabled: false)
read_with_new_artifact_file_reader(file_path)
else
read_with_legacy_artifact_file_reader(file_path)
end
end
def read_with_new_artifact_file_reader(file_path)
job.artifacts_file.use_open_file do |file|
zip_file = Zip::File.new(file, false, true)
entry = zip_file.find_entry(file_path)
......@@ -61,6 +69,25 @@ module Gitlab
end
end
def read_with_legacy_artifact_file_reader(file_path)
job.artifacts_file.use_file do |archive_path|
Zip::File.open(archive_path) do |zip_file|
entry = zip_file.find_entry(file_path)
unless entry
raise Error, "Path `#{file_path}` does not exist inside the `#{job.name}` artifacts archive!"
end
if entry.name_is_directory?
raise Error, "Path `#{file_path}` was expected to be a file but it was a directory!"
end
zip_file.get_input_stream(entry) do |is|
is.read
end
end
end
end
def max_archive_size_in_mb
ActiveSupport::NumberHelper.number_to_human_size(MAX_ARCHIVE_SIZE)
end
......
......@@ -18,6 +18,15 @@ module Gitlab
FEATURE_CATEGORY_HEADER = 'X-Gitlab-Feature-Category'
FEATURE_CATEGORY_DEFAULT = 'unknown'
# These were the top 5 categories at a point in time, chosen as a
# reasonable default. If we initialize every category we'll end up
# with an explosion in unused metric combinations, but we want the
# most common ones to be always present.
FEATURE_CATEGORIES_TO_INITIALIZE = ['authentication_and_authorization',
'code_review', 'continuous_integration',
'not_owned', 'source_code_management',
FEATURE_CATEGORY_DEFAULT].freeze
def initialize(app)
@app = app
end
......@@ -46,16 +55,10 @@ module Gitlab
#
# For example `rate(http_requests_total{status="500"}[1m])` would return
# no data until the first 500 error would occur.
# The list of feature categories is currently not needed by the application
# anywhere else. So no need to keep these in memory forever.
# Doing it here, means we're only reading the file on boot.
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:strip).uniq << FEATURE_CATEGORY_DEFAULT
HTTP_METHODS.each do |method, statuses|
http_request_duration_seconds.get({ method: method })
statuses.product(feature_categories) do |status, feature_category|
statuses.product(FEATURE_CATEGORIES_TO_INITIALIZE) do |status, feature_category|
http_requests_total.get({ method: method, status: status, feature_category: feature_category })
end
end
......
......@@ -10884,6 +10884,9 @@ msgstr ""
msgid "Expand approvers"
msgstr ""
msgid "Expand file"
msgstr ""
msgid "Expand milestones"
msgstr ""
......@@ -11585,6 +11588,9 @@ msgstr ""
msgid "Files breadcrumb"
msgstr ""
msgid "Files with large changes are collapsed by default."
msgstr ""
msgid "Files, directories, and submodules in the path %{path} for commit reference %{ref}"
msgstr ""
......
......@@ -15,11 +15,11 @@ RSpec.describe 'User expands diff', :js do
it 'allows user to expand diff' do
page.within find('[id="19763941ab80e8c09871c0a425f0560d9053bcb3"]') do
click_link 'Click to expand it.'
find('[data-testid="expand-button"]').click
wait_for_requests
expect(page).not_to have_content('Click to expand it.')
expect(page).not_to have_content('Expand file')
expect(page).to have_selector('.code')
end
end
......
......@@ -90,7 +90,7 @@ function createComponent({ file }) {
const findDiffHeader = wrapper => wrapper.find(DiffFileHeaderComponent);
const findDiffContentArea = wrapper => wrapper.find('[data-testid="content-area"]');
const findLoader = wrapper => wrapper.find('[data-testid="loader-icon"]');
const findToggleLinks = wrapper => wrapper.findAll('[data-testid="toggle-link"]');
const findToggleButton = wrapper => wrapper.find('[data-testid="expand-button"]');
const toggleFile = wrapper => findDiffHeader(wrapper).vm.$emit('toggleFile');
const isDisplayNone = element => element.style.display === 'none';
......@@ -187,9 +187,11 @@ describe('DiffFile', () => {
makeFileAutomaticallyCollapsed(store);
});
it('should show the collapsed file warning with expansion link', () => {
expect(findDiffContentArea(wrapper).html()).toContain('This diff is collapsed');
expect(findToggleLinks(wrapper).length).toEqual(1);
it('should show the collapsed file warning with expansion button', () => {
expect(findDiffContentArea(wrapper).html()).toContain(
'Files with large changes are collapsed by default.',
);
expect(findToggleButton(wrapper).exists()).toBe(true);
});
it('should style the component so that it `.has-body` for layout purposes', () => {
......@@ -292,8 +294,10 @@ describe('DiffFile', () => {
await wrapper.vm.$nextTick();
expect(findDiffContentArea(wrapper).html()).toContain('This diff is collapsed');
expect(findToggleLinks(wrapper).length).toEqual(1);
expect(findDiffContentArea(wrapper).html()).toContain(
'Files with large changes are collapsed by default.',
);
expect(findToggleButton(wrapper).exists()).toBe(true);
});
it.each`
......
......@@ -8,10 +8,10 @@ RSpec.describe GitlabSchema.types['ReleaseLinks'] do
it 'has the expected fields' do
expected_fields = %w[
selfUrl
openMergeRequestsUrl
openedMergeRequestsUrl
mergedMergeRequestsUrl
closedMergeRequestsUrl
openIssuesUrl
openedIssuesUrl
closedIssuesUrl
editUrl
mergeRequestsUrl
......
......@@ -18,6 +18,17 @@ RSpec.describe Gitlab::Ci::ArtifactFileReader do
expect(YAML.safe_load(subject).keys).to contain_exactly('rspec', 'time', 'custom')
end
context 'when FF ci_new_artifact_file_reader is disabled' do
before do
stub_feature_flags(ci_new_artifact_file_reader: false)
end
it 'returns the content at the path' do
is_expected.to be_present
expect(YAML.safe_load(subject).keys).to contain_exactly('rspec', 'time', 'custom')
end
end
context 'when path does not exist' do
let(:path) { 'file/does/not/exist.txt' }
let(:expected_error) do
......
......@@ -129,12 +129,11 @@ RSpec.describe Gitlab::Metrics::RequestsRackMiddleware, :aggregate_failures do
describe '.initialize_metrics', :prometheus do
it "sets labels for http_requests_total" do
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:strip) << described_class::FEATURE_CATEGORY_DEFAULT
expected_labels = []
described_class::HTTP_METHODS.each do |method, statuses|
statuses.each do |status|
feature_categories.each do |feature_category|
described_class::FEATURE_CATEGORIES_TO_INITIALIZE.each do |feature_category|
expected_labels << { method: method.to_s, status: status.to_s, feature_category: feature_category.to_s }
end
end
......@@ -152,6 +151,13 @@ RSpec.describe Gitlab::Metrics::RequestsRackMiddleware, :aggregate_failures do
expect(described_class.http_request_duration_seconds.values.keys).to include(*expected_labels)
end
it 'has every label in config/feature_categories.yml' do
defaults = [described_class::FEATURE_CATEGORY_DEFAULT, 'not_owned']
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:strip) + defaults
expect(described_class::FEATURE_CATEGORIES_TO_INITIALIZE).to all(be_in(feature_categories))
end
end
end
end
......@@ -64,8 +64,8 @@ RSpec.describe ReleasePresenter do
end
end
describe '#open_merge_requests_url' do
subject { presenter.open_merge_requests_url }
describe '#opened_merge_requests_url' do
subject { presenter.opened_merge_requests_url }
it 'returns merge requests url with state=open' do
is_expected.to eq(project_merge_requests_url(project, opened_url_params))
......@@ -112,8 +112,8 @@ RSpec.describe ReleasePresenter do
end
end
describe '#open_issues_url' do
subject { presenter.open_issues_url }
describe '#opened_issues_url' do
subject { presenter.opened_issues_url }
it 'returns issues url with state=open' do
is_expected.to eq(project_issues_url(project, opened_url_params))
......
......@@ -184,10 +184,10 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
let(:release_fields) do
query_graphql_field(:links, nil, %{
selfUrl
openMergeRequestsUrl
openedMergeRequestsUrl
mergedMergeRequestsUrl
closedMergeRequestsUrl
openIssuesUrl
openedIssuesUrl
closedIssuesUrl
mergeRequestsUrl
issuesUrl
......@@ -199,10 +199,10 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
expect(data).to eq(
'selfUrl' => project_release_url(project, release),
'openMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'openedMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'mergedMergeRequestsUrl' => project_merge_requests_url(project, merged_url_params),
'closedMergeRequestsUrl' => project_merge_requests_url(project, closed_url_params),
'openIssuesUrl' => project_issues_url(project, opened_url_params),
'openedIssuesUrl' => project_issues_url(project, opened_url_params),
'closedIssuesUrl' => project_issues_url(project, closed_url_params),
'mergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'issuesUrl' => project_issues_url(project, opened_url_params)
......
......@@ -42,10 +42,10 @@ RSpec.describe 'Query.project(fullPath).releases()' do
}
links {
selfUrl
openMergeRequestsUrl
openedMergeRequestsUrl
mergedMergeRequestsUrl
closedMergeRequestsUrl
openIssuesUrl
openedIssuesUrl
closedIssuesUrl
mergeRequestsUrl
issuesUrl
......@@ -111,10 +111,10 @@ RSpec.describe 'Query.project(fullPath).releases()' do
},
'links' => {
'selfUrl' => project_release_url(project, release),
'openMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'openedMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'mergedMergeRequestsUrl' => project_merge_requests_url(project, merged_url_params),
'closedMergeRequestsUrl' => project_merge_requests_url(project, closed_url_params),
'openIssuesUrl' => project_issues_url(project, opened_url_params),
'openedIssuesUrl' => project_issues_url(project, opened_url_params),
'closedIssuesUrl' => project_issues_url(project, closed_url_params),
'mergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'issuesUrl' => project_issues_url(project, opened_url_params)
......
......@@ -9,9 +9,14 @@ RSpec.describe Ci::DeleteObjectsWorker do
describe '#perform' do
it 'executes a service' do
allow(worker).to receive(:max_running_jobs).and_return(25)
expect_next_instance_of(Ci::DeleteObjectsService) do |instance|
expect(instance).to receive(:execute)
expect(instance).to receive(:remaining_batches_count).once.and_call_original
expect(instance).to receive(:remaining_batches_count)
.with(max_batch_count: 25)
.once
.and_call_original
end
worker.perform
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment