diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-10 09:10:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-10 09:10:08 +0300 |
commit | f9d25383cf2654e14741c46823417a1a4296ea82 (patch) | |
tree | dd65ba6ca3895b8d5af041163cad6bfb0509e372 | |
parent | ebc589e90ca9bc03315411b912d2ce957cb84903 (diff) |
Add latest changes from gitlab-org/gitlab@master
20 files changed, 86 insertions, 124 deletions
diff --git a/app/assets/javascripts/content_editor/constants.js b/app/assets/javascripts/content_editor/constants.js index 0f708649d94..7a5f1d3ed1f 100644 --- a/app/assets/javascripts/content_editor/constants.js +++ b/app/assets/javascripts/content_editor/constants.js @@ -29,6 +29,12 @@ export const TEXT_STYLE_DROPDOWN_ITEMS = [ label: __('Heading 3'), }, { + contentType: 'heading', + editorCommand: 'setHeading', + commandParams: { level: 4 }, + label: __('Heading 4'), + }, + { contentType: 'paragraph', editorCommand: 'setParagraph', label: __('Normal text'), diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 7b57ad94bb4..ee27af72b71 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -203,6 +203,9 @@ document.addEventListener('DOMContentLoaded', () => { }); $('.navbar-toggler').on('click', () => { + // The order is important. The `menu-expanded` is used as a source of truth for now. + // This can be simplified when the :combined_menu feature flag is removed. + // https://gitlab.com/gitlab-org/gitlab/-/issues/333180 $('.header-content').toggleClass('menu-expanded'); navEventHub.$emit(EVENT_RESPONSIVE_TOGGLE); }); diff --git a/app/assets/javascripts/nav/components/responsive_app.vue b/app/assets/javascripts/nav/components/responsive_app.vue index cef1a14df19..d601586a3f8 100644 --- a/app/assets/javascripts/nav/components/responsive_app.vue +++ b/app/assets/javascripts/nav/components/responsive_app.vue @@ -3,7 +3,7 @@ import { FREQUENT_ITEMS_PROJECTS, FREQUENT_ITEMS_GROUPS } from '~/frequent_items import { BV_DROPDOWN_SHOW, BV_DROPDOWN_HIDE } from '~/lib/utils/constants'; import KeepAliveSlots from '~/vue_shared/components/keep_alive_slots.vue'; import eventHub, { EVENT_RESPONSIVE_TOGGLE } from '../event_hub'; -import { resetMenuItemsActive } from '../utils/reset_menu_items_active'; +import { resetMenuItemsActive, hasMenuExpanded } from '../utils'; import ResponsiveHeader from './responsive_header.vue'; import ResponsiveHome from './responsive_home.vue'; import TopNavContainerView from './top_nav_container_view.vue'; @@ -33,9 +33,11 @@ export default { }, }, created() { - eventHub.$on(EVENT_RESPONSIVE_TOGGLE, this.onToggle); + eventHub.$on(EVENT_RESPONSIVE_TOGGLE, this.updateResponsiveOpen); this.$root.$on(BV_DROPDOWN_SHOW, this.showMobileOverlay); this.$root.$on(BV_DROPDOWN_HIDE, this.hideMobileOverlay); + + this.updateResponsiveOpen(); }, beforeDestroy() { eventHub.$off(EVENT_RESPONSIVE_TOGGLE, this.onToggle); @@ -43,8 +45,12 @@ export default { this.$root.$off(BV_DROPDOWN_HIDE, this.hideMobileOverlay); }, methods: { - onToggle() { - document.body.classList.toggle('top-nav-responsive-open'); + updateResponsiveOpen() { + if (hasMenuExpanded()) { + document.body.classList.add('top-nav-responsive-open'); + } else { + document.body.classList.remove('top-nav-responsive-open'); + } }, onMenuItemClick({ view }) { if (view) { diff --git a/app/assets/javascripts/nav/utils/has_menu_expanded.js b/app/assets/javascripts/nav/utils/has_menu_expanded.js new file mode 100644 index 00000000000..4e4d6c7c71e --- /dev/null +++ b/app/assets/javascripts/nav/utils/has_menu_expanded.js @@ -0,0 +1,5 @@ +export const hasMenuExpanded = () => { + const header = document.querySelector('.header-content'); + + return Boolean(header?.classList.contains('menu-expanded')); +}; diff --git a/app/assets/javascripts/nav/utils/index.js b/app/assets/javascripts/nav/utils/index.js new file mode 100644 index 00000000000..4fa3d0910da --- /dev/null +++ b/app/assets/javascripts/nav/utils/index.js @@ -0,0 +1,2 @@ +export * from './has_menu_expanded'; +export * from './reset_menu_items_active'; diff --git a/app/assets/javascripts/vue_shared/security_reports/components/security_report_download_dropdown.vue b/app/assets/javascripts/vue_shared/security_reports/components/security_report_download_dropdown.vue index d7c1e27ff3e..9e941087da2 100644 --- a/app/assets/javascripts/vue_shared/security_reports/components/security_report_download_dropdown.vue +++ b/app/assets/javascripts/vue_shared/security_reports/components/security_report_download_dropdown.vue @@ -1,5 +1,5 @@ <script> -import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; +import { GlDropdown, GlDropdownItem, GlTooltipDirective as GlTooltip } from '@gitlab/ui'; import { s__, sprintf } from '~/locale'; export default { @@ -8,6 +8,9 @@ export default { GlDropdown, GlDropdownItem, }, + directives: { + GlTooltip, + }, props: { artifacts: { type: Array, @@ -31,9 +34,11 @@ export default { <template> <gl-dropdown - :text="s__('SecurityReports|Download results')" + v-gl-tooltip + :title="s__('SecurityReports|Download results')" :loading="loading" icon="download" + size="small" right > <gl-dropdown-item diff --git a/app/services/clusters/gcp/finalize_creation_service.rb b/app/services/clusters/gcp/finalize_creation_service.rb index 0aff1bcc8b9..73d6fc4dc8f 100644 --- a/app/services/clusters/gcp/finalize_creation_service.rb +++ b/app/services/clusters/gcp/finalize_creation_service.rb @@ -43,8 +43,6 @@ module Clusters cluster.build_platform_kubernetes( api_url: 'https://' + gke_cluster.endpoint, ca_cert: Base64.decode64(gke_cluster.master_auth.cluster_ca_certificate), - username: gke_cluster.master_auth.username, - password: gke_cluster.master_auth.password, authorization_type: authorization_type, token: request_kubernetes_token) end @@ -75,18 +73,16 @@ module Clusters def kube_client @kube_client ||= build_kube_client!( 'https://' + gke_cluster.endpoint, - Base64.decode64(gke_cluster.master_auth.cluster_ca_certificate), - gke_cluster.master_auth.username, - gke_cluster.master_auth.password + Base64.decode64(gke_cluster.master_auth.cluster_ca_certificate) ) end - def build_kube_client!(api_url, ca_pem, username, password) - raise "Incomplete settings" unless api_url && username && password + def build_kube_client!(api_url, ca_pem) + raise "Incomplete settings" unless api_url Gitlab::Kubernetes::KubeClient.new( api_url, - auth_options: { username: username, password: password }, + auth_options: { bearer_token: provider.access_token }, ssl_options: kubeclient_ssl_options(ca_pem), http_proxy_uri: ENV['http_proxy'] ) diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 985ca73d0d2..f3fe5c69a0c 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -637,15 +637,6 @@ :idempotent: :tags: - :exclude_from_kubernetes -- :name: deployment:deployments_execute_hooks - :worker_name: Deployments::ExecuteHooksWorker - :feature_category: :continuous_delivery - :has_external_dependencies: - :urgency: :low - :resource_boundary: :cpu - :weight: 3 - :idempotent: - :tags: [] - :name: deployment:deployments_finished :worker_name: Deployments::FinishedWorker :feature_category: :continuous_delivery diff --git a/app/workers/deployments/execute_hooks_worker.rb b/app/workers/deployments/execute_hooks_worker.rb deleted file mode 100644 index 3046aa28e20..00000000000 --- a/app/workers/deployments/execute_hooks_worker.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Deployments - # TODO: remove in https://gitlab.com/gitlab-org/gitlab/-/issues/329360 - class ExecuteHooksWorker # rubocop:disable Scalability/IdempotentWorker - include ApplicationWorker - - sidekiq_options retry: 3 - - queue_namespace :deployment - feature_category :continuous_delivery - worker_resource_boundary :cpu - - def perform(deployment_id) - if (deploy = Deployment.find_by_id(deployment_id)) - deploy.execute_hooks(Time.current) - end - end - end -end diff --git a/doc/ci/pipelines/pipeline_artifacts.md b/doc/ci/pipelines/pipeline_artifacts.md index b58c0e1c768..b80a056bbca 100644 --- a/doc/ci/pipelines/pipeline_artifacts.md +++ b/doc/ci/pipelines/pipeline_artifacts.md @@ -17,5 +17,10 @@ Pipeline artifacts are saved to disk or object storage. They count towards a pro ## When pipeline artifacts are deleted -See the [`expire_in`](../yaml/README.md#artifactsexpire_in) documentation for information on when -pipeline artifacts are deleted. +Pipeline artifacts are deleted either: + +- Seven days after creation. +- After another pipeline runs successfully, if they are from the most recent successful + pipeline. + +This deletion may take up to two days. diff --git a/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md b/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md index 0dabb80204a..0d4bbd165a0 100644 --- a/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md +++ b/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md @@ -100,9 +100,15 @@ If your Auto DevOps project has an active environment that was deployed with the MIGRATE_HELM_2TO3: "true" .auto-deploy: - image: registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v2.0.0-beta.1 + # Optional: If you are on GitLab 13.12 or older, pin the auto-deploy-image + # image: registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v2.6.0 variables: AUTO_DEVOPS_FORCE_DEPLOY_V2: 1 + # If you have non-public pipelines, you can back up the entire namespace in a job artifact + # prior to the migration by setting the CI variable BACKUP_NAMESPACE to a non-empty value. + # WARNING: If you have public pipelines, this artifact will be public and can + # expose your secrets. + # BACKUP_HELM2_RELEASES: 1 ``` 1. Run the `<environment-name>:helm-2to3:migrate` job. @@ -110,10 +116,14 @@ If your Auto DevOps project has an active environment that was deployed with the 1. If the deployment succeeds, you can safely run `environment:helm-2to3:cleanup`. This deletes all Helm 2 release data from the namespace. - If you accidentally delete the Helm 2 releases before you are ready, the `<environment-name>:helm2to3:migrate` + If you set `BACKUP_HELM2_RELEASES` to a non-empty value, then the + the `<environment-name>:helm2to3:migrate` job job saves a backup for 1 week in a job artifact called `helm-2-release-backups`. - The backup is in a Kubernetes manifest file that can be restored using - `kubectl apply -f $backup`. + If you accidentally delete the Helm 2 releases before you are ready, then + this backup is in a Kubernetes manifest file that can be restored using + `kubectl apply -f $backup`. + **WARNING:** This artifact can contain secrets and will be visible to any + user who can see your job. 1. Remove the `MIGRATE_HELM_2TO3` CI/CD variable. #### In-Cluster PostgreSQL Channel 2 diff --git a/doc/user/application_security/dependency_scanning/index.md b/doc/user/application_security/dependency_scanning/index.md index 5f5e29e4ecd..96fc085e7c6 100644 --- a/doc/user/application_security/dependency_scanning/index.md +++ b/doc/user/application_security/dependency_scanning/index.md @@ -189,7 +189,7 @@ The following variables are used for configuring specific analyzers (used for a | `GEMNASIUM_DB_REMOTE_URL` | `gemnasium` | `https://gitlab.com/gitlab-org/security-products/gemnasium-db.git` | Repository URL for fetching the Gemnasium database. | | `GEMNASIUM_DB_REF_NAME` | `gemnasium` | `master` | Branch name for remote repository database. `GEMNASIUM_DB_REMOTE_URL` is required. | | `DS_REMEDIATE` | `gemnasium` | `"true"` | Enable automatic remediation of vulnerable dependencies. | -| `DS_JAVA_VERSION` | `gemnasium-maven` | `11` | Version of Java. Available versions: `8`, `11`, `13`, `14`, `15`. Maven and Gradle use the Java version specified by this value. | +| `DS_JAVA_VERSION` | `gemnasium-maven` | `11` | Version of Java. Available versions: `8`, `11`, `13`, `14`, `15`, `16`. Maven and Gradle use the Java version specified by this value (Dependency Scanning for Gradle does not currently support Java `16`). | | `MAVEN_CLI_OPTS` | `gemnasium-maven` | `"-DskipTests --batch-mode"` | List of command line arguments that are passed to `maven` by the analyzer. See an example for [using private repositories](../index.md#using-private-maven-repositories). | | `GRADLE_CLI_OPTS` | `gemnasium-maven` | | List of command line arguments that are passed to `gradle` by the analyzer. | | `SBT_CLI_OPTS` | `gemnasium-maven` | | List of command-line arguments that the analyzer passes to `sbt`. | diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb index 34e3be2320b..c917debd3d9 100644 --- a/lib/google_api/cloud_platform/client.rb +++ b/lib/google_api/cloud_platform/client.rb @@ -13,10 +13,6 @@ module GoogleApi LEAST_TOKEN_LIFE_TIME = 10.minutes CLUSTER_MASTER_AUTH_USERNAME = 'admin' CLUSTER_IPV4_CIDR_BLOCK = '/16' - # Don't upgrade to > 1.18 before we move away from Basic Auth - # See issue: https://gitlab.com/gitlab-org/gitlab/-/issues/331582 - # Possible solution: https://gitlab.com/groups/gitlab-org/-/epics/6049 - GKE_VERSION = '1.18' CLUSTER_OAUTH_SCOPES = [ "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", @@ -94,13 +90,11 @@ module GoogleApi cluster: { name: cluster_name, initial_node_count: cluster_size, - initial_cluster_version: GKE_VERSION, node_config: { machine_type: machine_type, oauth_scopes: CLUSTER_OAUTH_SCOPES }, master_auth: { - username: CLUSTER_MASTER_AUTH_USERNAME, client_certificate_config: { issue_client_certificate: true } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index ae3521dedab..853fa1261fc 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -16159,6 +16159,9 @@ msgstr "" msgid "Heading 3" msgstr "" +msgid "Heading 4" +msgstr "" + msgid "Headings" msgstr "" diff --git a/spec/frontend/nav/components/responsive_app_spec.js b/spec/frontend/nav/components/responsive_app_spec.js index 3274a1b7086..4d7f053e43b 100644 --- a/spec/frontend/nav/components/responsive_app_spec.js +++ b/spec/frontend/nav/components/responsive_app_spec.js @@ -1,5 +1,4 @@ import { shallowMount } from '@vue/test-utils'; -import { range } from 'lodash'; import ResponsiveApp from '~/nav/components/responsive_app.vue'; import ResponsiveHeader from '~/nav/components/responsive_header.vue'; import ResponsiveHome from '~/nav/components/responsive_home.vue'; @@ -32,6 +31,7 @@ describe('~/nav/components/responsive_app.vue', () => { const hasMobileOverlayVisible = () => findMobileOverlay().classes('mobile-nav-open'); beforeEach(() => { + document.body.innerHTML = ''; // Add test class to reset state + assert that we're adding classes correctly document.body.className = 'test-class'; }); @@ -53,14 +53,17 @@ describe('~/nav/components/responsive_app.vue', () => { }); it.each` - times | expectation - ${0} | ${false} - ${1} | ${true} - ${2} | ${false} + bodyHtml | expectation + ${''} | ${false} + ${'<div class="header-content"></div>'} | ${false} + ${'<div class="menu-expanded"></div>'} | ${false} + ${'<div></div><div class="header-content menu-expanded"></div>}'} | ${true} `( - 'with responsive toggle event triggered $times, body responsive open = $expectation', - ({ times, expectation }) => { - range(times).forEach(triggerResponsiveToggle); + 'with responsive toggle event and html set to $bodyHtml, responsive open = $expectation', + ({ bodyHtml, expectation }) => { + document.body.innerHTML = bodyHtml; + + triggerResponsiveToggle(); expect(hasBodyResponsiveOpen()).toBe(expectation); }, @@ -88,6 +91,17 @@ describe('~/nav/components/responsive_app.vue', () => { ); }); + describe('with menu expanded in body', () => { + beforeEach(() => { + document.body.innerHTML = '<div></div><div class="header-content menu-expanded"></div>'; + createComponent(); + }); + + it('sets the body responsive open', () => { + expect(hasBodyResponsiveOpen()).toBe(true); + }); + }); + const projectsContainerProps = { containerClass: 'gl-px-3', frequentItemsDropdownType: ResponsiveApp.FREQUENT_ITEMS_PROJECTS.namespace, diff --git a/spec/lib/google_api/cloud_platform/client_spec.rb b/spec/lib/google_api/cloud_platform/client_spec.rb index b674ae0218f..3dd8f7c413e 100644 --- a/spec/lib/google_api/cloud_platform/client_spec.rb +++ b/spec/lib/google_api/cloud_platform/client_spec.rb @@ -91,7 +91,6 @@ RSpec.describe GoogleApi::CloudPlatform::Client do cluster: { name: cluster_name, initial_node_count: cluster_size, - initial_cluster_version: '1.18', node_config: { machine_type: machine_type, oauth_scopes: [ @@ -101,7 +100,6 @@ RSpec.describe GoogleApi::CloudPlatform::Client do ] }, master_auth: { - username: 'admin', client_certificate_config: { issue_client_certificate: true } diff --git a/spec/migrations/schedule_merge_request_cleanup_schedules_backfill_spec.rb b/spec/migrations/schedule_merge_request_cleanup_schedules_backfill_spec.rb index fa8dd38619a..319c0802f2c 100644 --- a/spec/migrations/schedule_merge_request_cleanup_schedules_backfill_spec.rb +++ b/spec/migrations/schedule_merge_request_cleanup_schedules_backfill_spec.rb @@ -24,7 +24,7 @@ RSpec.describe ScheduleMergeRequestCleanupSchedulesBackfill, :sidekiq, schema: 2 stub_const("#{described_class}::BATCH_SIZE", 2) end - it 'schdules BackfillMergeRequestCleanupSchedules background jobs' do + it 'schedules BackfillMergeRequestCleanupSchedules background jobs' do Sidekiq::Testing.fake! do migrate! diff --git a/spec/services/clusters/gcp/finalize_creation_service_spec.rb b/spec/services/clusters/gcp/finalize_creation_service_spec.rb index d8c95a70bd0..9c553d0eec2 100644 --- a/spec/services/clusters/gcp/finalize_creation_service_spec.rb +++ b/spec/services/clusters/gcp/finalize_creation_service_spec.rb @@ -11,8 +11,6 @@ RSpec.describe Clusters::Gcp::FinalizeCreationService, '#execute' do let(:platform) { cluster.platform } let(:endpoint) { '111.111.111.111' } let(:api_url) { 'https://' + endpoint } - let(:username) { 'sample-username' } - let(:password) { 'sample-password' } let(:secret_name) { 'gitlab-token' } let(:token) { 'sample-token' } let(:namespace) { "#{cluster.project.path}-#{cluster.project.id}" } @@ -34,8 +32,6 @@ RSpec.describe Clusters::Gcp::FinalizeCreationService, '#execute' do expect(provider.endpoint).to eq(endpoint) expect(platform.api_url).to eq(api_url) expect(platform.ca_cert).to eq(Base64.decode64(load_sample_cert).strip) - expect(platform.username).to eq(username) - expect(platform.password).to eq(password) expect(platform.token).to eq(token) end end @@ -83,7 +79,7 @@ RSpec.describe Clusters::Gcp::FinalizeCreationService, '#execute' do shared_context 'kubernetes information successfully fetched' do before do stub_cloud_platform_get_zone_cluster( - provider.gcp_project_id, provider.zone, cluster.name, { endpoint: endpoint, username: username, password: password } + provider.gcp_project_id, provider.zone, cluster.name, { endpoint: endpoint } ) stub_kubeclient_discover(api_url) diff --git a/spec/workers/deployments/execute_hooks_worker_spec.rb b/spec/workers/deployments/execute_hooks_worker_spec.rb deleted file mode 100644 index fb1dc8cf290..00000000000 --- a/spec/workers/deployments/execute_hooks_worker_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Deployments::ExecuteHooksWorker do - let(:worker) { described_class.new } - - describe '#perform' do - before do - allow(ProjectServiceWorker).to receive(:perform_async) - end - - it 'executes project services for deployment_hooks' do - deployment = create(:deployment, :running) - project = deployment.project - service = create(:service, type: 'SlackService', project: project, deployment_events: true, active: true) - - expect(ProjectServiceWorker).to receive(:perform_async).with(service.id, an_instance_of(Hash)) - - worker.perform(deployment.id) - end - - it 'does not execute an inactive service' do - deployment = create(:deployment, :running) - project = deployment.project - create(:service, type: 'SlackService', project: project, deployment_events: true, active: false) - - expect(ProjectServiceWorker).not_to receive(:perform_async) - - worker.perform(deployment.id) - end - - it 'does not execute if a deployment does not exist' do - expect(ProjectServiceWorker).not_to receive(:perform_async) - - worker.perform(non_existing_record_id) - end - - it 'execute webhooks' do - deployment = create(:deployment, :running) - project = deployment.project - web_hook = create(:project_hook, deployment_events: true, project: project) - - expect_next_instance_of(WebHookService, web_hook, an_instance_of(Hash), "deployment_hooks") do |service| - expect(service).to receive(:async_execute) - end - - worker.perform(deployment.id) - end - end -end diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb index 350d6080c85..d7a59636b9d 100644 --- a/spec/workers/every_sidekiq_worker_spec.rb +++ b/spec/workers/every_sidekiq_worker_spec.rb @@ -195,7 +195,6 @@ RSpec.describe 'Every Sidekiq worker' do 'DeleteUserWorker' => 3, 'Deployments::AutoRollbackWorker' => 3, 'Deployments::DropOlderDeploymentsWorker' => 3, - 'Deployments::ExecuteHooksWorker' => 3, 'Deployments::FinishedWorker' => 3, 'Deployments::ForwardDeploymentWorker' => 3, 'Deployments::LinkMergeRequestWorker' => 3, |