This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit d808ff92 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent dd2803a2e63c
......@@ -2,6 +2,8 @@
cache:
paths:
- vendor/ruby/
- public/assets/webpack/
- assets-hash.txt
- .yarn-cache/
- tmp/cache/assets/sprockets
- tmp/cache/babel-loader
......@@ -28,18 +30,24 @@
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
cache:
key: "assets-compile:production:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:tmp_cache_webpack:v9"
key: "assets-compile:production:v1"
artifacts:
name: webpack-report
expire_in: 31d
paths:
- webpack-report/
- public/assets/
- assets-compile.log
- public/assets/application-*.css
- public/assets/application-*.css.gz
when: always
script:
- node --version
- retry yarn install --frozen-lockfile --production --cache-folder .yarn-cache --prefer-offline
- free -m
- retry bundle exec rake gitlab:assets:compile
- time bin/rake gitlab:assets:compile > assets-compile.log 2>&1
# TODO: Change the image tag to be the MD5 of assets files and skip image building if the image exists
# We'll also need to pass GITLAB_ASSETS_TAG to the trigerred omnibus-gitlab pipeline similarly to how we do it for trigerred CNG pipelines
# https://gitlab.com/gitlab-org/gitlab/issues/208389
- time scripts/build_assets_image
- scripts/clean-old-cached-assets
- rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here
......@@ -71,7 +79,7 @@ gitlab:assets:compile pull-cache:
- node --version
- retry yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
- free -m
- retry bundle exec rake gitlab:assets:compile
- time bin/rake gitlab:assets:compile > assets-compile.log 2>&1
- scripts/clean-old-cached-assets
variables:
SETUP_DB: "false"
......@@ -79,12 +87,13 @@ gitlab:assets:compile pull-cache:
NODE_OPTIONS: --max_old_space_size=3584
WEBPACK_VENDOR_DLL: "true"
cache:
key: "assets-compile:v9"
key: "assets-compile:test:v1"
artifacts:
expire_in: 7d
paths:
- node_modules
- public/assets
- assets-compile.log
compile-assets pull-push-cache:
extends:
......@@ -100,7 +109,7 @@ compile-assets pull-push-cache as-if-foss:
- .as-if-foss
cache:
policy: pull-push
key: "assets-compile:v9:foss"
key: "assets-compile:test:as-if-foss:v1"
compile-assets pull-cache:
extends:
......@@ -116,7 +125,7 @@ compile-assets pull-cache as-if-foss:
- .as-if-foss
cache:
policy: pull
key: "assets-compile:v9:foss"
key: "assets-compile:test:as-if-foss:v1"
.frontend-fixtures-base:
extends:
......
......@@ -55,5 +55,9 @@ package-and-qa:
extends:
- .package-and-qa-base
- .qa:rules:package-and-qa
needs: ["build-qa-image", "gitlab:assets:compile pull-cache"]
needs:
- job: build-qa-image
artifacts: false
- job: gitlab:assets:compile pull-cache
artifacts: false
allow_failure: true
......@@ -327,6 +327,7 @@ export default {
</gl-table>
<gl-pagination
v-if="!isLoading"
ref="pagination"
v-model="currentPage"
:per-page="tagsPagination.perPage"
......
......@@ -48,14 +48,7 @@ def authorize
private
def file_is_valid?
# TODO: remove the condition and the private method after the WH version including
# https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/470
# is released and GITLAB_WORKHORSE_VERSION is updated accordingly.
if with_workhorse_upload_acceleration?
return false unless project_params[:file].is_a?(::UploadedFile)
else
return false unless project_params[:file] && project_params[:file].respond_to?(:read)
end
return false unless project_params[:file].is_a?(::UploadedFile)
filename = project_params[:file].original_filename
......@@ -75,8 +68,4 @@ def project_params
def whitelist_query_limiting
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42437')
end
def with_workhorse_upload_acceleration?
request.headers[Gitlab::Workhorse::INTERNAL_API_REQUEST_HEADER].present?
end
end
......@@ -598,19 +598,15 @@ def features
end
def merge_request
return @merge_request if defined?(@merge_request)
strong_memoize(:merge_request) do
merge_requests = MergeRequest.includes(:latest_merge_request_diff)
.where(source_branch: ref, source_project: pipeline.project)
.reorder(iid: :desc)
@merge_request ||=
begin
merge_requests = MergeRequest.includes(:latest_merge_request_diff)
.where(source_branch: ref,
source_project: pipeline.project)
.reorder(iid: :desc)
merge_requests.find do |merge_request|
merge_request.commit_shas.include?(pipeline.sha)
end
merge_requests.find do |merge_request|
merge_request.commit_shas.include?(pipeline.sha)
end
end
end
def repo_url
......
......@@ -16,7 +16,7 @@
%head{ prefix: "og: http://ogp.me/ns#" }
%meta{ charset: "utf-8" }
- if Feature.enabled?('asset_host_prefetch') && ActionController::Base.asset_host
- if ActionController::Base.asset_host
%link{ rel: 'dns-prefetch', href: ActionController::Base.asset_host }
%link{ rel: 'preconnnect', href: ActionController::Base.asset_host, crossorigin: '' }
......
---
title: Adds branch information to the package details title section
merge_request: 27488
author:
type: added
---
title: Enable Workhorse upload acceleration for Project Import uploads via UI
merge_request: 27332
author:
type: performance
---
title: Disable lookup of other ActiveSessions to determine admin mode status
merge_request: 27318
author: Diego Louzán
type: changed
---
title: Prefetch DNS for asset host
merge_request: 26868
author:
type: performance
......@@ -77,7 +77,7 @@ def admin_mode?
return false unless user
Gitlab::SafeRequestStore.fetch(admin_mode_rs_key) do
user.admin? && any_session_with_admin_mode?
user.admin? && session_with_admin_mode?
end
end
......@@ -136,19 +136,10 @@ def current_session_data
@current_session ||= Gitlab::NamespacedSessionStore.new(SESSION_STORE_KEY)
end
def any_session_with_admin_mode?
def session_with_admin_mode?
return true if bypass_session?
return true if current_session_data.initiated? && current_session_data[ADMIN_MODE_START_TIME_KEY].to_i > MAX_ADMIN_MODE_TIME.ago.to_i
all_sessions.any? do |session|
session[ADMIN_MODE_START_TIME_KEY].to_i > MAX_ADMIN_MODE_TIME.ago.to_i
end
end
def all_sessions
@all_sessions ||= ActiveSession.list_sessions(user).lazy.map do |session|
Gitlab::NamespacedSessionStore.new(SESSION_STORE_KEY, session.with_indifferent_access )
end
current_session_data.initiated? && current_session_data[ADMIN_MODE_START_TIME_KEY].to_i > MAX_ADMIN_MODE_TIME.ago.to_i
end
def admin_mode_requested_in_grace_period?
......
# frozen_string_literal: true
require 'fileutils'
module Tasks
module Gitlab
module Assets
FOSS_ASSET_FOLDERS = %w[app/assets app/views fixtures/emojis vendor/assets/javascripts].freeze
EE_ASSET_FOLDERS = %w[ee/app/assets ee/app/views].freeze
JS_ASSET_PATTERNS = %w[*.js config/**/*.js].freeze
JS_ASSET_FILES = %w[package.json yarn.lock].freeze
MASTER_MD5_HASH_FILE = 'master-assets-hash.txt'
HEAD_MD5_HASH_FILE = 'assets-hash.txt'
PUBLIC_ASSETS_WEBPACK_DIR = 'public/assets/webpack'
def self.md5_of_assets_impacting_webpack_compilation
start_time = Time.now
asset_files = assets_impacting_webpack_compilation
puts "Generating the MD5 hash for #{assets_impacting_webpack_compilation.size} Webpack-related assets..."
asset_file_md5s = asset_files.map do |asset_file|
Digest::MD5.file(asset_file).hexdigest
end
Digest::MD5.hexdigest(asset_file_md5s.join).tap { |md5| puts "=> MD5 generated in #{Time.now - start_time}: #{md5}" }
end
def self.assets_impacting_webpack_compilation
assets_folders = FOSS_ASSET_FOLDERS
assets_folders += EE_ASSET_FOLDERS if ::Gitlab.ee?
asset_files = Dir.glob(JS_ASSET_PATTERNS)
asset_files += JS_ASSET_FILES
assets_folders.each do |folder|
asset_files.concat(Dir.glob(["#{folder}/**/*.*"]))
end
asset_files
end
private_class_method :assets_impacting_webpack_compilation
end
end
end
namespace :gitlab do
namespace :assets do
desc 'GitLab | Assets | Compile all frontend assets'
......@@ -8,9 +53,35 @@ namespace :gitlab do
yarn:check
gettext:po_to_json
rake:assets:precompile
webpack:compile
gitlab:assets:compile_webpack_if_needed
gitlab:assets:fix_urls
].each(&Gitlab::TaskHelpers.method(:invoke_and_time_task))
].each(&::Gitlab::TaskHelpers.method(:invoke_and_time_task))
end
desc 'GitLab | Assets | Compile all Webpack assets'
task :compile_webpack_if_needed do
FileUtils.mv(Tasks::Gitlab::Assets::HEAD_MD5_HASH_FILE, Tasks::Gitlab::Assets::MASTER_MD5_HASH_FILE, force: true)
master_assets_md5 =
if File.exist?(Tasks::Gitlab::Assets::MASTER_MD5_HASH_FILE)
File.read(Tasks::Gitlab::Assets::MASTER_MD5_HASH_FILE)
else
'missing!'
end
head_assets_md5 = Tasks::Gitlab::Assets.md5_of_assets_impacting_webpack_compilation.tap do |md5|
File.write(Tasks::Gitlab::Assets::HEAD_MD5_HASH_FILE, md5)
end
puts "Webpack assets MD5 for `master`: #{master_assets_md5}"
puts "Webpack assets MD5 for `HEAD`: #{head_assets_md5}"
public_assets_webpack_dir_exists = Dir.exist?(Tasks::Gitlab::Assets::PUBLIC_ASSETS_WEBPACK_DIR)
if head_assets_md5 != master_assets_md5 || !public_assets_webpack_dir_exists
FileUtils.rm_r(Tasks::Gitlab::Assets::PUBLIC_ASSETS_WEBPACK_DIR) if public_assets_webpack_dir_exists
Rake::Task['webpack:compile'].invoke
end
end
desc 'GitLab | Assets | Clean up old compiled frontend assets'
......
......@@ -3,90 +3,21 @@
require 'spec_helper'
describe 'Group navbar' do
let(:user) { create(:user) }
let(:group) { create(:group) }
include NavbarStructureHelper
let(:analytics_nav_item) do
{
nav_item: _('Analytics'),
nav_sub_items: [
_('Contribution')
]
}
end
include_context 'group navbar structure'
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let(:structure) do
[
{
nav_item: _('Group overview'),
nav_sub_items: [
_('Details'),
_('Activity')
]
},
{
nav_item: _('Issues'),
nav_sub_items: [
_('List'),
_('Board'),
_('Labels'),
_('Milestones')
]
},
{
nav_item: _('Merge Requests'),
nav_sub_items: []
},
{
nav_item: _('Kubernetes'),
nav_sub_items: []
},
(analytics_nav_item if Gitlab.ee?),
{
nav_item: _('Members'),
nav_sub_items: []
}
]
before do
group.add_maintainer(user)
sign_in(user)
end
it_behaves_like 'verified navigation bar' do
before do
group.add_maintainer(user)
sign_in(user)
visit group_path(group)
end
end
if Gitlab.ee?
context 'when productivity analytics is available' do
before do
stub_licensed_features(productivity_analytics: true)
analytics_nav_item[:nav_sub_items] << _('Productivity')
group.add_maintainer(user)
sign_in(user)
visit group_path(group)
end
it_behaves_like 'verified navigation bar'
end
context 'when value stream analytics is available' do
before do
stub_licensed_features(cycle_analytics_for_groups: true)
analytics_nav_item[:nav_sub_items] << _('Value Stream')
group.add_maintainer(user)
sign_in(user)
visit group_path(group)
end
it_behaves_like 'verified navigation bar'
end
end
end
......@@ -3,112 +3,14 @@
require 'spec_helper'
describe 'Project navbar' do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
include NavbarStructureHelper
let(:analytics_nav_item) do
{
nav_item: _('Analytics'),
nav_sub_items: [
_('CI / CD'),
(_('Code Review') if Gitlab.ee?),
_('Repository'),
_('Value Stream')
]
}
end
include_context 'project navbar structure'
let(:requirements_nav_item) do
{
nav_item: _('Requirements'),
nav_sub_items: [_('List')]
}
end
let(:structure) do
[
{
nav_item: _('Project overview'),
nav_sub_items: [
_('Details'),
_('Activity'),
_('Releases')
]
},
{
nav_item: _('Repository'),
nav_sub_items: [
_('Files'),
_('Commits'),
_('Branches'),
_('Tags'),
_('Contributors'),
_('Graph'),
_('Compare'),
(_('Locked Files') if Gitlab.ee?)
]
},
{
nav_item: _('Issues'),
nav_sub_items: [
_('List'),
_('Boards'),
_('Labels'),
_('Milestones')
]
},
{
nav_item: _('Merge Requests'),
nav_sub_items: []
},
(requirements_nav_item if Gitlab.ee?),
{
nav_item: _('CI / CD'),
nav_sub_items: [
_('Pipelines'),
_('Jobs'),
_('Artifacts'),
_('Schedules')
]
},
{
nav_item: _('Operations'),
nav_sub_items: [
_('Metrics'),
_('Environments'),
_('Error Tracking'),
_('Serverless'),
_('Logs'),
_('Kubernetes')
]
},
analytics_nav_item,
{
nav_item: _('Wiki'),
nav_sub_items: []
},
{
nav_item: _('Snippets'),
nav_sub_items: []
},
{
nav_item: _('Settings'),
nav_sub_items: [
_('General'),
_('Members'),
_('Integrations'),
_('Webhooks'),
_('Repository'),
_('CI / CD'),
_('Operations'),
(_('Audit Events') if Gitlab.ee?)
].compact
}
]
end
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
before do
stub_licensed_features(requirements: false)
project.add_maintainer(user)
sign_in(user)
end
......@@ -119,28 +21,19 @@
end
end
if Gitlab.ee?
context 'when issues analytics is available' do
before do
stub_licensed_features(issues_analytics: true)
analytics_nav_item[:nav_sub_items] << _('Issues')
analytics_nav_item[:nav_sub_items].sort!
context 'when pages are available' do
before do
allow(Gitlab.config.pages).to receive(:enabled).and_return(true)
visit project_path(project)
end
insert_after_sub_nav_item(
_('Operations'),
within: _('Settings'),
new_sub_nav_item_name: _('Pages')
)
it_behaves_like 'verified navigation bar'
visit project_path(project)
end
context 'when requirements is available' do
before do
stub_licensed_features(requirements: true)
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
end
it_behaves_like 'verified navigation bar'
end
end
......@@ -13,6 +13,9 @@
sign_in(user)
visit(project_snippet_path(project, snippet))
# Snippet's content is loaded async, we wait for it before we try to click anything
wait_for_requests
end
it 'leaves a comment on a snippet' do
......@@ -34,7 +37,8 @@
end
it 'has zen mode' do
find('.js-zen-enter').click
click_button 'Go full screen'
expect(page).to have_selector('.fullscreen')
end
end
......@@ -66,6 +66,10 @@ describe('Details Page', () => {
it('does not have list items', () => {
expect(findFirstRowItem('rowCheckbox').exists()).toBe(false);
});
it('does not show pagination', () => {
expect(findPagination().exists()).toBe(false);
});
});
describe('table', () => {
......
......@@ -151,13 +151,13 @@
allow(ActiveSession).to receive(:list_sessions).with(user).and_return([session, another_session])
end