Skip to content

Commit aee5750

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 99c1dfd commit aee5750

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+878
-407
lines changed

.gitlab/ci/build-images.gitlab-ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ build-qa-image:
2323
script:
2424
- run_timed_command "scripts/build_qa_image"
2525

26+
build-qa-image as-if-foss:
27+
extends:
28+
- build-qa-image
29+
- .as-if-foss
30+
2631
build-assets-image:
2732
extends:
2833
- .base-image-build

.gitlab/ci/global.gitlab-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@
350350
variables:
351351
QEMU_IMAGE: tonistiigi/binfmt:qemu-v7.0.0
352352
before_script:
353-
- source scripts/utils.sh
353+
- !reference [.default-utils-before_script, before_script]
354354
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
355355
- |
356356
if [[ "${ARCH}" =~ arm64 ]]; then

.solargraph.yml.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ formatter:
2424
rubocop: # formatting
2525
require_paths: []
2626
plugins: []
27-
max_files: 15000
27+
max_files: 20000

GITALY_SERVER_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ced25e5189dc1ad4c22103b831672749f66e6775
1+
7009d90dabb1f18a921af11fe12cb8640d7fa14a

app/assets/javascripts/pages/projects/blob/show/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ const router = new VueRouter({ mode: 'history' });
2727
const viewBlobEl = document.querySelector('#js-view-blob-app');
2828

2929
if (viewBlobEl) {
30-
const { blobPath, projectPath, targetBranch, originalBranch } = viewBlobEl.dataset;
31-
30+
const { blobPath, projectPath, targetBranch, originalBranch, refType } = viewBlobEl.dataset;
3231
// eslint-disable-next-line no-new
3332
new Vue({
3433
el: viewBlobEl,
@@ -38,6 +37,7 @@ if (viewBlobEl) {
3837
provide: {
3938
targetBranch,
4039
originalBranch,
40+
refType,
4141
},
4242
render(createElement) {
4343
return createElement(BlobContentViewer, {

app/assets/javascripts/repository/components/blob_content_viewer.vue

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export default {
4040
originalBranch: {
4141
default: '',
4242
},
43+
refType: {
44+
default: '',
45+
},
4346
},
4447
apollo: {
4548
projectInfo: {
@@ -76,6 +79,7 @@ export default {
7679
projectPath: this.projectPath,
7780
filePath: this.path,
7881
ref: this.originalBranch || this.ref,
82+
refType: this.refType,
7983
shouldFetchRawText: Boolean(this.glFeatures.highlightJs),
8084
};
8185
},

app/assets/javascripts/work_items/components/work_item_detail.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getParameterByName } from '~/lib/utils/url_utility';
1919
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
2020
import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue';
2121
import {
22+
sprintfWorkItem,
2223
i18n,
2324
WIDGET_TYPE_ASSIGNEES,
2425
WIDGET_TYPE_LABELS,
@@ -207,6 +208,9 @@ export default {
207208
canDelete() {
208209
return this.workItem?.userPermissions?.deleteWorkItem;
209210
},
211+
confidentialTooltip() {
212+
return sprintfWorkItem(this.$options.i18n.confidentialTooltip, this.workItemType);
213+
},
210214
fullPath() {
211215
return this.workItem?.project.fullPath;
212216
},
@@ -482,7 +486,7 @@ export default {
482486
<gl-badge
483487
v-if="workItem.confidential"
484488
v-gl-tooltip.bottom
485-
:title="$options.i18n.confidentialTooltip"
489+
:title="confidentialTooltip"
486490
variant="warning"
487491
icon="eye-slash"
488492
class="gl-mr-3 gl-cursor-help"

app/assets/javascripts/work_items/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const i18n = {
4141
),
4242
updateError: s__('WorkItem|Something went wrong while updating the work item. Please try again.'),
4343
confidentialTooltip: s__(
44-
'WorkItem|Only project members with at least the Reporter role, the author, and assignees can view or be notified about this task.',
44+
'WorkItem|Only project members with at least the Reporter role, the author, and assignees can view or be notified about this %{workItemType}.',
4545
),
4646
};
4747

app/assets/stylesheets/utilities.scss

+19
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,25 @@ to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1709
236236
}
237237
}
238238

239+
// Utils below are very specific so cannot be part of GitLab UI
240+
.gl-md-mt-5 {
241+
@include gl-media-breakpoint-up(md) {
242+
margin-top: $gl-spacing-scale-5;
243+
}
244+
}
245+
246+
.gl-sm-mr-0\! {
247+
@include gl-media-breakpoint-down(md) {
248+
margin-right: 0 !important;
249+
}
250+
}
251+
252+
.gl-sm-mb-5 {
253+
@include gl-media-breakpoint-down(md) {
254+
margin-bottom: $gl-spacing-scale-5;
255+
}
256+
}
257+
239258

240259
.gl-gap-2 {
241260
gap: $gl-spacing-scale-2;

app/controllers/projects/blob_controller.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def create
6262
def show
6363
conditionally_expand_blob(@blob)
6464

65+
@ref_type = ref_type
6566
respond_to do |format|
6667
format.html do
6768
show_html
@@ -146,8 +147,8 @@ def blob
146147
end
147148

148149
def commit
149-
@commit ||= @repository.commit(@ref)
150-
150+
@repo = @repository
151+
super
151152
return render_404 unless @commit
152153
end
153154

app/controllers/projects/refs_controller.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ def switch
2222
when "tree"
2323
project_tree_path(@project, @id)
2424
when "blob"
25-
project_blob_path(@project, @id)
25+
if Feature.enabled?(:use_ref_type_parameter, @project)
26+
project_blob_path(@project, @id, ref_type: ref_type)
27+
else
28+
project_blob_path(@project, @id)
29+
end
2630
when "graph"
2731
if Feature.enabled?(:use_ref_type_parameter, @project)
2832
project_network_path(@project, @id, ref_type: ref_type)

app/graphql/queries/repository/blob_info.query.graphql

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ query getBlobInfo(
22
$projectPath: ID!
33
$filePath: String!
44
$ref: String!
5+
$refType: String
56
$shouldFetchRawText: Boolean!
67
) {
78
project(fullPath: $projectPath) {
@@ -10,7 +11,7 @@ query getBlobInfo(
1011
repository {
1112
__typename
1213
empty
13-
blobs(paths: [$filePath], ref: $ref) {
14+
blobs(paths: [$filePath], ref: $ref, refType: $refType) {
1415
__typename
1516
nodes {
1617
__typename

app/graphql/resolvers/blobs_resolver.rb

+19-2
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,43 @@ class BlobsResolver < BaseResolver
1717
required: false,
1818
default_value: nil,
1919
description: 'Commit ref to get the blobs from. Default value is HEAD.'
20+
argument :ref_type, GraphQL::Types::String,
21+
required: false,
22+
default_value: nil,
23+
description: 'Type of the ref. heads for branches and tags for tags.'
2024

2125
# We fetch blobs from Gitaly efficiently but it still scales O(N) with the
2226
# number of paths being fetched, so apply a scaling limit to that.
2327
def self.resolver_complexity(args, child_complexity:)
2428
super + (args[:paths] || []).size
2529
end
2630

27-
def resolve(paths:, ref:)
31+
def resolve(paths:, ref:, ref_type:)
2832
authorize!(repository.container)
2933

3034
return [] if repository.empty?
3135

3236
ref ||= repository.root_ref
3337
validate_ref(ref)
3438

35-
repository.blobs_at(paths.map { |path| [ref, path] })
39+
ref = fully_qualifed_ref(ref, ref_type)
40+
41+
repository.blobs_at(paths.map { |path| [ref, path] }).tap do |blobs|
42+
blobs.each do |blob|
43+
blob.ref_type = ref_type
44+
end
45+
end
3646
end
3747

3848
private
3949

50+
def fully_qualifed_ref(ref, ref_type)
51+
return ref unless ref_type.present? && Feature.enabled?(:use_ref_type_parameter, repository.project)
52+
53+
ref_type = ref_type == 'tags' ? 'tags' : 'heads'
54+
%(refs/#{ref_type}/#{ref})
55+
end
56+
4057
def validate_ref(ref)
4158
unless Gitlab::GitRefValidator.validate(ref)
4259
raise Gitlab::Graphql::Errors::ArgumentError, 'Ref is not valid'

app/models/blob.rb

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Blob < SimpleDelegator
7272
].freeze
7373

7474
attr_reader :container
75+
attr_accessor :ref_type
7576

7677
delegate :repository, to: :container, allow_nil: true
7778
delegate :project, to: :repository, allow_nil: true

app/models/issue.rb

-5
Original file line numberDiff line numberDiff line change
@@ -663,11 +663,6 @@ def hidden?
663663
author&.banned?
664664
end
665665

666-
# Necessary until all issues are backfilled and we add a NOT NULL constraint on the DB
667-
def work_item_type
668-
super || WorkItems::Type.default_by_type(issue_type)
669-
end
670-
671666
def expire_etag_cache
672667
key = Gitlab::Routing.url_helpers.realtime_changes_project_issue_path(project, self)
673668
Gitlab::EtagCaching::Store.new.touch(key)

app/models/packages/nuget.rb

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Packages
33
module Nuget
44
TEMPORARY_PACKAGE_NAME = 'NuGet.Temporary.Package'
55
TEMPORARY_SYMBOL_PACKAGE_NAME = 'NuGet.Temporary.SymbolPackage'
6+
FORMAT = 'nupkg'
67

78
def self.table_name_prefix
89
'packages_nuget_'

app/models/packages/package.rb

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Packages::Package < ApplicationRecord
3636
# TODO: put the installable default scope on the :package_files association once the dependent: :destroy is removed
3737
# See https://gitlab.com/gitlab-org/gitlab/-/issues/349191
3838
has_many :installable_package_files, -> { installable }, class_name: 'Packages::PackageFile', inverse_of: :package
39+
has_many :installable_nuget_package_files, -> { installable.with_nuget_format }, class_name: 'Packages::PackageFile', inverse_of: :package
3940
has_many :dependency_links, inverse_of: :package, class_name: 'Packages::DependencyLink'
4041
has_many :tags, inverse_of: :package, class_name: 'Packages::Tag'
4142
has_one :conan_metadatum, inverse_of: :package, class_name: 'Packages::Conan::Metadatum'
@@ -128,6 +129,7 @@ class Packages::Package < ApplicationRecord
128129
scope :including_project_namespace_route, -> { includes(project: { namespace: :route }) }
129130
scope :including_tags, -> { includes(:tags) }
130131
scope :including_dependency_links, -> { includes(dependency_links: :dependency) }
132+
scope :including_dependency_links_with_nuget_metadatum, -> { includes(dependency_links: [:dependency, :nuget_metadatum]) }
131133

132134
scope :with_conan_channel, ->(package_channel) do
133135
joins(:conan_metadatum).where(packages_conan_metadata: { package_channel: package_channel })
@@ -149,12 +151,14 @@ class Packages::Package < ApplicationRecord
149151
end
150152
scope :preload_composer, -> { preload(:composer_metadatum) }
151153
scope :preload_npm_metadatum, -> { preload(:npm_metadatum) }
154+
scope :preload_nuget_metadatum, -> { preload(:nuget_metadatum) }
152155
scope :preload_pypi_metadatum, -> { preload(:pypi_metadatum) }
153156

154157
scope :without_nuget_temporary_name, -> { where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) }
155158

156159
scope :has_version, -> { where.not(version: nil) }
157160
scope :preload_files, -> { preload(:installable_package_files) }
161+
scope :preload_nuget_files, -> { preload(:installable_nuget_package_files) }
158162
scope :preload_pipelines, -> { preload(pipelines: :user) }
159163
scope :last_of_each_version, -> { where(id: all.select('MAX(id) AS id').group(:version)) }
160164
scope :limit_recent, ->(limit) { order_created_desc.limit(limit) }

app/models/packages/package_file.rb

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Packages::PackageFile < ApplicationRecord
4444
scope :with_file_name_like, ->(file_name) { where(arel_table[:file_name].matches(file_name)) }
4545
scope :with_files_stored_locally, -> { where(file_store: ::Packages::PackageFileUploader::Store::LOCAL) }
4646
scope :with_format, ->(format) { where(::Packages::PackageFile.arel_table[:file_name].matches("%.#{format}")) }
47+
scope :with_nuget_format, -> { with_format(Packages::Nuget::FORMAT) }
4748

4849
scope :preload_package, -> { preload(:package) }
4950
scope :preload_pipelines, -> { preload(pipelines: :user) }

app/presenters/blob_presenter.rb

+23-6
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ def raw_plain_data
5656
end
5757

5858
def web_url
59-
url_helpers.project_blob_url(project, ref_qualified_path)
59+
url_helpers.project_blob_url(*path_params)
6060
end
6161

6262
def web_path
63-
url_helpers.project_blob_path(project, ref_qualified_path)
63+
url_helpers.project_blob_path(*path_params)
6464
end
6565

6666
def edit_blob_path
67-
url_helpers.project_edit_blob_path(project, ref_qualified_path)
67+
url_helpers.project_edit_blob_path(*path_params)
6868
end
6969

7070
def raw_path
71-
url_helpers.project_raw_path(project, ref_qualified_path)
71+
url_helpers.project_raw_path(*path_params)
7272
end
7373

7474
def replace_path
75-
url_helpers.project_update_blob_path(project, ref_qualified_path)
75+
url_helpers.project_update_blob_path(*path_params)
7676
end
7777

7878
def pipeline_editor_path
@@ -164,6 +164,18 @@ def project_blob_path_root
164164

165165
private
166166

167+
def path_params
168+
if Feature.enabled?(:use_ref_type_parameter, project) && ref_type
169+
[project, ref_qualified_path, { ref_type: ref_type }]
170+
else
171+
[project, ref_qualified_path]
172+
end
173+
end
174+
175+
def ref_type
176+
blob.try(:ref_type)
177+
end
178+
167179
def url_helpers
168180
Gitlab::Routing.url_helpers
169181
end
@@ -179,7 +191,12 @@ def project
179191
end
180192

181193
def ref_qualified_path
182-
File.join(blob.commit_id, blob.path)
194+
commit_id = blob.commit_id
195+
196+
# A hack to make the commit_id response from gitaly something controllers can handle
197+
commit_id = commit_id.sub(%r{^refs/(heads|tags)/}, '') if ref_type && Feature.enabled?(:use_ref_type_parameter, project)
198+
199+
File.join(commit_id, blob.path)
183200
end
184201

185202
def load_all_blob_data

app/presenters/packages/nuget/packages_metadata_presenter.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ class PackagesMetadataPresenter
1010

1111
def initialize(packages)
1212
@packages = packages
13+
.preload_nuget_files
14+
.preload_nuget_metadatum
15+
.including_tags
16+
.including_dependency_links_with_nuget_metadatum
1317
end
1418

1519
def count
@@ -23,12 +27,14 @@ def items
2327
private
2428

2529
def summary
30+
packages_with_metadata = @packages.map { |pkg| metadata_for(pkg) }
31+
2632
{
2733
json_url: json_url,
2834
lower_version: lower_version,
2935
upper_version: upper_version,
30-
packages_count: @packages.count,
31-
packages: @packages.map { |pkg| metadata_for(pkg) }
36+
packages_count: packages_with_metadata.size,
37+
packages: packages_with_metadata
3238
}
3339
end
3440

0 commit comments

Comments
 (0)