diff options
author | John Jarvis <jarv@gitlab.com> | 2018-12-19 13:59:48 +0000 |
---|---|---|
committer | John Jarvis <jarv@gitlab.com> | 2018-12-19 13:59:48 +0000 |
commit | 0b82735090d296b6bb4c2c6c76074df740ca3b2f (patch) | |
tree | 758355bd7cad219dadb29ba7198b2908865c7cc7 | |
parent | efa5eeb7deda2ed8c6192f1b5ee9ff2677c647c9 (diff) | |
parent | a643abf0083f470fa36ff87409aade1f39293dc3 (diff) | |
download | gitlab-ce-0b82735090d296b6bb4c2c6c76074df740ca3b2f.tar.gz |
Merge branch '11-6-stable-prepare-rc9' into '11-6-stable'
Prepare 11.6 RC9 release
See merge request gitlab-org/gitlab-ce!23918
105 files changed, 651 insertions, 194 deletions
@@ -181,6 +181,7 @@ gem 'acts-as-taggable-on', '~> 5.0' gem 'sidekiq', '~> 5.2.1' gem 'sidekiq-cron', '~> 0.6.0' gem 'redis-namespace', '~> 1.6.0' +gem 'gitlab-sidekiq-fetcher', '~> 0.1.0', require: 'sidekiq-reliable-fetch' # Cron Parser gem 'rufus-scheduler', '~> 3.4' @@ -310,7 +311,6 @@ gem 'peek-mysql2', '~> 1.1.0', group: :mysql gem 'peek-pg', '~> 1.3.0', group: :postgres gem 'peek-rblineprof', '~> 0.2.0' gem 'peek-redis', '~> 1.2.0' -gem 'gitlab-sidekiq-fetcher', require: 'sidekiq-reliable-fetch' # Metrics group :metrics do diff --git a/Gemfile.lock b/Gemfile.lock index 430025c7bde..7bc8fdbcb09 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -280,7 +280,7 @@ GEM gitlab-default_value_for (3.1.1) activerecord (>= 3.2.0, < 6.0) gitlab-markup (1.6.5) - gitlab-sidekiq-fetcher (0.3.0) + gitlab-sidekiq-fetcher (0.1.0) sidekiq (~> 5) gitlab-styles (2.4.1) rubocop (~> 0.54.0) @@ -1011,7 +1011,7 @@ DEPENDENCIES github-markup (~> 1.7.0) gitlab-default_value_for (~> 3.1.1) gitlab-markup (~> 1.6.5) - gitlab-sidekiq-fetcher + gitlab-sidekiq-fetcher (~> 0.1.0) gitlab-styles (~> 2.4) gitlab_omniauth-ldap (~> 2.0.4) gon (~> 6.2) diff --git a/Gemfile.rails4.lock b/Gemfile.rails4.lock index 9e7bae84299..15c188e9d66 100644 --- a/Gemfile.rails4.lock +++ b/Gemfile.rails4.lock @@ -4,38 +4,38 @@ GEM RedCloth (4.3.2) abstract_type (0.0.7) ace-rails-ap (4.1.2) - actionmailer (4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) + actionmailer (4.2.11) + actionpack (= 4.2.11) + actionview (= 4.2.11) + activejob (= 4.2.11) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.10) - actionview (= 4.2.10) - activesupport (= 4.2.10) + actionpack (4.2.11) + actionview (= 4.2.11) + activesupport (= 4.2.11) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.10) - activesupport (= 4.2.10) + actionview (4.2.11) + activesupport (= 4.2.11) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.10) - activesupport (= 4.2.10) + activejob (4.2.11) + activesupport (= 4.2.11) globalid (>= 0.3.0) - activemodel (4.2.10) - activesupport (= 4.2.10) + activemodel (4.2.11) + activesupport (= 4.2.11) builder (~> 3.1) - activerecord (4.2.10) - activemodel (= 4.2.10) - activesupport (= 4.2.10) + activerecord (4.2.11) + activemodel (= 4.2.11) + activesupport (= 4.2.11) arel (~> 6.0) activerecord_sane_schema_dumper (0.2) rails (>= 4, < 5) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) @@ -277,7 +277,7 @@ GEM grpc (~> 1.0) github-markup (1.7.0) gitlab-markup (1.6.5) - gitlab-sidekiq-fetcher (0.3.0) + gitlab-sidekiq-fetcher (0.1.0) sidekiq (~> 5) gitlab-styles (2.4.1) rubocop (~> 0.54.0) @@ -641,14 +641,14 @@ GEM rails-i18n (4.0.9) i18n (~> 0.7) railties (~> 4.0) - railties (4.2.10) - actionpack (= 4.2.10) - activesupport (= 4.2.10) + railties (4.2.11) + actionpack (= 4.2.11) + activesupport (= 4.2.11) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (3.0.0) raindrops (0.18.0) - rake (12.3.1) + rake (12.3.2) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) @@ -1002,7 +1002,7 @@ DEPENDENCIES gitaly-proto (~> 1.3.0) github-markup (~> 1.7.0) gitlab-markup (~> 1.6.5) - gitlab-sidekiq-fetcher + gitlab-sidekiq-fetcher (~> 0.1.0) gitlab-styles (~> 2.4) gitlab_omniauth-ldap (~> 2.0.4) gon (~> 6.2) diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index 2ea884d1293..ed4203cf5e0 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -138,7 +138,7 @@ export default { if (file.highlighted_diff_lines) { file.highlighted_diff_lines = file.highlighted_diff_lines.map(line => - mapDiscussions(line), + lineCheck(line) ? mapDiscussions(line) : line, ); } diff --git a/app/assets/javascripts/pages/projects/issues/form.js b/app/assets/javascripts/pages/projects/issues/form.js index 02a56685a35..f99023ad8e7 100644 --- a/app/assets/javascripts/pages/projects/issues/form.js +++ b/app/assets/javascripts/pages/projects/issues/form.js @@ -17,7 +17,7 @@ export default () => { new MilestoneSelect(); new IssuableTemplateSelectors(); - if (gon.features.issueSuggestions && gon.features.graphql) { + if (gon.features.graphql) { initSuggestions(); } }; diff --git a/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue b/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue index 7fbadcc0111..fad1a2f3f56 100644 --- a/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue +++ b/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue @@ -30,10 +30,14 @@ export default { computed: { jobLine() { if (this.user.bio && this.user.organization) { - return sprintf(__('%{bio} at %{organization}'), { - bio: this.user.bio, - organization: this.user.organization, - }); + return sprintf( + __('%{bio} at %{organization}'), + { + bio: this.user.bio, + organization: this.user.organization, + }, + false, + ); } else if (this.user.bio) { return this.user.bio; } else if (this.user.organization) { diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb index 6ea4758ec32..3ef03bc9622 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -43,6 +43,6 @@ class GraphqlController < ApplicationController end def check_graphql_feature_flag! - render_404 unless Feature.enabled?(:graphql) + render_404 unless Gitlab::Graphql.enabled? end end diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb index dcee8eb7e6e..055d900eece 100644 --- a/app/controllers/profiles/keys_controller.rb +++ b/app/controllers/profiles/keys_controller.rb @@ -40,7 +40,6 @@ class Profiles::KeysController < Profiles::ApplicationController begin user = UserFinder.new(params[:username]).find_by_username if user.present? - headers['Content-Disposition'] = 'attachment' render plain: user.all_ssh_keys.join("\n") else return render_404 diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index c6ab6b4642e..5ed46fc0545 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -268,7 +268,6 @@ class Projects::IssuesController < Projects::ApplicationController end def set_suggested_issues_feature_flags - push_frontend_feature_flag(:graphql) - push_frontend_feature_flag(:issue_suggestions) + push_frontend_feature_flag(:graphql, default_enabled: true) end end diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb index c58b30eace7..bfbbcba883f 100644 --- a/app/controllers/projects/jobs_controller.rb +++ b/app/controllers/projects/jobs_controller.rb @@ -9,7 +9,7 @@ class Projects::JobsController < Projects::ApplicationController before_action :authorize_update_build!, except: [:index, :show, :status, :raw, :trace, :cancel_all, :erase] before_action :authorize_erase_build!, only: [:erase] - before_action :authorize_use_build_terminal!, only: [:terminal, :terminal_workhorse_authorize] + before_action :authorize_use_build_terminal!, only: [:terminal, :terminal_websocket_authorize] before_action :verify_api_request!, only: :terminal_websocket_authorize layout 'project' diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index 30724de7f6a..ac3004d069f 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -5,7 +5,6 @@ module Projects class RepositoryController < Projects::ApplicationController before_action :authorize_admin_project! before_action :remote_mirror, only: [:show] - before_action :check_cleanup_feature_flag!, only: :cleanup def show render_show @@ -37,10 +36,6 @@ module Projects private - def check_cleanup_feature_flag! - render_404 unless ::Feature.enabled?(:project_cleanup, project) - end - def render_show @deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user) @deploy_tokens = @project.deploy_tokens.active diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index e191b009db2..82b2ab64a5d 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -2,7 +2,7 @@ - show_auto_devops_callout = show_auto_devops_callout?(@project) .project-home-panel{ class: ("empty-project" if empty_repo) } .project-header.row.append-bottom-8 - .project-title-row.col-md-12.col-lg-7.d-flex + .project-title-row.col-md-12.col-lg-6.d-flex .avatar-container.project-avatar.float-none = project_icon(@project, alt: @project.name, class: 'avatar avatar-tile s64', width: 64, height: 64) .d-flex.flex-column.flex-wrap.align-items-baseline @@ -25,7 +25,7 @@ - if @project.has_extra_tags? = _("+ %{count} more") % { count: @project.count_of_extra_tags_not_shown } - .project-repo-buttons.col-md-12.col-lg-5.d-inline-flex.flex-wrap.justify-content-lg-end + .project-repo-buttons.col-md-12.col-lg-6.d-inline-flex.flex-wrap.justify-content-lg-end - if current_user .d-inline-flex = render 'projects/buttons/notifications', notification_setting: @notification_setting, btn_class: 'btn-xs' diff --git a/app/views/projects/cleanup/_show.html.haml b/app/views/projects/cleanup/_show.html.haml index 778d27fc61d..cecc139b183 100644 --- a/app/views/projects/cleanup/_show.html.haml +++ b/app/views/projects/cleanup/_show.html.haml @@ -1,5 +1,3 @@ -- return unless Feature.enabled?(:project_cleanup, @project) - - expanded = Rails.env.test? %section.settings.no-animate#cleanup{ class: ('expanded' if expanded) } diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index 1618655182c..c6a391ae563 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -17,7 +17,7 @@ = render 'shared/issuable/form/template_selector', issuable: issuable = render 'shared/issuable/form/title', issuable: issuable, form: form, has_wip_commits: commits && commits.detect(&:work_in_progress?) -- if Feature.enabled?(:issue_suggestions) && Feature.enabled?(:graphql) +- if Gitlab::Graphql.enabled? #js-suggestions{ data: { project_path: @project.full_path } } = render 'shared/form_elements/description', model: issuable, form: form, project: project diff --git a/changelogs/unreleased/revert-1cccfca1.yml b/changelogs/unreleased/revert-1cccfca1.yml new file mode 100644 index 00000000000..c1efdaac138 --- /dev/null +++ b/changelogs/unreleased/revert-1cccfca1.yml @@ -0,0 +1,5 @@ +--- +title: Restore kubernetes:active in Auto-DevOps.gitlab-ci.yml (reverts 22929) +merge_request: 23826 +author: +type: fixed diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 6aba6c7c21d..be4183f39be 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -42,7 +42,9 @@ Sidekiq.configure_server do |config| end if Feature::FlipperFeature.table_exists? && Feature.enabled?(:gitlab_sidekiq_reliable_fetcher) - Sidekiq::ReliableFetcher.setup_reliable_fetch!(config) + # By default we're going to use Semi Reliable Fetch + config.options[:semi_reliable_fetch] = Feature.enabled?(:gitlab_sidekiq_enable_semi_reliable_fetcher, default_enabled: true) + Sidekiq::ReliableFetch.setup_reliable_fetch!(config) end # Sidekiq-cron: load recurring jobs from gitlab.yml diff --git a/config/routes/api.rb b/config/routes/api.rb index b1aebf4d606..3719b7d3a1e 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -1,4 +1,4 @@ -constraints(::Constraints::FeatureConstrainer.new(:graphql)) do +constraints(::Constraints::FeatureConstrainer.new(:graphql, default_enabled: true)) do post '/api/graphql', to: 'graphql#execute' mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql' end diff --git a/doc/administration/monitoring/performance/img/request_profiling_token.png b/doc/administration/monitoring/performance/img/request_profiling_token.png Binary files differindex a9160b62acb..9f3dd7f08ca 100644 --- a/doc/administration/monitoring/performance/img/request_profiling_token.png +++ b/doc/administration/monitoring/performance/img/request_profiling_token.png diff --git a/doc/api/suggestions.md b/doc/api/suggestions.md new file mode 100644 index 00000000000..9d76ef0c4bf --- /dev/null +++ b/doc/api/suggestions.md @@ -0,0 +1,36 @@ +# Suggest Changes API + +Every API call to suggestions must be authenticated. + +## Applying suggestions + +Applies a suggested patch in a merge request. Users must be +at least [Developer](../user/permissions.md) to perform such action. + +``` +PUT /suggestions/:id/apply +``` + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer/string | yes | The ID of a suggestion | + +```bash +curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/suggestions/5/apply +``` + +Example response: + +```json + { + "id": 36, + "from_original_line": 10, + "to_original_line": 10, + "from_line": 10, + "to_line": 10, + "appliable": false, + "applied": true, + "from_content": " \"--talk-name=org.freedesktop.\",\n", + "to_content": " \"--talk-name=org.free.\",\n \"--talk-name=org.desktop.\",\n" + } +``` diff --git a/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/img/cloud_foundry_variables.png b/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/img/cloud_foundry_variables.png Binary files differindex 28323e2d8de..e76767741ce 100644 --- a/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/img/cloud_foundry_variables.png +++ b/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/img/cloud_foundry_variables.png diff --git a/doc/ci/examples/laravel_with_gitlab_and_envoy/img/variables_page.png b/doc/ci/examples/laravel_with_gitlab_and_envoy/img/variables_page.png Binary files differindex 80d8eb0f4fc..4675e20ef79 100644 --- a/doc/ci/examples/laravel_with_gitlab_and_envoy/img/variables_page.png +++ b/doc/ci/examples/laravel_with_gitlab_and_envoy/img/variables_page.png diff --git a/doc/ci/img/pipelines-goal.png b/doc/ci/img/pipelines-goal.png Binary files differindex a96368e562b..f15716d0b8f 100644 --- a/doc/ci/img/pipelines-goal.png +++ b/doc/ci/img/pipelines-goal.png diff --git a/doc/ci/img/types-of-pipelines.png b/doc/ci/img/types-of-pipelines.png Binary files differindex bd809de5e68..829a53d5d52 100644 --- a/doc/ci/img/types-of-pipelines.png +++ b/doc/ci/img/types-of-pipelines.png diff --git a/doc/ci/img/view_on_mr_widget.png b/doc/ci/img/view_on_mr_widget.png Binary files differindex 04f4b58df62..efe023b07b5 100644 --- a/doc/ci/img/view_on_mr_widget.png +++ b/doc/ci/img/view_on_mr_widget.png diff --git a/doc/ci/interactive_web_terminal/index.md b/doc/ci/interactive_web_terminal/index.md index d8136b80c11..d299e28d2e6 100644 --- a/doc/ci/interactive_web_terminal/index.md +++ b/doc/ci/interactive_web_terminal/index.md @@ -6,8 +6,9 @@ Interactive web terminals give the user access to a terminal in GitLab for running one-off commands for their CI pipeline. NOTE: **Note:** -GitLab.com does not support interactive web terminal at the moment. Please -follow [this issue](https://gitlab.com/gitlab-org/gitlab-ce/issues/52611) for +GitLab.com does not support interactive web terminal at the moment – neither +using shared GitLab.com runners nor your own runners. Please follow +[this issue](https://gitlab.com/gitlab-org/gitlab-ce/issues/52611) for progress. ## Configuration diff --git a/doc/ci/merge_request_pipelines/img/merge_request.png b/doc/ci/merge_request_pipelines/img/merge_request.png Binary files differindex 1fe2eec2008..cf9c628e9a0 100644 --- a/doc/ci/merge_request_pipelines/img/merge_request.png +++ b/doc/ci/merge_request_pipelines/img/merge_request.png diff --git a/doc/ci/merge_request_pipelines/img/pipeline_detail.png b/doc/ci/merge_request_pipelines/img/pipeline_detail.png Binary files differindex def1781dd75..6094a0975fb 100644 --- a/doc/ci/merge_request_pipelines/img/pipeline_detail.png +++ b/doc/ci/merge_request_pipelines/img/pipeline_detail.png diff --git a/doc/ci/triggers/img/trigger_variables.png b/doc/ci/triggers/img/trigger_variables.png Binary files differindex f862155b47f..d273b1fe3a2 100644 --- a/doc/ci/triggers/img/trigger_variables.png +++ b/doc/ci/triggers/img/trigger_variables.png diff --git a/doc/ci/variables/img/variables.png b/doc/ci/variables/img/variables.png Binary files differindex d2dc99bbac0..0795f7c888f 100644 --- a/doc/ci/variables/img/variables.png +++ b/doc/ci/variables/img/variables.png diff --git a/doc/img/devops-stages.png b/doc/img/devops-stages.png Binary files differindex a971e81a419..424bce95607 100644 --- a/doc/img/devops-stages.png +++ b/doc/img/devops-stages.png diff --git a/doc/install/aws/img/associate_subnet_gateway_2.png b/doc/install/aws/img/associate_subnet_gateway_2.png Binary files differindex 76e101d32a3..6e10d9647b1 100644 --- a/doc/install/aws/img/associate_subnet_gateway_2.png +++ b/doc/install/aws/img/associate_subnet_gateway_2.png diff --git a/doc/install/aws/img/choose_ami.png b/doc/install/aws/img/choose_ami.png Binary files differindex 034ac92691d..a07d42dd6fb 100644 --- a/doc/install/aws/img/choose_ami.png +++ b/doc/install/aws/img/choose_ami.png diff --git a/doc/install/aws/img/ec_az.png b/doc/install/aws/img/ec_az.png Binary files differindex 22a8291c593..431dbb0251b 100644 --- a/doc/install/aws/img/ec_az.png +++ b/doc/install/aws/img/ec_az.png diff --git a/doc/install/aws/img/ec_subnet.png b/doc/install/aws/img/ec_subnet.png Binary files differindex c44fb4485e3..08a9b169267 100644 --- a/doc/install/aws/img/ec_subnet.png +++ b/doc/install/aws/img/ec_subnet.png diff --git a/doc/integration/img/github_app.png b/doc/integration/img/github_app.png Binary files differindex 4a1523d41ac..b72cf03dd4d 100644 --- a/doc/integration/img/github_app.png +++ b/doc/integration/img/github_app.png diff --git a/doc/integration/img/github_app_entry.png b/doc/integration/img/github_app_entry.png Binary files differindex 9e151f8cdff..0a1fe0ca65a 100644 --- a/doc/integration/img/github_app_entry.png +++ b/doc/integration/img/github_app_entry.png diff --git a/doc/integration/img/github_register_app.png b/doc/integration/img/github_register_app.png Binary files differindex edd3f660f4e..5786b822f53 100644 --- a/doc/integration/img/github_register_app.png +++ b/doc/integration/img/github_register_app.png diff --git a/doc/university/high-availability/aws/img/reference-arch2.png b/doc/university/high-availability/aws/img/reference-arch2.png Binary files differindex 9f50b2f5171..a9cb6663103 100644 --- a/doc/university/high-availability/aws/img/reference-arch2.png +++ b/doc/university/high-availability/aws/img/reference-arch2.png diff --git a/doc/user/admin_area/img/admin_area_settings_button.png b/doc/user/admin_area/img/admin_area_settings_button.png Binary files differindex 315ef40a375..5b969ecd668 100644 --- a/doc/user/admin_area/img/admin_area_settings_button.png +++ b/doc/user/admin_area/img/admin_area_settings_button.png diff --git a/doc/user/admin_area/settings/img/import_sources.png b/doc/user/admin_area/settings/img/import_sources.png Binary files differindex 4257f02448f..20829a27dd7 100644 --- a/doc/user/admin_area/settings/img/import_sources.png +++ b/doc/user/admin_area/settings/img/import_sources.png diff --git a/doc/user/discussions/img/insert_suggestion.png b/doc/user/discussions/img/insert_suggestion.png Binary files differnew file mode 100644 index 00000000000..4bf293b8297 --- /dev/null +++ b/doc/user/discussions/img/insert_suggestion.png diff --git a/doc/user/discussions/img/make_suggestion.png b/doc/user/discussions/img/make_suggestion.png Binary files differnew file mode 100644 index 00000000000..20acc1417da --- /dev/null +++ b/doc/user/discussions/img/make_suggestion.png diff --git a/doc/user/discussions/img/suggestion.png b/doc/user/discussions/img/suggestion.png Binary files differnew file mode 100644 index 00000000000..68a67e6ae5e --- /dev/null +++ b/doc/user/discussions/img/suggestion.png diff --git a/doc/user/discussions/index.md b/doc/user/discussions/index.md index 0f89d261ff6..9379d047fca 100644 --- a/doc/user/discussions/index.md +++ b/doc/user/discussions/index.md @@ -293,6 +293,51 @@ Once you select one of the filters in a given issue or MR, GitLab will save your preference, so that it will persist when you visit the same page again from any device you're logged into. +## Suggest Changes + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/18008) in GitLab 11.6. + +As a reviewer, you're able to suggest code changes with a simple +markdown syntax in Merge Request Diff discussions. Then, the +Merge Request author (or other users with appropriate +[permission](../permissions.md)) is able to apply these +suggestions with a click, which will generate a commit in +the Merge Request authored by the user that applied them. + +1. Choose a line of code to be changed, add a new comment, then click +on the **Insert suggestion** icon in the toolbar: + + ![Add a new comment](img/insert_suggestion.png) + + > **Note:** + The suggestion will only affect the commented line. Multi-line + suggestions are currently not supported. Will be introduced by + [#53310](https://gitlab.com/gitlab-org/gitlab-ce/issues/53310). + +1. In the comment, add your suggestion to the pre-populated code block: + + ![Add a suggestion into a code block tagged properly](img/make_suggestion.png) + +1. Click **Comment**. + + The suggestions in the comment can be applied by the merge request author + directly from the merge request: + + ![Apply suggestions](img/suggestion.png) + + > **Note:** + Discussions are _not_ automatically resolved. Will be introduced by + [#54405](https://gitlab.com/gitlab-org/gitlab-ce/issues/54405). + +Once the author applies a suggestion, it will be marked with the **Applied** label, +and GitLab will create a new commit with the message `Apply suggestion to <file-name>` +and push the suggested change directly into the codebase in the merge request's branch. +[Developer permission](../permissions.md) is required to do so. + +> **Note:** +Custom commit messages will be introduced by +[#54404](https://gitlab.com/gitlab-org/gitlab-ce/issues/54404). + [ce-5022]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5022 [ce-7125]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7125 [ce-7527]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7527 diff --git a/doc/user/group/img/add_new_members.png b/doc/user/group/img/add_new_members.png Binary files differindex 4431c9fbe0b..6d43e309e84 100644 --- a/doc/user/group/img/add_new_members.png +++ b/doc/user/group/img/add_new_members.png diff --git a/doc/user/group/img/create_new_project_from_group.png b/doc/user/group/img/create_new_project_from_group.png Binary files differindex b6286ac7800..df98091334c 100644 --- a/doc/user/group/img/create_new_project_from_group.png +++ b/doc/user/group/img/create_new_project_from_group.png diff --git a/doc/user/img/color_inline_colorchip_render_gfm.png b/doc/user/img/color_inline_colorchip_render_gfm.png Binary files differindex 6a8a674d6e0..fed8ca5c34b 100644 --- a/doc/user/img/color_inline_colorchip_render_gfm.png +++ b/doc/user/img/color_inline_colorchip_render_gfm.png diff --git a/doc/user/img/math_inline_sup_render_gfm.png b/doc/user/img/math_inline_sup_render_gfm.png Binary files differindex bf1464457bc..3ee2abb14df 100644 --- a/doc/user/img/math_inline_sup_render_gfm.png +++ b/doc/user/img/math_inline_sup_render_gfm.png diff --git a/doc/user/img/mermaid_diagram_render_gfm.png b/doc/user/img/mermaid_diagram_render_gfm.png Binary files differindex 3b3eb3a738a..9d192a30a85 100644 --- a/doc/user/img/mermaid_diagram_render_gfm.png +++ b/doc/user/img/mermaid_diagram_render_gfm.png diff --git a/doc/user/img/task_list_ordered_render_gfm.png b/doc/user/img/task_list_ordered_render_gfm.png Binary files differindex fdff8a9886c..0905a8378be 100644 --- a/doc/user/img/task_list_ordered_render_gfm.png +++ b/doc/user/img/task_list_ordered_render_gfm.png diff --git a/doc/user/img/unordered_check_list_render_gfm.png b/doc/user/img/unordered_check_list_render_gfm.png Binary files differindex 2e3fb7cbb79..ccdeab6e62c 100644 --- a/doc/user/img/unordered_check_list_render_gfm.png +++ b/doc/user/img/unordered_check_list_render_gfm.png diff --git a/doc/user/markdown.md b/doc/user/markdown.md index debebd4c081..893658290e5 100644 --- a/doc/user/markdown.md +++ b/doc/user/markdown.md @@ -5,11 +5,11 @@ It is not valid for the [GitLab documentation website](https://docs.gitlab.com) nor [GitLab's main website](https://about.gitlab.com), as they both use [Kramdown](https://kramdown.gettalong.org) as their markdown engine. The documentation website uses an extended Kramdown gem, [GitLab Kramdown](https://gitlab.com/gitlab-org/gitlab_kramdown). -Consult the [GitLab Kramdown Guide](https://about.gitlab.com/handbook/product/technical-writing/markdown-guide/) for a complete Kramdown reference._ +Consult the [GitLab Kramdown Guide](https://about.gitlab.com/handbook/product/technical-writing/markdown-guide/) for a complete Kramdown reference. ## GitLab Flavored Markdown (GFM) -GitLab uses "GitLab Flavored Markdown" (GFM). It extends the [CommonMark specification][commonmark-spec] (which is based on standard Markdown) in a few significant ways to add some useful functionality. It was inspired by [GitHub Flavored Markdown](https://help.github.com/articles/basic-writing-and-formatting-syntax/). +GitLab uses "GitLab Flavored Markdown" (GFM). It extends the [CommonMark specification][commonmark-spec] (which is based on standard Markdown) in a few significant ways to add additional useful functionality. It was inspired by [GitHub Flavored Markdown](https://help.github.com/articles/basic-writing-and-formatting-syntax/). You can use GFM in the following areas: @@ -26,8 +26,7 @@ dependency to do so. Please see the [`github-markup` gem readme](https://github. > **Notes:** > -> For the best result, we encourage you to check this document out as [rendered -> by GitLab itself](markdown.md). +> We encourage you to view this document as [rendered by GitLab itself](markdown.md). > > As of 11.1, GitLab uses the [CommonMark Ruby Library][commonmarker] for Markdown processing of all new issues, merge requests, comments, and other Markdown content @@ -142,7 +141,7 @@ GFM will autolink almost any URL you copy and paste into your text: * <a href="irc://irc.freenode.net/gitlab">irc://irc.freenode.net/gitlab</a> * http://localhost:3000 -### Multiline Blockquote +### Multiline blockquote > If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#multiline-blockquote @@ -172,7 +171,7 @@ you can quote that without having to manually prepend `>` to every line! <p>you can quote that without having to manually prepend <code>></code> to every line!</p> </blockquote> -### Code and Syntax Highlighting +### Code and syntax highlighting > If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#code-and-syntax-highlighting @@ -242,7 +241,7 @@ s = "There is no highlighting for this." But let's throw in a <b>tag</b>. ``` -### Inline Diff +### Inline diff > If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#inline-diff @@ -309,7 +308,7 @@ On Linux, you can download [Noto Color Emoji](https://www.google.com/get/noto/he Ubuntu 18.04 (like many modern Linux distros) has this font installed by default. -### Special GitLab References +### Special GitLab references GFM recognizes special references. @@ -363,7 +362,7 @@ It also has a shorthand version to reference other projects from the same namesp | `project@9ba12248...b19a04f5` | commit range comparison | | `project~"Some label"` | issues with given label | -### Task Lists +### Task lists > If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#task-lists @@ -505,6 +504,66 @@ Becomes: For details see the [Mermaid official page][mermaid]. +### Front matter + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23331) + in GitLab 11.6. + +Front matter is metadata included at the beginning of a markdown document, preceding +its content. This data can be used by static site generators such as [Jekyll](https://jekyllrb.com/docs/front-matter/) and [Hugo](https://gohugo.io/content-management/front-matter/), +and many other applications. + +In GitLab, front matter is only used in Markdown files and wiki pages, not the other places where Markdown formatting is supported. +When you view a Markdown file rendered by GitLab, any front matter is displayed as-is, in a box at the top of the document, before the rendered HTML content. +To view an example, you can toggle between the source and rendered version of a [GitLab documentation file](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/README.md). + +The following delimeters are supported: + +- YAML (`---`): + + ``` + --- + title: About Front Matter + example: + language: yaml + --- + ``` + +- TOML (`+++`): + + ``` + +++ + title = "About Front Matter" + [example] + language = "toml" + +++ + ``` + +- JSON (`;;;`): + + ``` + ;;; + { + "title": "About Front Matter" + "example": { + "language": "json" + } + } + ;;; + ``` + +Other languages are supported by adding a specifier to any of the existing +delimiters. For example: + +``` +---php +$title = "About Front Matter"; +$example = array( + 'language' => "php", +); +--- +``` + ## Standard Markdown ### Headers diff --git a/doc/user/permissions.md b/doc/user/permissions.md index c4a2d5f66e5..ed00f86f9de 100644 --- a/doc/user/permissions.md +++ b/doc/user/permissions.md @@ -79,6 +79,7 @@ The following table depicts the various user permission levels in a project. | View approved/blacklisted licenses **[ULTIMATE]** | | | ✓ | ✓ | ✓ | | Use security dashboard **[ULTIMATE]** | | | ✓ | ✓ | ✓ | | Dismiss vulnerability **[ULTIMATE]** | | | ✓ | ✓ | ✓ | +| Apply code change suggestions | | | ✓ | ✓ | ✓ | | Use environment terminals | | | | ✓ | ✓ | | Add new team members | | | | ✓ | ✓ | | Push to protected branches | | | | ✓ | ✓ | diff --git a/doc/user/project/clusters/runbooks/img/authorize-jupyter.png b/doc/user/project/clusters/runbooks/img/authorize-jupyter.png Binary files differindex 64f95ed45f0..84cce311483 100644 --- a/doc/user/project/clusters/runbooks/img/authorize-jupyter.png +++ b/doc/user/project/clusters/runbooks/img/authorize-jupyter.png diff --git a/doc/user/project/clusters/runbooks/img/demo-runbook.png b/doc/user/project/clusters/runbooks/img/demo-runbook.png Binary files differindex 25c9df4126d..37c110ed0d8 100644 --- a/doc/user/project/clusters/runbooks/img/demo-runbook.png +++ b/doc/user/project/clusters/runbooks/img/demo-runbook.png diff --git a/doc/user/project/clusters/runbooks/img/gitlab-variables.png b/doc/user/project/clusters/runbooks/img/gitlab-variables.png Binary files differindex f76ed21145f..1d338f063a9 100644 --- a/doc/user/project/clusters/runbooks/img/gitlab-variables.png +++ b/doc/user/project/clusters/runbooks/img/gitlab-variables.png diff --git a/doc/user/project/clusters/runbooks/img/helm-install.png b/doc/user/project/clusters/runbooks/img/helm-install.png Binary files differindex e39094bcbf7..003e482e756 100644 --- a/doc/user/project/clusters/runbooks/img/helm-install.png +++ b/doc/user/project/clusters/runbooks/img/helm-install.png diff --git a/doc/user/project/clusters/runbooks/img/ingress-install.png b/doc/user/project/clusters/runbooks/img/ingress-install.png Binary files differindex 093c61f2d0e..7edc11d5b45 100644 --- a/doc/user/project/clusters/runbooks/img/ingress-install.png +++ b/doc/user/project/clusters/runbooks/img/ingress-install.png diff --git a/doc/user/project/clusters/runbooks/img/jupyterhub-install.png b/doc/user/project/clusters/runbooks/img/jupyterhub-install.png Binary files differindex 2115ec9745b..75c6028a763 100644 --- a/doc/user/project/clusters/runbooks/img/jupyterhub-install.png +++ b/doc/user/project/clusters/runbooks/img/jupyterhub-install.png diff --git a/doc/user/project/clusters/runbooks/img/postgres-query.png b/doc/user/project/clusters/runbooks/img/postgres-query.png Binary files differindex 3880438c97a..04315d54d5e 100644 --- a/doc/user/project/clusters/runbooks/img/postgres-query.png +++ b/doc/user/project/clusters/runbooks/img/postgres-query.png diff --git a/doc/user/project/clusters/runbooks/img/sample-runbook.png b/doc/user/project/clusters/runbooks/img/sample-runbook.png Binary files differindex c12ce8990a4..70011202bf0 100644 --- a/doc/user/project/clusters/runbooks/img/sample-runbook.png +++ b/doc/user/project/clusters/runbooks/img/sample-runbook.png diff --git a/doc/user/project/clusters/serverless/img/deploy-stage.png b/doc/user/project/clusters/serverless/img/deploy-stage.png Binary files differindex dc2f8af9c63..a4a6b363b64 100644 --- a/doc/user/project/clusters/serverless/img/deploy-stage.png +++ b/doc/user/project/clusters/serverless/img/deploy-stage.png diff --git a/doc/user/project/clusters/serverless/img/install-knative.png b/doc/user/project/clusters/serverless/img/install-knative.png Binary files differindex a9fcc127240..93b1cbe602f 100644 --- a/doc/user/project/clusters/serverless/img/install-knative.png +++ b/doc/user/project/clusters/serverless/img/install-knative.png diff --git a/doc/user/project/clusters/serverless/img/knative-app.png b/doc/user/project/clusters/serverless/img/knative-app.png Binary files differindex 54301e1786f..931830d83ae 100644 --- a/doc/user/project/clusters/serverless/img/knative-app.png +++ b/doc/user/project/clusters/serverless/img/knative-app.png diff --git a/doc/user/project/img/issue_board.png b/doc/user/project/img/issue_board.png Binary files differindex b46b995d8bb..b753593d212 100644 --- a/doc/user/project/img/issue_board.png +++ b/doc/user/project/img/issue_board.png diff --git a/doc/user/project/img/issue_board_summed_weights.png b/doc/user/project/img/issue_board_summed_weights.png Binary files differindex 2288d767d8c..6035d7ca330 100644 --- a/doc/user/project/img/issue_board_summed_weights.png +++ b/doc/user/project/img/issue_board_summed_weights.png diff --git a/doc/user/project/img/issue_boards_core.png b/doc/user/project/img/issue_boards_core.png Binary files differindex 8bc187482ad..41ddbb24b14 100644 --- a/doc/user/project/img/issue_boards_core.png +++ b/doc/user/project/img/issue_boards_core.png diff --git a/doc/user/project/img/issue_boards_premium.png b/doc/user/project/img/issue_boards_premium.png Binary files differindex 4e238ea6983..ef9f5bbea32 100644 --- a/doc/user/project/img/issue_boards_premium.png +++ b/doc/user/project/img/issue_boards_premium.png diff --git a/doc/user/project/integrations/img/jira_api_token.png b/doc/user/project/integrations/img/jira_api_token.png Binary files differindex 2c64f7bc44f..4fa7a46854e 100644 --- a/doc/user/project/integrations/img/jira_api_token.png +++ b/doc/user/project/integrations/img/jira_api_token.png diff --git a/doc/user/project/integrations/img/jira_api_token_menu.png b/doc/user/project/integrations/img/jira_api_token_menu.png Binary files differindex 20655ba3c0e..55c8fb1bdb9 100644 --- a/doc/user/project/integrations/img/jira_api_token_menu.png +++ b/doc/user/project/integrations/img/jira_api_token_menu.png diff --git a/doc/user/project/integrations/img/jira_service_page.png b/doc/user/project/integrations/img/jira_service_page.png Binary files differindex 869d562ed5b..3a27b4df841 100644 --- a/doc/user/project/integrations/img/jira_service_page.png +++ b/doc/user/project/integrations/img/jira_service_page.png diff --git a/doc/user/project/issues/img/issue_board.png b/doc/user/project/issues/img/issue_board.png Binary files differindex c75c35a382e..dd40740aec5 100644 --- a/doc/user/project/issues/img/issue_board.png +++ b/doc/user/project/issues/img/issue_board.png diff --git a/doc/user/project/issues/img/similar_issues.png b/doc/user/project/issues/img/similar_issues.png Binary files differindex 153430d4be7..0dfb5b00e02 100644 --- a/doc/user/project/issues/img/similar_issues.png +++ b/doc/user/project/issues/img/similar_issues.png diff --git a/doc/user/project/merge_requests/img/comment-on-any-diff-line.png b/doc/user/project/merge_requests/img/comment-on-any-diff-line.png Binary files differindex 856ede41527..c2455c2d1e5 100644 --- a/doc/user/project/merge_requests/img/comment-on-any-diff-line.png +++ b/doc/user/project/merge_requests/img/comment-on-any-diff-line.png diff --git a/doc/user/project/merge_requests/img/filter_wip_merge_requests.png b/doc/user/project/merge_requests/img/filter_wip_merge_requests.png Binary files differindex 40913718385..81878709487 100644 --- a/doc/user/project/merge_requests/img/filter_wip_merge_requests.png +++ b/doc/user/project/merge_requests/img/filter_wip_merge_requests.png diff --git a/doc/user/project/merge_requests/img/merge_request_pipeline.png b/doc/user/project/merge_requests/img/merge_request_pipeline.png Binary files differindex 183d9cb910b..ce1d6bab536 100644 --- a/doc/user/project/merge_requests/img/merge_request_pipeline.png +++ b/doc/user/project/merge_requests/img/merge_request_pipeline.png diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index 85d8d804133..d4f8cf929f6 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -150,6 +150,16 @@ in a Merge Request. To do so, click the **...** button in the gutter of the Merg ![Comment on any diff file line](img/comment-on-any-diff-line.png) +## Suggest changes + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/18008) in GitLab 11.6. + +As a reviewer, you can add suggestions to change the content in +merge request discussions, and users with appropriate [permission](../../permissions.md) +can easily apply them to the codebase directly from the UI. Read +through the documentation on [Suggest changes](../../discussions/index.md#suggest-changes) +to learn more. + ## Resolve conflicts When a merge request has conflicts, GitLab may provide the option to resolve diff --git a/doc/user/project/pages/img/icons/click.png b/doc/user/project/pages/img/icons/click.png Binary files differindex daaf760ec08..a534ae29e0f 100644 --- a/doc/user/project/pages/img/icons/click.png +++ b/doc/user/project/pages/img/icons/click.png diff --git a/doc/user/project/pages/img/icons/cogs.png b/doc/user/project/pages/img/icons/cogs.png Binary files differindex a12da1b5e8c..f37f8f361d1 100644 --- a/doc/user/project/pages/img/icons/cogs.png +++ b/doc/user/project/pages/img/icons/cogs.png diff --git a/doc/user/project/pages/img/icons/fork.png b/doc/user/project/pages/img/icons/fork.png Binary files differindex e2c9577e7ce..8a3aa46eb37 100644 --- a/doc/user/project/pages/img/icons/fork.png +++ b/doc/user/project/pages/img/icons/fork.png diff --git a/doc/user/project/pages/img/icons/free.png b/doc/user/project/pages/img/icons/free.png Binary files differindex 3b8f8f6863e..ae455033e94 100644 --- a/doc/user/project/pages/img/icons/free.png +++ b/doc/user/project/pages/img/icons/free.png diff --git a/doc/user/project/pages/img/icons/lock.png b/doc/user/project/pages/img/icons/lock.png Binary files differindex 1c1f0b4457b..f4c35c84112 100644 --- a/doc/user/project/pages/img/icons/lock.png +++ b/doc/user/project/pages/img/icons/lock.png diff --git a/doc/user/project/pages/img/icons/monitor.png b/doc/user/project/pages/img/icons/monitor.png Binary files differindex 7b99d430eef..8bad059a74c 100644 --- a/doc/user/project/pages/img/icons/monitor.png +++ b/doc/user/project/pages/img/icons/monitor.png diff --git a/doc/user/project/pages/img/icons/terminal.png b/doc/user/project/pages/img/icons/terminal.png Binary files differindex ab5ae11310c..377eeb4edc6 100644 --- a/doc/user/project/pages/img/icons/terminal.png +++ b/doc/user/project/pages/img/icons/terminal.png diff --git a/doc/user/project/repository/branches/img/branch_filter_search_box.png b/doc/user/project/repository/branches/img/branch_filter_search_box.png Binary files differindex c4364ef39f4..5dc7eccf189 100644 --- a/doc/user/project/repository/branches/img/branch_filter_search_box.png +++ b/doc/user/project/repository/branches/img/branch_filter_search_box.png diff --git a/doc/user/project/repository/img/repository_cleanup.png b/doc/user/project/repository/img/repository_cleanup.png Binary files differindex 2749392ffa4..bda40d3e193 100644 --- a/doc/user/project/repository/img/repository_cleanup.png +++ b/doc/user/project/repository/img/repository_cleanup.png diff --git a/doc/user/search/img/dashboard_links.png b/doc/user/search/img/dashboard_links.png Binary files differindex 2c472c7e464..d784ba8018e 100644 --- a/doc/user/search/img/dashboard_links.png +++ b/doc/user/search/img/dashboard_links.png diff --git a/doc/user/search/img/issues_assigned_to_you.png b/doc/user/search/img/issues_assigned_to_you.png Binary files differindex d2fff5e9a67..55986eedcba 100644 --- a/doc/user/search/img/issues_assigned_to_you.png +++ b/doc/user/search/img/issues_assigned_to_you.png diff --git a/doc/workflow/img/repository_mirroring_force_update.png b/doc/workflow/img/repository_mirroring_force_update.png Binary files differindex 8ba715d1ba3..1e6dcb9ea08 100644 --- a/doc/workflow/img/repository_mirroring_force_update.png +++ b/doc/workflow/img/repository_mirroring_force_update.png diff --git a/lib/constraints/feature_constrainer.rb b/lib/constraints/feature_constrainer.rb index ca4376a9d38..cd246cf37a4 100644 --- a/lib/constraints/feature_constrainer.rb +++ b/lib/constraints/feature_constrainer.rb @@ -2,14 +2,14 @@ module Constraints class FeatureConstrainer - attr_reader :feature + attr_reader :args - def initialize(feature) - @feature = feature + def initialize(*args) + @args = args end def matches?(_request) - Feature.enabled?(feature) + Feature.enabled?(*args) end end end diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 6eb5f9e2300..7aa02009aa0 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -199,7 +199,7 @@ module Gitlab end # rubocop: enable CodeReuse/ActiveRecord - def lfs_token_check(login, password, project) + def lfs_token_check(login, encoded_token, project) deploy_key_matches = login.match(/\Alfs\+deploy-key-(\d+)\z/) actor = @@ -222,7 +222,7 @@ module Gitlab read_authentication_abilities end - if Devise.secure_compare(token_handler.token, password) + if token_handler.token_valid?(encoded_token) Gitlab::Auth::Result.new(actor, nil, token_handler.type, authentication_abilities) end end diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml index d0613aa59e1..a9e361b0b32 100644 --- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml @@ -149,10 +149,10 @@ performance: only: refs: - branches + kubernetes: active except: variables: - $PERFORMANCE_DISABLED - - $KUBECONFIG == null sast: stage: test @@ -228,6 +228,7 @@ dast: only: refs: - branches + kubernetes: active variables: - $GITLAB_FEATURES =~ /\bdast\b/ except: @@ -235,7 +236,6 @@ dast: - master variables: - $DAST_DISABLED - - $KUBECONFIG == null review: stage: review @@ -257,12 +257,12 @@ review: only: refs: - branches + kubernetes: active except: refs: - master variables: - $REVIEW_DISABLED - - $KUBECONFIG == null stop_review: stage: cleanup @@ -280,12 +280,12 @@ stop_review: only: refs: - branches + kubernetes: active except: refs: - master variables: - $REVIEW_DISABLED - - $KUBECONFIG == null # Staging deploys are disabled by default since # continuous deployment to production is enabled by default @@ -309,11 +309,9 @@ staging: only: refs: - master + kubernetes: active variables: - $STAGING_ENABLED - except: - variables: - - $KUBECONFIG == null # Canaries are also disabled by default, but if you want them, # and know what the downsides are, you can enable this by setting @@ -336,11 +334,9 @@ canary: only: refs: - master + kubernetes: active variables: - $CANARY_ENABLED - except: - variables: - - $KUBECONFIG == null .production: &production_template stage: production @@ -366,13 +362,13 @@ production: only: refs: - master + kubernetes: active except: variables: - $STAGING_ENABLED - $CANARY_ENABLED - $INCREMENTAL_ROLLOUT_ENABLED - $INCREMENTAL_ROLLOUT_MODE - - $KUBECONFIG == null production_manual: <<: *production_template @@ -381,6 +377,7 @@ production_manual: only: refs: - master + kubernetes: active variables: - $STAGING_ENABLED - $CANARY_ENABLED @@ -388,7 +385,6 @@ production_manual: variables: - $INCREMENTAL_ROLLOUT_ENABLED - $INCREMENTAL_ROLLOUT_MODE - - $KUBECONFIG == null # This job implements incremental rollout on for every push to `master`. @@ -418,13 +414,13 @@ production_manual: only: refs: - master + kubernetes: active variables: - $INCREMENTAL_ROLLOUT_MODE == "manual" - $INCREMENTAL_ROLLOUT_ENABLED except: variables: - $INCREMENTAL_ROLLOUT_MODE == "timed" - - $KUBECONFIG == null .timed_rollout_template: &timed_rollout_template <<: *rollout_template @@ -433,11 +429,9 @@ production_manual: only: refs: - master + kubernetes: active variables: - $INCREMENTAL_ROLLOUT_MODE == "timed" - except: - variables: - - $KUBECONFIG == null timed rollout 10%: <<: *timed_rollout_template diff --git a/lib/gitlab/gitaly_client/cleanup_service.rb b/lib/gitlab/gitaly_client/cleanup_service.rb index 8e412a9b3ef..3e8d6a773ca 100644 --- a/lib/gitlab/gitaly_client/cleanup_service.rb +++ b/lib/gitlab/gitaly_client/cleanup_service.rb @@ -20,6 +20,7 @@ module Gitlab while data = io.read(RepositoryService::MAX_MSG_SIZE) y.yield Gitaly::ApplyBfgObjectMapRequest.new(object_map: data) + break if io&.eof? end end diff --git a/lib/gitlab/graphql.rb b/lib/gitlab/graphql.rb index 74c04e5380e..8a59e83974f 100644 --- a/lib/gitlab/graphql.rb +++ b/lib/gitlab/graphql.rb @@ -3,5 +3,9 @@ module Gitlab module Graphql StandardGraphqlError = Class.new(StandardError) + + def self.enabled? + Feature.enabled?(:graphql, default_enabled: true) + end end end diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb index 05d3096a208..c09d3ebc7be 100644 --- a/lib/gitlab/lfs_token.rb +++ b/lib/gitlab/lfs_token.rb @@ -2,10 +2,21 @@ module Gitlab class LfsToken - attr_accessor :actor + module LfsTokenHelper + def user? + actor.is_a?(User) + end + + def actor_name + user? ? actor.username : "lfs+deploy-key-#{actor.id}" + end + end + + include LfsTokenHelper - TOKEN_LENGTH = 50 - EXPIRY_TIME = 1800 + DEFAULT_EXPIRE_TIME = 1800 + + attr_accessor :actor def initialize(actor) @actor = @@ -19,36 +30,108 @@ module Gitlab end end - def token - Gitlab::Redis::SharedState.with do |redis| - token = redis.get(redis_shared_state_key) - token ||= Devise.friendly_token(TOKEN_LENGTH) - redis.set(redis_shared_state_key, token, ex: EXPIRY_TIME) + def token(expire_time: DEFAULT_EXPIRE_TIME) + HMACToken.new(actor).token(expire_time) + end - token - end + def token_valid?(token_to_check) + HMACToken.new(actor).token_valid?(token_to_check) || + LegacyRedisDeviseToken.new(actor).token_valid?(token_to_check) end def deploy_key_pushable?(project) actor.is_a?(DeployKey) && actor.can_push_to?(project) end - def user? - actor.is_a?(User) - end - def type user? ? :lfs_token : :lfs_deploy_token end - def actor_name - actor.is_a?(User) ? actor.username : "lfs+deploy-key-#{actor.id}" + private # rubocop:disable Lint/UselessAccessModifier + + class HMACToken + include LfsTokenHelper + + def initialize(actor) + @actor = actor + end + + def token(expire_time) + hmac_token = JSONWebToken::HMACToken.new(secret) + hmac_token.expire_time = Time.now + expire_time + hmac_token[:data] = { actor: actor_name } + hmac_token.encoded + end + + def token_valid?(token_to_check) + decoded_token = JSONWebToken::HMACToken.decode(token_to_check, secret).first + decoded_token.dig('data', 'actor') == actor_name + rescue JWT::DecodeError + false + end + + private + + attr_reader :actor + + def secret + salt + key + end + + def salt + case actor + when DeployKey, Key + actor.fingerprint.delete(':').first(16) + when User + # Take the last 16 characters as they're more unique than the first 16 + actor.id.to_s + actor.encrypted_password.last(16) + end + end + + def key + # Take 16 characters of attr_encrypted_db_key_base, as that's what the + # cipher needs exactly + Settings.attr_encrypted_db_key_base.first(16) + end end - private + # TODO: LegacyRedisDeviseToken and references need to be removed after + # next released milestone + # + class LegacyRedisDeviseToken + TOKEN_LENGTH = 50 + DEFAULT_EXPIRY_TIME = 1800 * 1000 # 30 mins + + def initialize(actor) + @actor = actor + end + + def token_valid?(token_to_check) + Devise.secure_compare(stored_token, token_to_check) + end + + def stored_token + Gitlab::Redis::SharedState.with { |redis| redis.get(state_key) } + end + + # This method exists purely to facilitate legacy testing to ensure the + # same redis key is used. + # + def store_new_token(expiry_time_in_ms = DEFAULT_EXPIRY_TIME) + Gitlab::Redis::SharedState.with do |redis| + new_token = Devise.friendly_token(TOKEN_LENGTH) + redis.set(state_key, new_token, px: expiry_time_in_ms) + new_token + end + end + + private - def redis_shared_state_key - "gitlab:lfs_token:#{actor.class.name.underscore}_#{actor.id}" if actor + attr_reader :actor + + def state_key + "gitlab:lfs_token:#{actor.class.name.underscore}_#{actor.id}" + end end end end diff --git a/spec/controllers/profiles/keys_controller_spec.rb b/spec/controllers/profiles/keys_controller_spec.rb index 685db8488f0..d55d15d0db8 100644 --- a/spec/controllers/profiles/keys_controller_spec.rb +++ b/spec/controllers/profiles/keys_controller_spec.rb @@ -65,12 +65,6 @@ describe Profiles::KeysController do expect(response.content_type).to eq("text/plain") end - - it "responds with attachment content disposition" do - get :get_keys, username: user.username - - expect(response.headers['Content-Disposition']).to eq('attachment') - end end end end diff --git a/spec/controllers/projects/settings/repository_controller_spec.rb b/spec/controllers/projects/settings/repository_controller_spec.rb index 70f79a47e63..1c6ddfc1864 100644 --- a/spec/controllers/projects/settings/repository_controller_spec.rb +++ b/spec/controllers/projects/settings/repository_controller_spec.rb @@ -19,35 +19,15 @@ describe Projects::Settings::RepositoryController do end describe 'PUT cleanup' do - before do - allow(RepositoryCleanupWorker).to receive(:perform_async) - end + let(:object_map) { fixture_file_upload('spec/fixtures/bfg_object_map.txt') } - def do_put! - object_map = fixture_file_upload('spec/fixtures/bfg_object_map.txt') + it 'enqueues a RepositoryCleanupWorker' do + allow(RepositoryCleanupWorker).to receive(:perform_async) put :cleanup, namespace_id: project.namespace, project_id: project, project: { object_map: object_map } - end - - context 'feature enabled' do - it 'enqueues a RepositoryCleanupWorker' do - stub_feature_flags(project_cleanup: true) - - do_put! - - expect(response).to redirect_to project_settings_repository_path(project) - expect(RepositoryCleanupWorker).to have_received(:perform_async).once - end - end - - context 'feature disabled' do - it 'shows a 404 error' do - stub_feature_flags(project_cleanup: false) - - do_put! - expect(response).to have_gitlab_http_status(404) - end + expect(response).to redirect_to project_settings_repository_path(project) + expect(RepositoryCleanupWorker).to have_received(:perform_async).once end end end diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 418e22f8c35..1982136b89d 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -200,35 +200,21 @@ describe 'Projects > Settings > Repository settings' do context 'repository cleanup settings' do let(:object_map_file) { Rails.root.join('spec', 'fixtures', 'bfg_object_map.txt') } - context 'feature enabled' do - it 'uploads an object map file', :js do - stub_feature_flags(project_cleanup: true) - - visit project_settings_repository_path(project) + it 'uploads an object map file', :js do + visit project_settings_repository_path(project) - expect(page).to have_content('Repository cleanup') + expect(page).to have_content('Repository cleanup') - page.within('#cleanup') do - attach_file('project[bfg_object_map]', object_map_file, visible: false) + page.within('#cleanup') do + attach_file('project[bfg_object_map]', object_map_file, visible: false) - Sidekiq::Testing.fake! do - click_button 'Start cleanup' - end + Sidekiq::Testing.fake! do + click_button 'Start cleanup' end - - expect(page).to have_content('Repository cleanup has started') - expect(RepositoryCleanupWorker.jobs.count).to eq(1) end - end - context 'feature disabled' do - it 'does not show the settings' do - stub_feature_flags(project_cleanup: false) - - visit project_settings_repository_path(project) - - expect(page).not_to have_content('Repository cleanup') - end + expect(page).to have_content('Repository cleanup has started') + expect(RepositoryCleanupWorker.jobs.count).to eq(1) end end end diff --git a/spec/javascripts/diffs/store/mutations_spec.js b/spec/javascripts/diffs/store/mutations_spec.js index f3449bec6ec..d8733941181 100644 --- a/spec/javascripts/diffs/store/mutations_spec.js +++ b/spec/javascripts/diffs/store/mutations_spec.js @@ -358,6 +358,71 @@ describe('DiffsStoreMutations', () => { expect(state.diffFiles[0].highlighted_diff_lines[0].discussions[0].resolved).toBe(true); }); + it('should not duplicate inline diff discussions', () => { + const diffPosition = { + base_sha: 'ed13df29948c41ba367caa757ab3ec4892509910', + head_sha: 'b921914f9a834ac47e6fd9420f78db0f83559130', + new_line: null, + new_path: '500-lines-4.txt', + old_line: 5, + old_path: '500-lines-4.txt', + start_sha: 'ed13df29948c41ba367caa757ab3ec4892509910', + }; + + const state = { + latestDiff: true, + diffFiles: [ + { + file_hash: 'ABC', + highlighted_diff_lines: [ + { + line_code: 'ABC_1', + discussions: [ + { + id: 1, + line_code: 'ABC_1', + diff_discussion: true, + resolvable: true, + original_position: diffPosition, + position: diffPosition, + diff_file: { + file_hash: 'ABC', + }, + }, + ], + }, + { + line_code: 'ABC_2', + discussions: [], + }, + ], + }, + ], + }; + const discussion = { + id: 2, + line_code: 'ABC_2', + diff_discussion: true, + resolvable: true, + original_position: diffPosition, + position: diffPosition, + diff_file: { + file_hash: state.diffFiles[0].file_hash, + }, + }; + + const diffPositionByLineCode = { + ABC_2: diffPosition, + }; + + mutations[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, { + discussion, + diffPositionByLineCode, + }); + + expect(state.diffFiles[0].highlighted_diff_lines[0].discussions.length).toBe(1); + }); + it('should add legacy discussions to the given line', () => { const diffPosition = { base_sha: 'ed13df29948c41ba367caa757ab3ec4892509910', diff --git a/spec/javascripts/vue_shared/components/user_popover/user_popover_spec.js b/spec/javascripts/vue_shared/components/user_popover/user_popover_spec.js index 1578b0f81f9..e16ab156679 100644 --- a/spec/javascripts/vue_shared/components/user_popover/user_popover_spec.js +++ b/spec/javascripts/vue_shared/components/user_popover/user_popover_spec.js @@ -101,6 +101,19 @@ describe('User Popover Component', () => { expect(vm.$el.textContent).toContain('Engineer at GitLab'); }); + + it('should not encode special characters when we have bio and organization', () => { + const testProps = Object.assign({}, DEFAULT_PROPS); + testProps.user.bio = 'Manager & Team Lead'; + testProps.user.organization = 'GitLab'; + + vm = mountComponent(UserPopover, { + ...DEFAULT_PROPS, + target: document.querySelector('.js-user-link'), + }); + + expect(vm.$el.textContent).toContain('Manager & Team Lead at GitLab'); + }); }); describe('status data', () => { diff --git a/spec/lib/constraints/feature_constrainer_spec.rb b/spec/lib/constraints/feature_constrainer_spec.rb new file mode 100644 index 00000000000..42efc164f81 --- /dev/null +++ b/spec/lib/constraints/feature_constrainer_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe Constraints::FeatureConstrainer do + describe '#matches' do + it 'calls Feature.enabled? with the correct arguments' do + expect(Feature).to receive(:enabled?).with(:feature_name, "an object", default_enabled: true) + + described_class.new(:feature_name, "an object", default_enabled: true).matches?(double('request')) + end + end +end diff --git a/spec/lib/gitlab/git/repository_cleaner_spec.rb b/spec/lib/gitlab/git/repository_cleaner_spec.rb index a9d9e67ef94..7f9cc2bc9ec 100644 --- a/spec/lib/gitlab/git/repository_cleaner_spec.rb +++ b/spec/lib/gitlab/git/repository_cleaner_spec.rb @@ -1,31 +1,61 @@ require 'spec_helper' describe Gitlab::Git::RepositoryCleaner do + include HttpIOHelpers + let(:project) { create(:project, :repository) } let(:repository) { project.repository } let(:head_sha) { repository.head_commit.id } - - let(:object_map) { StringIO.new("#{head_sha} #{'0' * 40}") } + let(:object_map_data) { "#{head_sha} #{'0' * 40}" } subject(:cleaner) { described_class.new(repository.raw) } describe '#apply_bfg_object_map' do - it 'removes internal references pointing at SHAs in the object map' do - # Create some refs we expect to be removed - repository.keep_around(head_sha) - repository.create_ref(head_sha, 'refs/environments/1') - repository.create_ref(head_sha, 'refs/merge-requests/1') - repository.create_ref(head_sha, 'refs/heads/_keep') - repository.create_ref(head_sha, 'refs/tags/_keep') - - cleaner.apply_bfg_object_map(object_map) - - aggregate_failures do - expect(repository.kept_around?(head_sha)).to be_falsy - expect(repository.ref_exists?('refs/environments/1')).to be_falsy - expect(repository.ref_exists?('refs/merge-requests/1')).to be_falsy - expect(repository.ref_exists?('refs/heads/_keep')).to be_truthy - expect(repository.ref_exists?('refs/tags/_keep')).to be_truthy + let(:clean_refs) { %W[refs/environments/1 refs/merge-requests/1 refs/keep-around/#{head_sha}] } + let(:keep_refs) { %w[refs/heads/_keep refs/tags/_keep] } + + before do + (clean_refs + keep_refs).each { |ref| repository.create_ref(head_sha, ref) } + end + + context 'from StringIO' do + let(:object_map) { StringIO.new(object_map_data) } + + it 'removes internal references' do + cleaner.apply_bfg_object_map(object_map) + + aggregate_failures do + clean_refs.each { |ref| expect(repository.ref_exists?(ref)).to be_falsy } + keep_refs.each { |ref| expect(repository.ref_exists?(ref)).to be_truthy } + end + end + end + + context 'from Gitlab::HttpIO' do + let(:url) { 'http://example.com/bfg_object_map.txt' } + let(:tempfile) { Tempfile.new } + let(:object_map) { Gitlab::HttpIO.new(url, object_map_data.size) } + + around do |example| + begin + tempfile.write(object_map_data) + tempfile.close + + example.run + ensure + tempfile.unlink + end + end + + it 'removes internal references' do + stub_remote_url_200(url, tempfile.path) + + cleaner.apply_bfg_object_map(object_map) + + aggregate_failures do + clean_refs.each { |ref| expect(repository.ref_exists?(ref)).to be_falsy } + keep_refs.each { |ref| expect(repository.ref_exists?(ref)).to be_truthy } + end end end end diff --git a/spec/lib/gitlab/lfs_token_spec.rb b/spec/lib/gitlab/lfs_token_spec.rb index 77ee30264bf..1ec1ba19e39 100644 --- a/spec/lib/gitlab/lfs_token_spec.rb +++ b/spec/lib/gitlab/lfs_token_spec.rb @@ -1,50 +1,187 @@ +# frozen_string_literal: true + require 'spec_helper' -describe Gitlab::LfsToken do +describe Gitlab::LfsToken, :clean_gitlab_redis_shared_state do describe '#token' do shared_examples 'an LFS token generator' do - it 'returns a randomly generated token' do - token = handler.token + it 'returns a computed token' do + expect(Settings).to receive(:attr_encrypted_db_key_base).and_return('fbnbv6hdjweo53qka7kza8v8swxc413c05pb51qgtfte0bygh1p2e508468hfsn5ntmjcyiz7h1d92ashpet5pkdyejg7g8or3yryhuso4h8o5c73h429d9c3r6bjnet').twice + + token = lfs_token.token expect(token).not_to be_nil expect(token).to be_a String - expect(token.length).to eq 50 + expect(described_class.new(actor).token_valid?(token)).to be_truthy + end + end + + context 'when the actor is a user' do + let(:actor) { create(:user, username: 'test_user_lfs_1') } + let(:lfs_token) { described_class.new(actor) } + + before do + allow(actor).to receive(:encrypted_password).and_return('$2a$04$ETfzVS5spE9Hexn9wh6NUenCHG1LyZ2YdciOYxieV1WLSa8DHqOFO') end - it 'returns the correct token based on the key' do - token = handler.token + it_behaves_like 'an LFS token generator' + + it 'returns the correct username' do + expect(lfs_token.actor_name).to eq(actor.username) + end - expect(handler.token).to eq(token) + it 'returns the correct token type' do + expect(lfs_token.type).to eq(:lfs_token) end end - context 'when the actor is a user' do - let(:actor) { create(:user) } - let(:handler) { described_class.new(actor) } + context 'when the actor is a key' do + let(:user) { create(:user, username: 'test_user_lfs_2') } + let(:actor) { create(:key, user: user) } + let(:lfs_token) { described_class.new(actor) } + + before do + allow(user).to receive(:encrypted_password).and_return('$2a$04$C1GAMKsOKouEbhKy2JQoe./3LwOfQAZc.hC8zW2u/wt8xgukvnlV.') + end it_behaves_like 'an LFS token generator' it 'returns the correct username' do - expect(handler.actor_name).to eq(actor.username) + expect(lfs_token.actor_name).to eq(user.username) end it 'returns the correct token type' do - expect(handler.type).to eq(:lfs_token) + expect(lfs_token.type).to eq(:lfs_token) end end context 'when the actor is a deploy key' do + let(:actor_id) { 1 } let(:actor) { create(:deploy_key) } - let(:handler) { described_class.new(actor) } + let(:project) { create(:project) } + let(:lfs_token) { described_class.new(actor) } + + before do + allow(actor).to receive(:id).and_return(actor_id) + end it_behaves_like 'an LFS token generator' it 'returns the correct username' do - expect(handler.actor_name).to eq("lfs+deploy-key-#{actor.id}") + expect(lfs_token.actor_name).to eq("lfs+deploy-key-#{actor_id}") end it 'returns the correct token type' do - expect(handler.type).to eq(:lfs_deploy_token) + expect(lfs_token.type).to eq(:lfs_deploy_token) + end + end + + context 'when the actor is invalid' do + it 'raises an exception' do + expect { described_class.new('invalid') }.to raise_error('Bad Actor') + end + end + end + + describe '#token_valid?' do + let(:actor) { create(:user, username: 'test_user_lfs_1') } + let(:lfs_token) { described_class.new(actor) } + + before do + allow(actor).to receive(:encrypted_password).and_return('$2a$04$ETfzVS5spE9Hexn9wh6NUenCHG1LyZ2YdciOYxieV1WLSa8DHqOFO') + end + + context 'for an HMAC token' do + before do + # We're not interested in testing LegacyRedisDeviseToken here + allow(Gitlab::LfsToken::LegacyRedisDeviseToken).to receive_message_chain(:new, :token_valid?).and_return(false) + end + + context 'where the token is invalid' do + context "because it's junk" do + it 'returns false' do + expect(lfs_token.token_valid?('junk')).to be_falsey + end + end + + context "because it's been fiddled with" do + it 'returns false' do + fiddled_token = lfs_token.token.tap { |token| token[0] = 'E' } + expect(lfs_token.token_valid?(fiddled_token)).to be_falsey + end + end + + context "because it was generated with a different secret" do + it 'returns false' do + different_actor = create(:user, username: 'test_user_lfs_2') + different_secret_token = described_class.new(different_actor).token + expect(lfs_token.token_valid?(different_secret_token)).to be_falsey + end + end + + context "because it's expired" do + it 'returns false' do + expired_token = lfs_token.token + # Needs to be at least 1860 seconds, because the default expiry is + # 1800 seconds with an additional 60 second leeway. + Timecop.freeze(Time.now + 1865) do + expect(lfs_token.token_valid?(expired_token)).to be_falsey + end + end + end + end + + context 'where the token is valid' do + it 'returns true' do + expect(lfs_token.token_valid?(lfs_token.token)).to be_truthy + end + end + end + + context 'for a LegacyRedisDevise token' do + before do + # We're not interested in testing HMACToken here + allow_any_instance_of(Gitlab::LfsToken::HMACToken).to receive(:token_valid?).and_return(false) + end + + context 'where the token is invalid' do + context "because it's junk" do + it 'returns false' do + expect(lfs_token.token_valid?('junk')).to be_falsey + end + end + + context "because it's been fiddled with" do + it 'returns false' do + generated_token = Gitlab::LfsToken::LegacyRedisDeviseToken.new(actor).store_new_token + fiddled_token = generated_token.tap { |token| token[0] = 'E' } + expect(lfs_token.token_valid?(fiddled_token)).to be_falsey + end + end + + context "because it was generated with a different secret" do + it 'returns false' do + different_actor = create(:user, username: 'test_user_lfs_2') + different_secret_token = described_class.new(different_actor).token + expect(lfs_token.token_valid?(different_secret_token)).to be_falsey + end + end + + context "because it's expired" do + it 'returns false' do + generated_token = Gitlab::LfsToken::LegacyRedisDeviseToken.new(actor).store_new_token(1) + # We need a real sleep here because we need to wait for redis to expire the key. + sleep(0.01) + expect(lfs_token.token_valid?(generated_token)).to be_falsey + end + end + end + + context 'where the token is valid' do + it 'returns true' do + generated_token = Gitlab::LfsToken::LegacyRedisDeviseToken.new(actor).store_new_token + expect(lfs_token.token_valid?(generated_token)).to be_truthy + end end end end diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb index 2ebcb787d06..1575de78bb4 100644 --- a/spec/requests/api/internal_spec.rb +++ b/spec/requests/api/internal_spec.rb @@ -156,9 +156,8 @@ describe API::Internal do expect(response).to have_gitlab_http_status(200) expect(json_response['username']).to eq(user.username) - expect(json_response['lfs_token']).to eq(Gitlab::LfsToken.new(key).token) - expect(json_response['repository_http_path']).to eq(project.http_url_to_repo) + expect(Gitlab::LfsToken.new(key).token_valid?(json_response['lfs_token'])).to be_truthy end it 'returns the correct information about the user' do @@ -166,9 +165,8 @@ describe API::Internal do expect(response).to have_gitlab_http_status(200) expect(json_response['username']).to eq(user.username) - expect(json_response['lfs_token']).to eq(Gitlab::LfsToken.new(user).token) - expect(json_response['repository_http_path']).to eq(project.http_url_to_repo) + expect(Gitlab::LfsToken.new(user).token_valid?(json_response['lfs_token'])).to be_truthy end it 'returns a 404 when no key or user is provided' do @@ -198,8 +196,8 @@ describe API::Internal do expect(response).to have_gitlab_http_status(200) expect(json_response['username']).to eq("lfs+deploy-key-#{key.id}") - expect(json_response['lfs_token']).to eq(Gitlab::LfsToken.new(key).token) expect(json_response['repository_http_path']).to eq(project.http_url_to_repo) + expect(Gitlab::LfsToken.new(key).token_valid?(json_response['lfs_token'])).to be_truthy end end end diff --git a/spec/workers/mail_scheduler/notification_service_worker_spec.rb b/spec/workers/mail_scheduler/notification_service_worker_spec.rb index f725c8763a0..e726f469816 100644 --- a/spec/workers/mail_scheduler/notification_service_worker_spec.rb +++ b/spec/workers/mail_scheduler/notification_service_worker_spec.rb @@ -16,7 +16,14 @@ describe MailScheduler::NotificationServiceWorker do worker.perform(method, *serialize(key)) end - context 'when the arguments cannot be deserialized' do + # actionmailer wasn't actually upgraded from 4.2.10 to 4.2.11 in + # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23520. + # + # Attempting to run this spec in Rails 4 will fail until + # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23396 + # is merged. Let's disable it since we are only using Rails 5 on + # this branch. + context 'when the arguments cannot be deserialized', :rails5 do it 'does nothing' do expect(worker.notification_service).not_to receive(method) |