diff options
341 files changed, 7526 insertions, 1385 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a54b38d284d..1a65e0473c4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -160,6 +160,9 @@ build-package: when: manual script: - scripts/trigger-build + only: + - //@gitlab-org/gitlab-ce + - //@gitlab-org/gitlab-ee # Prepare and merge knapsack tests knapsack: @@ -180,6 +183,7 @@ update-knapsack: <<: *only-canonical-masters stage: post-test script: + - retry gem install fog-aws mime-types - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec-pg_node_*.json - scripts/merge-reports ${KNAPSACK_SPINACH_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/spinach-pg_node_*.json - '[[ -z ${KNAPSACK_S3_BUCKET} ]] || scripts/sync-reports put $KNAPSACK_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH $KNAPSACK_SPINACH_SUITE_REPORT_PATH' diff --git a/CHANGELOG.md b/CHANGELOG.md index c181aba0205..de3b4b0d3e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ documentation](doc/development/changelog.md) for instructions on adding your own entry. +## 9.3.8 (2017-07-19) + +- Improve support for external issue references. !12485 +- Renders 404 if given project is not readable by the user on Todos dashboard. +- Use uploads/system directory for personal snippets. +- Remove uploads/appearance symlink. A leftover from a previous migration. + +## 9.3.7 (2017-07-18) + +- Prevent bad data being added to application settings when Redis is unavailable. !12750 +- Return `is_admin` attribute in the GET /user endpoint for admins. !12811 + ## 9.3.6 (2017-07-12) - Fix API Scoping. !12300 @@ -258,6 +270,13 @@ entry. - Remove foreigh key on ci_trigger_schedules only if it exists. - Allow translation of Pipeline Schedules. +## 9.2.8 (2017-07-19) + +- Improve support for external issue references. !12485 +- Renders 404 if given project is not readable by the user on Todos dashboard. +- Fix incorrect project authorizations. +- Remove uploads/appearance symlink. A leftover from a previous migration. + ## 9.2.7 (2017-06-21) - Reinstate is_admin flag in users api when authenticated user is an admin. !12211 (rickettm) @@ -502,6 +521,13 @@ entry. - Fix preemptive scroll bar on user activity calendar. - Pipeline chat notifications convert seconds to minutes and hours. +## 9.1.8 (2017-07-19) + +- Improve support for external issue references. !12485 +- Renders 404 if given project is not readable by the user on Todos dashboard. +- Fix incorrect project authorizations. +- Remove uploads/appearance symlink. A leftover from a previous migration. + ## 9.1.7 (2017-06-07) - No changes. @@ -814,6 +840,12 @@ entry. - Only send chat notifications for the default branch. - Don't fill in the default kubernetes namespace. +## 9.0.11 (2017-07-19) + +- Renders 404 if given project is not readable by the user on Todos dashboard. +- Fix incorrect project authorizations. +- Remove uploads/appearance symlink. A leftover from a previous migration. + ## 9.0.10 (2017-06-07) - No changes. @@ -1184,6 +1216,11 @@ entry. - Change development tanuki favicon colors to match logo color order. - API issues - support filtering by iids. +## 8.17.7 (2017-07-19) + +- Renders 404 if given project is not readable by the user on Todos dashboard. +- Fix incorrect project authorizations. + ## 8.17.6 (2017-05-05) - Enforce project features when searching blobs and wikis. diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index c5523bd09b1..59dad104b0b 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -0.17.0 +0.21.2 @@ -37,7 +37,7 @@ gem 'omniauth-saml', '~> 1.7.0' gem 'omniauth-shibboleth', '~> 1.2.0' gem 'omniauth-twitter', '~> 1.2.0' gem 'omniauth_crowd', '~> 2.2.0' -gem 'omniauth-authentiq', '~> 0.3.0' +gem 'omniauth-authentiq', '~> 0.3.1' gem 'rack-oauth2', '~> 1.2.1' gem 'jwt', '~> 1.5.6' @@ -91,7 +91,7 @@ gem 'carrierwave', '~> 1.1' gem 'dropzonejs-rails', '~> 0.7.1' # for backups -gem 'fog-aws', '~> 0.9' +gem 'fog-aws', '~> 1.4' gem 'fog-core', '~> 1.44' gem 'fog-google', '~> 0.5' gem 'fog-local', '~> 0.3' @@ -163,6 +163,9 @@ gem 'rainbow', '~> 2.2' # GitLab settings gem 'settingslogic', '~> 2.0.9' +# Linear-time regex library for untrusted regular expressions +gem 're2', '~> 1.0.0' + # Misc gem 'version_sorter', '~> 2.1.0' @@ -237,7 +240,6 @@ gem 'webpack-rails', '~> 0.9.10' gem 'rack-proxy', '~> 0.6.0' gem 'sass-rails', '~> 5.0.6' -gem 'coffee-rails', '~> 4.1.0' gem 'uglifier', '~> 2.7.2' gem 'addressable', '~> 2.3.8' @@ -269,7 +271,7 @@ gem 'peek', '~> 1.0.1' gem 'peek-gc', '~> 0.0.2' gem 'peek-host', '~> 1.0.0' gem 'peek-mysql2', '~> 1.1.0', group: :mysql -gem 'peek-performance_bar', '~> 1.2.1' +gem 'peek-performance_bar', '~> 1.3.0' gem 'peek-pg', '~> 1.3.0', group: :postgres gem 'peek-rblineprof', '~> 0.2.0' gem 'peek-redis', '~> 1.2.0' @@ -282,7 +284,7 @@ group :metrics do gem 'influxdb', '~> 0.2', require: false # Prometheus - gem 'prometheus-client-mmap', '~>0.7.0.beta5' + gem 'prometheus-client-mmap', '~>0.7.0.beta9' gem 'raindrops', '~> 0.18' end @@ -391,3 +393,6 @@ gem 'toml-rb', '~> 0.3.15', require: false # Feature toggles gem 'flipper', '~> 0.10.2' gem 'flipper-active_record', '~> 0.10.2' + +# Structured logging +gem 'lograge', '~> 0.5' diff --git a/Gemfile.lock b/Gemfile.lock index 41ef1e9d456..dfa7acc8917 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -122,13 +122,6 @@ GEM coderay (1.1.1) coercible (1.0.0) descendants_tracker (~> 0.0.1) - coffee-rails (4.1.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.10.0) colorize (0.7.7) concurrent-ruby (1.0.5) concurrent-ruby-ext (1.0.5) @@ -186,7 +179,7 @@ GEM et-orbi (1.0.3) tzinfo eventmachine (1.0.8) - excon (0.55.0) + excon (0.57.1) execjs (2.6.0) expression_parser (0.9.0) extlib (0.9.16) @@ -222,26 +215,26 @@ GEM fog-json (~> 1.0) ipaddress (~> 0.8) xml-simple (~> 1.1) - fog-aws (0.13.0) + fog-aws (1.4.0) fog-core (~> 1.38) fog-json (~> 1.0) fog-xml (~> 0.1) ipaddress (~> 0.8) - fog-core (1.44.1) + fog-core (1.44.3) builder excon (~> 0.49) formatador (~> 0.2) - fog-google (0.5.0) + fog-google (0.5.3) fog-core fog-json fog-xml fog-json (1.0.2) fog-core (~> 1.0) multi_json (~> 1.10) - fog-local (0.3.0) + fog-local (0.3.1) fog-core (~> 1.27) - fog-openstack (0.1.6) - fog-core (>= 1.39) + fog-openstack (0.1.21) + fog-core (>= 1.40) fog-json (>= 1.0) ipaddress (>= 0.8) fog-rackspace (0.1.1) @@ -450,6 +443,10 @@ GEM logging (2.2.2) little-plugger (~> 1.1) multi_json (~> 1.10) + lograge (0.5.1) + actionpack (>= 4, < 5.2) + activesupport (>= 4, < 5.2) + railties (>= 4, < 5.2) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.5) @@ -491,7 +488,7 @@ GEM rack (>= 1.0, < 3) omniauth-auth0 (1.4.1) omniauth-oauth2 (~> 1.1) - omniauth-authentiq (0.3.0) + omniauth-authentiq (0.3.1) omniauth-oauth2 (~> 1.3, >= 1.3.1) omniauth-azure-oauth2 (0.0.6) jwt (~> 1.0) @@ -560,7 +557,7 @@ GEM atomic (>= 1.0.0) mysql2 peek - peek-performance_bar (1.2.1) + peek-performance_bar (1.3.0) peek (>= 0.1.0) peek-pg (1.3.0) concurrent-ruby @@ -595,7 +592,7 @@ GEM premailer-rails (1.9.7) actionmailer (>= 3, < 6) premailer (~> 1.7, >= 1.7.9) - prometheus-client-mmap (0.7.0.beta8) + prometheus-client-mmap (0.7.0.beta9) mmap2 (~> 2.2, >= 2.2.7) pry (0.10.4) coderay (~> 1.1.0) @@ -660,6 +657,7 @@ GEM debugger-ruby_core_source (~> 1.3) rdoc (4.2.2) json (~> 1.4) + re2 (1.0.0) recaptcha (3.0.0) json recursive-open-struct (1.0.0) @@ -938,7 +936,6 @@ DEPENDENCIES charlock_holmes (~> 0.7.3) chronic (~> 0.10.2) chronic_duration (~> 0.10.6) - coffee-rails (~> 4.1.0) concurrent-ruby (~> 1.0.5) connection_pool (~> 2.0) creole (~> 0.5.0) @@ -961,7 +958,7 @@ DEPENDENCIES flipper (~> 0.10.2) flipper-active_record (~> 0.10.2) fog-aliyun (~> 0.1.0) - fog-aws (~> 0.9) + fog-aws (~> 1.4) fog-core (~> 1.44) fog-google (~> 0.5) fog-local (~> 0.3) @@ -1006,6 +1003,7 @@ DEPENDENCIES letter_opener_web (~> 1.3.0) license_finder (~> 2.1.0) licensee (~> 8.7.0) + lograge (~> 0.5) loofah (~> 2.0.3) mail_room (~> 0.9.1) method_source (~> 0.8) @@ -1018,7 +1016,7 @@ DEPENDENCIES oj (~> 2.17.4) omniauth (~> 1.4.2) omniauth-auth0 (~> 1.4.1) - omniauth-authentiq (~> 0.3.0) + omniauth-authentiq (~> 0.3.1) omniauth-azure-oauth2 (~> 0.0.6) omniauth-cas3 (~> 1.1.2) omniauth-facebook (~> 4.0.0) @@ -1037,7 +1035,7 @@ DEPENDENCIES peek-gc (~> 0.0.2) peek-host (~> 1.0.0) peek-mysql2 (~> 1.1.0) - peek-performance_bar (~> 1.2.1) + peek-performance_bar (~> 1.3.0) peek-pg (~> 1.3.0) peek-rblineprof (~> 0.2.0) peek-redis (~> 1.2.0) @@ -1045,7 +1043,7 @@ DEPENDENCIES pg (~> 0.18.2) poltergeist (~> 1.9.0) premailer-rails (~> 1.9.7) - prometheus-client-mmap (~> 0.7.0.beta5) + prometheus-client-mmap (~> 0.7.0.beta9) pry-byebug (~> 3.4.1) pry-rails (~> 0.3.4) rack-attack (~> 4.4.1) @@ -1059,6 +1057,7 @@ DEPENDENCIES raindrops (~> 0.18) rblineprof (~> 0.3.6) rdoc (~> 4.2) + re2 (~> 1.0.0) recaptcha (~> 3.0) redcarpet (~> 3.4) redis (~> 3.2) diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index ae19592ecbe..9e90a36a364 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -1,4 +1,5 @@ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */ +/* global ProjectSelect */ /* global ShortcutsNavigation */ /* global IssuableIndex */ /* global ShortcutsIssuable */ @@ -157,6 +158,9 @@ import PerformanceBar from './performance_bar'; shortcut_handler = new ShortcutsIssuable(); new ZenMode(); break; + case 'dashboard:milestones:index': + new ProjectSelect(); + break; case 'projects:milestones:show': case 'groups:milestones:show': case 'dashboard:milestones:show': @@ -166,6 +170,7 @@ import PerformanceBar from './performance_bar'; case 'groups:issues': case 'groups:merge_requests': new UsersSelect(); + new ProjectSelect(); break; case 'dashboard:todos:index': new Todos(); @@ -259,6 +264,7 @@ import PerformanceBar from './performance_bar'; break; case 'dashboard:issues': case 'dashboard:merge_requests': + new ProjectSelect(); new UsersSelect(); break; case 'projects:commit:show': diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index 73675d300be..9ebbb22e807 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -5,21 +5,28 @@ import './preview_markdown'; window.DropzoneInput = (function() { function DropzoneInput(form) { - var updateAttachingMessage, $attachingFileMessage, $mdArea, $attachButton, $cancelButton, $retryLink, $uploadingErrorContainer, $uploadingErrorMessage, $uploadProgress, $uploadingProgressContainer, appendToTextArea, btnAlert, child, closeAlertMessage, closeSpinner, divHover, divSpinner, dropzone, $formDropzone, formTextarea, getFilename, handlePaste, iconPaperclip, iconSpinner, insertToTextArea, isImage, maxFileSize, pasteText, uploadsPath, showError, showSpinner, uploadFile, addFileToForm; Dropzone.autoDiscover = false; - divHover = '<div class="div-dropzone-hover"></div>'; - iconPaperclip = '<i class="fa fa-paperclip div-dropzone-icon"></i>'; - $attachButton = form.find('.button-attach-file'); - $attachingFileMessage = form.find('.attaching-file-message'); - $cancelButton = form.find('.button-cancel-uploading-files'); - $retryLink = form.find('.retry-uploading-link'); - $uploadProgress = form.find('.uploading-progress'); - $uploadingErrorContainer = form.find('.uploading-error-container'); - $uploadingErrorMessage = form.find('.uploading-error-message'); - $uploadingProgressContainer = form.find('.uploading-progress-container'); - uploadsPath = window.uploads_path || null; - maxFileSize = gon.max_file_size || 10; - formTextarea = form.find('.js-gfm-input'); + const divHover = '<div class="div-dropzone-hover"></div>'; + const iconPaperclip = '<i class="fa fa-paperclip div-dropzone-icon"></i>'; + const $attachButton = form.find('.button-attach-file'); + const $attachingFileMessage = form.find('.attaching-file-message'); + const $cancelButton = form.find('.button-cancel-uploading-files'); + const $retryLink = form.find('.retry-uploading-link'); + const $uploadProgress = form.find('.uploading-progress'); + const $uploadingErrorContainer = form.find('.uploading-error-container'); + const $uploadingErrorMessage = form.find('.uploading-error-message'); + const $uploadingProgressContainer = form.find('.uploading-progress-container'); + const uploadsPath = window.uploads_path || null; + const maxFileSize = gon.max_file_size || 10; + const formTextarea = form.find('.js-gfm-input'); + let handlePaste; + let pasteText; + let addFileToForm; + let updateAttachingMessage; + let isImage; + let getFilename; + let uploadFile; + formTextarea.wrap('<div class="div-dropzone"></div>'); formTextarea.on('paste', (function(_this) { return function(event) { @@ -28,16 +35,16 @@ window.DropzoneInput = (function() { })(this)); // Add dropzone area to the form. - $mdArea = formTextarea.closest('.md-area'); + const $mdArea = formTextarea.closest('.md-area'); form.setupMarkdownPreview(); - $formDropzone = form.find('.div-dropzone'); + const $formDropzone = form.find('.div-dropzone'); $formDropzone.parent().addClass('div-dropzone-wrapper'); $formDropzone.append(divHover); $formDropzone.find('.div-dropzone-hover').append(iconPaperclip); if (!uploadsPath) return; - dropzone = $formDropzone.dropzone({ + const dropzone = $formDropzone.dropzone({ url: uploadsPath, dictDefaultMessage: '', clickable: true, @@ -117,7 +124,7 @@ window.DropzoneInput = (function() { } }); - child = $(dropzone[0]).children('textarea'); + const child = $(dropzone[0]).children('textarea'); // removeAllFiles(true) stops uploading files (if any) // and remove them from dropzone files queue. @@ -214,6 +221,35 @@ window.DropzoneInput = (function() { return value.first(); }; + const showSpinner = function(e) { + return $uploadingProgressContainer.removeClass('hide'); + }; + + const closeSpinner = function() { + return $uploadingProgressContainer.addClass('hide'); + }; + + const showError = function(message) { + $uploadingErrorContainer.removeClass('hide'); + $uploadingErrorMessage.html(message); + }; + + const closeAlertMessage = function() { + return form.find('.div-dropzone-alert').alert('close'); + }; + + const insertToTextArea = function(filename, url) { + return $(child).val(function(index, val) { + return val.replace(`{{${filename}}}`, url); + }); + }; + + const appendToTextArea = function(url) { + return $(child).val(function(index, val) { + return val + url + "\n"; + }); + }; + uploadFile = function(item, filename) { var formData; formData = new FormData(); @@ -262,35 +298,6 @@ window.DropzoneInput = (function() { messageContainer.text(attachingMessage); }; - insertToTextArea = function(filename, url) { - return $(child).val(function(index, val) { - return val.replace(`{{${filename}}}`, url); - }); - }; - - appendToTextArea = function(url) { - return $(child).val(function(index, val) { - return val + url + "\n"; - }); - }; - - showSpinner = function(e) { - return $uploadingProgressContainer.removeClass('hide'); - }; - - closeSpinner = function() { - return $uploadingProgressContainer.addClass('hide'); - }; - - showError = function(message) { - $uploadingErrorContainer.removeClass('hide'); - $uploadingErrorMessage.html(message); - }; - - closeAlertMessage = function() { - return form.find('.div-dropzone-alert').alert('close'); - }; - form.find('.markdown-selector').click(function(e) { e.preventDefault(); $(this).closest('.gfm-form').find('.div-dropzone').click(); diff --git a/app/assets/javascripts/due_date_select.js b/app/assets/javascripts/due_date_select.js index a8fc5b41fb4..2856c8e2862 100644 --- a/app/assets/javascripts/due_date_select.js +++ b/app/assets/javascripts/due_date_select.js @@ -2,6 +2,8 @@ /* global dateFormat */ /* global Pikaday */ +import DateFix from './lib/utils/datefix'; + class DueDateSelect { constructor({ $dropdown, $loading } = {}) { const $dropdownParent = $dropdown.closest('.dropdown'); @@ -43,14 +45,13 @@ class DueDateSelect { initDatePicker() { const $dueDateInput = $(`input[name='${this.fieldName}']`); - + const dateFix = DateFix.dashedFix($dueDateInput.val()); const calendar = new Pikaday({ field: $dueDateInput.get(0), theme: 'gitlab-theme', format: 'yyyy-mm-dd', onSelect: (dateText) => { const formattedDate = dateFormat(new Date(dateText), 'yyyy-mm-dd'); - $dueDateInput.val(formattedDate); if (this.$dropdown.hasClass('js-issue-boards-due-date')) { @@ -62,7 +63,7 @@ class DueDateSelect { } }); - calendar.setDate(new Date($dueDateInput.val())); + calendar.setDate(dateFix); this.$datePicker.append(calendar.el); this.$datePicker.data('pikaday', calendar); } @@ -168,6 +169,7 @@ class DueDateSelectors { initMilestoneDatePicker() { $('.datepicker').each(function() { const $datePicker = $(this); + const dateFix = DateFix.dashedFix($datePicker.val()); const calendar = new Pikaday({ field: $datePicker.get(0), theme: 'gitlab-theme animate-picker', @@ -177,7 +179,8 @@ class DueDateSelectors { $datePicker.val(dateFormat(new Date(dateText), 'yyyy-mm-dd')); } }); - calendar.setDate(new Date($datePicker.val())); + + calendar.setDate(dateFix); $datePicker.data('pikaday', calendar); }); diff --git a/app/assets/javascripts/group_name.js b/app/assets/javascripts/group_name.js index 37c6765d942..3e483b69fd2 100644 --- a/app/assets/javascripts/group_name.js +++ b/app/assets/javascripts/group_name.js @@ -5,12 +5,15 @@ export default class GroupName { constructor() { this.titleContainer = document.querySelector('.js-title-container'); this.title = this.titleContainer.querySelector('.title'); - this.titleWidth = this.title.offsetWidth; - this.groupTitle = this.titleContainer.querySelector('.group-title'); - this.groups = this.titleContainer.querySelectorAll('.group-path'); - this.toggle = null; - this.isHidden = false; - this.init(); + + if (this.title) { + this.titleWidth = this.title.offsetWidth; + this.groupTitle = this.titleContainer.querySelector('.group-title'); + this.groups = this.titleContainer.querySelectorAll('.group-path'); + this.toggle = null; + this.isHidden = false; + this.init(); + } } init() { diff --git a/app/assets/javascripts/layout_nav.js b/app/assets/javascripts/layout_nav.js index 71064ccc539..6186ffe20b3 100644 --- a/app/assets/javascripts/layout_nav.js +++ b/app/assets/javascripts/layout_nav.js @@ -1,5 +1,7 @@ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, no-unused-vars, one-var, one-var-declaration-per-line, vars-on-top, max-len */ import _ from 'underscore'; +import Cookies from 'js-cookie'; +import NewNavSidebar from './new_sidebar'; (function() { var hideEndFade; @@ -53,6 +55,11 @@ import _ from 'underscore'; } $(() => { + if (Cookies.get('new_nav') === 'true') { + const newNavSidebar = new NewNavSidebar(); + newNavSidebar.bindEvents(); + } + $(window).on('scroll', _.throttle(applyScrollNavClass, 100)); }); }).call(window); diff --git a/app/assets/javascripts/lib/utils/datefix.js b/app/assets/javascripts/lib/utils/datefix.js new file mode 100644 index 00000000000..990dc3f6d1a --- /dev/null +++ b/app/assets/javascripts/lib/utils/datefix.js @@ -0,0 +1,8 @@ +const DateFix = { + dashedFix(val) { + const [y, m, d] = val.split('-'); + return new Date(y, m - 1, d); + }, +}; + +export default DateFix; diff --git a/app/assets/javascripts/lib/utils/http_status.js b/app/assets/javascripts/lib/utils/http_status.js index 415e50f32ae..625e53ee9de 100644 --- a/app/assets/javascripts/lib/utils/http_status.js +++ b/app/assets/javascripts/lib/utils/http_status.js @@ -3,6 +3,7 @@ */ export default { + ABORTED: 0, NO_CONTENT: 204, OK: 200, }; diff --git a/app/assets/javascripts/lib/utils/poll.js b/app/assets/javascripts/lib/utils/poll.js index e31cc5fbabe..97666e13ebe 100644 --- a/app/assets/javascripts/lib/utils/poll.js +++ b/app/assets/javascripts/lib/utils/poll.js @@ -81,6 +81,9 @@ export default class Poll { }) .catch((error) => { notificationCallback(false); + if (error.status === httpStatusCodes.ABORTED) { + return; + } errorCallback(error); }); } diff --git a/app/assets/javascripts/new_sidebar.js b/app/assets/javascripts/new_sidebar.js new file mode 100644 index 00000000000..5f98aff8ced --- /dev/null +++ b/app/assets/javascripts/new_sidebar.js @@ -0,0 +1,23 @@ +export default class NewNavSidebar { + constructor() { + this.initDomElements(); + } + + initDomElements() { + this.$sidebar = $('.nav-sidebar'); + this.$overlay = $('.mobile-overlay'); + this.$openSidebar = $('.toggle-mobile-nav'); + this.$closeSidebar = $('.close-nav-button'); + } + + bindEvents() { + this.$openSidebar.on('click', () => this.toggleSidebarNav(true)); + this.$closeSidebar.on('click', () => this.toggleSidebarNav(false)); + this.$overlay.on('click', () => this.toggleSidebarNav(false)); + } + + toggleSidebarNav(show) { + this.$sidebar.toggleClass('nav-sidebar-expanded', show); + this.$overlay.toggleClass('mobile-nav-open', show); + } +} diff --git a/app/assets/javascripts/project_select.js b/app/assets/javascripts/project_select.js index 9896b88d487..ebcefc819f5 100644 --- a/app/assets/javascripts/project_select.js +++ b/app/assets/javascripts/project_select.js @@ -104,6 +104,14 @@ import Api from './api'; dropdownCssClass: "ajax-project-dropdown" }); }); + + $('.new-project-item-select-button').on('click', function() { + $('.project-item-select', this.parentNode).select2('open'); + }); + + $('.project-item-select').on('click', function() { + window.location = `${$(this).val()}/${this.dataset.relativePath}`; + }); } return ProjectSelect; diff --git a/app/assets/stylesheets/framework/avatar.scss b/app/assets/stylesheets/framework/avatar.scss index 4ae2b164d2e..06f7af33f94 100644 --- a/app/assets/stylesheets/framework/avatar.scss +++ b/app/assets/stylesheets/framework/avatar.scss @@ -60,7 +60,7 @@ } &:not([href]):hover { - border-color: rgba($avatar-border, .2); + border-color: darken($avatar-border, 10%); } } @@ -99,7 +99,7 @@ .avatar-counter { background-color: $gray-darkest; color: $white-light; - border: 1px solid $border-color; + border: 1px solid $avatar-border; border-radius: 1em; font-family: $regular_font; font-size: 9px; diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index f89f2f30443..5e410cbf563 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -205,6 +205,7 @@ @media (max-width: $screen-sm-min) { width: 100%; + min-width: 180px; } &.dropdown-open-left { @@ -288,27 +289,15 @@ padding: 5px 8px; color: $gl-text-color-secondary; } - - .badge { - position: absolute; - right: 8px; - top: 5px; - } } .droplab-dropdown { - .description { - display: inline-block; - white-space: normal; - margin-left: 5px; - } - .dropdown-toggle > i { pointer-events: none; } - li { - padding: $gl-btn-padding $gl-btn-padding 2px; + .dropdown-menu li { + padding: $gl-btn-padding; cursor: pointer; > a, @@ -344,9 +333,25 @@ visibility: visible; } + &.divider { + margin: 0 8px; + padding: 0; + border-top: $gray-darkest; + } + .icon { visibility: hidden; } + + .description { + display: inline-block; + white-space: normal; + margin-left: 5px; + + p { + margin-bottom: 0; + } + } } .icon { @@ -354,12 +359,6 @@ vertical-align: top; padding-top: 2px; } - - .divider { - margin: 0 8px; - padding: 0; - border-top: $gray-darkest; - } } .droplab-dropdown .dropdown-menu, @@ -462,10 +461,6 @@ left: auto; right: 0; margin-top: -5px; - - @media (max-width: $screen-xs-max) { - left: 0; - } } .dropdown-menu-selectable { diff --git a/app/assets/stylesheets/framework/filters.scss b/app/assets/stylesheets/framework/filters.scss index 7e4e5fd7f1c..41184907abb 100644 --- a/app/assets/stylesheets/framework/filters.scss +++ b/app/assets/stylesheets/framework/filters.scss @@ -275,7 +275,7 @@ } .filtered-search-input-dropdown-menu { - max-height: 215px; + max-height: 225px; max-width: 280px; overflow: auto; @@ -382,10 +382,6 @@ } } -.dropdown-menu .filter-dropdown-item { - padding: 0; -} - @media (max-width: $screen-xs-max) { .issues-details-filters { padding: 0 0 10px; @@ -435,6 +431,7 @@ .fa { width: 15px; + line-height: $line-height-base; } .dropdown-label-box { diff --git a/app/assets/stylesheets/framework/lists.scss b/app/assets/stylesheets/framework/lists.scss index e59cd0eea82..868e65a8f46 100644 --- a/app/assets/stylesheets/framework/lists.scss +++ b/app/assets/stylesheets/framework/lists.scss @@ -236,6 +236,8 @@ ul.content-list { ul.controls { float: right; list-style: none; + display: flex; + align-items: center; .btn { padding: 10px 14px; @@ -259,6 +261,12 @@ ul.controls { } } } + + .issuable-pipeline-broken a, + .issuable-pipeline-status a, + .author_link { + display: flex; + } } ul.indent-list { diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index 28b2a7cfacd..e71bf04aec7 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -325,7 +325,7 @@ position: absolute; top: 7px; right: 15px; - z-index: 2; + z-index: 300; li.active { font-weight: bold; diff --git a/app/assets/stylesheets/framework/typography.scss b/app/assets/stylesheets/framework/typography.scss index 785b09e622f..8a58c1ed567 100644 --- a/app/assets/stylesheets/framework/typography.scss +++ b/app/assets/stylesheets/framework/typography.scss @@ -2,6 +2,10 @@ color: $gl-text-color; word-wrap: break-word; + [dir="auto"] { + text-align: initial; + } + a { color: $md-link-color; } @@ -112,9 +116,12 @@ blockquote p { color: $gl-grayish-blue !important; - margin: 0; font-size: inherit; line-height: 1.5; + + &:last-child { + margin: 0; + } } p { diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 8bd69faf84c..7016208f624 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -379,7 +379,7 @@ $issue-boards-card-shadow: rgba(186, 186, 186, 0.5); * Avatar */ $avatar_radius: 50%; -$avatar-border: rgba(0, 0, 0, .1); +$avatar-border: $border-color; $gl-avatar-size: 40px; /* diff --git a/app/assets/stylesheets/new_nav.scss b/app/assets/stylesheets/new_nav.scss index 393d5006e24..e1873506bec 100644 --- a/app/assets/stylesheets/new_nav.scss +++ b/app/assets/stylesheets/new_nav.scss @@ -275,8 +275,6 @@ header.navbar-gitlab-new { .breadcrumbs { display: flex; min-height: 60px; - padding-top: $gl-padding-top; - padding-bottom: $gl-padding-top; color: $gl-text-color; border-bottom: 1px solid $border-color; @@ -300,6 +298,7 @@ header.navbar-gitlab-new { display: flex; width: 100%; position: relative; + align-items: center; .dropdown-menu-projects { margin-top: -$gl-padding; @@ -330,7 +329,7 @@ header.navbar-gitlab-new { white-space: nowrap; > a { - &:last-of-type { + &:last-of-type:not(:first-child) { font-weight: 600; } } @@ -384,6 +383,7 @@ header.navbar-gitlab-new { &::after { content: "/"; margin: 0 2px 0 5px; + color: rgba($black, .65); } } @@ -396,3 +396,13 @@ header.navbar-gitlab-new { color: $gl-text-color; } } + +.top-area { + .nav-controls-new-nav { + .dropdown { + @media (min-width: $screen-sm-min) { + margin-right: 0; + } + } + } +} diff --git a/app/assets/stylesheets/new_sidebar.scss b/app/assets/stylesheets/new_sidebar.scss index 82cabefa129..ce8f4c41cb5 100644 --- a/app/assets/stylesheets/new_sidebar.scss +++ b/app/assets/stylesheets/new_sidebar.scss @@ -26,46 +26,79 @@ $new-sidebar-width: 220px; } .context-header { - border-bottom: 1px solid $border-color; - font-weight: 600; - display: flex; - align-items: center; - padding: 10px 16px 10px 10px; - color: $gl-text-color; + position: relative; - .avatar-container { - flex: 0 0 40px; - background-color: $white-light; - } - - &:hover { - background-color: $hover-background; - color: $hover-color; - border-color: $hover-background; + a { + border-bottom: 1px solid $border-color; + font-weight: 600; + display: flex; + align-items: center; + padding: 10px 16px 10px 10px; + color: $gl-text-color; - .avatar-container { - border-color: transparent; + @media (max-width: $screen-xs-max) { + padding-right: 30px; } - .settings-avatar { - background-color: $indigo-500; + &:hover { + background-color: $hover-background; + color: $hover-color; + border-color: $hover-background; - i { - color: $hover-color; + .avatar-container { + border-color: transparent; + } + + .settings-avatar { + background-color: $indigo-500; + + i { + color: $hover-color; + } } } } + .avatar-container { + flex: 0 0 40px; + background-color: $white-light; + } + .project-title, .group-title { overflow: hidden; text-overflow: ellipsis; } + + + &:hover { + .close-nav-button { + color: $white-light; + } + } + + .close-nav-button { + display: none; + position: absolute; + top: 0; + right: 0; + height: 100%; + background-color: transparent; + border: 0; + padding: 0 10px; + + @media (max-width: $screen-xs-max) { + display: block; + } + + &:hover { + color: $gl-text-color; + } + } } .settings-avatar { background-color: $white-light; - transition: background-color 100ms linear; i { font-size: 20px; @@ -73,7 +106,6 @@ $new-sidebar-width: 220px; color: $gl-text-color-secondary; text-align: center; align-self: center; - transition: color 100ms linear; } } @@ -81,7 +113,7 @@ $new-sidebar-width: 220px; position: fixed; z-index: 400; width: $new-sidebar-width; - transition: width $sidebar-transition-duration; + transition: left $sidebar-transition-duration; top: 50px; bottom: 0; left: 0; @@ -89,7 +121,12 @@ $new-sidebar-width: 220px; background-color: $gray-normal; box-shadow: inset -2px 0 0 $border-color; + &.nav-sidebar-expanded { + left: 0; + } + a { + transition: none; text-decoration: none; } @@ -118,7 +155,7 @@ $new-sidebar-width: 220px; } @media (max-width: $screen-xs-max) { - width: 0; + left: (-$new-sidebar-width); } } @@ -177,7 +214,6 @@ $new-sidebar-width: 220px; color: $hover-color; .badge { - transition: background-color 100ms linear, color 100ms linear; background-color: $indigo-500; color: $hover-color; } @@ -185,6 +221,38 @@ $new-sidebar-width: 220px; } } +.toggle-mobile-nav { + display: none; + background-color: transparent; + border: 0; + padding: 6px 16px; + margin: 0 16px 0 -15px; + height: 46px; + border-right: 1px solid $gl-text-color-quaternary; + + i { + font-size: 20px; + color: $gl-text-color-secondary; + } + + @media (max-width: $screen-xs-max) { + display: inline-block; + } +} + +.mobile-overlay { + display: none; + + &.mobile-nav-open { + display: block; + position: fixed; + background-color: $black-transparent; + height: 100%; + width: 100%; + z-index: 300; + } +} + // Make issue boards full-height now that sub-nav is gone diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 56a4b53ed61..aa04e490649 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -346,13 +346,9 @@ display: none; } - .avatar:hover, - .avatar-counter:hover { - border-color: $issuable-sidebar-color; - } - .avatar-counter:hover { color: $issuable-sidebar-color; + border-color: $issuable-sidebar-color; } .btn-clipboard { @@ -813,8 +809,6 @@ } .description { - margin-bottom: 10px; - .text { margin: 0; } diff --git a/app/assets/stylesheets/pages/profile.scss b/app/assets/stylesheets/pages/profile.scss index 235c475ff26..22672614e0d 100644 --- a/app/assets/stylesheets/pages/profile.scss +++ b/app/assets/stylesheets/pages/profile.scss @@ -376,3 +376,18 @@ table.u2f-registrations { } } } + +.nav-wip { + border: 1px solid $blue-500; + background: $blue-25; + padding: $gl-padding; + margin-bottom: $gl-padding; + + a { + color: $blue-500; + } + + p:last-child { + margin-bottom: 0; + } +} diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index e18778cdf80..b43b2c5621f 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -32,10 +32,10 @@ module IssuableCollections def filter_params set_sort_order_from_cookie - set_default_scope set_default_state - @filter_params = params.dup + # Skip irrelevant Rails routing params + @filter_params = params.dup.except(:controller, :action, :namespace_id) @filter_params[:sort] ||= default_sort_order @sort = @filter_params[:sort] @@ -55,10 +55,6 @@ module IssuableCollections @filter_params end - def set_default_scope - params[:scope] = 'all' if params[:scope].blank? - end - def set_default_state params[:state] = 'opened' if params[:state].blank? end diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 28c90548cc1..59e5b5e4775 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -1,6 +1,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController include ActionView::Helpers::NumberHelper + before_action :authorize_read_project!, only: :index before_action :find_todos, only: [:index, :destroy_all] def index @@ -49,6 +50,15 @@ class Dashboard::TodosController < Dashboard::ApplicationController private + def authorize_read_project! + project_id = params[:project_id] + + if project_id.present? + project = Project.find(project_id) + render_404 unless can?(current_user, :read_project, project) + end + end + def find_todos @todos ||= TodosFinder.new(current_user, params).execute end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 13f03e7e63e..0ac9da2ff0f 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -266,7 +266,7 @@ class Projects::IssuesController < Projects::ApplicationController if action_name == 'new' redirect_to external.new_issue_path else - redirect_to external.project_path + redirect_to external.issue_tracker_path end end diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 2e5a6493134..fc63e30c8fb 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -20,9 +20,9 @@ # class IssuableFinder include CreatedAtFilter - + NONE = '0'.freeze - IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page].freeze + IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page state].freeze attr_accessor :current_user, :params @@ -89,8 +89,14 @@ class IssuableFinder execute.find_by!(*params) end - def state_counter_cache_key(state) - Digest::SHA1.hexdigest(state_counter_cache_key_components(state).flatten.join('-')) + def state_counter_cache_key + cache_key(state_counter_cache_key_components) + end + + def clear_caches! + state_counter_cache_key_components_permutations.each do |components| + Rails.cache.delete(cache_key(components)) + end end def group @@ -417,12 +423,19 @@ class IssuableFinder params[:scope] == 'created-by-me' || params[:scope] == 'authored' || params[:scope] == 'assigned-to-me' end - def state_counter_cache_key_components(state) + def state_counter_cache_key_components opts = params.with_indifferent_access - opts[:state] = state opts.except!(*IRRELEVANT_PARAMS_FOR_CACHE_KEY) opts.delete_if { |_, value| value.blank? } ['issuables_count', klass.to_ability_name, opts.sort] end + + def state_counter_cache_key_components_permutations + [state_counter_cache_key_components] + end + + def cache_key(components) + Digest::SHA1.hexdigest(components.flatten.join('-')) + end end diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index 85230ff1293..0ec42a4e6eb 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -75,7 +75,7 @@ class IssuesFinder < IssuableFinder current_user.blank? || for_counting || params[:for_counting] end - def state_counter_cache_key_components(state) + def state_counter_cache_key_components extra_components = [ user_can_see_all_confidential_issues?, user_cannot_see_confidential_issues?(for_counting: true) @@ -84,6 +84,16 @@ class IssuesFinder < IssuableFinder super + extra_components end + def state_counter_cache_key_components_permutations + # Ignore the last two, as we'll provide both options for them. + components = super.first[0..-3] + + [ + components + [false, true], + components + [true, false] + ] + end + def by_assignee(items) if assignee items.assigned_to(assignee) diff --git a/app/helpers/breadcrumbs_helper.rb b/app/helpers/breadcrumbs_helper.rb new file mode 100644 index 00000000000..abe8edd6a8c --- /dev/null +++ b/app/helpers/breadcrumbs_helper.rb @@ -0,0 +1,25 @@ +module BreadcrumbsHelper + def add_to_breadcrumbs(text, link) + @breadcrumbs_extra_links ||= [] + @breadcrumbs_extra_links.push({ + text: text, + link: link + }) + end + + def breadcrumb_title_link + return @breadcrumb_link if @breadcrumb_link + + if controller.available_action?(:index) + url_for(action: "index") + else + request.path + end + end + + def breadcrumb_title(title) + return if defined?(@breadcrumb_title) + + @breadcrumb_title = title + end +end diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index d0c518f81f7..425af547330 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -235,7 +235,7 @@ module IssuablesHelper def issuables_count_for_state(issuable_type, state, finder: nil) finder ||= public_send("#{issuable_type}_finder") - cache_key = finder.state_counter_cache_key(state) + cache_key = finder.state_counter_cache_key @counts ||= {} @counts[cache_key] ||= Rails.cache.fetch(cache_key, expires_in: 2.minutes) do diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb index 3286a92a8a7..b30b2eb1d03 100644 --- a/app/helpers/page_layout_helper.rb +++ b/app/helpers/page_layout_helper.rb @@ -4,6 +4,10 @@ module PageLayoutHelper @page_title.push(*titles.compact) if titles.any? + if show_new_nav? && titles.any? && !defined?(@breadcrumb_title) + @breadcrumb_title = @page_title.last + end + # Segments are seperated by middot @page_title.join(" \u00b7 ") end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 26d11f9ab46..9a8d296d514 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -195,7 +195,7 @@ module ProjectsHelper controller.controller_name, controller.action_name, current_application_settings.cache_key, - 'v2.4' + 'v2.5' ] key << pipeline_status_cache_key(project.pipeline_status) if project.pipeline_status.has_status? diff --git a/app/models/commit.rb b/app/models/commit.rb index c7f62617c4c..1e19f00106a 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -1,5 +1,6 @@ class Commit extend ActiveModel::Naming + extend Gitlab::Cache::RequestCache include ActiveModel::Conversion include Noteable @@ -169,19 +170,9 @@ class Commit end def author - if RequestStore.active? - key = "commit_author:#{author_email.downcase}" - # nil is a valid value since no author may exist in the system - if RequestStore.store.key?(key) - @author = RequestStore.store[key] - else - @author = find_author_by_any_email - RequestStore.store[key] = @author - end - else - @author ||= find_author_by_any_email - end + User.find_by_any_email(author_email.downcase) end + request_cache(:author) { author_email.downcase } def committer @committer ||= User.find_by_any_email(committer_email.downcase) @@ -322,7 +313,7 @@ class Commit def raw_diffs(*args) if Gitlab::GitalyClient.feature_enabled?(:commit_raw_diffs) - Gitlab::GitalyClient::Commit.new(project.repository).diff_from_parent(self, *args) + Gitlab::GitalyClient::CommitService.new(project.repository).diff_from_parent(self, *args) else raw.diffs(*args) end @@ -331,7 +322,7 @@ class Commit def raw_deltas @deltas ||= Gitlab::GitalyClient.migrate(:commit_deltas) do |is_enabled| if is_enabled - Gitlab::GitalyClient::Commit.new(project.repository).commit_deltas(self) + Gitlab::GitalyClient::CommitService.new(project.repository).commit_deltas(self) else raw.deltas end @@ -368,10 +359,6 @@ class Commit end end - def find_author_by_any_email - User.find_by_any_email(author_email.downcase) - end - def repo_changes changes = { added: [], modified: [], removed: [] } diff --git a/app/models/concerns/editable.rb b/app/models/concerns/editable.rb index c62c7e1e936..28623d257a6 100644 --- a/app/models/concerns/editable.rb +++ b/app/models/concerns/editable.rb @@ -4,4 +4,8 @@ module Editable def is_edited? last_edited_at.present? && last_edited_at != created_at end + + def last_edited_by + super || User.ghost + end end diff --git a/app/models/group.rb b/app/models/group.rb index 70a4ceeffd8..dfa4e8adedd 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -2,7 +2,6 @@ require 'carrierwave/orm/activerecord' class Group < Namespace include Gitlab::ConfigHelper - include Gitlab::VisibilityLevel include AccessRequestable include Avatarable include Referable @@ -103,10 +102,6 @@ class Group < Namespace full_name end - def visibility_level_field - :visibility_level - end - def visibility_level_allowed_by_projects allowed_by_projects = self.projects.where('visibility_level > ?', self.visibility_level).none? diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 15713fc5f6d..0bb04194bdb 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -5,6 +5,7 @@ class Namespace < ActiveRecord::Base include Sortable include Gitlab::ShellAdapter include Gitlab::CurrentSettings + include Gitlab::VisibilityLevel include Routable include AfterCommitQueue @@ -105,6 +106,10 @@ class Namespace < ActiveRecord::Base end end + def visibility_level_field + :visibility_level + end + def to_param full_path end diff --git a/app/models/note.rb b/app/models/note.rb index 3d39047d32f..d0e3bc0bfed 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -190,7 +190,7 @@ class Note < ActiveRecord::Base # override to return commits, which are not active record def noteable if for_commit? - project.commit(commit_id) + @commit ||= project.commit(commit_id) else super end diff --git a/app/models/project_services/gitlab_issue_tracker_service.rb b/app/models/project_services/gitlab_issue_tracker_service.rb index 420102875a5..88c428b4aae 100644 --- a/app/models/project_services/gitlab_issue_tracker_service.rb +++ b/app/models/project_services/gitlab_issue_tracker_service.rb @@ -23,7 +23,7 @@ class GitlabIssueTrackerService < IssueTrackerService project_issue_url(project, id: iid) end - def project_path + def issue_tracker_path project_issues_path(project) end diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index 1fa4cd4db30..6d6a3ae3647 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -20,8 +20,8 @@ class IssueTrackerService < Service self.issues_url.gsub(':id', iid.to_s) end - def project_path - read_attribute(:project_url) + def issue_tracker_path + project_url end def new_issue_path diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb index 62f7c057c5b..dee99bbb859 100644 --- a/app/models/project_services/kubernetes_service.rb +++ b/app/models/project_services/kubernetes_service.rb @@ -59,21 +59,21 @@ class KubernetesService < DeploymentService def fields [ { type: 'text', - name: 'namespace', - title: 'Kubernetes namespace', - placeholder: namespace_placeholder }, - { type: 'text', name: 'api_url', title: 'API URL', placeholder: 'Kubernetes API URL, like https://kube.example.com/' }, - { type: 'text', - name: 'token', - title: 'Service token', - placeholder: 'Service token' }, { type: 'textarea', name: 'ca_pem', - title: 'Custom CA bundle', - placeholder: 'Certificate Authority bundle (PEM format)' } + title: 'CA Certificate', + placeholder: 'Certificate Authority bundle (PEM format)' }, + { type: 'text', + name: 'namespace', + title: 'Project namespace (optional/unique)', + placeholder: namespace_placeholder }, + { type: 'text', + name: 'token', + title: 'Token', + placeholder: 'Service token' } ] end diff --git a/app/models/user.rb b/app/models/user.rb index 8f40af24e20..c26be6d05a2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -385,9 +385,11 @@ class User < ActiveRecord::Base # Return (create if necessary) the ghost user. The ghost user # owns records previously belonging to deleted users. def ghost - unique_internal(where(ghost: true), 'ghost', 'ghost%s@example.com') do |u| + email = 'ghost%s@example.com' + unique_internal(where(ghost: true), 'ghost', email) do |u| u.bio = 'This is a "Ghost User", created to hold all issues authored by users that have since been deleted. This user cannot be removed.' u.name = 'Ghost User' + u.notification_email = email end end end diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb index a886efc1360..386822d3ff6 100644 --- a/app/policies/ci/build_policy.rb +++ b/app/policies/ci/build_policy.rb @@ -3,9 +3,13 @@ module Ci condition(:protected_action) do next false unless @subject.action? - !::Gitlab::UserAccess - .new(@user, project: @subject.project) - .can_merge_to_branch?(@subject.ref) + access = ::Gitlab::UserAccess.new(@user, project: @subject.project) + + if @subject.tag? + !access.can_create_tag?(@subject.ref) + else + !access.can_merge_to_branch?(@subject.ref) + end end rule { protected_action }.prevent :update_build diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index a1d67cbc244..eb345fead2d 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -33,17 +33,12 @@ module Boards end def filter_params - set_default_scope set_project set_state params end - def set_default_scope - params[:scope] = 'all' - end - def set_project params[:project_id] = project.id end diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 4f35255fb53..273386776fa 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -135,7 +135,7 @@ module Ci end def pipeline_created_counter - @pipeline_created_counter ||= Gitlab::Metrics.counter(:pipelines_created_count, "Pipelines created count") + @pipeline_created_counter ||= Gitlab::Metrics.counter(:pipelines_created_total, "Counter of pipelines created") end end end diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index a03a7abfeb1..9078b1f0983 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -183,7 +183,7 @@ class IssuableBaseService < BaseService after_create(issuable) issuable.create_cross_references!(current_user) execute_hooks(issuable) - invalidate_cache_counts(issuable.assignees, issuable) + invalidate_cache_counts(issuable, users: issuable.assignees) end issuable @@ -240,12 +240,12 @@ class IssuableBaseService < BaseService old_assignees: old_assignees ) - if old_assignees != issuable.assignees - new_assignees = issuable.assignees.to_a - affected_assignees = (old_assignees + new_assignees) - (old_assignees & new_assignees) - invalidate_cache_counts(affected_assignees.compact, issuable) - end + new_assignees = issuable.assignees.to_a + affected_assignees = (old_assignees + new_assignees) - (old_assignees & new_assignees) + # Don't clear the project cache, because it will be handled by the + # appropriate service (close / reopen / merge / etc.). + invalidate_cache_counts(issuable, users: affected_assignees.compact, skip_project_cache: true) after_update(issuable) issuable.create_new_cross_references!(current_user) execute_hooks(issuable, 'update') @@ -339,9 +339,18 @@ class IssuableBaseService < BaseService create_labels_note(issuable, old_labels) if issuable.labels != old_labels end - def invalidate_cache_counts(users, issuable) + def invalidate_cache_counts(issuable, users: [], skip_project_cache: false) users.each do |user| user.public_send("invalidate_#{issuable.model_name.singular}_cache_counts") end + + unless skip_project_cache + case issuable + when Issue + IssuesFinder.new(nil, project_id: issuable.project_id).clear_caches! + when MergeRequest + MergeRequestsFinder.new(nil, project_id: issuable.target_project_id).clear_caches! + end + end end end diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb index 85c616ca576..ddef5281498 100644 --- a/app/services/issues/close_service.rb +++ b/app/services/issues/close_service.rb @@ -28,7 +28,7 @@ module Issues notification_service.close_issue(issue, current_user) if notifications todo_service.close_issue(issue, current_user) execute_hooks(issue, 'close') - invalidate_cache_counts(issue.assignees, issue) + invalidate_cache_counts(issue, users: issue.assignees) end issue diff --git a/app/services/issues/reopen_service.rb b/app/services/issues/reopen_service.rb index 80ea6312768..73b2e85cba3 100644 --- a/app/services/issues/reopen_service.rb +++ b/app/services/issues/reopen_service.rb @@ -8,7 +8,7 @@ module Issues create_note(issue) notification_service.reopen_issue(issue, current_user) execute_hooks(issue, 'reopen') - invalidate_cache_counts(issue.assignees, issue) + invalidate_cache_counts(issue, users: issue.assignees) end issue diff --git a/app/services/merge_requests/close_service.rb b/app/services/merge_requests/close_service.rb index 2ffc989ed71..c0ce01f7523 100644 --- a/app/services/merge_requests/close_service.rb +++ b/app/services/merge_requests/close_service.rb @@ -13,7 +13,7 @@ module MergeRequests notification_service.close_mr(merge_request, current_user) todo_service.close_merge_request(merge_request, current_user) execute_hooks(merge_request, 'close') - invalidate_cache_counts(merge_request.assignees, merge_request) + invalidate_cache_counts(merge_request, users: merge_request.assignees) end merge_request diff --git a/app/services/merge_requests/post_merge_service.rb b/app/services/merge_requests/post_merge_service.rb index f0d998731d7..261a8bfa200 100644 --- a/app/services/merge_requests/post_merge_service.rb +++ b/app/services/merge_requests/post_merge_service.rb @@ -13,7 +13,7 @@ module MergeRequests create_note(merge_request) notification_service.merge_mr(merge_request, current_user) execute_hooks(merge_request, 'merge') - invalidate_cache_counts(merge_request.assignees, merge_request) + invalidate_cache_counts(merge_request, users: merge_request.assignees) end private diff --git a/app/services/merge_requests/reopen_service.rb b/app/services/merge_requests/reopen_service.rb index f2fddf7f345..52f6d511f98 100644 --- a/app/services/merge_requests/reopen_service.rb +++ b/app/services/merge_requests/reopen_service.rb @@ -10,7 +10,7 @@ module MergeRequests execute_hooks(merge_request, 'reopen') merge_request.reload_diff(current_user) merge_request.mark_as_unchecked - invalidate_cache_counts(merge_request.assignees, merge_request) + invalidate_cache_counts(merge_request, users: merge_request.assignees) end merge_request diff --git a/app/services/metrics_service.rb b/app/services/metrics_service.rb index c92f070601c..a02eee4961b 100644 --- a/app/services/metrics_service.rb +++ b/app/services/metrics_service.rb @@ -31,6 +31,6 @@ class MetricsService end def multiprocess_metrics_path - @multiprocess_metrics_path ||= Rails.root.join(ENV['prometheus_multiproc_dir']).freeze + ::Prometheus::Client.configuration.multiprocess_files_dir end end diff --git a/app/services/users/migrate_to_ghost_user_service.rb b/app/services/users/migrate_to_ghost_user_service.rb index 4628c4c6f6e..3a9c151cf9b 100644 --- a/app/services/users/migrate_to_ghost_user_service.rb +++ b/app/services/users/migrate_to_ghost_user_service.rb @@ -50,10 +50,12 @@ module Users def migrate_issues user.issues.update_all(author_id: ghost_user.id) + Issue.where(last_edited_by_id: user.id).update_all(last_edited_by_id: ghost_user.id) end def migrate_merge_requests user.merge_requests.update_all(author_id: ghost_user.id) + MergeRequest.where(merge_user_id: user.id).update_all(merge_user_id: ghost_user.id) end def migrate_notes diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index 0da7a025591..05a2091633a 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -16,7 +16,7 @@ class GitlabUploader < CarrierWave::Uploader::Base def self.base_dir return root_dir unless file_storage? - File.join(root_dir, 'system') + File.join(root_dir, '-', 'system') end def self.file_storage? diff --git a/app/uploaders/personal_file_uploader.rb b/app/uploaders/personal_file_uploader.rb index 7f857765fbf..ef70871624b 100644 --- a/app/uploaders/personal_file_uploader.rb +++ b/app/uploaders/personal_file_uploader.rb @@ -3,6 +3,10 @@ class PersonalFileUploader < FileUploader File.join(CarrierWave.root, model_path(model)) end + def self.base_dir + File.join(root_dir, 'system') + end + private def secure_url diff --git a/app/views/admin/applications/edit.html.haml b/app/views/admin/applications/edit.html.haml index c596866bde2..13b583e6072 100644 --- a/app/views/admin/applications/edit.html.haml +++ b/app/views/admin/applications/edit.html.haml @@ -1,4 +1,5 @@ - page_title "Edit", @application.name, "Applications" + %h3.page-title Edit application - @url = admin_application_path(@application) = render 'form', application: @application diff --git a/app/views/admin/applications/new.html.haml b/app/views/admin/applications/new.html.haml index 6310d89bd6b..346c58877d9 100644 --- a/app/views/admin/applications/new.html.haml +++ b/app/views/admin/applications/new.html.haml @@ -1,4 +1,6 @@ +- breadcrumb_title "Applications" - page_title "New Application" + %h3.page-title New application - @url = admin_applications_path = render 'form', application: @application diff --git a/app/views/admin/broadcast_messages/edit.html.haml b/app/views/admin/broadcast_messages/edit.html.haml index 45e053eb31d..8cbc4597e32 100644 --- a/app/views/admin/broadcast_messages/edit.html.haml +++ b/app/views/admin/broadcast_messages/edit.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Messages" - page_title "Broadcast Messages" = render 'form' diff --git a/app/views/admin/broadcast_messages/index.html.haml b/app/views/admin/broadcast_messages/index.html.haml index 4f2ae081d7a..b806882eee3 100644 --- a/app/views/admin/broadcast_messages/index.html.haml +++ b/app/views/admin/broadcast_messages/index.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Messages" - page_title "Broadcast Messages" %h3.page-title diff --git a/app/views/dashboard/_groups_head.html.haml b/app/views/dashboard/_groups_head.html.haml index 4594c52b34b..5a379eae8f4 100644 --- a/app/views/dashboard/_groups_head.html.haml +++ b/app/views/dashboard/_groups_head.html.haml @@ -1,3 +1,7 @@ +- if show_new_nav? && current_user.can_create_group? + - content_for :breadcrumbs_extra do + = link_to "New group", new_group_path, class: "btn btn-new" + .top-area %ul.nav-links = nav_link(page: dashboard_groups_path) do @@ -6,9 +10,8 @@ = nav_link(page: explore_groups_path) do = link_to explore_groups_path, title: 'Explore public groups' do Explore public groups - .nav-controls + .nav-controls{ class: ("nav-controls-new-nav" if show_new_nav?) } = render 'shared/groups/search_form' = render 'shared/groups/dropdown' - if current_user.can_create_group? - = link_to new_group_path, class: "btn btn-new" do - New group + = link_to "New group", new_group_path, class: "btn btn-new #{("visible-xs" if show_new_nav?)}" diff --git a/app/views/dashboard/_projects_head.html.haml b/app/views/dashboard/_projects_head.html.haml index 64b737ee886..1f9a5b401b6 100644 --- a/app/views/dashboard/_projects_head.html.haml +++ b/app/views/dashboard/_projects_head.html.haml @@ -1,5 +1,10 @@ = content_for :flash_message do = render 'shared/project_limit' + +- if show_new_nav? && current_user.can_create_project? + - content_for :breadcrumbs_extra do + = link_to "New project", new_project_path, class: 'btn btn-new' + .top-area.scrolling-tabs-container.inner-page-scroll-tabs .fade-left= icon('angle-left') .fade-right= icon('angle-right') @@ -14,9 +19,8 @@ = link_to explore_root_path, title: 'Explore', data: {placement: 'right'} do Explore projects - .nav-controls + .nav-controls{ class: ("nav-controls-new-nav" if show_new_nav?) } = render 'shared/projects/search_form' = render 'shared/projects/dropdown' - if current_user.can_create_project? - = link_to new_project_path, class: 'btn btn-new' do - New project + = link_to "New project", new_project_path, class: "btn btn-new #{("visible-xs" if show_new_nav?)}" diff --git a/app/views/dashboard/_snippets_head.html.haml b/app/views/dashboard/_snippets_head.html.haml index 02e90bbfa55..fd5389106bb 100644 --- a/app/views/dashboard/_snippets_head.html.haml +++ b/app/views/dashboard/_snippets_head.html.haml @@ -1,3 +1,7 @@ +- if show_new_nav? && current_user + - content_for :breadcrumbs_extra do + = link_to "New snippet", new_snippet_path, class: "btn btn-new", title: "New snippet" + .top-area %ul.nav-links = nav_link(page: dashboard_snippets_path, html_options: {class: 'home'}) do @@ -8,6 +12,5 @@ Explore Snippets - if current_user - .nav-controls.hidden-xs - = link_to new_snippet_path, class: "btn btn-new", title: "New snippet" do - New snippet + .nav-controls.hidden-xs{ class: ("hidden-sm hidden-md hidden-lg" if show_new_nav?) } + = link_to "New snippet", new_snippet_path, class: "btn btn-new", title: "New snippet" diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index d6b46dee0e4..52e0012fd7d 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -1,11 +1,18 @@ +- @hide_top_links = true - page_title "Issues" - header_title "Issues", issues_dashboard_path(assignee_id: current_user.id) = content_for :meta_tags do = auto_discovery_link_tag(:atom, params.merge(rss_url_options), title: "#{current_user.name} issues") +- if show_new_nav? + - content_for :breadcrumbs_extra do + = link_to params.merge(rss_url_options), class: 'btn has-tooltip append-right-10', title: 'Subscribe' do + = icon('rss') + = render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", with_feature_enabled: 'issues' + .top-area = render 'shared/issuable/nav', type: :issues - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } = link_to params.merge(rss_url_options), class: 'btn has-tooltip', title: 'Subscribe' do = icon('rss') = render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", with_feature_enabled: 'issues' diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 6f6afe161d1..c3fe14da2b2 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -1,9 +1,14 @@ +- @hide_top_links = true - page_title "Merge Requests" - header_title "Merge Requests", merge_requests_dashboard_path(assignee_id: current_user.id) +- if show_new_nav? + - content_for :breadcrumbs_extra do + = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request", with_feature_enabled: 'merge_requests' + .top-area = render 'shared/issuable/nav', type: :merge_requests - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request", with_feature_enabled: 'merge_requests' = render 'shared/issuable/filter', type: :merge_requests diff --git a/app/views/dashboard/milestones/index.html.haml b/app/views/dashboard/milestones/index.html.haml index ef1467c4d78..37dbcaf5cb8 100644 --- a/app/views/dashboard/milestones/index.html.haml +++ b/app/views/dashboard/milestones/index.html.haml @@ -2,10 +2,14 @@ - page_title 'Milestones' - header_title 'Milestones', dashboard_milestones_path +- if show_new_nav? + - content_for :breadcrumbs_extra do + = render 'shared/new_project_item_select', path: 'milestones/new', label: 'New milestone', include_groups: true + .top-area = render 'shared/milestones_filter', counts: @milestone_states - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } = render 'shared/new_project_item_select', path: 'milestones/new', label: 'New milestone', include_groups: true .milestones diff --git a/app/views/dashboard/projects/index.html.haml b/app/views/dashboard/projects/index.html.haml index 7ac6cf06fb9..ec6cb1a9624 100644 --- a/app/views/dashboard/projects/index.html.haml +++ b/app/views/dashboard/projects/index.html.haml @@ -1,6 +1,5 @@ - @no_container = true - @hide_top_links = true -- @breadcrumb_title = "Projects" = content_for :meta_tags do = auto_discovery_link_tag(:atom, dashboard_projects_url(rss_url_options), title: "All activity") diff --git a/app/views/dashboard/projects/starred.html.haml b/app/views/dashboard/projects/starred.html.haml index 99efe9c9b86..ae1d733a516 100644 --- a/app/views/dashboard/projects/starred.html.haml +++ b/app/views/dashboard/projects/starred.html.haml @@ -1,5 +1,6 @@ +- @hide_top_links = true - @no_container = true - +- breadcrumb_title "Projects" - page_title "Starred Projects" - header_title "Projects", dashboard_projects_path diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index 52d6ebd8a14..9b615ec999e 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -1,3 +1,4 @@ +- @hide_top_links = true - page_title "Todos" - header_title "Todos", dashboard_todos_path diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml index ffe07b217a7..2651ef37e67 100644 --- a/app/views/explore/groups/index.html.haml +++ b/app/views/explore/groups/index.html.haml @@ -1,3 +1,4 @@ +- @hide_top_links = true - page_title "Groups" - header_title "Groups", dashboard_groups_path diff --git a/app/views/explore/projects/index.html.haml b/app/views/explore/projects/index.html.haml index ec461755103..f00802e0af7 100644 --- a/app/views/explore/projects/index.html.haml +++ b/app/views/explore/projects/index.html.haml @@ -1,3 +1,4 @@ +- @hide_top_links = true - page_title "Projects" - header_title "Projects", dashboard_projects_path diff --git a/app/views/explore/projects/starred.html.haml b/app/views/explore/projects/starred.html.haml index ec461755103..f00802e0af7 100644 --- a/app/views/explore/projects/starred.html.haml +++ b/app/views/explore/projects/starred.html.haml @@ -1,3 +1,4 @@ +- @hide_top_links = true - page_title "Projects" - header_title "Projects", dashboard_projects_path diff --git a/app/views/explore/projects/trending.html.haml b/app/views/explore/projects/trending.html.haml index ec461755103..f00802e0af7 100644 --- a/app/views/explore/projects/trending.html.haml +++ b/app/views/explore/projects/trending.html.haml @@ -1,3 +1,4 @@ +- @hide_top_links = true - page_title "Projects" - header_title "Projects", dashboard_projects_path diff --git a/app/views/explore/snippets/index.html.haml b/app/views/explore/snippets/index.html.haml index e5706d04736..94fc4ac21d2 100644 --- a/app/views/explore/snippets/index.html.haml +++ b/app/views/explore/snippets/index.html.haml @@ -1,3 +1,4 @@ +- @hide_top_links = true - page_title "Snippets" - header_title "Snippets", snippets_path diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 182dbe2f98a..735d9390699 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -1,12 +1,19 @@ - page_title "Issues" +- group_issues_exists = group_issues(@group).exists? = render "head_issues" = content_for :meta_tags do = auto_discovery_link_tag(:atom, params.merge(rss_url_options), title: "#{@group.name} issues") -- if group_issues(@group).exists? +- if show_new_nav? && group_issues_exists + - content_for :breadcrumbs_extra do + = link_to params.merge(rss_url_options), class: 'btn btn-default append-right-10' do + = icon('rss') + = render 'shared/new_project_item_select', path: 'issues/new', label: "New issue" + +- if group_issues_exists .top-area = render 'shared/issuable/nav', type: :issues - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } = link_to params.merge(rss_url_options), class: 'btn' do = icon('rss') %span.icon-label diff --git a/app/views/groups/labels/index.html.haml b/app/views/groups/labels/index.html.haml index 2bc00fb16c8..50179a47797 100644 --- a/app/views/groups/labels/index.html.haml +++ b/app/views/groups/labels/index.html.haml @@ -1,14 +1,18 @@ - page_title 'Labels' +- if show_new_nav? && can?(current_user, :admin_label, @group) + - content_for :breadcrumbs_extra do + = link_to "New label", new_group_label_path(@group), class: "btn btn-new" + = render "groups/head_issues" + .top-area.adjust .nav-text Labels can be applied to issues and merge requests. Group labels are available for any project within the group. - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } - if can?(current_user, :admin_label, @group) - = link_to new_group_label_path(@group), class: "btn btn-new" do - New label + = link_to "New label", new_group_label_path(@group), class: "btn btn-new" .labels .other-labels diff --git a/app/views/groups/labels/new.html.haml b/app/views/groups/labels/new.html.haml index 2be87460b1d..ae240490bbd 100644 --- a/app/views/groups/labels/new.html.haml +++ b/app/views/groups/labels/new.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Labels" - page_title 'New Label' - header_title group_title(@group, 'Labels', group_labels_path(@group)) diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index 45e39252e16..997c82c77d9 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -1,12 +1,16 @@ - page_title "Merge Requests" +- if show_new_nav? && current_user + - content_for :breadcrumbs_extra do + = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request" + - if @group_merge_requests.empty? = render 'shared/empty_states/merge_requests', project_select_button: true - else .top-area = render 'shared/issuable/nav', type: :merge_requests - if current_user - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request" = render 'shared/issuable/filter', type: :merge_requests diff --git a/app/views/groups/milestones/index.html.haml b/app/views/groups/milestones/index.html.haml index 6ceb4092307..66c6cc9e279 100644 --- a/app/views/groups/milestones/index.html.haml +++ b/app/views/groups/milestones/index.html.haml @@ -1,13 +1,16 @@ - page_title "Milestones" +- if show_new_nav? && can?(current_user, :admin_milestones, @group) + - content_for :breadcrumbs_extra do + = link_to "New milestone", new_group_milestone_path(@group), class: "btn btn-new" + = render "groups/head_issues" .top-area = render 'shared/milestones_filter', counts: @milestone_states - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } - if can?(current_user, :admin_milestones, @group) - = link_to new_group_milestone_path(@group), class: "btn btn-new" do - New milestone + = link_to "New milestone", new_group_milestone_path(@group), class: "btn btn-new" .milestones %ul.content-list diff --git a/app/views/groups/milestones/new.html.haml b/app/views/groups/milestones/new.html.haml index e24844661ee..eca7fb9ddb1 100644 --- a/app/views/groups/milestones/new.html.haml +++ b/app/views/groups/milestones/new.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Milestones" - page_title "Milestones" - header_title group_title(@group, "Milestones", group_milestones_path(@group)) diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml index 000c7af2326..e9daac95ca1 100644 --- a/app/views/groups/new.html.haml +++ b/app/views/groups/new.html.haml @@ -1,3 +1,6 @@ +- @breadcrumb_link = dashboard_groups_path +- breadcrumb_title "Groups" +- @hide_top_links = true - page_title 'New Group' - header_title "Groups", dashboard_groups_path diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 80a8ba4a755..e07f61c94e4 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -1,4 +1,5 @@ - @no_container = true +- breadcrumb_title "Group" = content_for :meta_tags do = auto_discovery_link_tag(:atom, group_url(@group, rss_url_options), title: "#{@group.name} activity") diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index cc9219cb6fe..873220cc73d 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -10,12 +10,15 @@ - if content_for?(:sub_nav) = yield :sub_nav .content-wrapper{ class: "#{(layout_nav_class unless show_new_nav?)}" } + - if show_new_nav? + .mobile-overlay .alert-wrapper = render "layouts/broadcast" - if show_new_nav? - if content_for?(:new_global_flash) = yield :new_global_flash - = render "layouts/nav/breadcrumbs" + - unless @hide_breadcrumbs + = render "layouts/nav/breadcrumbs" = render "layouts/flash" = yield :flash_message %div{ class: "#{(container_class unless @no_container)} #{@content_class}" } diff --git a/app/views/layouts/nav/_breadcrumbs.html.haml b/app/views/layouts/nav/_breadcrumbs.html.haml index b0c1ab7420f..4db84771f4e 100644 --- a/app/views/layouts/nav/_breadcrumbs.html.haml +++ b/app/views/layouts/nav/_breadcrumbs.html.haml @@ -1,19 +1,27 @@ -- breadcrumb_title = @breadcrumb_title || controller.controller_name.humanize +- breadcrumb_link = breadcrumb_title_link - hide_top_links = @hide_top_links || false %nav.breadcrumbs{ role: "navigation" } .breadcrumbs-container{ class: [container_class, @content_class] } + - if defined?(@new_sidebar) + = button_tag class: 'toggle-mobile-nav', type: 'button' do + %span.sr-only Open sidebar + = icon ('bars') .breadcrumbs-links.js-title-container - unless hide_top_links .title = link_to "GitLab", root_path \/ + - if content_for?(:header_title_before) + = yield :header_title_before + \/ = header_title %h2.breadcrumbs-sub-title %ul.list-unstyled - - if content_for?(:sub_title_before) - = yield :sub_title_before - %li= link_to breadcrumb_title, request.path + - if @breadcrumbs_extra_links + - @breadcrumbs_extra_links.each do |extra| + %li= link_to extra[:text], extra[:link] + %li= link_to @breadcrumb_title, breadcrumb_link - if content_for?(:breadcrumbs_extra) .breadcrumbs-extra.hidden-xs= yield :breadcrumbs_extra = yield :header_content diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index ac222ad8c82..be7d27df2a0 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -42,18 +42,18 @@ .key = icon('arrow-up', 'aria-label' => 'hidden') I + %span.badge.pull-right= number_with_delimiter(assigned_issuables_count(:issues)) %span Issues - .badge= number_with_delimiter(assigned_issuables_count(:issues)) = nav_link(path: 'dashboard#merge_requests') do = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do .shortcut-mappings .key = icon('arrow-up', 'aria-label' => 'hidden') M + %span.badge.pull-right= number_with_delimiter(assigned_issuables_count(:merge_requests)) %span Merge Requests - .badge= number_with_delimiter(assigned_issuables_count(:merge_requests)) = nav_link(controller: 'dashboard/snippets') do = link_to dashboard_snippets_path, class: 'dashboard-shortcuts-snippets', title: 'Snippets' do .shortcut-mappings diff --git a/app/views/layouts/nav/_new_admin_sidebar.html.haml b/app/views/layouts/nav/_new_admin_sidebar.html.haml index d7a9e530983..95443de40c2 100644 --- a/app/views/layouts/nav/_new_admin_sidebar.html.haml +++ b/app/views/layouts/nav/_new_admin_sidebar.html.haml @@ -1,8 +1,12 @@ .nav-sidebar - = link_to admin_root_path, title: 'Admin Overview', class: 'context-header' do - .avatar-container.s40.settings-avatar - = icon('wrench') - .project-title Admin Area + .context-header + = link_to admin_root_path, title: 'Admin Overview' do + .avatar-container.s40.settings-avatar + = icon('wrench') + .project-title Admin Area + = button_tag class: 'close-nav-button', type: 'button' do + %span.sr-only Close sidebar + = icon ('times') %ul.sidebar-top-level-items = nav_link(controller: %w(dashboard admin projects users groups jobs runners cohorts), html_options: {class: 'home'}) do = link_to admin_root_path, title: 'Overview', class: 'shortcuts-tree' do @@ -13,7 +17,7 @@ = nav_link(controller: :dashboard, html_options: {class: 'home'}) do = link_to admin_root_path, title: 'Overview' do %span - Overview + Dashboard = nav_link(controller: [:admin, :projects]) do = link_to admin_projects_path, title: 'Projects' do %span diff --git a/app/views/layouts/nav/_new_dashboard.html.haml b/app/views/layouts/nav/_new_dashboard.html.haml index 7109baa4dad..cfdfcbebc9f 100644 --- a/app/views/layouts/nav/_new_dashboard.html.haml +++ b/app/views/layouts/nav/_new_dashboard.html.haml @@ -3,7 +3,7 @@ = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do Projects - = nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do + = nav_link(controller: ['dashboard/groups', 'explore/groups']) do = link_to dashboard_groups_path, class: 'dashboard-shortcuts-groups', title: 'Groups' do Groups diff --git a/app/views/layouts/nav/_new_group_sidebar.html.haml b/app/views/layouts/nav/_new_group_sidebar.html.haml index 7b68d11041e..a7897c09e79 100644 --- a/app/views/layouts/nav/_new_group_sidebar.html.haml +++ b/app/views/layouts/nav/_new_group_sidebar.html.haml @@ -1,20 +1,24 @@ .nav-sidebar - = link_to group_path(@group), title: @group.name, class: 'context-header' do - .avatar-container.s40.group-avatar - = image_tag group_icon(@group), class: "avatar s40 avatar-tile" - .group-title - = @group.name + .context-header + = link_to group_path(@group), title: @group.name do + .avatar-container.s40.group-avatar + = image_tag group_icon(@group), class: "avatar s40 avatar-tile" + .group-title + = @group.name + = button_tag class: 'close-nav-button', type: 'button' do + %span.sr-only Close sidebar + = icon ('times') %ul.sidebar-top-level-items = nav_link(path: ['groups#show', 'groups#activity', 'groups#subgroups'], html_options: { class: 'home' }) do - = link_to group_path(@group), title: 'Home' do + = link_to group_path(@group), title: 'About group' do %span - Group + About %ul.sidebar-sub-level-items = nav_link(path: ['groups#show', 'groups#subgroups'], html_options: { class: 'home' }) do - = link_to group_path(@group), title: 'Group Home' do + = link_to group_path(@group), title: 'Group details' do %span - Home + Details = nav_link(path: 'groups#activity') do = link_to activity_group_path(@group), title: 'Activity' do @@ -55,7 +59,22 @@ %span Members - if current_user && can?(current_user, :admin_group, @group) - = nav_link(path: %w[groups#projects groups#edit]) do + = nav_link(path: %w[groups#projects groups#edit ci_cd#show]) do = link_to edit_group_path(@group), title: 'Settings' do %span Settings + %ul.sidebar-sub-level-items + = nav_link(path: 'groups#edit') do + = link_to edit_group_path(@group), title: 'General' do + %span + General + + = nav_link(path: 'groups#projects') do + = link_to projects_group_path(@group), title: 'Projects' do + %span + Projects + + = nav_link(controller: :ci_cd) do + = link_to group_settings_ci_cd_path(@group), title: 'Pipelines' do + %span + Pipelines diff --git a/app/views/layouts/nav/_new_profile_sidebar.html.haml b/app/views/layouts/nav/_new_profile_sidebar.html.haml index 033ea149cfb..239e6b949e2 100644 --- a/app/views/layouts/nav/_new_profile_sidebar.html.haml +++ b/app/views/layouts/nav/_new_profile_sidebar.html.haml @@ -1,8 +1,12 @@ .nav-sidebar - = link_to profile_path, title: 'Profile Settings', class: 'context-header' do - .avatar-container.s40.settings-avatar - = icon('user') - .project-title User Settings + .context-header + = link_to profile_path, title: 'Profile Settings' do + .avatar-container.s40.settings-avatar + = icon('user') + .project-title User Settings + = button_tag class: 'close-nav-button', type: 'button' do + %span.sr-only Close sidebar + = icon ('times') %ul.sidebar-top-level-items = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = link_to profile_path, title: 'Profile Settings' do diff --git a/app/views/layouts/nav/_new_project_sidebar.html.haml b/app/views/layouts/nav/_new_project_sidebar.html.haml index 8838852803b..21f175291fa 100644 --- a/app/views/layouts/nav/_new_project_sidebar.html.haml +++ b/app/views/layouts/nav/_new_project_sidebar.html.haml @@ -1,20 +1,24 @@ .nav-sidebar - can_edit = can?(current_user, :admin_project, @project) - = link_to project_path(@project), title: @project.name, class: 'context-header' do - .avatar-container.s40.project-avatar - = project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile') - .project-title - = @project.name + .context-header + = link_to project_path(@project), title: @project.name do + .avatar-container.s40.project-avatar + = project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile') + .project-title + = @project.name + = button_tag class: 'close-nav-button', type: 'button' do + %span.sr-only Close sidebar + = icon ('times') %ul.sidebar-top-level-items = nav_link(path: ['projects#show', 'projects#activity', 'cycle_analytics#show'], html_options: { class: 'home' }) do - = link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do + = link_to project_path(@project), title: 'About project', class: 'shortcuts-project' do %span - Project + About %ul.sidebar-sub-level-items = nav_link(path: 'projects#show') do - = link_to project_path(@project), title: _('Project home'), class: 'shortcuts-project' do - %span= _('Home') + = link_to project_path(@project), title: _('Project details'), class: 'shortcuts-project' do + %span= _('Details') = nav_link(path: 'projects#activity') do = link_to activity_project_path(@project), title: _('Activity'), class: 'shortcuts-project-activity' do @@ -165,7 +169,7 @@ Snippets - if project_nav_tab? :settings - = nav_link(path: %w[projects#edit members#show integrations#show services#edit repository#show ci_cd#show pages#show]) do + = nav_link(path: %w[projects#edit project_members#index integrations#show services#edit repository#show ci_cd#show pages#show]) do = link_to edit_project_path(@project), title: 'Settings', class: 'shortcuts-tree' do %span Settings @@ -177,8 +181,8 @@ = link_to edit_project_path(@project), title: 'General' do %span General - = nav_link(controller: :members) do - = link_to project_settings_members_path(@project), title: 'Members' do + = nav_link(controller: :project_members) do + = link_to project_project_members_path(@project), title: 'Members' do %span Members - if can_edit diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index bd602071384..9aed498a8a0 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -24,6 +24,12 @@ %p This setting allows you to turn on or off the new upcoming navigation concept. .col-lg-8.syntax-theme + .nav-wip + %p + The new navigation is currently a work-in-progress concept and is currently only usable on wide-screens. There are a number of improvements that we are working on in order to further refine our navigation. + %p + %a{ href: 'https://gitlab.com/gitlab-org/gitlab-ce/issues/32794', target: 'blank' } Learn more + about the improvements that are coming soon! = label_tag do .preview= image_tag "old_nav.png" %input.js-experiment-feature-toggle{ type: "radio", value: "false", name: "new_nav", checked: !show_new_nav? } diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index bac75a49075..a8ae0b92334 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Profile" - @content_class = "limit-container-width" unless fluid_layout = render 'profiles/head' diff --git a/app/views/profiles/two_factor_auths/show.html.haml b/app/views/profiles/two_factor_auths/show.html.haml index 67792de3870..037cb30efb9 100644 --- a/app/views/profiles/two_factor_auths/show.html.haml +++ b/app/views/profiles/two_factor_auths/show.html.haml @@ -1,6 +1,10 @@ - page_title 'Two-Factor Authentication', 'Account' -- header_title "Two-Factor Authentication", profile_two_factor_auth_path +- if show_new_nav? + - add_to_breadcrumbs("Account", profile_account_path) +- else + - header_title "Two-Factor Authentication", profile_two_factor_auth_path - @content_class = "limit-container-width" unless fluid_layout + = render 'profiles/head' - if inject_u2f_api? diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml index ef8d8051cbf..9e2688e492e 100644 --- a/app/views/projects/activity.html.haml +++ b/app/views/projects/activity.html.haml @@ -1,5 +1,8 @@ - @no_container = true +- if show_new_nav? + - add_to_breadcrumbs("Project", project_path(@project)) + - page_title "Activity" = render "projects/head" diff --git a/app/views/projects/artifacts/browse.html.haml b/app/views/projects/artifacts/browse.html.haml index 576e5b385af..a33743c2f57 100644 --- a/app/views/projects/artifacts/browse.html.haml +++ b/app/views/projects/artifacts/browse.html.haml @@ -5,12 +5,6 @@ .tree-holder .nav-block - .tree-controls - = link_to download_project_job_artifacts_path(@project, @build), - rel: 'nofollow', download: '', class: 'btn btn-default download' do - = icon('download') - Download artifacts archive - %ul.breadcrumb.repo-breadcrumb %li = link_to 'Artifacts', browse_project_job_artifacts_path(@project, @build) @@ -18,6 +12,12 @@ %li = link_to truncate(title, length: 40), browse_project_job_artifacts_path(@project, @build, path) + .tree-controls + = link_to download_project_job_artifacts_path(@project, @build), + rel: 'nofollow', download: '', class: 'btn btn-default download' do + = icon('download') + Download artifacts archive + .tree-content-holder %table.table.tree-table %thead diff --git a/app/views/projects/blob/edit.html.haml b/app/views/projects/blob/edit.html.haml index f8cb612a2b4..992fe7f717f 100644 --- a/app/views/projects/blob/edit.html.haml +++ b/app/views/projects/blob/edit.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Repository" - @no_container = true - page_title "Edit", @blob.path, @ref - content_for :page_specific_javascripts do diff --git a/app/views/projects/blob/new.html.haml b/app/views/projects/blob/new.html.haml index 8620a470041..a4263774dfd 100644 --- a/app/views/projects/blob/new.html.haml +++ b/app/views/projects/blob/new.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Repository" - page_title "New File", @path.presence, @ref - content_for :page_specific_javascripts do = page_specific_javascript_tag('lib/ace.js') diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml index 6e2ae4717cd..7dd834e84b5 100644 --- a/app/views/projects/blob/show.html.haml +++ b/app/views/projects/blob/show.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Repository" - @no_container = true - page_title @blob.path, @ref diff --git a/app/views/projects/boards/_show.html.haml b/app/views/projects/boards/_show.html.haml index 07272ea2df1..2076e46fde8 100644 --- a/app/views/projects/boards/_show.html.haml +++ b/app/views/projects/boards/_show.html.haml @@ -3,8 +3,7 @@ - page_title "Boards" - if show_new_nav? - - content_for :sub_title_before do - %li= link_to "Issues", project_issues_path(@project) + - add_to_breadcrumbs("Issues", project_issues_path(@project)) - content_for :page_specific_javascripts do = webpack_bundle_tag 'common_vue' diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml index 8bc1996452b..945a5c11d6d 100644 --- a/app/views/projects/branches/index.html.haml +++ b/app/views/projects/branches/index.html.haml @@ -2,11 +2,15 @@ - page_title "Branches" = render "projects/commits/head" +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) + %div{ class: container_class } .top-area.adjust - .nav-text - Protected branches can be managed in - = link_to 'project settings', project_protected_branches_path(@project) + - if can?(current_user, :admin_project, @project) + .nav-text + Protected branches can be managed in + = link_to 'project settings', project_protected_branches_path(@project) .nav-controls = form_tag(filter_branches_path, method: :get) do diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml index b8547c10c73..844ebb65148 100644 --- a/app/views/projects/commits/show.html.haml +++ b/app/views/projects/commits/show.html.haml @@ -1,9 +1,13 @@ - @no_container = true +- breadcrumb_title _("Commits") - page_title _("Commits"), @ref = content_for :meta_tags do = auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, rss_url_options), title: "#{@project.name}:#{@ref} commits") +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) + = content_for :sub_nav do = render "head" diff --git a/app/views/projects/compare/index.html.haml b/app/views/projects/compare/index.html.haml index 2cf14859f30..05de21e8dbf 100644 --- a/app/views/projects/compare/index.html.haml +++ b/app/views/projects/compare/index.html.haml @@ -1,5 +1,7 @@ - @no_container = true - page_title "Compare" +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) = render "projects/commits/head" %div{ class: container_class } diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml index a1bca2cf83a..8bc863f77b3 100644 --- a/app/views/projects/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -1,5 +1,8 @@ - @no_container = true +- breadcrumb_title "Compare" - page_title "#{params[:from]}...#{params[:to]}" +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) = render "projects/commits/head" %div{ class: container_class } diff --git a/app/views/projects/cycle_analytics/show.html.haml b/app/views/projects/cycle_analytics/show.html.haml index 7000b289f75..c704635ead3 100644 --- a/app/views/projects/cycle_analytics/show.html.haml +++ b/app/views/projects/cycle_analytics/show.html.haml @@ -1,5 +1,7 @@ - @no_container = true - page_title "Cycle Analytics" +- if show_new_nav? + - add_to_breadcrumbs("Project", project_path(@project)) - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('common_vue') = page_specific_javascript_bundle_tag('cycle_analytics') @@ -9,8 +11,8 @@ #cycle-analytics{ class: container_class, "v-cloak" => "true", data: { request_path: project_cycle_analytics_path(@project) } } - if @cycle_analytics_no_data .landing.content-block{ "v-if" => "!isOverviewDialogDismissed" } - %button.dismiss-button{ type: 'button', 'aria-label': 'Dismiss Cycle Analytics introduction box' } - = icon("times", "@click" => "dismissOverviewDialog()") + %button.dismiss-button{ type: 'button', 'aria-label': 'Dismiss Cycle Analytics introduction box', "@click" => "dismissOverviewDialog()" } + = icon("times") .svg-container = custom_icon('icon_cycle_analytics_splash') .inner-content diff --git a/app/views/projects/environments/index.html.haml b/app/views/projects/environments/index.html.haml index 30cdbc5ae04..d0f723af5bf 100644 --- a/app/views/projects/environments/index.html.haml +++ b/app/views/projects/environments/index.html.haml @@ -2,6 +2,9 @@ - page_title "Environments" = render "projects/pipelines/head" +- if show_new_nav? + - add_to_breadcrumbs("Pipelines", project_pipelines_path(@project)) + - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('common_vue') = page_specific_javascript_bundle_tag("environments") diff --git a/app/views/projects/environments/new.html.haml b/app/views/projects/environments/new.html.haml index 24638c77cbb..88f43a1e7e4 100644 --- a/app/views/projects/environments/new.html.haml +++ b/app/views/projects/environments/new.html.haml @@ -1,4 +1,5 @@ - @no_container = true +- breadcrumb_title "Environments" - page_title 'New Environment' = render "projects/pipelines/head" diff --git a/app/views/projects/graphs/charts.html.haml b/app/views/projects/graphs/charts.html.haml index 464ac34d961..249b9d82ad9 100644 --- a/app/views/projects/graphs/charts.html.haml +++ b/app/views/projects/graphs/charts.html.haml @@ -1,5 +1,7 @@ - @no_container = true - page_title "Charts" +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('common_d3') = page_specific_javascript_bundle_tag('graphs') diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml index 640e0d689ca..4256a8c4d7e 100644 --- a/app/views/projects/graphs/show.html.haml +++ b/app/views/projects/graphs/show.html.haml @@ -3,6 +3,10 @@ - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('common_d3') = page_specific_javascript_bundle_tag('graphs') + +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) + = render 'projects/commits/head' %div{ class: container_class } diff --git a/app/views/projects/issues/new.html.haml b/app/views/projects/issues/new.html.haml index e8aae0f47e2..60fe442014f 100644 --- a/app/views/projects/issues/new.html.haml +++ b/app/views/projects/issues/new.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Issues" - page_title "New Issue" %h3.page-title diff --git a/app/views/projects/jobs/_header.html.haml b/app/views/projects/jobs/_header.html.haml index d81b8f6bb4c..83a2af1dc74 100644 --- a/app/views/projects/jobs/_header.html.haml +++ b/app/views/projects/jobs/_header.html.haml @@ -1,7 +1,7 @@ - show_controls = local_assigns.fetch(:show_controls, true) - pipeline = @build.pipeline -.content-block.build-header.top-area +.content-block.build-header.top-area.page-content-header .header-content = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: @build.status_title %strong diff --git a/app/views/projects/jobs/index.html.haml b/app/views/projects/jobs/index.html.haml index 8604c7d3ea4..d78891546f7 100644 --- a/app/views/projects/jobs/index.html.haml +++ b/app/views/projects/jobs/index.html.haml @@ -2,6 +2,9 @@ - page_title "Jobs" = render "projects/pipelines/head" +- if show_new_nav? + - add_to_breadcrumbs("Pipelines", project_pipelines_path(@project)) + %div{ class: container_class } .top-area - build_path_proc = ->(scope) { project_jobs_path(@project, scope: scope) } diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml index 8fbc4588902..d02ea5cccc3 100644 --- a/app/views/projects/labels/index.html.haml +++ b/app/views/projects/labels/index.html.haml @@ -1,6 +1,11 @@ - @no_container = true - page_title "Labels" - hide_class = '' + +- if show_new_nav? && can?(current_user, :admin_label, @project) + - content_for :breadcrumbs_extra do + = link_to "New label", new_namespace_project_label_path(@project.namespace, @project), class: "btn btn-new" + = render "shared/mr_head" - if @labels.exists? || @prioritized_labels.exists? @@ -9,7 +14,7 @@ .nav-text Labels can be applied to issues and merge requests. Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging. - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } - if can?(current_user, :admin_label, @project) = link_to new_project_label_path(@project), class: "btn btn-new" do New label diff --git a/app/views/projects/labels/new.html.haml b/app/views/projects/labels/new.html.haml index 79e90b7ca3b..562b6fb8d8c 100644 --- a/app/views/projects/labels/new.html.haml +++ b/app/views/projects/labels/new.html.haml @@ -1,4 +1,5 @@ - @no_container = true +- breadcrumb_title "Labels" - page_title "New Label" = render "shared/mr_head" diff --git a/app/views/projects/merge_requests/creations/new.html.haml b/app/views/projects/merge_requests/creations/new.html.haml index 2e798ce780a..3220512d60d 100644 --- a/app/views/projects/merge_requests/creations/new.html.haml +++ b/app/views/projects/merge_requests/creations/new.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Merge Requests" - page_title "New Merge Request" - if @merge_request.can_be_created && !params[:change_branches] diff --git a/app/views/projects/milestones/index.html.haml b/app/views/projects/milestones/index.html.haml index e53fcd6e425..a89387bc8f1 100644 --- a/app/views/projects/milestones/index.html.haml +++ b/app/views/projects/milestones/index.html.haml @@ -1,5 +1,10 @@ - @no_container = true - page_title 'Milestones' + +- if show_new_nav? + - content_for :breadcrumbs_extra do + = link_to "New milestone", new_namespace_project_milestone_path(@project.namespace, @project), class: 'btn btn-new', title: 'New milestone' + = render "shared/mr_head" %div{ class: container_class } diff --git a/app/views/projects/milestones/new.html.haml b/app/views/projects/milestones/new.html.haml index 586eb909afa..84ffbc0a926 100644 --- a/app/views/projects/milestones/new.html.haml +++ b/app/views/projects/milestones/new.html.haml @@ -1,4 +1,5 @@ - @no_container = true +- breadcrumb_title "Milestones" - page_title "New Milestone" = render "shared/mr_head" diff --git a/app/views/projects/network/show.html.haml b/app/views/projects/network/show.html.haml index e8c26636be9..ab948df4a3f 100644 --- a/app/views/projects/network/show.html.haml +++ b/app/views/projects/network/show.html.haml @@ -1,6 +1,9 @@ +- breadcrumb_title "Graph" - page_title "Graph", @ref - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('network') +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) = render "projects/commits/head" = render "head" %div{ class: container_class } diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index b0b7575f0d1..a2d7a21d5f6 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -1,3 +1,6 @@ +- @breadcrumb_link = dashboard_projects_path +- breadcrumb_title "Projects" +- @hide_top_links = true - page_title 'New Project' - header_title "Projects", dashboard_projects_path - visibility_level = params.dig(:project, :visibility_level) || default_project_visibility diff --git a/app/views/projects/pipeline_schedules/index.html.haml b/app/views/projects/pipeline_schedules/index.html.haml index c4ee064ac43..8426b29bb14 100644 --- a/app/views/projects/pipeline_schedules/index.html.haml +++ b/app/views/projects/pipeline_schedules/index.html.haml @@ -1,9 +1,18 @@ +- breadcrumb_title "Schedules" + - content_for :page_specific_javascripts do = webpack_bundle_tag 'common_vue' = webpack_bundle_tag 'schedules_index' - @no_container = true - page_title _("Pipeline Schedules") + +- if show_new_nav? && can?(current_user, :create_pipeline_schedule, @project) + - content_for :breadcrumbs_extra do + = link_to _('New schedule'), new_namespace_project_pipeline_schedule_path(@project.namespace, @project), class: 'btn btn-create' + + - add_to_breadcrumbs("Pipelines", project_pipelines_path(@project)) + = render "projects/pipelines/head" %div{ class: container_class } @@ -13,7 +22,7 @@ = render "tabs", schedule_path_proc: schedule_path_proc, all_schedules: @all_schedules, scope: @scope - if can?(current_user, :create_pipeline_schedule, @project) - .nav-controls + .nav-controls{ class: ("visible-xs" if show_new_nav?) } = link_to new_project_pipeline_schedule_path(@project), class: 'btn btn-create' do %span= _('New schedule') diff --git a/app/views/projects/pipeline_schedules/new.html.haml b/app/views/projects/pipeline_schedules/new.html.haml index 87390d4dd02..c7237cb96d8 100644 --- a/app/views/projects/pipeline_schedules/new.html.haml +++ b/app/views/projects/pipeline_schedules/new.html.haml @@ -1,5 +1,10 @@ +- breadcrumb_title "Schedules" +- @breadcrumb_link = namespace_project_pipeline_schedules_path(@project.namespace, @project) - page_title _("New Pipeline Schedule") +- if show_new_nav? + - add_to_breadcrumbs("Pipelines", project_pipelines_path(@project)) + %h3.page-title = _("Schedule a new pipeline") %hr diff --git a/app/views/projects/pipelines/charts.html.haml b/app/views/projects/pipelines/charts.html.haml index 78002e8cd64..fd3ad69d85d 100644 --- a/app/views/projects/pipelines/charts.html.haml +++ b/app/views/projects/pipelines/charts.html.haml @@ -1,5 +1,7 @@ - @no_container = true - page_title _("Charts"), _("Pipelines") +- if show_new_nav? + - add_to_breadcrumbs("Pipelines", project_pipelines_path(@project)) - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('common_d3') = page_specific_javascript_bundle_tag('graphs') diff --git a/app/views/projects/pipelines/new.html.haml b/app/views/projects/pipelines/new.html.haml index 308f2611e02..c966df62856 100644 --- a/app/views/projects/pipelines/new.html.haml +++ b/app/views/projects/pipelines/new.html.haml @@ -1,3 +1,4 @@ +- breadcrumb_title "Pipelines" - page_title "New Pipeline" %h3.page-title diff --git a/app/views/projects/project_members/index.html.haml b/app/views/projects/project_members/index.html.haml index 25153fd0b6f..9f7c5a315eb 100644 --- a/app/views/projects/project_members/index.html.haml +++ b/app/views/projects/project_members/index.html.haml @@ -1,5 +1,8 @@ - page_title "Members" +- if show_new_nav? + - add_to_breadcrumbs("Settings", edit_project_path(@project)) + .row.prepend-top-default .col-lg-12 %h4 diff --git a/app/views/projects/services/edit.html.haml b/app/views/projects/services/edit.html.haml index 0f1a76a104a..8056217bb1e 100644 --- a/app/views/projects/services/edit.html.haml +++ b/app/views/projects/services/edit.html.haml @@ -1,3 +1,8 @@ +- breadcrumb_title "Integrations" - page_title @service.title, "Services" + +- if show_new_nav? + - add_to_breadcrumbs("Settings", edit_project_path(@project)) + = render "projects/settings/head" = render 'form' diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml index 6afb38c5709..0c4130857da 100644 --- a/app/views/projects/settings/ci_cd/show.html.haml +++ b/app/views/projects/settings/ci_cd/show.html.haml @@ -1,5 +1,9 @@ - @content_class = "limit-container-width" unless fluid_layout - page_title "Pipelines" + +- if show_new_nav? + - add_to_breadcrumbs("Settings", edit_project_path(@project)) + = render "projects/settings/head" = render 'projects/runners/index' diff --git a/app/views/projects/settings/integrations/show.html.haml b/app/views/projects/settings/integrations/show.html.haml index 1d1d0849289..149da96d3f6 100644 --- a/app/views/projects/settings/integrations/show.html.haml +++ b/app/views/projects/settings/integrations/show.html.haml @@ -1,5 +1,7 @@ - @content_class = "limit-container-width" unless fluid_layout - page_title 'Integrations' +- if show_new_nav? + - add_to_breadcrumbs("Settings", edit_project_path(@project)) = render "projects/settings/head" = render 'projects/hooks/index' = render 'projects/services/index' diff --git a/app/views/projects/settings/repository/show.html.haml b/app/views/projects/settings/repository/show.html.haml index 0f20ecf8c69..cb37f3c7580 100644 --- a/app/views/projects/settings/repository/show.html.haml +++ b/app/views/projects/settings/repository/show.html.haml @@ -1,5 +1,9 @@ - page_title "Repository" - @content_class = "limit-container-width" unless fluid_layout + +- if show_new_nav? + - add_to_breadcrumbs("Settings", edit_project_path(@project)) + = render "projects/settings/head" - content_for :page_specific_javascripts do diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index a73e111ad6d..49d0a6828fe 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -1,4 +1,5 @@ - @no_container = true +- breadcrumb_title "Project" - @content_class = "limit-container-width" unless fluid_layout - flash_message_container = show_new_nav? ? :new_global_flash : :flash_message diff --git a/app/views/projects/snippets/index.html.haml b/app/views/projects/snippets/index.html.haml index 4f8ce526c83..ccc5fe80755 100644 --- a/app/views/projects/snippets/index.html.haml +++ b/app/views/projects/snippets/index.html.haml @@ -1,19 +1,16 @@ - page_title "Snippets" +- if show_new_nav? && can?(current_user, :create_project_snippet, @project) + - content_for :breadcrumbs_extra do + = link_to "New snippet", new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new", title: "New snippet" + - if current_user .top-area - include_private = @project.team.member?(current_user) || current_user.admin? = render partial: 'snippets/snippets_scope_menu', locals: { subject: @project, include_private: include_private } - .nav-controls.hidden-xs + .nav-controls{ class: ("visible-xs" if show_new_nav?) } - if can?(current_user, :create_project_snippet, @project) - = link_to new_project_snippet_path(@project), class: "btn btn-new", title: "New snippet" do - New snippet - -- if can?(current_user, :create_project_snippet, @project) - .visible-xs - - = link_to new_project_snippet_path(@project), class: "btn btn-new btn-block", title: "New snippet" do - New snippet + = link_to "New snippet", new_project_snippet_path(@project), class: "btn btn-new", title: "New snippet" = render 'snippets/snippets' diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml index bf97cbc1f68..00000e0667c 100644 --- a/app/views/projects/tags/index.html.haml +++ b/app/views/projects/tags/index.html.haml @@ -3,6 +3,9 @@ - page_title "Tags" = render "projects/commits/head" +- if show_new_nav? + - add_to_breadcrumbs("Repository", project_tree_path(@project)) + .flex-list{ class: container_class } .top-area.adjust .nav-text.row-main-content diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index f727f340bb9..c8587245f88 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -1,4 +1,5 @@ - @no_container = true +- breadcrumb_title _("Repository") - @content_class = "limit-container-width" unless fluid_layout - page_title @path.presence || _("Files"), @ref diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml index 13591dd8e74..9dadd685ea2 100644 --- a/app/views/projects/wikis/show.html.haml +++ b/app/views/projects/wikis/show.html.haml @@ -1,4 +1,5 @@ - @content_class = "limit-container-width limit-container-width-sm" unless fluid_layout +- breadcrumb_title "Wiki" - page_title @page.title.capitalize, "Wiki" .wiki-page-header.has-sidebar-toggle diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 215dbb3909e..499697f2777 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,3 +1,5 @@ +- @hide_top_links = true +- breadcrumb_title "Search" - page_title @search_term .prepend-top-default diff --git a/app/views/shared/_new_project_item_select.html.haml b/app/views/shared/_new_project_item_select.html.haml index 9ed844cf5e7..c1acee1a211 100644 --- a/app/views/shared/_new_project_item_select.html.haml +++ b/app/views/shared/_new_project_item_select.html.haml @@ -1,19 +1,6 @@ - if @projects.any? .project-item-select-holder = project_select_tag :project_path, class: "project-item-select", data: { include_groups: local_assigns[:include_groups], order_by: 'last_activity_at' }, with_feature_enabled: local_assigns[:with_feature_enabled] - %a.btn.btn-new.new-project-item-select-button + %a.btn.btn-new.new-project-item-select-button{ data: { relative_path: local_assigns[:path] } } = local_assigns[:label] = icon('caret-down') - - :javascript - $('.new-project-item-select-button').on('click', function() { - $('.project-item-select').select2('open'); - }); - - var relativePath = '#{local_assigns[:path]}'; - - $('.project-item-select').on('click', function() { - window.location = $(this).val() + '/' + relativePath; - }); - - new ProjectSelect() diff --git a/app/views/shared/empty_states/_issues.html.haml b/app/views/shared/empty_states/_issues.html.haml index 046b127f73c..b0c0ab523c7 100644 --- a/app/views/shared/empty_states/_issues.html.haml +++ b/app/views/shared/empty_states/_issues.html.haml @@ -16,7 +16,8 @@ Also, issues are searchable and filterable. - if project_select_button = render 'shared/new_project_item_select', path: 'issues/new', label: 'New issue' - = link_to 'New issue', button_path, class: 'btn btn-new', title: 'New issue', id: 'new_issue_link' + - else + = link_to 'New issue', button_path, class: 'btn btn-new', title: 'New issue', id: 'new_issue_link' - else .text-center %h4 There are no issues to show. diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml index bdb573cb8fd..6f0b7600698 100644 --- a/app/views/shared/issuable/_search_bar.html.haml +++ b/app/views/shared/issuable/_search_bar.html.haml @@ -98,7 +98,7 @@ - if type == :boards - if can?(current_user, :admin_list, @project) .dropdown.prepend-left-10#js-add-list - %button.btn.btn-create.btn-inverted.js-new-board-list{ type: "button", data: { toggle: "dropdown", labels: labels_filter_path, namespace_path: @project.try(:namespace).try(:path), project_path: @project.try(:path) } } + %button.btn.btn-create.btn-inverted.js-new-board-list{ type: "button", data: { toggle: "dropdown", labels: labels_filter_path, namespace_path: @project.try(:namespace).try(:full_path), project_path: @project.try(:path) } } Add list .dropdown-menu.dropdown-menu-paging.dropdown-menu-align-right.dropdown-menu-issues-board-new.dropdown-menu-selectable = render partial: "shared/issuable/label_page_default", locals: { show_footer: true, show_create: true, show_boards_content: true, title: "Add list" } diff --git a/app/views/snippets/new.html.haml b/app/views/snippets/new.html.haml index ca8afb4bb6a..f01915107e3 100644 --- a/app/views/snippets/new.html.haml +++ b/app/views/snippets/new.html.haml @@ -1,3 +1,5 @@ +- @hide_top_links = true +- breadcrumb_title "Snippets" - page_title "New Snippet" %h3.page-title New Snippet diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 8818590362d..706f13dd004 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -1,3 +1,4 @@ +- @hide_top_links = true - @content_class = "limit-container-width limited-inner-width-container" unless fluid_layout - page_title "#{@snippet.title} (#{@snippet.to_reference})", "Snippets" diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index f246bd7a586..919ba5d15d3 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -1,3 +1,5 @@ +- @hide_top_links = true +- @hide_breadcrumbs = true - page_title @user.name - page_description @user.bio - content_for :page_specific_javascripts do diff --git a/app/workers/project_service_worker.rb b/app/workers/project_service_worker.rb index fdfdeab7b41..4883d848c53 100644 --- a/app/workers/project_service_worker.rb +++ b/app/workers/project_service_worker.rb @@ -2,6 +2,8 @@ class ProjectServiceWorker include Sidekiq::Worker include DedicatedSidekiqQueue + sidekiq_options dead: false + def perform(hook_id, data) data = data.with_indifferent_access Service.find(hook_id).execute(data) diff --git a/app/workers/web_hook_worker.rb b/app/workers/web_hook_worker.rb index ad5ddf02a12..713c0228040 100644 --- a/app/workers/web_hook_worker.rb +++ b/app/workers/web_hook_worker.rb @@ -2,7 +2,7 @@ class WebHookWorker include Sidekiq::Worker include DedicatedSidekiqQueue - sidekiq_options retry: 4 + sidekiq_options retry: 4, dead: false def perform(hook_id, data, hook_name) hook = WebHook.find(hook_id) diff --git a/changelogs/unreleased/12892-reset-css-text-align-to-initial-for-rtl.md b/changelogs/unreleased/12892-reset-css-text-align-to-initial-for-rtl.md new file mode 100644 index 00000000000..87e95240bba --- /dev/null +++ b/changelogs/unreleased/12892-reset-css-text-align-to-initial-for-rtl.md @@ -0,0 +1,4 @@ +--- +title: "reset text-align to initial to let elements with dir="auto" align texts to right in RTL languages ( default is left )" +merge_request: 12892 +author: goshhob diff --git a/changelogs/unreleased/23036-replace-dashboard-event-filters-spinach.yml b/changelogs/unreleased/23036-replace-dashboard-event-filters-spinach.yml new file mode 100644 index 00000000000..807cd097178 --- /dev/null +++ b/changelogs/unreleased/23036-replace-dashboard-event-filters-spinach.yml @@ -0,0 +1,4 @@ +--- +title: Replaces dashboard/event_filters.feature spinach with rspec +merge_request: 12651 +author: Alexander Randa (@randaalex) diff --git a/changelogs/unreleased/23036-replace-dashboard-spinach.yml b/changelogs/unreleased/23036-replace-dashboard-spinach.yml new file mode 100644 index 00000000000..b3197c4cfa6 --- /dev/null +++ b/changelogs/unreleased/23036-replace-dashboard-spinach.yml @@ -0,0 +1,4 @@ +--- +title: Replaces dashboard/dashboard.feature spinach with rspec +merge_request: 12876 +author: Alexander Randa (@randaalex) diff --git a/changelogs/unreleased/29901-refactor-initialization-dropzone_input-js.yml b/changelogs/unreleased/29901-refactor-initialization-dropzone_input-js.yml new file mode 100644 index 00000000000..8850422fc88 --- /dev/null +++ b/changelogs/unreleased/29901-refactor-initialization-dropzone_input-js.yml @@ -0,0 +1,4 @@ +--- +title: refactor initializations in dropzone_input.js +merge_request: 12768 +author: Brandon Everett diff --git a/changelogs/unreleased/31571-don-t-let-webhooks-jobs-go-to-the-dead-jobs-queue.yml b/changelogs/unreleased/31571-don-t-let-webhooks-jobs-go-to-the-dead-jobs-queue.yml new file mode 100644 index 00000000000..69900f0b314 --- /dev/null +++ b/changelogs/unreleased/31571-don-t-let-webhooks-jobs-go-to-the-dead-jobs-queue.yml @@ -0,0 +1,5 @@ +--- +title: Prevent web hook and project service background jobs from going to the dead + jobs queue +merge_request: +author: diff --git a/changelogs/unreleased/33741-clarify-k8s-service-keys.yml b/changelogs/unreleased/33741-clarify-k8s-service-keys.yml new file mode 100644 index 00000000000..91142a0d580 --- /dev/null +++ b/changelogs/unreleased/33741-clarify-k8s-service-keys.yml @@ -0,0 +1,5 @@ +--- +title: Clarifies and rearranges the input variables on the kubernetes integration + page and adjusts the docs slightly to meet the same order +merge_request: !12188 +author: diff --git a/changelogs/unreleased/33770-respect-blockquote-line-breaks.yml b/changelogs/unreleased/33770-respect-blockquote-line-breaks.yml new file mode 100644 index 00000000000..3a45ad88270 --- /dev/null +++ b/changelogs/unreleased/33770-respect-blockquote-line-breaks.yml @@ -0,0 +1,4 @@ +--- +title: Respect blockquote line breaks in markdown +merge_request: +author: diff --git a/changelogs/unreleased/34173-add-portuguese-brazil-translations-of-commits-page.yml b/changelogs/unreleased/34173-add-portuguese-brazil-translations-of-commits-page.yml new file mode 100644 index 00000000000..16a9216852d --- /dev/null +++ b/changelogs/unreleased/34173-add-portuguese-brazil-translations-of-commits-page.yml @@ -0,0 +1,4 @@ +--- +title: Add Portuguese Brazil translations of Commits Page +merge_request: 12408 +author: Huang Tao diff --git a/changelogs/unreleased/34325-reinstate-is_admin-for-user-api.yml b/changelogs/unreleased/34325-reinstate-is_admin-for-user-api.yml deleted file mode 100644 index 3bed1fbe16e..00000000000 --- a/changelogs/unreleased/34325-reinstate-is_admin-for-user-api.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Return `is_admin` attribute in the GET /user endpoint for admins -merge_request: 12811 -author: diff --git a/changelogs/unreleased/34468-remove-extra-blank-on-admin-on-mobile.yml b/changelogs/unreleased/34468-remove-extra-blank-on-admin-on-mobile.yml new file mode 100644 index 00000000000..99291b4c75a --- /dev/null +++ b/changelogs/unreleased/34468-remove-extra-blank-on-admin-on-mobile.yml @@ -0,0 +1,4 @@ +--- +title: Use smaller min-width for dropdown-menu-nav only on mobile +merge_request: 12528 +author: Takuya Noguchi diff --git a/changelogs/unreleased/34563-usage-ping-github.yml b/changelogs/unreleased/34563-usage-ping-github.yml new file mode 100644 index 00000000000..3ab982beea3 --- /dev/null +++ b/changelogs/unreleased/34563-usage-ping-github.yml @@ -0,0 +1,4 @@ +--- +title: Add GitHub imported projects count to usage data +merge_request: +author: diff --git a/changelogs/unreleased/34728-fix-application-setting-created-when-redis-down.yml b/changelogs/unreleased/34728-fix-application-setting-created-when-redis-down.yml deleted file mode 100644 index 4fddabebf36..00000000000 --- a/changelogs/unreleased/34728-fix-application-setting-created-when-redis-down.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Prevent bad data being added to application settings when Redis is unavailable -merge_request: 12750 -author: diff --git a/changelogs/unreleased/34789-add-japanese-translations-of-commits-page.yml b/changelogs/unreleased/34789-add-japanese-translations-of-commits-page.yml new file mode 100644 index 00000000000..40a24847580 --- /dev/null +++ b/changelogs/unreleased/34789-add-japanese-translations-of-commits-page.yml @@ -0,0 +1,4 @@ +--- +title: Add Japanese translations for Cycle Analytics & Project pages & Repository pages & Commits pages & Pipeline Charts. +merge_request: 12693 +author: Huang Tao diff --git a/changelogs/unreleased/34831-remove-coffee-rails-gem.yml b/changelogs/unreleased/34831-remove-coffee-rails-gem.yml new file mode 100644 index 00000000000..b555f112b8d --- /dev/null +++ b/changelogs/unreleased/34831-remove-coffee-rails-gem.yml @@ -0,0 +1,4 @@ +--- +title: Remove coffee-rails gem +merge_request: +author: Takuya Noguchi diff --git a/changelogs/unreleased/34880-add-ukrainian-translations-to-i18n.yml b/changelogs/unreleased/34880-add-ukrainian-translations-to-i18n.yml new file mode 100644 index 00000000000..4e8a042fdb5 --- /dev/null +++ b/changelogs/unreleased/34880-add-ukrainian-translations-to-i18n.yml @@ -0,0 +1,4 @@ +--- +title: Add Ukrainian translations for Cycle Analytics & Project pages & Repository pages & Commits pages & Pipeline Charts. +merge_request: 12744 +author: Huang Tao diff --git a/changelogs/unreleased/34881-add-russian-translations-to-i18n.yml b/changelogs/unreleased/34881-add-russian-translations-to-i18n.yml new file mode 100644 index 00000000000..aed05dd1031 --- /dev/null +++ b/changelogs/unreleased/34881-add-russian-translations-to-i18n.yml @@ -0,0 +1,4 @@ +--- +title: Add Russian translations for Cycle Analytics & Project pages & Repository pages & Commits pages & Pipeline Charts. +merge_request: 12743 +author: Huang Tao diff --git a/changelogs/unreleased/34927-protect-manual-actions-on-tags.yml b/changelogs/unreleased/34927-protect-manual-actions-on-tags.yml new file mode 100644 index 00000000000..d996ae2826a --- /dev/null +++ b/changelogs/unreleased/34927-protect-manual-actions-on-tags.yml @@ -0,0 +1,4 @@ +--- +title: Protect manual actions against protected tag too +merge_request: 12908 +author: diff --git a/changelogs/unreleased/34930-fix-edited-by.yml b/changelogs/unreleased/34930-fix-edited-by.yml new file mode 100644 index 00000000000..f133dfab0c2 --- /dev/null +++ b/changelogs/unreleased/34930-fix-edited-by.yml @@ -0,0 +1,4 @@ +--- +title: Use Ghost user for last_edited_by and merge_user when original user is deleted +merge_request: 12933 +author: diff --git a/changelogs/unreleased/35087-mr-status-misaligned.yml b/changelogs/unreleased/35087-mr-status-misaligned.yml new file mode 100644 index 00000000000..3be43125a61 --- /dev/null +++ b/changelogs/unreleased/35087-mr-status-misaligned.yml @@ -0,0 +1,4 @@ +--- +title: Fix alignment of controls in mr issuable list +merge_request: +author: diff --git a/changelogs/unreleased/35155-upgrade-fog-core-to-1-44-3-and-its-providers-to-the-latest.yml b/changelogs/unreleased/35155-upgrade-fog-core-to-1-44-3-and-its-providers-to-the-latest.yml new file mode 100644 index 00000000000..9d9558347ba --- /dev/null +++ b/changelogs/unreleased/35155-upgrade-fog-core-to-1-44-3-and-its-providers-to-the-latest.yml @@ -0,0 +1,4 @@ +--- +title: Bump fog-core to 1.44.3 and fog providers' plugins to latest +merge_request: 12897 +author: Takuya Noguchi diff --git a/changelogs/unreleased/35164-cycle-analytics-firefox.yml b/changelogs/unreleased/35164-cycle-analytics-firefox.yml new file mode 100644 index 00000000000..0b7115136ca --- /dev/null +++ b/changelogs/unreleased/35164-cycle-analytics-firefox.yml @@ -0,0 +1,4 @@ +--- +title: allow closing Cycle Analytics intro box in firefox +merge_request: +author: diff --git a/changelogs/unreleased/35181-cannot-create-label-from-board-page.yml b/changelogs/unreleased/35181-cannot-create-label-from-board-page.yml new file mode 100644 index 00000000000..4afe603720d --- /dev/null +++ b/changelogs/unreleased/35181-cannot-create-label-from-board-page.yml @@ -0,0 +1,4 @@ +--- +title: Fix label creation from new list for subgroup projects +merge_request: +author: diff --git a/changelogs/unreleased/35209-add-wip-info-new-nav-pref.yml b/changelogs/unreleased/35209-add-wip-info-new-nav-pref.yml new file mode 100644 index 00000000000..680e1cd8222 --- /dev/null +++ b/changelogs/unreleased/35209-add-wip-info-new-nav-pref.yml @@ -0,0 +1,4 @@ +--- +title: Add wip message to new navigation preference section +merge_request: +author: diff --git a/changelogs/unreleased/35225-transient-poll.yml b/changelogs/unreleased/35225-transient-poll.yml new file mode 100644 index 00000000000..59e2e738c7b --- /dev/null +++ b/changelogs/unreleased/35225-transient-poll.yml @@ -0,0 +1,4 @@ +--- +title: fix transient js error in rspec tests +merge_request: +author: diff --git a/changelogs/unreleased/35253-desc-protected-branches-for-non-member.yml b/changelogs/unreleased/35253-desc-protected-branches-for-non-member.yml new file mode 100644 index 00000000000..9b2a66da1c3 --- /dev/null +++ b/changelogs/unreleased/35253-desc-protected-branches-for-non-member.yml @@ -0,0 +1,4 @@ +--- +title: Hide description about protected branches to non-member +merge_request: 12945 +author: Takuya Noguchi diff --git a/changelogs/unreleased/adam-external-issue-references-spike.yml b/changelogs/unreleased/adam-external-issue-references-spike.yml deleted file mode 100644 index aeec6688425..00000000000 --- a/changelogs/unreleased/adam-external-issue-references-spike.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Improve support for external issue references -merge_request: 12485 -author: diff --git a/changelogs/unreleased/bvl-free-system-namespace.yml b/changelogs/unreleased/bvl-free-system-namespace.yml new file mode 100644 index 00000000000..6c2d1e0e61f --- /dev/null +++ b/changelogs/unreleased/bvl-free-system-namespace.yml @@ -0,0 +1,4 @@ +--- +title: "Move uploads from `uploads/system` to `uploads/-/system` to free up `system` as a group name" +merge_request: 11713 +author: diff --git a/changelogs/unreleased/request-store-wrap.yml b/changelogs/unreleased/request-store-wrap.yml new file mode 100644 index 00000000000..8017054b77b --- /dev/null +++ b/changelogs/unreleased/request-store-wrap.yml @@ -0,0 +1,4 @@ +--- +title: Add RequestCache which makes caching with RequestStore easier +merge_request: 12920 +author: diff --git a/changelogs/unreleased/sh-structured-logging.yml b/changelogs/unreleased/sh-structured-logging.yml new file mode 100644 index 00000000000..d89eb93f689 --- /dev/null +++ b/changelogs/unreleased/sh-structured-logging.yml @@ -0,0 +1,4 @@ +--- +title: Add structured logging for Rails processes +merge_request: +author: diff --git a/config/boot.rb b/config/boot.rb index 2d01092acd5..f2830ae3166 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -4,8 +4,3 @@ require 'rubygems' ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) - -# set default directory for multiproces metrics gathering -if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test' - ENV['prometheus_multiproc_dir'] ||= 'tmp/prometheus_multiproc_dir' -end diff --git a/config/environments/test.rb b/config/environments/test.rb index c3b788c038e..986107150cf 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -43,4 +43,9 @@ Rails.application.configure do config.cache_store = :null_store config.active_job.queue_adapter = :test + + if ENV['CI'] && !ENV['RAILS_ENABLE_TEST_LOG'] + config.logger = Logger.new(nil) + config.log_level = :fatal + end end diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index d0ab2dab0af..cb007813b65 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -383,13 +383,13 @@ production: &base # service_validate_url: '/cas/p3/serviceValidate', # logout_url: '/cas/logout'} } # - { name: 'authentiq', - # # for client credentials (client ID and secret), go to https://www.authentiq.com/ + # # for client credentials (client ID and secret), go to https://www.authentiq.com/developers # app_id: 'YOUR_CLIENT_ID', # app_secret: 'YOUR_CLIENT_SECRET', # args: { # scope: 'aq:name email~rs address aq:push' - # # redirect_uri parameter is optional except when 'gitlab.host' in this file is set to 'localhost' - # # redirect_uri: 'YOUR_REDIRECT_URI' + # # callback_url parameter is optional except when 'gitlab.host' in this file is set to 'localhost' + # # callback_url: 'YOUR_CALLBACK_URL' # } # } # - { name: 'github', diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb new file mode 100644 index 00000000000..987324a86c9 --- /dev/null +++ b/config/initializers/7_prometheus_metrics.rb @@ -0,0 +1,12 @@ +require 'prometheus/client' + +Prometheus::Client.configure do |config| + config.logger = Rails.logger + + config.initial_mmap_file_size = 4 * 1024 + config.multiprocess_files_dir = ENV['prometheus_multiproc_dir'] + + if Rails.env.development? && Rails.env.test? + config.multiprocess_files_dir ||= Rails.root.join('tmp/prometheus_multiproc_dir') + end +end diff --git a/config/initializers/gettext_rails_i18n_patch.rb b/config/initializers/gettext_rails_i18n_patch.rb index 69118f464ca..377e5104f9d 100644 --- a/config/initializers/gettext_rails_i18n_patch.rb +++ b/config/initializers/gettext_rails_i18n_patch.rb @@ -33,7 +33,6 @@ module GettextI18nRailsJs [ ".js", ".jsx", - ".coffee", ".vue" ].include? ::File.extname(file) end diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb new file mode 100644 index 00000000000..14902316240 --- /dev/null +++ b/config/initializers/lograge.rb @@ -0,0 +1,21 @@ +# Only use Lograge for Rails +unless Sidekiq.server? + filename = File.join(Rails.root, 'log', "#{Rails.env}_json.log") + + Rails.application.configure do + config.lograge.enabled = true + # Store the lograge JSON files in a separate file + config.lograge.keep_original_rails_log = true + # Don't use the Logstash formatter since this requires logstash-event, an + # unmaintained gem that monkey patches `Time` + config.lograge.formatter = Lograge::Formatters::Json.new + config.lograge.logger = ActiveSupport::Logger.new(filename) + # Add request parameters to log output + config.lograge.custom_options = lambda do |event| + { + time: event.time, + params: event.payload[:params].except(%w(controller action format)) + } + end + end +end diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index da8282ec924..a54d53cbbe2 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -26,7 +26,3 @@ class PEEK_DB_CLIENT end PEEK_DB_VIEW.prepend ::Gitlab::PerformanceBar::PeekQueryTracker - -class Peek::Views::PerformanceBar::ProcessUtilization - prepend ::Gitlab::PerformanceBar::PeekPerformanceBarWithRackBody -end diff --git a/config/routes/uploads.rb b/config/routes/uploads.rb index a49e244af1a..e9c9aa8b2f9 100644 --- a/config/routes/uploads.rb +++ b/config/routes/uploads.rb @@ -1,21 +1,21 @@ scope path: :uploads do # Note attachments and User/Group/Project avatars - get "system/:model/:mounted_as/:id/:filename", + get "-/system/:model/:mounted_as/:id/:filename", to: "uploads#show", constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ } # show uploads for models, snippets (notes) available for now - get ':model/:id/:secret/:filename', + get 'system/:model/:id/:secret/:filename', to: 'uploads#show', constraints: { model: /personal_snippet/, id: /\d+/, filename: /[^\/]+/ } # show temporary uploads - get 'temp/:secret/:filename', + get 'system/temp/:secret/:filename', to: 'uploads#show', constraints: { filename: /[^\/]+/ } # Appearance - get "system/:model/:mounted_as/:id/:filename", + get "-/system/:model/:mounted_as/:id/:filename", to: "uploads#show", constraints: { model: /appearance/, mounted_as: /logo|header_logo/, filename: /.+/ } diff --git a/db/migrate/20170710083355_clean_stage_id_reference_migration.rb b/db/migrate/20170710083355_clean_stage_id_reference_migration.rb new file mode 100644 index 00000000000..681203eaf40 --- /dev/null +++ b/db/migrate/20170710083355_clean_stage_id_reference_migration.rb @@ -0,0 +1,18 @@ +class CleanStageIdReferenceMigration < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + ## + # `MigrateStageIdReferenceInBackground` background migration cleanup. + # + def up + Gitlab::BackgroundMigration.steal('MigrateBuildStageIdReference') + end + + def down + # noop + end +end diff --git a/db/migrate/20170713104829_add_foreign_key_to_merge_requests.rb b/db/migrate/20170713104829_add_foreign_key_to_merge_requests.rb new file mode 100644 index 00000000000..c25d4fd5986 --- /dev/null +++ b/db/migrate/20170713104829_add_foreign_key_to_merge_requests.rb @@ -0,0 +1,45 @@ +class AddForeignKeyToMergeRequests < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + class MergeRequest < ActiveRecord::Base + self.table_name = 'merge_requests' + include ::EachBatch + end + + def up + scope = <<-SQL.strip_heredoc + head_pipeline_id IS NOT NULL + AND NOT EXISTS ( + SELECT 1 FROM ci_pipelines + WHERE ci_pipelines.id = merge_requests.head_pipeline_id + ) + SQL + + MergeRequest.where(scope).each_batch(of: 1000) do |merge_requests| + merge_requests.update_all(head_pipeline_id: nil) + end + + unless foreign_key_exists?(:merge_requests, :head_pipeline_id) + add_concurrent_foreign_key(:merge_requests, :ci_pipelines, + column: :head_pipeline_id, on_delete: :nullify) + end + end + + def down + if foreign_key_exists?(:merge_requests, :head_pipeline_id) + remove_foreign_key(:merge_requests, column: :head_pipeline_id) + end + end + + private + + def foreign_key_exists?(table, column) + foreign_keys(table).any? do |key| + key.options[:column] == column.to_s + end + end +end diff --git a/db/migrate/20170717074009_move_system_upload_folder.rb b/db/migrate/20170717074009_move_system_upload_folder.rb new file mode 100644 index 00000000000..cce31794115 --- /dev/null +++ b/db/migrate/20170717074009_move_system_upload_folder.rb @@ -0,0 +1,60 @@ +class MoveSystemUploadFolder < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + DOWNTIME = false + + def up + unless file_storage? + say 'Using object storage, no need to move.' + return + end + + unless File.directory?(old_directory) + say "#{old_directory} doesn't exist, no need to move it." + return + end + + FileUtils.mkdir_p(File.join(base_directory, '-')) + + say "Moving #{old_directory} -> #{new_directory}" + FileUtils.mv(old_directory, new_directory) + FileUtils.ln_s(new_directory, old_directory) + end + + def down + unless file_storage? + say 'Using object storage, no need to move.' + return + end + + unless File.directory?(new_directory) + say "#{new_directory} doesn't exist, no need to move it." + return + end + + if File.symlink?(old_directory) + say "Removing #{old_directory} -> #{new_directory} symlink" + FileUtils.rm(old_directory) + end + + say "Moving #{new_directory} -> #{old_directory}" + FileUtils.mv(new_directory, old_directory) + end + + def new_directory + File.join(base_directory, '-', 'system') + end + + def old_directory + File.join(base_directory, 'system') + end + + def base_directory + File.join(Rails.root, 'public', 'uploads') + end + + def file_storage? + CarrierWave::Uploader::Base.storage == CarrierWave::Storage::File + end +end diff --git a/db/post_migrate/20170406111121_clean_upload_symlinks.rb b/db/post_migrate/20170406111121_clean_upload_symlinks.rb index 3ac9a6c10bc..fc3a4acc0bb 100644 --- a/db/post_migrate/20170406111121_clean_upload_symlinks.rb +++ b/db/post_migrate/20170406111121_clean_upload_symlinks.rb @@ -6,7 +6,7 @@ class CleanUploadSymlinks < ActiveRecord::Migration disable_ddl_transaction! DOWNTIME = false - DIRECTORIES_TO_MOVE = %w(user project note group appeareance) + DIRECTORIES_TO_MOVE = %w(user project note group appearance) def up return unless file_storage? diff --git a/db/post_migrate/20170612071012_move_personal_snippets_files.rb b/db/post_migrate/20170612071012_move_personal_snippets_files.rb new file mode 100644 index 00000000000..33043364bde --- /dev/null +++ b/db/post_migrate/20170612071012_move_personal_snippets_files.rb @@ -0,0 +1,91 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. +class MovePersonalSnippetsFiles < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + DOWNTIME = false + + def up + return unless file_storage? + + @source_relative_location = File.join('/uploads', 'personal_snippet') + @destination_relative_location = File.join('/uploads', 'system', 'personal_snippet') + + move_personal_snippet_files + end + + def down + return unless file_storage? + + @source_relative_location = File.join('/uploads', 'system', 'personal_snippet') + @destination_relative_location = File.join('/uploads', 'personal_snippet') + + move_personal_snippet_files + end + + def move_personal_snippet_files + query = "SELECT uploads.path, uploads.model_id, snippets.description FROM uploads "\ + "INNER JOIN snippets ON snippets.id = uploads.model_id WHERE uploader = 'PersonalFileUploader'" + select_all(query).each do |upload| + secret = upload['path'].split('/')[0] + file_name = upload['path'].split('/')[1] + + next unless move_file(upload['model_id'], secret, file_name) + update_markdown(upload['model_id'], secret, file_name, upload['description']) + end + end + + def move_file(snippet_id, secret, file_name) + source_dir = File.join(base_directory, @source_relative_location, snippet_id.to_s, secret) + destination_dir = File.join(base_directory, @destination_relative_location, snippet_id.to_s, secret) + + source_file_path = File.join(source_dir, file_name) + destination_file_path = File.join(destination_dir, file_name) + + unless File.exist?(source_file_path) + say "Source file `#{source_file_path}` doesn't exist. Skipping." + return + end + + say "Moving file #{source_file_path} -> #{destination_file_path}" + + FileUtils.mkdir_p(destination_dir) + FileUtils.move(source_file_path, destination_file_path) + + true + end + + def update_markdown(snippet_id, secret, file_name, description) + source_markdown_path = File.join(@source_relative_location, snippet_id.to_s, secret, file_name) + destination_markdown_path = File.join(@destination_relative_location, snippet_id.to_s, secret, file_name) + + source_markdown = "](#{source_markdown_path})" + destination_markdown = "](#{destination_markdown_path})" + + if description.present? + description = description.gsub(source_markdown, destination_markdown) + quoted_description = quote_string(description) + + execute("UPDATE snippets SET description = '#{quoted_description}', description_html = NULL "\ + "WHERE id = #{snippet_id}") + end + + query = "SELECT id, note FROM notes WHERE noteable_id = #{snippet_id} "\ + "AND noteable_type = 'Snippet' AND note IS NOT NULL" + select_all(query).each do |note| + text = note['note'].gsub(source_markdown, destination_markdown) + quoted_text = quote_string(text) + + execute("UPDATE notes SET note = '#{quoted_text}', note_html = NULL WHERE id = #{note['id']}") + end + end + + def base_directory + File.join(Rails.root, 'public') + end + + def file_storage? + CarrierWave::Uploader::Base.storage == CarrierWave::Storage::File + end +end diff --git a/db/post_migrate/20170613111224_clean_appearance_symlinks.rb b/db/post_migrate/20170613111224_clean_appearance_symlinks.rb new file mode 100644 index 00000000000..acb895e426f --- /dev/null +++ b/db/post_migrate/20170613111224_clean_appearance_symlinks.rb @@ -0,0 +1,52 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class CleanAppearanceSymlinks < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + DOWNTIME = false + + def up + return unless file_storage? + + symlink_location = File.join(old_upload_dir, dir) + + return unless File.symlink?(symlink_location) + say "removing symlink: #{symlink_location}" + FileUtils.rm(symlink_location) + end + + def down + return unless file_storage? + + symlink = File.join(old_upload_dir, dir) + destination = File.join(new_upload_dir, dir) + + return if File.directory?(symlink) + return unless File.directory?(destination) + + say "Creating symlink #{symlink} -> #{destination}" + FileUtils.ln_s(destination, symlink) + end + + def file_storage? + CarrierWave::Uploader::Base.storage == CarrierWave::Storage::File + end + + def dir + 'appearance' + end + + def base_directory + Rails.root + end + + def old_upload_dir + File.join(base_directory, "public", "uploads") + end + + def new_upload_dir + File.join(base_directory, "public", "uploads", "system") + end +end diff --git a/db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb b/db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb new file mode 100644 index 00000000000..26b99b61424 --- /dev/null +++ b/db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb @@ -0,0 +1,40 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class CleanupMoveSystemUploadFolderSymlink < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + if File.symlink?(old_directory) + say "Removing #{old_directory} -> #{new_directory} symlink" + FileUtils.rm(old_directory) + else + say "Symlink #{old_directory} non existant, nothing to do." + end + end + + def down + if File.directory?(new_directory) + say "Symlinking #{old_directory} -> #{new_directory}" + FileUtils.ln_s(new_directory, old_directory) + else + say "#{new_directory} doesn't exist, skipping." + end + end + + def new_directory + File.join(base_directory, '-', 'system') + end + + def old_directory + File.join(base_directory, 'system') + end + + def base_directory + File.join(Rails.root, 'public', 'uploads') + end +end diff --git a/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb b/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb new file mode 100644 index 00000000000..87069dce006 --- /dev/null +++ b/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb @@ -0,0 +1,20 @@ +class EnqueueMigrateSystemUploadsToNewFolder < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + OLD_FOLDER = 'uploads/system/' + NEW_FOLDER = 'uploads/-/system/' + + disable_ddl_transaction! + + def up + BackgroundMigrationWorker.perform_async('MigrateSystemUploadsToNewFolder', + [OLD_FOLDER, NEW_FOLDER]) + end + + def down + BackgroundMigrationWorker.perform_async('MigrateSystemUploadsToNewFolder', + [NEW_FOLDER, OLD_FOLDER]) + end +end diff --git a/db/schema.rb b/db/schema.rb index 5264fc99557..284b2068166 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170707184244) do +ActiveRecord::Schema.define(version: 20170717150329) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1615,6 +1615,7 @@ ActiveRecord::Schema.define(version: 20170707184244) do add_foreign_key "merge_request_diffs", "merge_requests", name: "fk_8483f3258f", on_delete: :cascade add_foreign_key "merge_request_metrics", "ci_pipelines", column: "pipeline_id", on_delete: :cascade add_foreign_key "merge_request_metrics", "merge_requests", on_delete: :cascade + add_foreign_key "merge_requests", "ci_pipelines", column: "head_pipeline_id", name: "fk_fd82eae0b9", on_delete: :nullify add_foreign_key "merge_requests", "projects", column: "target_project_id", name: "fk_a6963e8447", on_delete: :cascade add_foreign_key "merge_requests_closing_issues", "issues", on_delete: :cascade add_foreign_key "merge_requests_closing_issues", "merge_requests", on_delete: :cascade diff --git a/doc/administration/auth/authentiq.md b/doc/administration/auth/authentiq.md index fb1a16b0f96..1528f1d2b17 100644 --- a/doc/administration/auth/authentiq.md +++ b/doc/administration/auth/authentiq.md @@ -32,7 +32,7 @@ Authentiq will generate a Client ID and the accompanying Client Secret for you t "app_id" => "YOUR_CLIENT_ID", "app_secret" => "YOUR_CLIENT_SECRET", "args" => { - scope: 'aq:name email~rs aq:push' + "scope": 'aq:name email~rs address aq:push' } } ] @@ -45,21 +45,20 @@ Authentiq will generate a Client ID and the accompanying Client Secret for you t app_id: 'YOUR_CLIENT_ID', app_secret: 'YOUR_CLIENT_SECRET', args: { - scope: 'aq:name email~rs aq:push' + scope: 'aq:name email~rs address aq:push' } } ``` 5. The `scope` is set to request the user's name, email (required and signed), and permission to send push notifications to sign in on subsequent visits. -See [OmniAuth Authentiq strategy](https://github.com/AuthentiqID/omniauth-authentiq#scopes-and-redirect-uri-configuration) for more information on scopes and modifiers. +See [OmniAuth Authentiq strategy](https://github.com/AuthentiqID/omniauth-authentiq/wiki/Scopes,-callback-url-configuration-and-responses) for more information on scopes and modifiers. 6. Change `YOUR_CLIENT_ID` and `YOUR_CLIENT_SECRET` to the Client credentials you received in step 1. 7. Save the configuration file. -8. [Reconfigure](../restart_gitlab.md#omnibus-gitlab-reconfigure) or [restart GitLab](../restart_gitlab.md#installations-from-source) - for the changes to take effect if you installed GitLab via Omnibus or from source respectively. +8. [Reconfigure](../restart_gitlab.md#omnibus-gitlab-reconfigure) or [restart GitLab](../restart_gitlab.md#installations-from-source) for the changes to take effect if you installed GitLab via Omnibus or from source respectively. On the sign in page there should now be an Authentiq icon below the regular sign in form. Click the icon to begin the authentication process. diff --git a/doc/administration/monitoring/prometheus/gitlab_metrics.md b/doc/administration/monitoring/prometheus/gitlab_metrics.md index 7c5505de8a2..7072ab5d02a 100644 --- a/doc/administration/monitoring/prometheus/gitlab_metrics.md +++ b/doc/administration/monitoring/prometheus/gitlab_metrics.md @@ -26,24 +26,25 @@ server, because the embedded server configuration is overwritten once every In this experimental phase, only a few metrics are available: -| Metric | Type | Description | -| --------------------------------- | --------- | ----------- | -| db_ping_timeout | Gauge | Whether or not the last database ping timed out | -| db_ping_success | Gauge | Whether or not the last database ping succeeded | -| db_ping_latency_seconds | Gauge | Round trip time of the database ping | -| filesystem_access_latency_seconds | Gauge | Latency in accessing a specific filesystem | -| filesystem_accessible | Gauge | Whether or not a specific filesystem is accessible | -| filesystem_write_latency_seconds | Gauge | Write latency of a specific filesystem | -| filesystem_writable | Gauge | Whether or not the filesystem is writable | -| filesystem_read_latency_seconds | Gauge | Read latency of a specific filesystem | -| filesystem_readable | Gauge | Whether or not the filesystem is readable | -| http_requests_total | Counter | Rack request count | -| http_request_duration_seconds | Histogram | HTTP response time from rack middleware | -| rack_uncaught_errors_total | Counter | Rack connections handling uncaught errors count | -| redis_ping_timeout | Gauge | Whether or not the last redis ping timed out | -| redis_ping_success | Gauge | Whether or not the last redis ping succeeded | -| redis_ping_latency_seconds | Gauge | Round trip time of the redis ping | -| user_session_logins_total | Counter | Counter of how many users have logged in | +| Metric | Type | Since | Description | +|:--------------------------------- |:--------- |:----- |:----------- | +| db_ping_timeout | Gauge | 9.4 | Whether or not the last database ping timed out | +| db_ping_success | Gauge | 9.4 | Whether or not the last database ping succeeded | +| db_ping_latency_seconds | Gauge | 9.4 | Round trip time of the database ping | +| filesystem_access_latency_seconds | Gauge | 9.4 | Latency in accessing a specific filesystem | +| filesystem_accessible | Gauge | 9.4 | Whether or not a specific filesystem is accessible | +| filesystem_write_latency_seconds | Gauge | 9.4 | Write latency of a specific filesystem | +| filesystem_writable | Gauge | 9.4 | Whether or not the filesystem is writable | +| filesystem_read_latency_seconds | Gauge | 9.4 | Read latency of a specific filesystem | +| filesystem_readable | Gauge | 9.4 | Whether or not the filesystem is readable | +| http_requests_total | Counter | 9.4 | Rack request count | +| http_request_duration_seconds | Histogram | 9.4 | HTTP response time from rack middleware | +| pipelines_created_total | Counter | 9.4 | Counter of pipelines created | +| rack_uncaught_errors_total | Counter | 9.4 | Rack connections handling uncaught errors count | +| redis_ping_timeout | Gauge | 9.4 | Whether or not the last redis ping timed out | +| redis_ping_success | Gauge | 9.4 | Whether or not the last redis ping succeeded | +| redis_ping_latency_seconds | Gauge | 9.4 | Round trip time of the redis ping | +| user_session_logins_total | Counter | 9.4 | Counter of how many users have logged in | [← Back to the main Prometheus page](index.md) diff --git a/doc/administration/monitoring/prometheus/index.md b/doc/administration/monitoring/prometheus/index.md index 695fdf09a87..f43c89dad87 100644 --- a/doc/administration/monitoring/prometheus/index.md +++ b/doc/administration/monitoring/prometheus/index.md @@ -95,8 +95,9 @@ Sample Prometheus queries: ## Configuring Prometheus to monitor Kubernetes > Introduced in GitLab 9.0. +> Pod monitoring introduced in GitLab 9.4. -If your GitLab server is running within Kubernetes, Prometheus will collect metrics from the Nodes in the cluster including performance data on each container. This is particularly helpful if your CI/CD environments run in the same cluster, as you can use the [Prometheus project integration][] to monitor them. +If your GitLab server is running within Kubernetes, Prometheus will collect metrics from the Nodes and [annotated Pods](https://prometheus.io/docs/operating/configuration/#<kubernetes_sd_config>) in the cluster, including performance data on each container. This is particularly helpful if your CI/CD environments run in the same cluster, as you can use the [Prometheus project integration][] to monitor them. To disable the monitoring of Kubernetes: diff --git a/doc/api/projects.md b/doc/api/projects.md index 0d892c74d00..61ae89a64c0 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -1257,17 +1257,21 @@ endpoint can be accessed without authentication if the project is publicly accessible. ``` -GET /projects/search/:query +GET /projects ``` Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `query` | string | yes | A string contained in the project name | +| `search` | string | yes | A string contained in the project name | | `order_by` | string | no | Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields | | `sort` | string | no | Return requests sorted in `asc` or `desc` order | +```bash +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects?search=test +``` + ## Start the Housekeeping task for a Project >**Note:** This feature was introduced in GitLab 9.0 diff --git a/doc/ci/environments.md b/doc/ci/environments.md index 3393030210e..df5c66a4c85 100644 --- a/doc/ci/environments.md +++ b/doc/ci/environments.md @@ -602,9 +602,8 @@ exist, you should see something like: >**Notes:** > - For the monitor dashboard to appear, you need to: - - Have enabled the [Kubernetes integration][kube] - - Have your app deployed on Kubernetes - Have enabled the [Prometheus integration][prom] + - Configured Prometheus to collect at least one [supported metric](../user/project/integrations/prometheus_library/metrics.md) - With GitLab 9.2, all deployments to an environment are shown directly on the monitoring dashboard diff --git a/doc/ci/img/environments_monitoring.png b/doc/ci/img/environments_monitoring.png Binary files differindex 387b6c54b61..d9c46ea4c95 100644 --- a/doc/ci/img/environments_monitoring.png +++ b/doc/ci/img/environments_monitoring.png diff --git a/doc/development/gotchas.md b/doc/development/gotchas.md index 565d4b33457..c2ca8966a3f 100644 --- a/doc/development/gotchas.md +++ b/doc/development/gotchas.md @@ -3,35 +3,6 @@ The purpose of this guide is to document potential "gotchas" that contributors might encounter or should avoid during development of GitLab CE and EE. -## Do not `describe` symbols - -Consider the following model spec: - -```ruby -require 'rails_helper' - -describe User do - describe :to_param do - it 'converts the username to a param' do - user = described_class.new(username: 'John Smith') - - expect(user.to_param).to eq 'john-smith' - end - end -end -``` - -When run, this spec doesn't do what we might expect: - -```sh -spec/models/user_spec.rb|6 error| Failure/Error: u = described_class.new NoMethodError: undefined method `new' for :to_param:Symbol -``` - -### Solution - -Except for the top-level `describe` block, always provide a String argument to -`describe`. - ## Do not assert against the absolute value of a sequence-generated attribute Consider the following factory: diff --git a/doc/development/testing.md b/doc/development/testing.md index cf3ea2ccfc2..e6aa4ae8f2f 100644 --- a/doc/development/testing.md +++ b/doc/development/testing.md @@ -195,7 +195,6 @@ Please consult the [dedicated "Frontend testing" guide](./fe_guide/testing.md). - Use `context` to test branching logic. - Use multi-line `do...end` blocks for `before` and `after`, even when it would fit on a single line. -- Don't `describe` symbols (see [Gotchas](gotchas.md#dont-describe-symbols)). - Don't assert against the absolute value of a sequence-generated attribute (see [Gotchas](gotchas.md#dont-assert-against-the-absolute-value-of-a-sequence-generated-attribute)). - Don't supply the `:each` argument to hooks since it's the default. - Prefer `not_to` to `to_not` (_this is enforced by RuboCop_). @@ -479,6 +478,11 @@ slowest test files and try to improve them. run the suite against MySQL for tags, `master`, and any branch that includes `mysql` in the name. - On EE, the test suite always runs both PostgreSQL and MySQL. +- Rails logging to `log/test.log` is disabled by default in CI [for + performance reasons][logging]. To override this setting, provide the + `RAILS_ENABLE_TEST_LOG` environment variable. + +[logging]: https://jtway.co/speed-up-your-rails-test-suite-by-6-in-1-line-13fedb869ec4 ## Spinach (feature) tests diff --git a/doc/update/9.3-to-9.4.md b/doc/update/9.3-to-9.4.md index 6962d124c80..9540c36e7d0 100644 --- a/doc/update/9.3-to-9.4.md +++ b/doc/update/9.3-to-9.4.md @@ -157,8 +157,7 @@ configuration file may contain syntax errors. The block name file, should be `[[storage]]` instead. ```shell -cd /home/git/gitaly -sudo -u git -H editor config.toml +sudo -u git -H sed -i.pre-9.4 's/\[\[storages\]\]/[[storage]]/' /home/git/gitaly/config.toml ``` #### Compile Gitaly diff --git a/doc/user/project/integrations/kubernetes.md b/doc/user/project/integrations/kubernetes.md index bfe2672e098..f4000523938 100644 --- a/doc/user/project/integrations/kubernetes.md +++ b/doc/user/project/integrations/kubernetes.md @@ -19,10 +19,10 @@ of your project and select the **Kubernetes** service to configure it. The Kubernetes service takes the following arguments: -1. Kubernetes namespace 1. API URL -1. Service token 1. Custom CA bundle +1. Kubernetes namespace +1. Service token The API URL is the URL that GitLab uses to access the Kubernetes API. Kubernetes exposes several APIs - we want the "base" URL that is common to all of them, diff --git a/doc/user/project/integrations/prometheus.md b/doc/user/project/integrations/prometheus.md index 86ceb14b965..6f15765751c 100644 --- a/doc/user/project/integrations/prometheus.md +++ b/doc/user/project/integrations/prometheus.md @@ -17,35 +17,30 @@ the settings page with a default template. To configure the template, see the Integration with Prometheus requires the following: 1. GitLab 9.0 or higher -1. The [Kubernetes integration must be enabled][kube] on your project -1. Your app must be deployed on [Kubernetes][] -1. Prometheus must be configured to collect Kubernetes metrics +1. Prometheus must be configured to collect one of the [supported metrics](prometheus_library/metrics.md) 1. Each metric must be have a label to indicate the environment -1. GitLab must have network connectivity to the Prometheus sever +1. GitLab must have network connectivity to the Prometheus server -There are a few steps necessary to set up integration between Prometheus and -GitLab. +## Getting started with Prometheus monitoring -## Configuring Prometheus to collect Kubernetes metrics +Depending on your deployment and where you have located your GitLab server, there are a few options to get started with Prometheus monitoring. -In order for Prometheus to collect Kubernetes metrics, you first must have a -Prometheus server up and running. You have two options here: +* If both GitLab and your applications are installed in the same Kubernetes cluster, you can leverage the [bundled Prometheus server within GitLab](#configuring-omnibus-gitlab-prometheus-to-monitor-kubernetes). +* If your applications are deployed on Kubernetes, but GitLab is not in the same cluster, then you can [configure a Prometheus server in your Kubernetes cluster](#configuring-your-own-prometheus-server-within-kubernetes). +* If your applications are not running in Kubernetes, [get started with Prometheus](#getting-started-with-prometheus-outside-of-kubernetes). -- If you installed Omnibus GitLab inside of Kubernetes, you can simply use the - [bundled version of Prometheus][promgldocs]. In that case, follow the info in the - [Omnibus GitLab section](#configuring-omnibus-gitlab-prometheus-to-monitor-kubernetes) - below. -- If you are using GitLab.com or installed GitLab outside of Kubernetes, you - will likely need to run a Prometheus server within the Kubernetes cluster. - Once installed, the easiest way to monitor Kubernetes is to simply use - Prometheus' support for [Kubernetes Service Discovery][prometheus-k8s-sd]. - In that case, follow the instructions on - [configuring your own Prometheus server within Kubernetes](#configuring-your-own-prometheus-server-within-kubernetes). +### Getting started with Prometheus outside of Kubernetes -### Configuring Omnibus GitLab Prometheus to monitor Kubernetes +Installing and configuring Prometheus to monitor applications is fairly straight forward. + +1. [Install Prometheus](https://prometheus.io/docs/introduction/install/) +1. Set up one of the [supported monitoring targets](prometheus_library/metrics.md) +1. Configure the Prometheus server to [collect their metrics](https://prometheus.io/docs/operating/configuration/#scrape_config) + +### Configuring Omnibus GitLab Prometheus to monitor Kubernetes deployments With Omnibus GitLab running inside of Kubernetes, you can leverage the bundled -version of Prometheus to collect the required metrics. +version of Prometheus to collect the supported metrics. Once enabled, Prometheus will automatically begin monitoring Kubernetes Nodes and any [annotated Pods](https://prometheus.io/docs/operating/configuration/#<kubernetes_sd_config>). 1. Read how to configure the bundled Prometheus server in the [Administration guide][gitlab-prometheus-k8s-monitor]. @@ -74,7 +69,7 @@ kubectl apply -f path/to/prometheus.yml Once deployed, you should see the Prometheus service, deployment, and pod start within the `prometheus` namespace. The server will begin to collect metrics from each Kubernetes Node in the cluster, based on the configuration -provided in the template. +provided in the template. It will also attempt to collect metrics from any Kubernetes Pods that have been [annotated for Prometheus](https://prometheus.io/docs/operating/configuration/#pod). Since GitLab is not running within Kubernetes, the template provides external network access via a `NodePort` running on `30090`. This method allows access @@ -133,30 +128,6 @@ to integrate with. ![Configure Prometheus Service](img/prometheus_service_configuration.png) -## Metrics and Labels - -GitLab retrieves performance data from two metrics, `container_cpu_usage_seconds_total` -and `container_memory_usage_bytes`. These metrics are collected from the -Kubernetes pods via Prometheus, and report CPU and Memory utilization of each -container or Pod running in the cluster. - -In order to isolate and only display relevant metrics for a given environment -however, GitLab needs a method to detect which pods are associated. To do that, -GitLab will specifically request metrics that have an `environment` tag that -matches the [$CI_ENVIRONMENT_SLUG][ci-environment-slug]. - -If you are using [GitLab Auto-Deploy][autodeploy] and one of the methods of -configuring Prometheus above, the `environment` will be automatically added. - -### GitLab Prometheus queries - -The queries utilized by GitLab are shown in the following table. - -| Metric | Query | -| ------ | ----- | -| Average Memory (MB) | `(sum(container_memory_usage_bytes{container_name!="POD",environment="$CI_ENVIRONMENT_SLUG"}) / count(container_memory_usage_bytes{container_name!="POD",environment="$CI_ENVIRONMENT_SLUG"})) /1024/1024` | -| Average CPU Utilization (%) | `sum(rate(container_cpu_usage_seconds_total{container_name!="POD",environment="$CI_ENVIRONMENT_SLUG"}[2m])) / count(container_cpu_usage_seconds_total{container_name!="POD",environment="$CI_ENVIRONMENT_SLUG"}) * 100` | - ## Monitoring CI/CD Environments Once configured, GitLab will attempt to retrieve performance metrics for any @@ -168,8 +139,9 @@ environment which has had a successful deployment. > [Introduced][ce-10408] in GitLab 9.2. > GitLab 9.3 added the [numeric comparison](https://gitlab.com/gitlab-org/gitlab-ce/issues/27439) of the 30 minute averages. +> Requires [Kubernetes](prometheus_library/kubernetes.md) metrics -Developers can view the performance impact of their changes within the merge +Developers can view theperformance impact of their changes within the merge request workflow. When a source branch has been deployed to an environment, a sparkline and numeric comparison of the average memory consumption will appear. On the sparkline, a dot indicates when the current changes were deployed, with up to 30 minutes of performance data displayed before and after. The comparison shows the difference between the 30 minute average before and after the deployment. This information is updated after diff --git a/doc/user/project/integrations/prometheus_library/cloudwatch.md b/doc/user/project/integrations/prometheus_library/cloudwatch.md new file mode 100644 index 00000000000..cc5cee36d28 --- /dev/null +++ b/doc/user/project/integrations/prometheus_library/cloudwatch.md @@ -0,0 +1,25 @@ +# Monitoring AWS Resources +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12621) in GitLab 9.4 + +GitLab has support for automatically detecting and monitoring AWS resources, starting with the [Elastic Load Balancer](https://aws.amazon.com/elasticloadbalancing/). This is provided by leveraging the official [Cloudwatch exporter](https://github.com/prometheus/cloudwatch_exporter), which translates [Cloudwatch metrics](https://aws.amazon.com/cloudwatch/) into a Prometheus readable form. + +## Metrics supported + +| Name | Query | +| ---- | ----- | +| Throughput (req/sec) | sum(aws_elb_request_count_sum{%{environment_filter}}) / 60 | +| Latency (ms) | avg(aws_elb_latency_average{%{environment_filter}}) * 1000 | +| HTTP Error Rate (%) | sum(aws_elb_httpcode_backend_5_xx_sum{%{environment_filter}}) / sum(aws_elb_request_count_sum{%{environment_filter}}) | + +## Configuring Prometheus to monitor for Cloudwatch metrics + +To get started with Cloudwatch monitoring, you should install and configure the [Cloudwatch exporter](https://github.com/hnlq715/nginx-vts-exporter) which retrieves and parses the specified Cloudwatch metrics and translates them into a Prometheus monitoring endpoint. + +Right now, the only AWS resource supported is the Elastic Load Balancer, whose Cloudwatch metrics can be found [here](http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html). + +A sample Cloudwatch Exporter configuration file, configured for basic AWS ELB monitoring, is [available for download](../samples/cloudwatch.yml). + +## Specifying the Environment label + +In order to isolate and only display relevant metrics for a given environment +however, GitLab needs a method to detect which labels are associated. To do this, GitLab will [look for an `environment` label](metrics.md#identifying-environments). diff --git a/doc/user/project/integrations/prometheus_library/kubernetes.md b/doc/user/project/integrations/prometheus_library/kubernetes.md new file mode 100644 index 00000000000..eb8cd821ddc --- /dev/null +++ b/doc/user/project/integrations/prometheus_library/kubernetes.md @@ -0,0 +1,26 @@ +# Monitoring Kubernetes +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8935) in GitLab 9.0 + +GitLab has support for automatically detecting and monitoring Kubernetes metrics. Kubernetes exposes Node level metrics out of the box via the built-in [Prometheus metrics support in cAdvisor](https://github.com/google/cadvisor). No additional services or exporters are needed. + +## Metrics supported + +| Name | Query | +| ---- | ----- | +| Average Memory Usage (MB) | (sum(container_memory_usage_bytes{container_name!="POD",%{environment_filter}}) / count(container_memory_usage_bytes{container_name!="POD",%{environment_filter}})) /1024/1024 | +| Average CPU Utilization (%) | sum(rate(container_cpu_usage_seconds_total{container_name!="POD",%{environment_filter}}[2m])) / count(container_cpu_usage_seconds_total{container_name!="POD",%{environment_filter}}) * 100 | + +## Configuring Prometheus to monitor for Kubernetes node metrics + +In order for Prometheus to collect Kubernetes metrics, you first must have a +Prometheus server up and running. You have two options here: + +- If you have an Omnibus based GitLab installation within your Kubernetes cluster, you can leverage the bundled Prometheus server to [monitor Kubernetes](../../../../administration/monitoring/prometheus/index.md#configuring-prometheus-to-monitor-kubernetes). +- To configure your own Prometheus server, you can follow the [Prometheus documentation](https://prometheus.io/docs/introduction/overview/) or [our guide](../../../../administration/monitoring/prometheus/index.md#configuring-your-own-prometheus-server-within-kubernetes). + +## Specifying the Environment label + +In order to isolate and only display relevant metrics for a given environment +however, GitLab needs a method to detect which labels are associated. To do this, GitLab will [look for an `environment` label](metrics.md#identifying-environments). + +If you are using [GitLab Auto-Deploy][autodeploy] and one of the two [provided Kubernetes monitoring solutions](../prometheus.md#getting-started-with-prometheus-monitoring), the `environment` label will be automatically added. diff --git a/doc/user/project/integrations/prometheus_library/metrics.md b/doc/user/project/integrations/prometheus_library/metrics.md new file mode 100644 index 00000000000..55146e57370 --- /dev/null +++ b/doc/user/project/integrations/prometheus_library/metrics.md @@ -0,0 +1,25 @@ +# Prometheus Metrics library +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8935) in GitLab 9.0 + +GitLab offers automatic detection of select [Prometheus exporters](https://prometheus.io/docs/instrumenting/exporters/). Currently supported exporters are: +* [Kubernetes](kubernetes.md) +* [NGINX](nginx.md) +* [Amazon Cloud Watch](cloudwatch.md) + +We have tried to surface the most important metrics for each exporter, and will be continuing to add support for additional exporters in future releases. If you would like to add support for other official exporters, [contributions](#adding-to-the-library) are welcome. + +## Identifying Environments + +GitLab retrieves performance data from the configured Prometheus server, and attempts to identifying the presence of known metrics. Once identified, GitLab then needs to be able to map the data to a particular environment. + +In order to isolate and only display relevant metrics for a given environment, GitLab needs a method to detect which labels are associated. To do that, +GitLab will look for the required metrics which have a label that +matches the [$CI_ENVIRONMENT_SLUG][ci-environment-slug]. + +For example if you are deploying to an environment named `production`, there must be a label for the metric with the value of `production`. + +## Adding to the library + +We strive to support the 2-4 most important metrics for each common system service that supports Prometheus. If you are looking for support for a particular exporter which has not yet been added to the library, additions can be made [to the `additional_metrics.yml`](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/prometheus/additional_metrics.yml) file. + +> Note: The library is only for monitoring public, common, system services which all customers can benefit from. Support for monitoring [customer proprietary metrics](https://gitlab.com/gitlab-org/gitlab-ee/issues/2273) will be added in a subsequent release. diff --git a/doc/user/project/integrations/prometheus_library/nginx.md b/doc/user/project/integrations/prometheus_library/nginx.md new file mode 100644 index 00000000000..fe238e74e36 --- /dev/null +++ b/doc/user/project/integrations/prometheus_library/nginx.md @@ -0,0 +1,23 @@ +# Monitoring NGINX +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12621) in GitLab 9.4 + +GitLab has support for automatically detecting and monitoring NGINX. This is provided by leveraging the [NGINX VTS exporter](https://github.com/hnlq715/nginx-vts-exporter), which translates [VTS statistics](https://github.com/vozlt/nginx-module-vts) into a Prometheus readable form. + +## Metrics supported + +| Name | Query | +| ---- | ----- | +| Throughput (req/sec) | sum(rate(nginx_requests_total{server_zone!="*", server_zone!="_", %{environment_filter}}[2m])) | +| Latency (ms) | avg(nginx_upstream_response_msecs_avg{%{environment_filter}}) * 1000 | +| HTTP Error Rate (%) | sum(nginx_responses_total{status_code="5xx", %{environment_filter}}) / sum(nginx_responses_total{server_zone!="*", server_zone!="_", %{environment_filter}}) | + +## Configuring Prometheus to monitor for NGINX metrics + +To get started with NGINX monitoring, you should first enable the [VTS statistics](https://github.com/vozlt/nginx-module-vts)) module for your NGINX server. This will capture and display statistics in an HTML readable form. Next, you should install and configure the [NGINX VTS exporter](https://github.com/hnlq715/nginx-vts-exporter) which parses these statistics and translates them into a Prometheus monitoring endpoint. + +If you are using NGINX as your Kubernetes ingress, there is [upcoming direct support](https://github.com/kubernetes/ingress/pull/423) for enabling Prometheus monitoring in the 0.9.0 release. + +## Specifying the Environment label + +In order to isolate and only display relevant metrics for a given environment +however, GitLab needs a method to detect which labels are associated. To do this, GitLab will [look for an `environment` label](metrics.md#identifying-environments). diff --git a/doc/user/project/integrations/samples/cloudwatch.yml b/doc/user/project/integrations/samples/cloudwatch.yml new file mode 100644 index 00000000000..d9b58f52c32 --- /dev/null +++ b/doc/user/project/integrations/samples/cloudwatch.yml @@ -0,0 +1,26 @@ +region: us-east-1 + metrics: + - aws_namespace: AWS/ELB + aws_metric_name: RequestCount + aws_dimensions: [AvailabilityZone, LoadBalancerName] + aws_dimension_select: + LoadBalancerName: [gitlab-ha-lb] + aws_statistics: [Sum] + - aws_namespace: AWS/ELB + aws_metric_name: Latency + aws_dimensions: [AvailabilityZone, LoadBalancerName] + aws_dimension_select: + LoadBalancerName: [gitlab-ha-lb] + aws_statistics: [Average] + - aws_namespace: AWS/ELB + aws_metric_name: HTTPCode_Backend_2XX + aws_dimensions: [AvailabilityZone, LoadBalancerName] + aws_dimension_select: + LoadBalancerName: [gitlab-ha-lb] + aws_statistics: [Sum] + - aws_namespace: AWS/ELB + aws_metric_name: HTTPCode_Backend_5XX + aws_dimensions: [AvailabilityZone, LoadBalancerName] + aws_dimension_select: + LoadBalancerName: [gitlab-ha-lb] + aws_statistics: [Sum] diff --git a/doc/user/project/integrations/samples/prometheus.yml b/doc/user/project/integrations/samples/prometheus.yml index 01bbcaffe1e..30b59e172a1 100644 --- a/doc/user/project/integrations/samples/prometheus.yml +++ b/doc/user/project/integrations/samples/prometheus.yml @@ -24,6 +24,44 @@ data: target_label: environment regex: (.+)-.+-.+ replacement: $1 + - job_name: kubernetes-pods + tls_config: + ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" + insecure_skip_verify: true + bearer_token_file: "/var/run/secrets/kubernetes.io/serviceaccount/token" + kubernetes_sd_configs: + - role: pod + api_server: https://kubernetes.default.svc:443 + tls_config: + ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" + bearer_token_file: "/var/run/secrets/kubernetes.io/serviceaccount/token" + relabel_configs: + - source_labels: + - __meta_kubernetes_pod_annotation_prometheus_io_scrape + action: keep + regex: 'true' + - source_labels: + - __meta_kubernetes_pod_annotation_prometheus_io_path + action: replace + target_label: __metrics_path__ + regex: "(.+)" + - source_labels: + - __address__ + - __meta_kubernetes_pod_annotation_prometheus_io_port + action: replace + regex: "([^:]+)(?::[0-9]+)?;([0-9]+)" + replacement: "$1:$2" + target_label: __address__ + - action: labelmap + regex: __meta_kubernetes_pod_label_(.+) + - source_labels: + - __meta_kubernetes_namespace + action: replace + target_label: kubernetes_namespace + - source_labels: + - __meta_kubernetes_pod_name + action: replace + target_label: kubernetes_pod_name --- apiVersion: v1 kind: Service diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature deleted file mode 100644 index 1af4d46dec9..00000000000 --- a/features/dashboard/dashboard.feature +++ /dev/null @@ -1,70 +0,0 @@ -@dashboard -Feature: Dashboard - Background: - Given I sign in as a user - And I own project "Shop" - And project "Shop" has push event - And project "Shop" has CI enabled - And project "Shop" has CI build - And project "Shop" has labels: "bug", "feature", "enhancement" - And project "Shop" has issue: "bug report" - And I visit dashboard page - - Scenario: I should see projects list - Then I should see "New Project" link - Then I should see "Shop" project link - Then I should see "Shop" project CI status - - @javascript - Scenario: I should see activity list - And I visit dashboard activity page - Then I should see project "Shop" activity feed - - Scenario: I should see groups list - Given I have group with projects - And I visit dashboard page - Then I should see groups list - - @javascript - Scenario: I should see last push widget - Then I should see last push widget - And I click "Create Merge Request" link - Then I see prefilled new Merge Request page - - @javascript - Scenario: Sorting Issues - Given I visit dashboard issues page - And I sort the list by "Oldest updated" - And I visit dashboard activity page - And I visit dashboard issues page - Then The list should be sorted by "Oldest updated" - - @javascript - Scenario: Filtering Issues by label - Given project "Shop" has issue "Bugfix1" with label "feature" - When I visit dashboard issues page - And I filter the list by label "feature" - Then I should see "Bugfix1" in issues list - - @javascript - Scenario: Visiting Project's issues after sorting - Given I visit dashboard issues page - And I sort the list by "Oldest updated" - And I visit project "Shop" issues page - Then The list should be sorted by "Oldest updated" - - @javascript - Scenario: Sorting Merge Requests - Given I visit dashboard merge requests page - And I sort the list by "Oldest updated" - And I visit dashboard activity page - And I visit dashboard merge requests page - Then The list should be sorted by "Oldest updated" - - @javascript - Scenario: Visiting Project's merge requests after sorting - Given project "Shop" has a "Bugfix MR" merge request open - And I visit dashboard merge requests page - And I sort the list by "Oldest updated" - And I visit project "Shop" merge requests page - Then The list should be sorted by "Oldest updated" diff --git a/features/dashboard/event_filters.feature b/features/dashboard/event_filters.feature deleted file mode 100644 index 8c3ff64164f..00000000000 --- a/features/dashboard/event_filters.feature +++ /dev/null @@ -1,58 +0,0 @@ -@dashboard -Feature: Event Filters - Background: - Given I sign in as a user - And I own a project - And this project has push event - And this project has new member event - And this project has merge request event - And I visit dashboard activity page - - @javascript - Scenario: I should see all events - Then I should see push event - And I should see new member event - And I should see merge request event - - @javascript - Scenario: I should see only pushed events - When I click "push" event filter - Then I should see push event - And I should not see new member event - And I should not see merge request event - - @javascript - Scenario: I should see only joined events - When I click "team" event filter - Then I should see new member event - And I should not see push event - And I should not see merge request event - - @javascript - Scenario: I should see only merged events - When I click "merge" event filter - Then I should see merge request event - And I should not see push event - And I should not see new member event - - @javascript - Scenario: I should see only selected events while page reloaded - When I click "push" event filter - And I visit dashboard activity page - Then I should see push event - And I should not see new member event - When I click "team" event filter - And I visit dashboard activity page - Then I should not see push event - And I should see new member event - And I should not see merge request event - When I click "push" event filter - And I visit dashboard activity page - Then I should see push event - And I should not see new member event - And I should not see merge request event - When I click "merge" event filter - And I visit dashboard activity page - Then I should see merge request event - And I should not see push event - And I should not see new member event diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb deleted file mode 100644 index 0960f49aad3..00000000000 --- a/features/steps/dashboard/dashboard.rb +++ /dev/null @@ -1,83 +0,0 @@ -class Spinach::Features::Dashboard < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - include SharedIssuable - - step 'I should see "New Project" link' do - expect(page).to have_link "New project" - end - - step 'I should see "Shop" project link' do - expect(page).to have_link "Shop" - end - - step 'I should see "Shop" project CI status' do - expect(page).to have_link "Commit: skipped" - end - - step 'I should see last push widget' do - expect(page).to have_content "You pushed to fix" - expect(page).to have_link "Create merge request" - end - - step 'I click "Create merge request" link' do - find_link("Create merge request", visible: false).trigger('click') - end - - step 'I see prefilled new Merge Request page' do - expect(page).to have_selector('.merge-request-form') - expect(current_path).to eq project_new_merge_request_path(@project) - expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s - expect(find("input#merge_request_source_branch").value).to eq "fix" - expect(find("input#merge_request_target_branch").value).to eq "master" - end - - step 'I have group with projects' do - @group = create(:group) - @project = create(:empty_project, namespace: @group) - @event = create(:closed_issue_event, project: @project) - - @project.team << [current_user, :master] - end - - step 'I should see projects list' do - @user.authorized_projects.all.each do |project| - expect(page).to have_link project.name_with_namespace - end - end - - step 'I should see groups list' do - Group.all.each do |group| - expect(page).to have_link group.name - end - end - - step 'group has a projects that does not belongs to me' do - @forbidden_project1 = create(:empty_project, group: @group) - @forbidden_project2 = create(:empty_project, group: @group) - end - - step 'I should see 1 project at group list' do - expect(find('span.last_activity/span')).to have_content('1') - end - - step 'I filter the list by label "feature"' do - page.within ".labels-filter" do - find('.dropdown').click - click_link "feature" - end - end - - step 'I should see "Bugfix1" in issues list' do - page.within "ul.content-list" do - expect(page).to have_content "Bugfix1" - end - end - - step 'project "Shop" has issue "Bugfix1" with label "feature"' do - project = Project.find_by(name: "Shop") - issue = create(:issue, title: "Bugfix1", project: project, assignees: [current_user]) - issue.labels << project.labels.find_by(title: 'feature') - end -end diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb deleted file mode 100644 index a745254cc31..00000000000 --- a/features/steps/dashboard/event_filters.rb +++ /dev/null @@ -1,92 +0,0 @@ -class Spinach::Features::EventFilters < Spinach::FeatureSteps - include WaitForRequests - include SharedAuthentication - include SharedPaths - include SharedProject - - step 'I should see push event' do - expect(page).to have_selector('span.pushed') - end - - step 'I should not see push event' do - expect(page).not_to have_selector('span.pushed') - end - - step 'I should see new member event' do - expect(page).to have_selector('span.joined') - end - - step 'I should not see new member event' do - expect(page).not_to have_selector('span.joined') - end - - step 'I should see merge request event' do - expect(page).to have_selector('span.accepted') - end - - step 'I should not see merge request event' do - expect(page).not_to have_selector('span.accepted') - end - - step 'this project has push event' do - data = { - before: Gitlab::Git::BLANK_SHA, - after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", - ref: "refs/heads/new_design", - user_id: @user.id, - user_name: @user.name, - repository: { - name: @project.name, - url: "localhost/rubinius", - description: "", - homepage: "localhost/rubinius", - private: true - } - } - - @event = Event.create( - project: @project, - action: Event::PUSHED, - data: data, - author_id: @user.id - ) - end - - step 'this project has new member event' do - user = create(:user, { name: "John Doe" }) - Event.create( - project: @project, - author_id: user.id, - action: Event::JOINED - ) - end - - step 'this project has merge request event' do - merge_request = create :merge_request, author: @user, source_project: @project, target_project: @project - Event.create( - project: @project, - action: Event::MERGED, - target_id: merge_request.id, - target_type: "MergeRequest", - author_id: @user.id - ) - end - - When 'I click "push" event filter' do - wait_for_requests - click_link("Push events") - wait_for_requests - end - - When 'I click "team" event filter' do - wait_for_requests - click_link("Team") - wait_for_requests - end - - When 'I click "merge" event filter' do - wait_for_requests - click_link("Merge events") - wait_for_requests - end -end diff --git a/features/steps/groups.rb b/features/steps/groups.rb index 0aedc422563..6b288b47da4 100644 --- a/features/steps/groups.rb +++ b/features/steps/groups.rb @@ -81,7 +81,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps step 'I should see new group "Owned" avatar' do expect(owned_group.avatar).to be_instance_of AvatarUploader - expect(owned_group.avatar.url).to eq "/uploads/system/group/avatar/#{Group.find_by(name: "Owned").id}/banana_sample.gif" + expect(owned_group.avatar.url).to eq "/uploads/-/system/group/avatar/#{Group.find_by(name: "Owned").id}/banana_sample.gif" end step 'I should see the "Remove avatar" button' do diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index 254c26bb6af..4b88cb5e27f 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -36,7 +36,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps step 'I should see new avatar' do expect(@user.avatar).to be_instance_of AvatarUploader - expect(@user.avatar.url).to eq "/uploads/system/user/avatar/#{@user.id}/banana_sample.gif" + expect(@user.avatar.url).to eq "/uploads/-/system/user/avatar/#{@user.id}/banana_sample.gif" end step 'I should see the "Remove avatar" button' do diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 7d34331db46..170e2f16c80 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -38,7 +38,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps step 'I should see new project avatar' do expect(@project.avatar).to be_instance_of AvatarUploader url = @project.avatar.url - expect(url).to eq "/uploads/system/project/avatar/#{@project.id}/banana_sample.gif" + expect(url).to eq "/uploads/-/system/project/avatar/#{@project.id}/banana_sample.gif" end step 'I should see the "Remove avatar" button' do diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 729e2b8982c..da1cdd9f897 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -239,11 +239,6 @@ module SharedProject create(:label, project: project, title: 'enhancement') end - step 'project "Shop" has issue: "bug report"' do - project = Project.find_by(name: "Shop") - create(:issue, project: project, title: "bug report") - end - step 'project "Shop" has CI enabled' do project = Project.find_by(name: "Shop") project.enable_ci diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 465363da582..8b007869dc3 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -150,7 +150,7 @@ module API # # begin # repository = wiki? ? project.wiki.repository : project.repository - # Gitlab::GitalyClient::Notifications.new(repository.raw_repository).post_receive + # Gitlab::GitalyClient::NotificationService.new(repository.raw_repository).post_receive # rescue GRPC::Unavailable => e # render_api_error!(e, 500) # end diff --git a/lib/declarative_policy.rb b/lib/declarative_policy.rb index d9959bc1aff..b1eb1a6cef1 100644 --- a/lib/declarative_policy.rb +++ b/lib/declarative_policy.rb @@ -8,7 +8,12 @@ require_dependency 'declarative_policy/step' require_dependency 'declarative_policy/base' +require 'thread' + module DeclarativePolicy + CLASS_CACHE_MUTEX = Mutex.new + CLASS_CACHE_IVAR = :@__DeclarativePolicy_CLASS_CACHE + class << self def policy_for(user, subject, opts = {}) cache = opts[:cache] || {} @@ -23,7 +28,36 @@ module DeclarativePolicy subject = find_delegate(subject) - subject.class.ancestors.each do |klass| + class_for_class(subject.class) + end + + private + + # This method is heavily cached because there are a lot of anonymous + # modules in play in a typical rails app, and #name performs quite + # slowly for anonymous classes and modules. + # + # See https://bugs.ruby-lang.org/issues/11119 + # + # if the above bug is resolved, this caching could likely be removed. + def class_for_class(subject_class) + unless subject_class.instance_variable_defined?(CLASS_CACHE_IVAR) + CLASS_CACHE_MUTEX.synchronize do + # re-check in case of a race + break if subject_class.instance_variable_defined?(CLASS_CACHE_IVAR) + + policy_class = compute_class_for_class(subject_class) + subject_class.instance_variable_set(CLASS_CACHE_IVAR, policy_class) + end + end + + policy_class = subject_class.instance_variable_get(CLASS_CACHE_IVAR) + raise "no policy for #{subject.class.name}" if policy_class.nil? + policy_class + end + + def compute_class_for_class(subject_class) + subject_class.ancestors.each do |klass| next unless klass.name begin @@ -37,12 +71,8 @@ module DeclarativePolicy nil end end - - raise "no policy for #{subject.class.name}" end - private - def find_delegate(subject) seen = Set.new diff --git a/lib/declarative_policy/cache.rb b/lib/declarative_policy/cache.rb index b8cc60074c7..0804edba016 100644 --- a/lib/declarative_policy/cache.rb +++ b/lib/declarative_policy/cache.rb @@ -21,11 +21,14 @@ module DeclarativePolicy private def id_for(obj) - if obj.respond_to?(:id) && obj.id - obj.id.to_s - else - "##{obj.object_id}" - end + id = + begin + obj.id + rescue NoMethodError + nil + end + + id || "##{obj.object_id}" end end end diff --git a/lib/declarative_policy/condition.rb b/lib/declarative_policy/condition.rb index 9d7cf6b9726..51c4a8b2bbe 100644 --- a/lib/declarative_policy/condition.rb +++ b/lib/declarative_policy/condition.rb @@ -82,13 +82,14 @@ module DeclarativePolicy # depending on the scope, we may cache only by the user or only by # the subject, resulting in sharing across different policy objects. def cache_key - case @condition.scope - when :normal then "/dp/condition/#{@condition.key}/#{user_key},#{subject_key}" - when :user then "/dp/condition/#{@condition.key}/#{user_key}" - when :subject then "/dp/condition/#{@condition.key}/#{subject_key}" - when :global then "/dp/condition/#{@condition.key}" - else raise 'invalid scope' - end + @cache_key ||= + case @condition.scope + when :normal then "/dp/condition/#{@condition.key}/#{user_key},#{subject_key}" + when :user then "/dp/condition/#{@condition.key}/#{user_key}" + when :subject then "/dp/condition/#{@condition.key}/#{subject_key}" + when :global then "/dp/condition/#{@condition.key}" + else raise 'invalid scope' + end end def user_key diff --git a/lib/gitlab/background_migration.rb b/lib/gitlab/background_migration.rb index d95ecd7b291..d3f66877672 100644 --- a/lib/gitlab/background_migration.rb +++ b/lib/gitlab/background_migration.rb @@ -1,24 +1,45 @@ module Gitlab module BackgroundMigration + def self.queue + @queue ||= BackgroundMigrationWorker.sidekiq_options['queue'] + end + # Begins stealing jobs from the background migrations queue, blocking the # caller until all jobs have been completed. # + # When a migration raises a StandardError is is going to be retries up to + # three times, for example, to recover from a deadlock. + # + # When Exception is being raised, it enqueues the migration again, and + # re-raises the exception. + # # steal_class - The name of the class for which to steal jobs. def self.steal(steal_class) - queue = Sidekiq::Queue - .new(BackgroundMigrationWorker.sidekiq_options['queue']) + enqueued = Sidekiq::Queue.new(self.queue) + scheduled = Sidekiq::ScheduledSet.new - queue.each do |job| - migration_class, migration_args = job.args + [scheduled, enqueued].each do |queue| + queue.each do |job| + migration_class, migration_args = job.args - next unless migration_class == steal_class + next unless job.queue == self.queue + next unless migration_class == steal_class - perform(migration_class, migration_args) + begin + perform(migration_class, migration_args) if job.delete + rescue Exception # rubocop:disable Lint/RescueException + BackgroundMigrationWorker # enqueue this migration again + .perform_async(migration_class, migration_args) - job.delete + raise + end + end end end + ## + # Performs a background migration. + # # class_name - The name of the background migration class as defined in the # Gitlab::BackgroundMigration namespace. # diff --git a/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder.rb b/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder.rb new file mode 100644 index 00000000000..0881244ed49 --- /dev/null +++ b/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder.rb @@ -0,0 +1,26 @@ +module Gitlab + module BackgroundMigration + class MigrateSystemUploadsToNewFolder + include Gitlab::Database::MigrationHelpers + attr_reader :old_folder, :new_folder + + class Upload < ActiveRecord::Base + self.table_name = 'uploads' + include EachBatch + end + + def perform(old_folder, new_folder) + replace_sql = replace_sql(uploads[:path], old_folder, new_folder) + affected_uploads = Upload.where(uploads[:path].matches("#{old_folder}%")) + + affected_uploads.each_batch do |batch| + batch.update_all("path = #{replace_sql}") + end + end + + def uploads + Arel::Table.new('uploads') + end + end + end +end diff --git a/lib/gitlab/cache/request_cache.rb b/lib/gitlab/cache/request_cache.rb new file mode 100644 index 00000000000..f1a04affd38 --- /dev/null +++ b/lib/gitlab/cache/request_cache.rb @@ -0,0 +1,94 @@ +module Gitlab + module Cache + # This module provides a simple way to cache values in RequestStore, + # and the cache key would be based on the class name, method name, + # optionally customized instance level values, optionally customized + # method level values, and optional method arguments. + # + # A simple example: + # + # class UserAccess + # extend Gitlab::Cache::RequestCache + # + # request_cache_key do + # [user&.id, project&.id] + # end + # + # request_cache def can_push_to_branch?(ref) + # # ... + # end + # end + # + # This way, the result of `can_push_to_branch?` would be cached in + # `RequestStore.store` based on the cache key. If RequestStore is not + # currently active, then it would be stored in a hash saved in an + # instance variable, so the cache logic would be the same. + # Here's another example using customized method level values: + # + # class Commit + # extend Gitlab::Cache::RequestCache + # + # def author + # User.find_by_any_email(author_email.downcase) + # end + # request_cache(:author) { author_email.downcase } + # end + # + # So that we could have different strategies for different methods + # + module RequestCache + def self.extended(klass) + return if klass < self + + extension = Module.new + klass.const_set(:RequestCacheExtension, extension) + klass.prepend(extension) + end + + def request_cache_key(&block) + if block_given? + @request_cache_key = block + else + @request_cache_key + end + end + + def request_cache(method_name, &method_key_block) + const_get(:RequestCacheExtension).module_eval do + cache_key_method_name = "#{method_name}_cache_key" + + define_method(method_name) do |*args| + store = + if RequestStore.active? + RequestStore.store + else + ivar_name = # ! and ? cannot be used as ivar name + "@cache_#{method_name.to_s.tr('!?', "\u2605\u2606")}" + + instance_variable_get(ivar_name) || + instance_variable_set(ivar_name, {}) + end + + key = __send__(cache_key_method_name, args) + + store.fetch(key) { store[key] = super(*args) } + end + + define_method(cache_key_method_name) do |args| + klass = self.class + + instance_key = instance_exec(&klass.request_cache_key) if + klass.request_cache_key + + method_key = instance_exec(&method_key_block) if method_key_block + + [klass.name, method_name, *instance_key, *method_key, *args] + .join(':') + end + + private cache_key_method_name + end + end + end + end +end diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb index c4c0623df6c..5d6977106d6 100644 --- a/lib/gitlab/ci/trace/stream.rb +++ b/lib/gitlab/ci/trace/stream.rb @@ -69,12 +69,12 @@ module Gitlab return unless valid? return unless regex - regex = Regexp.new(regex) + regex = Gitlab::UntrustedRegexp.new(regex) match = "" reverse_line do |line| - matches = line.scan(regex) + matches = regex.scan(line) next unless matches.is_a?(Array) next if matches.empty? diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 0643c56db9b..69ca9aa596b 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -140,6 +140,8 @@ module Gitlab return add_foreign_key(source, target, column: column, on_delete: on_delete) + else + on_delete = 'SET NULL' if on_delete == :nullify end disable_statement_timeout @@ -155,7 +157,7 @@ module Gitlab ADD CONSTRAINT #{key_name} FOREIGN KEY (#{column}) REFERENCES #{target} (id) - #{on_delete ? "ON DELETE #{on_delete}" : ''} + #{on_delete ? "ON DELETE #{on_delete.upcase}" : ''} NOT VALID; EOF diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index b6dd3cd20e0..db6cfc9671f 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -29,7 +29,7 @@ module Gitlab path = path.sub(/\A\/*/, '') path = '/' if path.empty? name = File.basename(path) - entry = Gitlab::GitalyClient::Commit.new(repository).tree_entry(sha, path, MAX_DATA_DISPLAY_SIZE) + entry = Gitlab::GitalyClient::CommitService.new(repository).tree_entry(sha, path, MAX_DATA_DISPLAY_SIZE) return unless entry case entry.type @@ -87,10 +87,10 @@ module Gitlab def raw(repository, sha) Gitlab::GitalyClient.migrate(:git_blob_raw) do |is_enabled| if is_enabled - Gitlab::GitalyClient::Blob.new(repository).get_blob(oid: sha, limit: MAX_DATA_DISPLAY_SIZE) + Gitlab::GitalyClient::BlobService.new(repository).get_blob(oid: sha, limit: MAX_DATA_DISPLAY_SIZE) else blob = repository.lookup(sha) - + new( id: blob.oid, size: blob.size, @@ -182,7 +182,7 @@ module Gitlab Gitlab::GitalyClient.migrate(:git_blob_load_all_data) do |is_enabled| @data = begin if is_enabled - Gitlab::GitalyClient::Blob.new(repository).get_blob(oid: id, limit: -1).data + Gitlab::GitalyClient::BlobService.new(repository).get_blob(oid: id, limit: -1).data else repository.lookup(id).content end diff --git a/lib/gitlab/git/branch.rb b/lib/gitlab/git/branch.rb index e2be9d784b9..c53882787f1 100644 --- a/lib/gitlab/git/branch.rb +++ b/lib/gitlab/git/branch.rb @@ -3,39 +3,8 @@ module Gitlab module Git class Branch < Ref - def initialize(repository, name, target) - if target.is_a?(Gitaly::FindLocalBranchResponse) - target = target_from_gitaly_local_branches_response(target) - end - - super(repository, name, target) - end - - def target_from_gitaly_local_branches_response(response) - # Git messages have no encoding enforcements. However, in the UI we only - # handle UTF-8, so basically we cross our fingers that the message force - # encoded to UTF-8 is readable. - message = response.commit_subject.dup.force_encoding('UTF-8') - - # NOTE: For ease of parsing in Gitaly, we have only the subject of - # the commit and not the full message. This is ok, since all the - # code that uses `local_branches` only cares at most about the - # commit message. - # TODO: Once gitaly "takes over" Rugged consider separating the - # subject from the message to make it clearer when there's one - # available but not the other. - hash = { - id: response.commit_id, - message: message, - authored_date: Time.at(response.commit_author.date.seconds), - author_name: response.commit_author.name, - author_email: response.commit_author.email, - committed_date: Time.at(response.commit_committer.date.seconds), - committer_name: response.commit_committer.name, - committer_email: response.commit_committer.email - } - - Gitlab::Git::Commit.decorate(hash) + def initialize(repository, name, target, target_commit) + super(repository, name, target, target_commit) end end end diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index d0f04d25db2..76a562f356e 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -98,7 +98,15 @@ module Gitlab # Commit.between(repo, '29eda46b', 'master') # def between(repo, base, head) - repo.commits_between(base, head).map do |commit| + commits = Gitlab::GitalyClient.migrate(:commits_between) do |is_enabled| + if is_enabled + repo.gitaly_commit_client.between(base, head) + else + repo.commits_between(base, head) + end + end + + commits.map do |commit| decorate(commit) end rescue Rugged::ReferenceError @@ -210,6 +218,8 @@ module Gitlab init_from_hash(raw_commit) elsif raw_commit.is_a?(Rugged::Commit) init_from_rugged(raw_commit) + elsif raw_commit.is_a?(Gitaly::GitCommit) + init_from_gitaly(raw_commit) else raise "Invalid raw commit type: #{raw_commit.class}" end @@ -371,6 +381,22 @@ module Gitlab @parent_ids = commit.parents.map(&:oid) end + def init_from_gitaly(commit) + @raw_commit = commit + @id = commit.id + # TODO: Once gitaly "takes over" Rugged consider separating the + # subject from the message to make it clearer when there's one + # available but not the other. + @message = (commit.body.presence || commit.subject).dup + @authored_date = Time.at(commit.author.date.seconds) + @author_name = commit.author.name.dup + @author_email = commit.author.email.dup + @committed_date = Time.at(commit.committer.date.seconds) + @committer_name = commit.committer.name.dup + @committer_email = commit.committer.email.dup + @parent_ids = commit.parent_ids + end + def serialize_keys SERIALIZE_KEYS end diff --git a/lib/gitlab/git/ref.rb b/lib/gitlab/git/ref.rb index c1a10688285..372ce005b94 100644 --- a/lib/gitlab/git/ref.rb +++ b/lib/gitlab/git/ref.rb @@ -33,10 +33,9 @@ module Gitlab object end - def initialize(repository, name, target) - encode! name - @name = name.gsub(/\Arefs\/(tags|heads)\//, '') - @dereferenced_target = Gitlab::Git::Commit.find(repository, target) + def initialize(repository, name, target, derefenced_target) + @name = Gitlab::Git.ref_name(name) + @dereferenced_target = derefenced_target @target = if target.respond_to?(:oid) target.oid elsif target.respond_to?(:name) diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 639f5625d59..63eebadff2e 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -80,16 +80,10 @@ module Gitlab end # Returns an Array of Branches - def branches(filter: nil, sort_by: nil) - branches = rugged.branches.each(filter).map do |rugged_ref| - begin - Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target) - rescue Rugged::ReferenceError - # Omit invalid branch - end - end.compact - - sort_branches(branches, sort_by) + # + # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/389 + def branches(sort_by: nil) + branches_filter(sort_by: sort_by) end def reload_rugged @@ -107,7 +101,10 @@ module Gitlab reload_rugged if force_reload rugged_ref = rugged.branches[name] - Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target) if rugged_ref + if rugged_ref + target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target) + Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit) + end end def local_branches(sort_by: nil) @@ -115,7 +112,7 @@ module Gitlab if is_enabled gitaly_ref_client.local_branches(sort_by: sort_by) else - branches(filter: :local, sort_by: sort_by) + branches_filter(filter: :local, sort_by: sort_by) end end end @@ -162,6 +159,8 @@ module Gitlab end # Returns an Array of Tags + # + # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/390 def tags rugged.references.each("refs/tags/*").map do |ref| message = nil @@ -174,7 +173,8 @@ module Gitlab end end - Gitlab::Git::Tag.new(self, ref.name, ref.target, message) + target_commit = Gitlab::Git::Commit.find(self, ref.target) + Gitlab::Git::Tag.new(self, ref.name, ref.target, target_commit, message) end.sort_by(&:name) end @@ -204,13 +204,6 @@ module Gitlab branch_names + tag_names end - # Deprecated. Will be removed in 5.2 - def heads - rugged.references.each("refs/heads/*").map do |head| - Gitlab::Git::Ref.new(self, head.name, head.target) - end.sort_by(&:name) - end - def has_commits? !empty? end @@ -297,28 +290,6 @@ module Gitlab (size.to_f / 1024).round(2) end - # Returns an array of BlobSnippets for files at the specified +ref+ that - # contain the +query+ string. - def search_files(query, ref = nil) - greps = [] - ref ||= root_ref - - populated_index(ref).each do |entry| - # Discard submodules - next if submodule?(entry) - - blob = Gitlab::Git::Blob.raw(self, entry[:oid]) - - # Skip binary files - next if blob.data.encoding == Encoding::ASCII_8BIT - - blob.load_all_data!(self) - greps += build_greps(blob.data, query, ref, entry[:path]) - end - - greps - end - # Use the Rugged Walker API to build an array of commits. # # Usage. @@ -707,7 +678,8 @@ module Gitlab # create_branch("other-feature", "master") def create_branch(ref, start_point = "HEAD") rugged_ref = rugged.branches.create(ref, start_point) - Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target) + target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target) + Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit) rescue Rugged::ReferenceError => e raise InvalidRef.new("Branch #{ref} already exists") if e.to_s =~ /'refs\/heads\/#{ref}'/ raise InvalidRef.new("Invalid reference #{start_point}") @@ -835,8 +807,30 @@ module Gitlab Gitlab::GitalyClient::Util.repository(@storage, @relative_path) end + def gitaly_ref_client + @gitaly_ref_client ||= Gitlab::GitalyClient::RefService.new(self) + end + + def gitaly_commit_client + @gitaly_commit_client ||= Gitlab::GitalyClient::CommitService.new(self) + end + private + # Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'. + def branches_filter(filter: nil, sort_by: nil) + branches = rugged.branches.each(filter).map do |rugged_ref| + begin + target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target) + Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit) + rescue Rugged::ReferenceError + # Omit invalid branch + end + end.compact + + sort_branches(branches, sort_by) + end + def raw_log(options) default_options = { limit: 10, @@ -1091,73 +1085,6 @@ module Gitlab index end - # Return an array of BlobSnippets for lines in +file_contents+ that match - # +query+ - def build_greps(file_contents, query, ref, filename) - # The file_contents string is potentially huge so we make sure to loop - # through it one line at a time. This gives Ruby the chance to GC lines - # we are not interested in. - # - # We need to do a little extra work because we are not looking for just - # the lines that matches the query, but also for the context - # (surrounding lines). We will use Enumerable#each_cons to efficiently - # loop through the lines while keeping surrounding lines on hand. - # - # First, we turn "foo\nbar\nbaz" into - # [ - # [nil, -3], [nil, -2], [nil, -1], - # ['foo', 0], ['bar', 1], ['baz', 3], - # [nil, 4], [nil, 5], [nil, 6] - # ] - lines_with_index = Enumerator.new do |yielder| - # Yield fake 'before' lines for the first line of file_contents - (-SEARCH_CONTEXT_LINES..-1).each do |i| - yielder.yield [nil, i] - end - - # Yield the actual file contents - count = 0 - file_contents.each_line do |line| - line.chomp! - yielder.yield [line, count] - count += 1 - end - - # Yield fake 'after' lines for the last line of file_contents - (count + 1..count + SEARCH_CONTEXT_LINES).each do |i| - yielder.yield [nil, i] - end - end - - greps = [] - - # Loop through consecutive blocks of lines with indexes - lines_with_index.each_cons(2 * SEARCH_CONTEXT_LINES + 1) do |line_block| - # Get the 'middle' line and index from the block - line, _ = line_block[SEARCH_CONTEXT_LINES] - - next unless line && line.match(/#{Regexp.escape(query)}/i) - - # Yay, 'line' contains a match! - # Get an array with just the context lines (no indexes) - match_with_context = line_block.map(&:first) - # Remove 'nil' lines in case we are close to the first or last line - match_with_context.compact! - - # Get the line number (1-indexed) of the first context line - first_context_line_number = line_block[0][1] + 1 - - greps << Gitlab::Git::BlobSnippet.new( - ref, - match_with_context, - first_context_line_number, - filename - ) - end - - greps - end - # Return the Rugged patches for the diff between +from+ and +to+. def diff_patches(from, to, options = {}, *paths) options ||= {} @@ -1186,14 +1113,6 @@ module Gitlab end end - def gitaly_ref_client - @gitaly_ref_client ||= Gitlab::GitalyClient::Ref.new(self) - end - - def gitaly_commit_client - @gitaly_commit_client ||= Gitlab::GitalyClient::Commit.new(self) - end - def gitaly_migrate(method, &block) Gitlab::GitalyClient.migrate(method, &block) rescue GRPC::NotFound => e diff --git a/lib/gitlab/git/tag.rb b/lib/gitlab/git/tag.rb index 9a39de6ad07..bc4e160dce9 100644 --- a/lib/gitlab/git/tag.rb +++ b/lib/gitlab/git/tag.rb @@ -5,8 +5,8 @@ module Gitlab class Tag < Ref attr_reader :object_sha - def initialize(repository, name, target, message = nil) - super(repository, name, target) + def initialize(repository, name, target, target_commit, message = nil) + super(repository, name, target, target_commit) @message = message end diff --git a/lib/gitlab/gitaly_client/blob.rb b/lib/gitlab/gitaly_client/blob_service.rb index 0c398b46a08..7ea8e8d0857 100644 --- a/lib/gitlab/gitaly_client/blob.rb +++ b/lib/gitlab/gitaly_client/blob_service.rb @@ -1,10 +1,10 @@ module Gitlab module GitalyClient - class Blob + class BlobService def initialize(repository) @gitaly_repo = repository.gitaly_repository end - + def get_blob(oid:, limit:) request = Gitaly::GetBlobRequest.new( repository: @gitaly_repo, diff --git a/lib/gitlab/gitaly_client/commit.rb b/lib/gitlab/gitaly_client/commit_service.rb index aafc0520664..8f5738fed06 100644 --- a/lib/gitlab/gitaly_client/commit.rb +++ b/lib/gitlab/gitaly_client/commit_service.rb @@ -1,6 +1,6 @@ module Gitlab module GitalyClient - class Commit + class CommitService # The ID of empty tree. # See http://stackoverflow.com/a/40884093/1856239 and https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012 EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'.freeze @@ -17,20 +17,20 @@ module Gitlab child_id: child_id ) - GitalyClient.call(@repository.storage, :commit, :commit_is_ancestor, request).value + GitalyClient.call(@repository.storage, :commit_service, :commit_is_ancestor, request).value end def diff_from_parent(commit, options = {}) request_params = commit_diff_request_params(commit, options) request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false) request = Gitaly::CommitDiffRequest.new(request_params) - response = GitalyClient.call(@repository.storage, :diff, :commit_diff, request) + response = GitalyClient.call(@repository.storage, :diff_service, :commit_diff, request) Gitlab::Git::DiffCollection.new(GitalyClient::DiffStitcher.new(response), options) end def commit_deltas(commit) request = Gitaly::CommitDeltaRequest.new(commit_diff_request_params(commit)) - response = GitalyClient.call(@repository.storage, :diff, :commit_delta, request) + response = GitalyClient.call(@repository.storage, :diff_service, :commit_delta, request) response.flat_map do |msg| msg.deltas.map { |d| Gitlab::Git::Diff.new(d) } end @@ -44,7 +44,7 @@ module Gitlab limit: limit.to_i ) - response = GitalyClient.call(@repository.storage, :commit, :tree_entry, request) + response = GitalyClient.call(@repository.storage, :commit_service, :tree_entry, request) entry = response.first return unless entry.oid.present? @@ -65,6 +65,17 @@ module Gitlab GitalyClient.call(@repository.storage, :commit_service, :count_commits, request).count end + def between(from, to) + request = Gitaly::CommitsBetweenRequest.new( + repository: @gitaly_repo, + from: from, + to: to + ) + + response = GitalyClient.call(@repository.storage, :commit_service, :commits_between, request) + consume_commits_response(response) + end + private def commit_diff_request_params(commit, options = {}) @@ -77,6 +88,10 @@ module Gitlab paths: options.fetch(:paths, []) } end + + def consume_commits_response(response) + response.flat_map { |r| r.commits } + end end end end diff --git a/lib/gitlab/gitaly_client/notifications.rb b/lib/gitlab/gitaly_client/notification_service.rb index 78ed433e6b8..326e6f7dafc 100644 --- a/lib/gitlab/gitaly_client/notifications.rb +++ b/lib/gitlab/gitaly_client/notification_service.rb @@ -1,6 +1,6 @@ module Gitlab module GitalyClient - class Notifications + class NotificationService # 'repository' is a Gitlab::Git::Repository def initialize(repository) @gitaly_repo = repository.gitaly_repository @@ -10,7 +10,7 @@ module Gitlab def post_receive GitalyClient.call( @storage, - :notifications, + :notification_service, :post_receive, Gitaly::PostReceiveRequest.new(repository: @gitaly_repo) ) diff --git a/lib/gitlab/gitaly_client/ref.rb b/lib/gitlab/gitaly_client/ref_service.rb index 6edc69de078..2c3d53410ac 100644 --- a/lib/gitlab/gitaly_client/ref.rb +++ b/lib/gitlab/gitaly_client/ref_service.rb @@ -1,6 +1,6 @@ module Gitlab module GitalyClient - class Ref + class RefService include Gitlab::EncodingHelper # 'repository' is a Gitlab::Git::Repository @@ -12,19 +12,19 @@ module Gitlab def default_branch_name request = Gitaly::FindDefaultBranchNameRequest.new(repository: @gitaly_repo) - response = GitalyClient.call(@storage, :ref, :find_default_branch_name, request) + response = GitalyClient.call(@storage, :ref_service, :find_default_branch_name, request) Gitlab::Git.branch_name(response.name) end def branch_names request = Gitaly::FindAllBranchNamesRequest.new(repository: @gitaly_repo) - response = GitalyClient.call(@storage, :ref, :find_all_branch_names, request) + response = GitalyClient.call(@storage, :ref_service, :find_all_branch_names, request) consume_refs_response(response) { |name| Gitlab::Git.branch_name(name) } end def tag_names request = Gitaly::FindAllTagNamesRequest.new(repository: @gitaly_repo) - response = GitalyClient.call(@storage, :ref, :find_all_tag_names, request) + response = GitalyClient.call(@storage, :ref_service, :find_all_tag_names, request) consume_refs_response(response) { |name| Gitlab::Git.tag_name(name) } end @@ -34,7 +34,7 @@ module Gitlab commit_id: commit_id, prefix: ref_prefix ) - encode!(GitalyClient.call(@storage, :ref, :find_ref_name, request).name.dup) + encode!(GitalyClient.call(@storage, :ref_service, :find_ref_name, request).name.dup) end def count_tag_names @@ -48,7 +48,7 @@ module Gitlab def local_branches(sort_by: nil) request = Gitaly::FindLocalBranchesRequest.new(repository: @gitaly_repo) request.sort_by = sort_by_param(sort_by) if sort_by - response = GitalyClient.call(@storage, :ref, :find_local_branches, request) + response = GitalyClient.call(@storage, :ref_service, :find_local_branches, request) consume_branches_response(response) end @@ -72,11 +72,39 @@ module Gitlab Gitlab::Git::Branch.new( @repository, encode!(gitaly_branch.name.dup), - gitaly_branch.commit_id + gitaly_branch.commit_id, + commit_from_local_branches_response(gitaly_branch) ) end end end + + def commit_from_local_branches_response(response) + # Git messages have no encoding enforcements. However, in the UI we only + # handle UTF-8, so basically we cross our fingers that the message force + # encoded to UTF-8 is readable. + message = response.commit_subject.dup.force_encoding('UTF-8') + + # NOTE: For ease of parsing in Gitaly, we have only the subject of + # the commit and not the full message. This is ok, since all the + # code that uses `local_branches` only cares at most about the + # commit message. + # TODO: Once gitaly "takes over" Rugged consider separating the + # subject from the message to make it clearer when there's one + # available but not the other. + hash = { + id: response.commit_id, + message: message, + authored_date: Time.at(response.commit_author.date.seconds), + author_name: response.commit_author.name.dup, + author_email: response.commit_author.email.dup, + committed_date: Time.at(response.commit_committer.date.seconds), + committer_name: response.commit_committer.name.dup, + committer_email: response.commit_committer.email.dup + } + + Gitlab::Git::Commit.decorate(hash) + end end end end diff --git a/lib/gitlab/i18n.rb b/lib/gitlab/i18n.rb index f3d489aad0d..a1b896c9511 100644 --- a/lib/gitlab/i18n.rb +++ b/lib/gitlab/i18n.rb @@ -12,8 +12,11 @@ module Gitlab 'zh_HK' => '繁體中文(香港)', 'zh_TW' => '繁體中文(臺灣)', 'bg' => 'български', + 'ru' => 'Русский', 'eo' => 'Esperanto', - 'it' => 'Italiano' + 'it' => 'Italiano', + 'uk' => 'Українська', + 'ja' => '日本語' }.freeze def available_locales diff --git a/lib/gitlab/metrics/prometheus.rb b/lib/gitlab/metrics/prometheus.rb index fb7bbc7cfc7..460dab47276 100644 --- a/lib/gitlab/metrics/prometheus.rb +++ b/lib/gitlab/metrics/prometheus.rb @@ -6,9 +6,11 @@ module Gitlab include Gitlab::CurrentSettings def metrics_folder_present? - ENV.has_key?('prometheus_multiproc_dir') && - ::Dir.exist?(ENV['prometheus_multiproc_dir']) && - ::File.writable?(ENV['prometheus_multiproc_dir']) + multiprocess_files_dir = ::Prometheus::Client.configuration.multiprocess_files_dir + + multiprocess_files_dir && + ::Dir.exist?(multiprocess_files_dir) && + ::File.writable?(multiprocess_files_dir) end def prometheus_metrics_enabled? diff --git a/lib/gitlab/path_regex.rb b/lib/gitlab/path_regex.rb index d81f825ef96..60a32d5d5ea 100644 --- a/lib/gitlab/path_regex.rb +++ b/lib/gitlab/path_regex.rb @@ -49,7 +49,6 @@ module Gitlab sent_notifications services snippets - system teams u unicorn_test diff --git a/lib/gitlab/performance_bar.rb b/lib/gitlab/performance_bar.rb index 2da2ce45ebc..56112ec2301 100644 --- a/lib/gitlab/performance_bar.rb +++ b/lib/gitlab/performance_bar.rb @@ -2,7 +2,8 @@ module Gitlab module PerformanceBar include Gitlab::CurrentSettings - ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids'.freeze + ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids:v2'.freeze + EXPIRY_TIME = 5.minutes def self.enabled?(user = nil) return false unless user && allowed_group_id @@ -15,7 +16,7 @@ module Gitlab end def self.allowed_user_ids - Rails.cache.fetch(ALLOWED_USER_IDS_KEY) do + Rails.cache.fetch(ALLOWED_USER_IDS_KEY, expires_in: EXPIRY_TIME) do group = Group.find_by_id(allowed_group_id) if group diff --git a/lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb b/lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb deleted file mode 100644 index d939a6ea18d..00000000000 --- a/lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb +++ /dev/null @@ -1,22 +0,0 @@ -# This solves a bug with a X-Senfile header that wouldn't be set properly, see -# https://github.com/peek/peek-performance_bar/pull/27 -module Gitlab - module PerformanceBar - module PeekPerformanceBarWithRackBody - def call(env) - @env = env - reset_stats - - @total_requests += 1 - first_request if @total_requests == 1 - - env['process.request_start'] = @start.to_f - env['process.total_requests'] = total_requests - - status, headers, body = @app.call(env) - body = Rack::BodyProxy.new(body) { record_request } - [status, headers, body] - end - end - end -end diff --git a/lib/gitlab/performance_bar/peek_query_tracker.rb b/lib/gitlab/performance_bar/peek_query_tracker.rb index 574ae8731a5..67fee8c227d 100644 --- a/lib/gitlab/performance_bar/peek_query_tracker.rb +++ b/lib/gitlab/performance_bar/peek_query_tracker.rb @@ -1,4 +1,5 @@ # Inspired by https://github.com/peek/peek-pg/blob/master/lib/peek/views/pg.rb +# PEEK_DB_CLIENT is a constant set in config/initializers/peek.rb module Gitlab module PerformanceBar module PeekQueryTracker @@ -23,14 +24,20 @@ module Gitlab subscribe('sql.active_record') do |_, start, finish, _, data| if RequestStore.active? && RequestStore.store[:peek_enabled] - track_query(data[:sql].strip, data[:binds], start, finish) + # data[:cached] is only available starting from Rails 5.1.0 + # https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb#L113 + # Before that, data[:name] was set to 'CACHE' + # https://github.com/rails/rails/blob/v4.2.9/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb#L80 + unless data.fetch(:cached, data[:name] == 'CACHE') + track_query(data[:sql].strip, data[:binds], start, finish) + end end end end def track_query(raw_query, bindings, start, finish) query = Gitlab::Sherlock::Query.new(raw_query, start, finish) - query_info = { duration: '%.3f' % query.duration, sql: query.formatted_query } + query_info = { duration: query.duration.round(3), sql: query.formatted_query } PEEK_DB_CLIENT.query_details << query_info end diff --git a/lib/gitlab/route_map.rb b/lib/gitlab/route_map.rb index 877aa6e6a28..f3952657983 100644 --- a/lib/gitlab/route_map.rb +++ b/lib/gitlab/route_map.rb @@ -18,7 +18,11 @@ module Gitlab mapping = @map.find { |mapping| mapping[:source] === path } return unless mapping - path.sub(mapping[:source], mapping[:public]) + if mapping[:source].is_a?(String) + path.sub(mapping[:source], mapping[:public]) + else + mapping[:source].replace(path, mapping[:public]) + end end private @@ -35,7 +39,7 @@ module Gitlab source_pattern = source_pattern[1...-1].gsub('\/', '/') begin - source_pattern = /\A#{source_pattern}\z/ + source_pattern = Gitlab::UntrustedRegexp.new('\A' + source_pattern + '\z') rescue RegexpError => e raise FormatError, "Route map entry source is not a valid regular expression: #{e}" end diff --git a/lib/gitlab/untrusted_regexp.rb b/lib/gitlab/untrusted_regexp.rb new file mode 100644 index 00000000000..8b43f0053d6 --- /dev/null +++ b/lib/gitlab/untrusted_regexp.rb @@ -0,0 +1,53 @@ +module Gitlab + # An untrusted regular expression is any regexp containing patterns sourced + # from user input. + # + # Ruby's built-in regular expression library allows patterns which complete in + # exponential time, permitting denial-of-service attacks. + # + # Not all regular expression features are available in untrusted regexes, and + # there is a strict limit on total execution time. See the RE2 documentation + # at https://github.com/google/re2/wiki/Syntax for more details. + class UntrustedRegexp + delegate :===, to: :regexp + + def initialize(pattern) + @regexp = RE2::Regexp.new(pattern, log_errors: false) + + raise RegexpError.new(regexp.error) unless regexp.ok? + end + + def replace_all(text, rewrite) + RE2.GlobalReplace(text, regexp, rewrite) + end + + def scan(text) + scan_regexp.scan(text).map do |match| + if regexp.number_of_capturing_groups == 0 + match.first + else + match + end + end + end + + def replace(text, rewrite) + RE2.Replace(text, regexp, rewrite) + end + + private + + attr_reader :regexp + + # RE2 scan operates differently to Ruby scan when there are no capture + # groups, so work around it + def scan_regexp + @scan_regexp ||= + if regexp.number_of_capturing_groups == 0 + RE2::Regexp.new('(' + regexp.source + ')') + else + regexp + end + end + end +end diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index f19b325a126..dba071d7e47 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -39,6 +39,7 @@ module Gitlab notes: Note.count, pages_domains: PagesDomain.count, projects: Project.count, + projects_imported_from_github: Project.where(import_type: 'github').count, projects_prometheus_active: PrometheusService.active.count, protected_branches: ProtectedBranch.count, releases: Release.count, diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index 3b922da7ced..8e91ee7287c 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -1,5 +1,11 @@ module Gitlab class UserAccess + extend Gitlab::Cache::RequestCache + + request_cache_key do + [user&.id, project&.id] + end + attr_reader :user, :project def initialize(user, project: nil) @@ -28,7 +34,7 @@ module Gitlab true end - def can_create_tag?(ref) + request_cache def can_create_tag?(ref) return false unless can_access_git? if ProtectedTag.protected?(project, ref) @@ -38,7 +44,7 @@ module Gitlab end end - def can_delete_branch?(ref) + request_cache def can_delete_branch?(ref) return false unless can_access_git? if ProtectedBranch.protected?(project, ref) @@ -48,7 +54,7 @@ module Gitlab end end - def can_push_to_branch?(ref) + request_cache def can_push_to_branch?(ref) return false unless can_access_git? if ProtectedBranch.protected?(project, ref) @@ -60,7 +66,7 @@ module Gitlab end end - def can_merge_to_branch?(ref) + request_cache def can_merge_to_branch?(ref) return false unless can_access_git? if ProtectedBranch.protected?(project, ref) diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb index 48f3d950779..c60bd91ea6e 100644 --- a/lib/gitlab/visibility_level.rb +++ b/lib/gitlab/visibility_level.rb @@ -89,12 +89,12 @@ module Gitlab end def level_name(level) - level_name = 'Unknown' + level_name = N_('VisibilityLevel|Unknown') options.each do |name, lvl| level_name = name if lvl == level.to_i end - level_name + s_(level_name) end def level_value(level) diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index b27f7475115..b48e4dce445 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -5,7 +5,7 @@ namespace :gettext do # See: https://github.com/grosser/gettext_i18n_rails#customizing-list-of-translatable-files def files_to_translate folders = %W(app lib config #{locale_path}).join(',') - exts = %w(rb erb haml slim rhtml js jsx vue coffee handlebars hbs mustache).join(',') + exts = %w(rb erb haml slim rhtml js jsx vue handlebars hbs mustache).join(',') Dir.glob( "{#{folders}}/**/*.{#{exts}}" diff --git a/locale/bg/gitlab.po b/locale/bg/gitlab.po index 0cc16404e1b..1774c911d71 100644 --- a/locale/bg/gitlab.po +++ b/locale/bg/gitlab.po @@ -4,11 +4,11 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-28 13:32+0200\n" +"POT-Creation-Date: 2017-07-05 08:50-0500\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2017-07-05 08:18-0400\n" +"PO-Revision-Date: 2017-07-13 08:13-0400\n" "Last-Translator: Lyubomir Vasilev <lyubomirv@abv.bg>\n" "Language-Team: Bulgarian (https://translate.zanata.org/project/view/GitLab)\n" "Language: bg\n" @@ -641,6 +641,12 @@ msgstr "Всички" msgid "PipelineSchedules|Inactive" msgstr "Неактивно" +msgid "PipelineSchedules|Input variable key" +msgstr "Въведете ключ за променливата" + +msgid "PipelineSchedules|Input variable value" +msgstr "Въведете стойността на променливата" + msgid "PipelineSchedules|Next Run" msgstr "Следващо изпълнение" @@ -650,12 +656,18 @@ msgstr "Нищо" msgid "PipelineSchedules|Provide a short description for this pipeline" msgstr "Въведете кратко описание за тази схема" +msgid "PipelineSchedules|Remove variable row" +msgstr "Премахване на реда за променлива" + msgid "PipelineSchedules|Take ownership" msgstr "Поемане на собствеността" msgid "PipelineSchedules|Target" msgstr "Цел" +msgid "PipelineSchedules|Variables" +msgstr "Променливи" + msgid "PipelineSheduleIntervalPattern|Custom" msgstr "собствен" @@ -1149,6 +1161,15 @@ msgid "Withdraw Access Request" msgstr "Оттегляне на заявката за достъп" msgid "" +"You are going to remove %{group_name}.\n" +"Removed groups CANNOT be restored!\n" +"Are you ABSOLUTELY sure?" +msgstr "" +"На път сте да премахнете „%{group_name}“.\n" +"Ако я премахнете, групата НЕ може да бъде възстановена!\n" +"НАИСТИНА ли искате това?" + +msgid "" "You are going to remove %{project_name_with_namespace}.\n" "Removed project CANNOT be restored!\n" "Are you ABSOLUTELY sure?" diff --git a/locale/eo/gitlab.po b/locale/eo/gitlab.po index 5218f6ae7b9..62dbc2621f4 100644 --- a/locale/eo/gitlab.po +++ b/locale/eo/gitlab.po @@ -4,11 +4,11 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-28 13:32+0200\n" +"POT-Creation-Date: 2017-07-05 08:50-0500\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2017-07-05 08:18-0400\n" +"PO-Revision-Date: 2017-07-13 08:46-0400\n" "Last-Translator: Lyubomir Vasilev <lyubomirv@abv.bg>\n" "Language-Team: Esperanto (https://translate.zanata.org/project/view/GitLab)\n" "Language: eo\n" @@ -642,6 +642,12 @@ msgstr "Ĉiuj" msgid "PipelineSchedules|Inactive" msgstr "Malŝaltitaj" +msgid "PipelineSchedules|Input variable key" +msgstr "Entajpu ŝlosilon por la variablo" + +msgid "PipelineSchedules|Input variable value" +msgstr "Entajpu la valoron de la variablo" + msgid "PipelineSchedules|Next Run" msgstr "Sekvanta plenumo" @@ -651,12 +657,18 @@ msgstr "Nenio" msgid "PipelineSchedules|Provide a short description for this pipeline" msgstr "Entajpu mallongan priskribon pri ĉi tiu ĉenstablo" +msgid "PipelineSchedules|Remove variable row" +msgstr "Forigi la variablan linion" + msgid "PipelineSchedules|Take ownership" msgstr "Akiri posedon" msgid "PipelineSchedules|Target" msgstr "Celo" +msgid "PipelineSchedules|Variables" +msgstr "Variabloj" + msgid "PipelineSheduleIntervalPattern|Custom" msgstr "Propra" @@ -1151,6 +1163,15 @@ msgid "Withdraw Access Request" msgstr "Nuligi la peton pri atingeblo" msgid "" +"You are going to remove %{group_name}.\n" +"Removed groups CANNOT be restored!\n" +"Are you ABSOLUTELY sure?" +msgstr "" +"Vi forigos „%{group_name}“.\n" +"Oni NE POVAS malfari la forigon de grupo!\n" +"Ĉu vi estas ABSOLUTE certa?" + +msgid "" "You are going to remove %{project_name_with_namespace}.\n" "Removed project CANNOT be restored!\n" "Are you ABSOLUTELY sure?" diff --git a/locale/es/gitlab.po b/locale/es/gitlab.po index 760a60f89d4..5c669d51a68 100644 --- a/locale/es/gitlab.po +++ b/locale/es/gitlab.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2017-07-12 12:35-0500\n" +"PO-Revision-Date: 2017-07-13 12:10-0500\n" "Language-Team: Spanish\n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1059,6 +1059,9 @@ msgstr "Privado" msgid "VisibilityLevel|Public" msgstr "Público" +msgid "VisibilityLevel|Unknown" +msgstr "Desconocido" + msgid "Want to see the data? Please ask an administrator for access." msgstr "¿Quieres ver los datos? Por favor pide acceso al administrador." diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 8f33c494de9..babef3ed0af 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-07-12 12:31-0500\n" -"PO-Revision-Date: 2017-07-12 12:31-0500\n" +"POT-Creation-Date: 2017-07-13 12:07-0500\n" +"PO-Revision-Date: 2017-07-13 12:07-0500\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "Language: \n" @@ -1060,6 +1060,9 @@ msgstr "" msgid "VisibilityLevel|Public" msgstr "" +msgid "VisibilityLevel|Unknown" +msgstr "" + msgid "Want to see the data? Please ask an administrator for access." msgstr "" diff --git a/locale/ja/gitlab.po b/locale/ja/gitlab.po new file mode 100644 index 00000000000..b880fc703ec --- /dev/null +++ b/locale/ja/gitlab.po @@ -0,0 +1,1184 @@ +# Arthur Charron <arthur.charron@hotmail.fr>, 2017. #zanata +# Huang Tao <htve@outlook.com>, 2017. #zanata +# Kohei Ota <inductor@kela.jp>, 2017. #zanata +# Taisuke Inoue <taisuke.inoue.jp@gmail.com>, 2017. #zanata +# Takuya Noguchi <takninnovationresearch@gmail.com>, 2017. #zanata +# YANO TETTER <tetuyano+zana@gmail.com>, 2017. #zanata +msgid "" +msgstr "" +"Project-Id-Version: gitlab 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-05 08:50-0500\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language-Team: Japanese (https://translate.zanata.org/project/view/GitLab)\n" +"PO-Revision-Date: 2017-07-18 09:27-0400\n" +"Last-Translator: YANO TETTER <tetuyano+zana@gmail.com>\n" +"Language: ja\n" +"X-Generator: Zanata 3.9.6\n" +"Plural-Forms: nplurals=1; plural=0\n" + +msgid "%s additional commit has been omitted to prevent performance issues." +msgid_plural "" +"%s additional commits have been omitted to prevent performance issues." +msgstr[0] "パフォーマンス低下を避けるため %s 個のコミットを省略しました。" + +msgid "%d commit" +msgid_plural "%d commits" +msgstr[0] "%d個のコミット" + +msgid "%{commit_author_link} committed %{commit_timeago}" +msgstr "%{commit_author_link}は%{commit_timeago}前、コミットしました。" + +msgid "1 pipeline" +msgid_plural "%d pipelines" +msgstr[0] "%d 個のパイプライン" + +msgid "A collection of graphs regarding Continuous Integration" +msgstr "CIについてのグラフ" + +msgid "About auto deploy" +msgstr "自動デプロイについて" + +msgid "Active" +msgstr "有効" + +msgid "Activity" +msgstr "アクティビティー" + +msgid "Add Changelog" +msgstr "変更履歴を追加" + +msgid "Add Contribution guide" +msgstr "貢献者向けガイドを追加" + +msgid "Add License" +msgstr "ライセンスを追加" + +msgid "Add an SSH key to your profile to pull or push via SSH." +msgstr "SSHでプルやプッシュする場合は、プロフィールにSSH鍵を追加してください。" + +msgid "Add new directory" +msgstr "新規ディレクトリを追加" + +msgid "Archived project! Repository is read-only" +msgstr "アーカイブ済みプロジェクト!(レポジトリーは読み取り専用です)" + +msgid "Are you sure you want to delete this pipeline schedule?" +msgstr "このパイプラインスケジュールを削除しますか?" + +msgid "Attach a file by drag & drop or %{upload_link}" +msgstr "ドラッグ&ドロップまたは %{upload_link} でファイルを添付" + +msgid "Branch" +msgid_plural "Branches" +msgstr[0] "ブランチ" + +msgid "" +"Branch <strong>%{branch_name}</strong> was created. To set up auto deploy, " +"choose a GitLab CI Yaml template and commit your changes. " +"%{link_to_autodeploy_doc}" +msgstr "" +"<strong>%{branch_name}</strong> ブランチが作成されました。自動デプロイを設定するには、GitLab CI Yaml " +"テンプレートを選択して、変更をコミットしてください。 %{link_to_autodeploy_doc}" + +msgid "BranchSwitcherPlaceholder|Search branches" +msgstr "ブランチを検索" + +msgid "BranchSwitcherTitle|Switch branch" +msgstr "ブランチを切替" + +msgid "Branches" +msgstr "ブランチ" + +msgid "Browse Directory" +msgstr "ディレクトリを表示" + +msgid "Browse File" +msgstr "ファイルを表示" + +msgid "Browse Files" +msgstr "ファイルを表示" + +msgid "Browse files" +msgstr "ファイルを表示" + +msgid "ByAuthor|by" +msgstr "作者" + +msgid "CI configuration" +msgstr "CI 設定" + +msgid "Cancel" +msgstr "キャンセル" + +msgid "ChangeTypeActionLabel|Pick into branch" +msgstr "ピック先ブランチ:" + +msgid "ChangeTypeActionLabel|Revert in branch" +msgstr "リバート先ブランチ:" + +msgid "ChangeTypeAction|Cherry-pick" +msgstr "チェリーピック" + +msgid "ChangeTypeAction|Revert" +msgstr "リバート" + +msgid "Changelog" +msgstr "変更履歴" + +msgid "Charts" +msgstr "チャート" + +msgid "Cherry-pick this commit" +msgstr "このコミットをチェリーピック" + +msgid "Cherry-pick this merge request" +msgstr "このマージリクエストをチェリーピック" + +msgid "CiStatusLabel|canceled" +msgstr "キャンセル" + +msgid "CiStatusLabel|created" +msgstr "作成済み" + +msgid "CiStatusLabel|failed" +msgstr "失敗" + +msgid "CiStatusLabel|manual action" +msgstr "手動実行" + +msgid "CiStatusLabel|passed" +msgstr "成功" + +msgid "CiStatusLabel|passed with warnings" +msgstr "成功(警告あり)" + +msgid "CiStatusLabel|pending" +msgstr "開始待ち" + +msgid "CiStatusLabel|skipped" +msgstr "スキップ済み" + +msgid "CiStatusLabel|waiting for manual action" +msgstr "手動実行待ち" + +msgid "CiStatusText|blocked" +msgstr "ブロック" + +msgid "CiStatusText|canceled" +msgstr "キャンセル" + +msgid "CiStatusText|created" +msgstr "作成済み" + +msgid "CiStatusText|failed" +msgstr "失敗" + +msgid "CiStatusText|manual" +msgstr "手動" + +msgid "CiStatusText|passed" +msgstr "成功" + +msgid "CiStatusText|pending" +msgstr "実行待ち" + +msgid "CiStatusText|skipped" +msgstr "スキップ済み" + +msgid "CiStatus|running" +msgstr "実行中" + +msgid "Commit" +msgid_plural "Commits" +msgstr[0] "コミット" + +msgid "Commit duration in minutes for last 30 commits" +msgstr "直近30コミットの所要時間(分)" + +msgid "Commit message" +msgstr "コミットメッセージ" + +msgid "CommitBoxTitle|Commit" +msgstr "コミット" + +msgid "CommitMessage|Add %{file_name}" +msgstr "%{file_name} を追加" + +msgid "Commits" +msgstr "コミット" + +msgid "Commits feed" +msgstr "コミットフィード" + +msgid "Commits|History" +msgstr "履歴" + +msgid "Committed by" +msgstr "コミット担当者: " + +msgid "Compare" +msgstr "比較" + +msgid "Contribution guide" +msgstr "貢献者向けガイド" + +msgid "Contributors" +msgstr "貢献者" + +msgid "Copy URL to clipboard" +msgstr "クリップボードにURLをコピー" + +msgid "Copy commit SHA to clipboard" +msgstr "コミットのSHAをクリップボードにコピー" + +msgid "Create New Directory" +msgstr "新規ディレクトリを作成" + +msgid "" +"Create a personal access token on your account to pull or push via " +"%{protocol}." +msgstr "%{protocol} でプッシュやプルするためのあなた個人用アクセストークンを作成" + +msgid "Create directory" +msgstr "ディレクトリを作成" + +msgid "Create empty bare repository" +msgstr "空のbareレポジトリーを作成" + +msgid "Create merge request" +msgstr "マージリクエストを作成" + +msgid "Create new..." +msgstr "新規作成" + +msgid "CreateNewFork|Fork" +msgstr "フォーク" + +msgid "CreateTag|Tag" +msgstr "タグ" + +msgid "CreateTokenToCloneLink|create a personal access token" +msgstr "個人用アクセストークンを作成" + +msgid "Cron Timezone" +msgstr "Cron のタイムゾーン" + +msgid "Cron syntax" +msgstr "Cron の構文" + +msgid "Custom notification events" +msgstr "カスタム通知設定" + +msgid "" +"Custom notification levels are the same as participating levels. With custom " +"notification levels you will also receive notifications for select events. " +"To find out more, check out %{notification_link}." +msgstr "" +"\"カスタム\" の通知レベルの基本は \"参加\" " +"と同じです。また、カスタム通知に設定することで選択したカスタムイベントの通知を受け取ることもできます。もっと詳しく知りたい場合は " +"%{notification_link} を見てください。" + +msgid "Cycle Analytics" +msgstr "サイクル分析" + +msgid "" +"Cycle Analytics gives an overview of how much time it takes to go from idea " +"to production in your project." +msgstr "" +"サイクル分析により、あなたのプロジェクトがアイディアの段階からプロダクション環境にリリースされるまでどれぐらい時間がかかったか俯瞰することができます。" + +msgid "CycleAnalyticsStage|Code" +msgstr "コード" + +msgid "CycleAnalyticsStage|Issue" +msgstr "課題" + +msgid "CycleAnalyticsStage|Plan" +msgstr "計画" + +msgid "CycleAnalyticsStage|Production" +msgstr "プロダクション" + +msgid "CycleAnalyticsStage|Review" +msgstr "レビュー" + +msgid "CycleAnalyticsStage|Staging" +msgstr "ステージング" + +msgid "CycleAnalyticsStage|Test" +msgstr "テスト" + +msgid "Define a custom pattern with cron syntax" +msgstr "Cron 構文でカスタムなパターンを指定する" + +msgid "Delete" +msgstr "削除" + +msgid "Deploy" +msgid_plural "Deploys" +msgstr[0] "デプロイ" + +msgid "Description" +msgstr "説明" + +msgid "Directory name" +msgstr "ディレクトリ名" + +msgid "Don't show again" +msgstr "次回から表示しない" + +msgid "Download" +msgstr "ダウンロード" + +msgid "Download tar" +msgstr "tar形式でダウンロード" + +msgid "Download tar.bz2" +msgstr "tar.bz2形式でダウンロード" + +msgid "Download tar.gz" +msgstr "tar.gz形式でダウンロード" + +msgid "Download zip" +msgstr "zip形式でダウンロード" + +msgid "DownloadArtifacts|Download" +msgstr "ダウンロード" + +msgid "DownloadCommit|Email Patches" +msgstr "パッチをメールで送信" + +msgid "DownloadCommit|Plain Diff" +msgstr "プレーン差分" + +msgid "DownloadSource|Download" +msgstr "ダウンロード" + +msgid "Edit" +msgstr "編集" + +msgid "Edit Pipeline Schedule %{id}" +msgstr "パイプラインスケジュール %{id} を編集" + +msgid "Every day (at 4:00am)" +msgstr "毎日 (午前4:00)" + +msgid "Every month (on the 1st at 4:00am)" +msgstr "毎月 (1日の午前4:00)" + +msgid "Every week (Sundays at 4:00am)" +msgstr "毎週 (日曜日の午前4:00)" + +msgid "Failed to change the owner" +msgstr "オーナーを変更できませんでした" + +msgid "Failed to remove the pipeline schedule" +msgstr "パイプラインスケジュールを削除できませんでした" + +msgid "Files" +msgstr "ファイル" + +msgid "Filter by commit message" +msgstr "コミットメッセージで絞り込み" + +msgid "Find by path" +msgstr "パスで検索" + +msgid "Find file" +msgstr "ファイルを検索" + +msgid "FirstPushedBy|First" +msgstr "初回" + +msgid "FirstPushedBy|pushed by" +msgstr "プッシュした人" + +msgid "Fork" +msgid_plural "Forks" +msgstr[0] "フォーク" + +msgid "ForkedFromProjectPath|Forked from" +msgstr "フォーク元" + +msgid "From issue creation until deploy to production" +msgstr "課題が登録されてからプロダクションにデプロイされるまで" + +msgid "From merge request merge until deploy to production" +msgstr "マージリクエストがマージされてからプロダクションにデプロイされるまで" + +msgid "Go to your fork" +msgstr "自分のフォークへ移動" + +msgid "GoToYourFork|Fork" +msgstr "フォーク" + +msgid "Home" +msgstr "ホーム" + +msgid "Housekeeping successfully started" +msgstr "ハウスキーピングは正常に起動しました。" + +msgid "Import repository" +msgstr "レポジトリーをインポート" + +msgid "Interval Pattern" +msgstr "間隔のパターン" + +msgid "Introducing Cycle Analytics" +msgstr "サイクル分析のご紹介" + +msgid "Jobs for last month" +msgstr "先月のジョブ" + +msgid "Jobs for last week" +msgstr "先週のジョブ" + +msgid "Jobs for last year" +msgstr "昨年のジョブ" + +msgid "LFSStatus|Disabled" +msgstr "無効" + +msgid "LFSStatus|Enabled" +msgstr "有効" + +msgid "Last %d day" +msgid_plural "Last %d days" +msgstr[0] "過去%d日間" + +msgid "Last Pipeline" +msgstr "最新パイプライン" + +msgid "Last Update" +msgstr "最新アップデート" + +msgid "Last commit" +msgstr "最新コミット" + +msgid "Learn more in the" +msgstr "詳しく見る:" + +msgid "Learn more in the|pipeline schedules documentation" +msgstr "詳しくはパイプラインスケジュールのドキュメントを参照" + +msgid "Leave group" +msgstr "グループを離脱" + +msgid "Leave project" +msgstr "プロジェクトを離脱" + +msgid "Limited to showing %d event at most" +msgid_plural "Limited to showing %d events at most" +msgstr[0] "イベント表示数を最大 %d 個に制限" + +msgid "Median" +msgstr "中央値" + +msgid "MissingSSHKeyWarningLink|add an SSH key" +msgstr "SSH 鍵を追加" + +msgid "New Issue" +msgid_plural "New Issues" +msgstr[0] "新規課題" + +msgid "New Pipeline Schedule" +msgstr "新規パイプラインスケジュール" + +msgid "New branch" +msgstr "新規ブランチ" + +msgid "New directory" +msgstr "新規ディレクトリ" + +msgid "New file" +msgstr "新規ファイル" + +msgid "New issue" +msgstr "新規課題" + +msgid "New merge request" +msgstr "新規マージリクエスト" + +msgid "New schedule" +msgstr "新規スケジュール" + +msgid "New snippet" +msgstr "新規スニペット" + +msgid "New tag" +msgstr "新規タグ" + +msgid "No repository" +msgstr "レポジトリーはありません" + +msgid "No schedules" +msgstr "スケジュールなし" + +msgid "Not available" +msgstr "利用できません" + +msgid "Not enough data" +msgstr "データ不足" + +msgid "Notification events" +msgstr "イベント通知" + +msgid "NotificationEvent|Close issue" +msgstr "課題をクローズ" + +msgid "NotificationEvent|Close merge request" +msgstr "マージリクエストをクローズ" + +msgid "NotificationEvent|Failed pipeline" +msgstr "パイプラインに失敗" + +msgid "NotificationEvent|Merge merge request" +msgstr "マージリクエストをマージ" + +msgid "NotificationEvent|New issue" +msgstr "新規課題" + +msgid "NotificationEvent|New merge request" +msgstr "新規マージリクエスト" + +msgid "NotificationEvent|New note" +msgstr "新規ノート" + +msgid "NotificationEvent|Reassign issue" +msgstr "課題の担当者を変更" + +msgid "NotificationEvent|Reassign merge request" +msgstr "マージリクエスト担当者を変更" + +msgid "NotificationEvent|Reopen issue" +msgstr "課題を再オープン" + +msgid "NotificationEvent|Successful pipeline" +msgstr "パイプライン成功" + +msgid "NotificationLevel|Custom" +msgstr "カスタム" + +msgid "NotificationLevel|Disabled" +msgstr "無効" + +msgid "NotificationLevel|Global" +msgstr "全体設定" + +msgid "NotificationLevel|On mention" +msgstr "メンション時" + +msgid "NotificationLevel|Participate" +msgstr "参加" + +msgid "NotificationLevel|Watch" +msgstr "すべて通知" + +msgid "OfSearchInADropdown|Filter" +msgstr "フィルター" + +msgid "OpenedNDaysAgo|Opened" +msgstr "オープンされたのは" + +msgid "Options" +msgstr "オプション" + +msgid "Owner" +msgstr "オーナー" + +msgid "Pipeline" +msgstr "パイプライン" + +msgid "Pipeline Health" +msgstr "パイプラインの進捗状況" + +msgid "Pipeline Schedule" +msgstr "パイプラインスケジュール" + +msgid "Pipeline Schedules" +msgstr "パイプラインスケジュール" + +msgid "PipelineCharts|Failed:" +msgstr "失敗:" + +msgid "PipelineCharts|Overall statistics" +msgstr "全体統計" + +msgid "PipelineCharts|Success ratio:" +msgstr "成功比率:" + +msgid "PipelineCharts|Successful:" +msgstr "成功:" + +msgid "PipelineCharts|Total:" +msgstr "合計:" + +msgid "PipelineSchedules|Activated" +msgstr "アクティブ" + +msgid "PipelineSchedules|Active" +msgstr "アクティブ" + +msgid "PipelineSchedules|All" +msgstr "全件" + +msgid "PipelineSchedules|Inactive" +msgstr "無効" + +msgid "PipelineSchedules|Next Run" +msgstr "次の実行" + +msgid "PipelineSchedules|None" +msgstr "なし" + +msgid "PipelineSchedules|Provide a short description for this pipeline" +msgstr "このパイプラインについて簡単に記述してください。" + +msgid "PipelineSchedules|Take ownership" +msgstr "権限を取得する" + +msgid "PipelineSchedules|Target" +msgstr "ターゲット" + +msgid "PipelineSheduleIntervalPattern|Custom" +msgstr "カスタム" + +msgid "Pipelines" +msgstr "パイプライン" + +msgid "Pipelines charts" +msgstr "パイプラインチャート" + +msgid "Pipeline|all" +msgstr "全件" + +msgid "Pipeline|success" +msgstr "成功" + +msgid "Pipeline|with stage" +msgstr "ステージあり" + +msgid "Pipeline|with stages" +msgstr "ステージあり" + +msgid "Project '%{project_name}' queued for deletion." +msgstr "'%{project_name}' プロジェクトは削除処理待ちです。" + +msgid "Project '%{project_name}' was successfully created." +msgstr "'%{project_name}' プロジェクトは正常に作成されました。" + +msgid "Project '%{project_name}' was successfully updated." +msgstr "'%{project_name}' プロジェクトは正常に更新されました。" + +msgid "Project '%{project_name}' will be deleted." +msgstr "'%{project_name}' プロジェクトは削除されます。" + +msgid "Project access must be granted explicitly to each user." +msgstr "ユーザーごとにプロジェクトアクセスの権限を指定しなければなりません。" + +msgid "Project export could not be deleted." +msgstr "プロジェクトのエクスポートを削除できませんでした。" + +msgid "Project export has been deleted." +msgstr "プロジェクトのエクスポートを削除しました。" + +msgid "" +"Project export link has expired. Please generate a new export from your " +"project settings." +msgstr "プロジェクトのエクスポートリンクは期限切れになりました。プロジェクト設定にて新しくエクスポートリンクを作成してください。" + +msgid "Project export started. A download link will be sent by email." +msgstr "プロジェクトのエクスポートを開始しました。ダウンロードのリンクはメールで送信します" + +msgid "Project home" +msgstr "プロジェクトホーム" + +msgid "ProjectFeature|Disabled" +msgstr "無効" + +msgid "ProjectFeature|Everyone with access" +msgstr "アクセス権限を持っている人" + +msgid "ProjectFeature|Only team members" +msgstr "チームメンバーのみ" + +msgid "ProjectFileTree|Name" +msgstr "名前" + +msgid "ProjectLastActivity|Never" +msgstr "記録なし" + +msgid "ProjectLifecycle|Stage" +msgstr "ステージ" + +msgid "ProjectNetworkGraph|Graph" +msgstr "ネットワークグラフ" + +msgid "Read more" +msgstr "続きを読む" + +msgid "Readme" +msgstr "Readme" + +msgid "RefSwitcher|Branches" +msgstr "ブランチ" + +msgid "RefSwitcher|Tags" +msgstr "タグ" + +msgid "Related Commits" +msgstr "関連するコミット" + +msgid "Related Deployed Jobs" +msgstr "関連するデプロイ済ジョブ" + +msgid "Related Issues" +msgstr "関連する課題" + +msgid "Related Jobs" +msgstr "関連するジョブ" + +msgid "Related Merge Requests" +msgstr "関連するマージリクエスト" + +msgid "Related Merged Requests" +msgstr "関連するマージリクエスト" + +msgid "Remind later" +msgstr "後で通知" + +msgid "Remove project" +msgstr "プロジェクトを削除" + +msgid "Request Access" +msgstr "アクセス権限をリクエストする" + +msgid "Revert this commit" +msgstr "このコミットをリバート" + +msgid "Revert this merge request" +msgstr "このマージリクエストをリバート" + +msgid "Save pipeline schedule" +msgstr "パイプラインスケジュールを保存" + +msgid "Schedule a new pipeline" +msgstr "新しいパイプラインのスケジュールを作成" + +msgid "Scheduling Pipelines" +msgstr "パイプラインスケジューリング" + +msgid "Search branches and tags" +msgstr "ブランチまたはタグを検索" + +msgid "Select Archive Format" +msgstr "アーカイブのフォーマットを選択" + +msgid "Select a timezone" +msgstr "タイムゾーンを選択" + +msgid "Select target branch" +msgstr "ターゲットブランチを選択" + +msgid "Set a password on your account to pull or push via %{protocol}." +msgstr "%{protocol} プロコトル経由でプル、プッシュするためにアカウントのパスワードを設定。" + +msgid "Set up CI" +msgstr "CI を設定" + +msgid "Set up Koding" +msgstr "Koding を設定" + +msgid "Set up auto deploy" +msgstr "自動デプロイを設定" + +msgid "SetPasswordToCloneLink|set a password" +msgstr "パスワードを設定" + +msgid "Showing %d event" +msgid_plural "Showing %d events" +msgstr[0] "%d のイベントを表示中" + +msgid "Source code" +msgstr "ソースコード" + +msgid "StarProject|Star" +msgstr "スターを付ける" + +msgid "Start a %{new_merge_request} with these changes" +msgstr "この変更で %{new_merge_request} を作成する" + +msgid "Switch branch/tag" +msgstr "ブランチ・タグ切り替え" + +msgid "Tag" +msgid_plural "Tags" +msgstr[0] "タグ" + +msgid "Tags" +msgstr "タグ" + +msgid "Target Branch" +msgstr "ターゲットブランチ" + +msgid "" +"The coding stage shows the time from the first commit to creating the merge " +"request. The data will automatically be added here once you create your " +"first merge request." +msgstr "" +"コーディングステージでは、最初のコミットからマージリクエストが作成されるまでの時間が表示されます。このデータは最初のマージリクエストが作成されたときに自動的に追加されます。" + +msgid "The collection of events added to the data gathered for that stage." +msgstr "このステージで計測データに追加されたイベントリスト" + +msgid "The fork relationship has been removed." +msgstr "フォークのリレーションが削除されました。" + +msgid "" +"The issue stage shows the time it takes from creating an issue to assigning " +"the issue to a milestone, or add the issue to a list on your Issue Board. " +"Begin creating issues to see data for this stage." +msgstr "" +"課題ステージでは、課題が登録されてからマイルストーンに割り当てられるか、課題ボードのリストに追加されるまでの時間が表示されます。このリストに表示するには課題を最初に作成してください。" + +msgid "The phase of the development lifecycle." +msgstr "開発ライフサイクルの段階" + +msgid "" +"The pipelines schedule runs pipelines in the future, repeatedly, for " +"specific branches or tags. Those scheduled pipelines will inherit limited " +"project access based on their associated user." +msgstr "" +"パイプラインスケジュールは指定のブランチまたはタグに対して自動的にパイプラインを実行します。計画済みパイプラインはそれらの紐付けられたユーザーのプロジェクトと同じ権限を継承します。" + +msgid "" +"The planning stage shows the time from the previous step to pushing your " +"first commit. This time will be added automatically once you push your first " +"commit." +msgstr "" +"計画ステージでは、課題ステージに登録されてからプッシュされた最初のコミット時刻までの時間が表示されます。最初のコミットがプッシュされときに自動的に追加されます。" + +msgid "" +"The production stage shows the total time it takes between creating an issue " +"and deploying the code to production. The data will be automatically added " +"once you have completed the full idea to production cycle." +msgstr "" +"プロダクションステージでは、課題が作成されてからプロダクションへデプロイされるまでの時間が表示されます。アイディアの時点からプロダクションまでの全ステージが完了したときに自動的に追加されます。" + +msgid "The project can be accessed by any logged in user." +msgstr "プロジェクトは、ログインユーザーであれば誰でもアクセスできます。" + +msgid "The project can be accessed without any authentication." +msgstr "プロジェクトは、ログインなしに誰でもアクセスできます。" + +msgid "The repository for this project does not exist." +msgstr "このプロジェクトにレポジトリーはありません。" + +msgid "" +"The review stage shows the time from creating the merge request to merging " +"it. The data will automatically be added after you merge your first merge " +"request." +msgstr "" +"レビューステージとは、マージリクエストを作成してからマージするまでの時間です。このデータは最初のマージリクエストがマージされたときに自動的に追加されます。" + +msgid "" +"The staging stage shows the time between merging the MR and deploying code " +"to the production environment. The data will be automatically added once you " +"deploy to production for the first time." +msgstr "" +"ステージングステージでは、マージリクエストがマージされてからコードがプロダクション環境にデプロイされるまでの時間が表示されます。このデータは最初にプロダクションにデプロイしたときに自動的に追加されます。" + +msgid "" +"The testing stage shows the time GitLab CI takes to run every pipeline for " +"the related merge request. The data will automatically be added after your " +"first pipeline finishes running." +msgstr "" +"テスティングステージでは、GitLab CI " +"が関連するマージリクエストの各パイプラインを実行する時間が表示されます。このデータは最初のパイプラインが完了したときに自動的に追加されます。" + +msgid "The time taken by each data entry gathered by that stage." +msgstr "このステージに収集されたデータ毎の時間" + +msgid "" +"The value lying at the midpoint of a series of observed values. E.g., " +"between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 =" +" 6." +msgstr "" +"得られた一連のデータを小さい順に並べたときに中央に位置する値。例えば、3, 5, 9の中央値は5。3, 5, 7, 8の中央値は (5+7)/2 = " +"6。" + +msgid "" +"This means you can not push code until you create an empty repository or " +"import existing one." +msgstr "空レポジトリーを作成または既存レポジトリーをインポートをしなければ、コードのプッシュはできません。" + +msgid "Time before an issue gets scheduled" +msgstr "課題が計画されるまでの時間" + +msgid "Time before an issue starts implementation" +msgstr "課題の実装が開始されるまでの時間" + +msgid "Time between merge request creation and merge/close" +msgstr "マージリクエストが作成されてからマージまたはクローズされるまでの時間" + +msgid "Time until first merge request" +msgstr "最初のマージリクエストまでの時間" + +msgid "Timeago|%s days ago" +msgstr "%s日前" + +msgid "Timeago|%s days remaining" +msgstr "残り %s日間" + +msgid "Timeago|%s hours remaining" +msgstr "残り %s時間" + +msgid "Timeago|%s minutes ago" +msgstr "%s分前" + +msgid "Timeago|%s minutes remaining" +msgstr "残り %s分間" + +msgid "Timeago|%s months ago" +msgstr "%sヶ月前" + +msgid "Timeago|%s months remaining" +msgstr "残り %sヶ月" + +msgid "Timeago|%s seconds remaining" +msgstr "残り %s 秒" + +msgid "Timeago|%s weeks ago" +msgstr "%s週間前" + +msgid "Timeago|%s weeks remaining" +msgstr "残り %s週間" + +msgid "Timeago|%s years ago" +msgstr "%s年前" + +msgid "Timeago|%s years remaining" +msgstr "残り %s年間" + +msgid "Timeago|1 day remaining" +msgstr "残り 1日間" + +msgid "Timeago|1 hour remaining" +msgstr "残り 1時間" + +msgid "Timeago|1 minute remaining" +msgstr "残り 1分間" + +msgid "Timeago|1 month remaining" +msgstr "残り 1ヶ月" + +msgid "Timeago|1 week remaining" +msgstr "残り 1週間" + +msgid "Timeago|1 year remaining" +msgstr "残り 1年間" + +msgid "Timeago|Past due" +msgstr "期限オーバー" + +msgid "Timeago|a day ago" +msgstr "1日前" + +msgid "Timeago|a month ago" +msgstr "1ヶ月前" + +msgid "Timeago|a week ago" +msgstr "1週間前" + +msgid "Timeago|a while" +msgstr "しばらく前" + +msgid "Timeago|a year ago" +msgstr "1年前" + +msgid "Timeago|about %s hours ago" +msgstr "約%s時間前" + +msgid "Timeago|about a minute ago" +msgstr "約1分間前" + +msgid "Timeago|about an hour ago" +msgstr "約1時間前" + +msgid "Timeago|in %s days" +msgstr "%s日間以内" + +msgid "Timeago|in %s hours" +msgstr "%s時間以内" + +msgid "Timeago|in %s minutes" +msgstr "%s分間以内" + +msgid "Timeago|in %s months" +msgstr "%sヶ月以内" + +msgid "Timeago|in %s seconds" +msgstr "%s秒以内" + +msgid "Timeago|in %s weeks" +msgstr "%s週間以内" + +msgid "Timeago|in %s years" +msgstr "%s年間以内" + +msgid "Timeago|in 1 day" +msgstr "1日以内" + +msgid "Timeago|in 1 hour" +msgstr "1時間以内" + +msgid "Timeago|in 1 minute" +msgstr "1分以内" + +msgid "Timeago|in 1 month" +msgstr "1ヶ月以内" + +msgid "Timeago|in 1 week" +msgstr "1週間以内" + +msgid "Timeago|in 1 year" +msgstr "1年以内" + +msgid "Timeago|less than a minute ago" +msgstr "1分未満" + +msgid "Time|hr" +msgid_plural "Time|hrs" +msgstr[0] "時間" + +msgid "Time|min" +msgid_plural "Time|mins" +msgstr[0] "分" + +msgid "Time|s" +msgstr "秒" + +msgid "Total Time" +msgstr "合計時間" + +msgid "Total test time for all commits/merges" +msgstr "すべてのコミット/マージの合計テスト時間" + +msgid "Unstar" +msgstr "スターを外す" + +msgid "Upload New File" +msgstr "新規ファイルをアップロード" + +msgid "Upload file" +msgstr "ファイルをアップロード" + +msgid "UploadLink|click to upload" +msgstr "クリックしてアップロード" + +msgid "Use your global notification setting" +msgstr "全体通知設定を利用" + +msgid "View open merge request" +msgstr "オープンなマージリクエストを表示" + +msgid "VisibilityLevel|Internal" +msgstr "内部" + +msgid "VisibilityLevel|Private" +msgstr "プライベート" + +msgid "VisibilityLevel|Public" +msgstr "パブリック" + +msgid "Want to see the data? Please ask an administrator for access." +msgstr "このデータを参照したいですか?アクセスするには管理者に問い合わせてください。" + +msgid "We don't have enough data to show this stage." +msgstr "データ不足のため、このステージの表示はできません。" + +msgid "Withdraw Access Request" +msgstr "アクセスリクエストを取り消す" + +msgid "" +"You are going to remove %{project_name_with_namespace}.\n" +"Removed project CANNOT be restored!\n" +"Are you ABSOLUTELY sure?" +msgstr "" +"%{project_name_with_namespace} プロジェクトを削除しようとしています。\n" +"削除されたプロジェクトは絶対に元には戻せません!\n" +"本当によろしいですか?" + +msgid "" +"You are going to remove the fork relationship to source project " +"%{forked_from_project}. Are you ABSOLUTELY sure?" +msgstr "元のプロジェクト (%{forked_from_project}) とのリレーションを削除しようとしています。\n" +"本当によろしいですか?" + +msgid "" +"You are going to transfer %{project_name_with_namespace} to another owner. " +"Are you ABSOLUTELY sure?" +msgstr "%{project_name_with_namespace} プロジェクトを別のオーナーに移譲しようとしています。本当によろしいですか?" + +msgid "You can only add files when you are on a branch" +msgstr "ファイルを追加するには、どこかのブランチにいなければいけません" + +msgid "You have reached your project limit" +msgstr "プロジェクト数の上限に達しています" + +msgid "You must sign in to star a project" +msgstr "プロジェクトにスターをつけたい場合はログインしてください" + +msgid "You need permission." +msgstr "権限が必要です" + +msgid "You will not get any notifications via email" +msgstr "通知メールを送信しません" + +msgid "You will only receive notifications for the events you choose" +msgstr "選択したイベントのみ通知します" + +msgid "" +"You will only receive notifications for threads you have participated in" +msgstr "参加したスレッドのみ通知します" + +msgid "You will receive notifications for any activity" +msgstr "全てのアクティビティーを通知します" + +msgid "" +"You will receive notifications only for comments in which you were " +"@mentioned" +msgstr "あなたが @mentioned でコメントされた時のみ通知します" + +msgid "" +"You won't be able to pull or push project code via %{protocol} until you " +"%{set_password_link} on your account" +msgstr "" +"%{set_password_link} でアカウントのパスワードがセットされていないので、プロジェクトに %{protocol} " +"でソースコードをプッシュ、プルできません" + +msgid "" +"You won't be able to pull or push project code via SSH until you " +"%{add_ssh_key_link} to your profile" +msgstr "%{add_ssh_key_link} をプロファイルに追加していないので、プロジェクトにソースコードをプッシュ、プルできません" + +msgid "Your name" +msgstr "名前" + +msgid "day" +msgid_plural "days" +msgstr[0] "日" + +msgid "new merge request" +msgstr "新規マージリクエスト" + +msgid "notification emails" +msgstr "メール通知" + +msgid "parent" +msgid_plural "parents" +msgstr[0] "親" + diff --git a/locale/ja/gitlab.po.time_stamp b/locale/ja/gitlab.po.time_stamp new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/locale/ja/gitlab.po.time_stamp diff --git a/locale/pt_BR/gitlab.po b/locale/pt_BR/gitlab.po index 1ea39894bb8..c4918a4c920 100644 --- a/locale/pt_BR/gitlab.po +++ b/locale/pt_BR/gitlab.po @@ -6,20 +6,41 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-15 21:59-0500\n" +"POT-Creation-Date: 2017-06-28 13:32+0200\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2017-07-05 02:56-0400\n" -"Last-Translator: Huang Tao <htve@outlook.com>\n" -"Language-Team: Portuguese (Brazil)\n" +"PO-Revision-Date: 2017-07-12 09:05-0400\n" +"Last-Translator: Leandro Nunes dos Santos <leandronunes@gmail.com>\n" +"Language-Team: Portuguese (Brazil) (https://translate.zanata.org/project/view/GitLab)\n" "Language: pt-BR\n" "X-Generator: Zanata 3.9.6\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" +msgid "%s additional commit has been omitted to prevent performance issues." +msgid_plural "" +"%s additional commits have been omitted to prevent performance issues." +msgstr[0] "" +"%s commit adicional foi omitido para prevenir problemas de performance." +msgstr[1] "" +"%s commits adicionais foram omitidos para prevenir problemas de performance." + +msgid "%d commit" +msgid_plural "%d commits" +msgstr[0] "%d commit" +msgstr[1] "%d commits" + msgid "%{commit_author_link} committed %{commit_timeago}" msgstr "%{commit_author_link} fez commit %{commit_timeago}" +msgid "1 pipeline" +msgid_plural "%d pipelines" +msgstr[0] "1 pipeline" +msgstr[1] "%d pipelines" + +msgid "A collection of graphs regarding Continuous Integration" +msgstr "Uma coleção de gráficos sobre Integração Contínua" + msgid "About auto deploy" msgstr "Sobre a implantação automática" @@ -67,9 +88,24 @@ msgstr "" "implantação automática, selecione um modelo de Yaml do GitLab CI e registre " "suas mudanças. %{link_to_autodeploy_doc}" +msgid "BranchSwitcherPlaceholder|Search branches" +msgstr "BranchSwitcherPlaceholder|Procurar por branches" + +msgid "BranchSwitcherTitle|Switch branch" +msgstr "BranchSwitcherTitle|Mudar de branch" + msgid "Branches" msgstr "Branches" +msgid "Browse Directory" +msgstr "Navegar no Diretório" + +msgid "Browse File" +msgstr "Pesquisar Arquivo" + +msgid "Browse Files" +msgstr "Pesquisar Arquivos" + msgid "Browse files" msgstr "Navegar pelos arquivos" @@ -165,6 +201,9 @@ msgid_plural "Commits" msgstr[0] "Commit" msgstr[1] "Commits" +msgid "Commit duration in minutes for last 30 commits" +msgstr "Duração do commit em minutos para os últimos 30 commits" + msgid "Commit message" msgstr "Mensagem de commit" @@ -177,6 +216,9 @@ msgstr "Adicionar %{file_name}" msgid "Commits" msgstr "Commits" +msgid "Commits feed" +msgstr "Feed de commits" + msgid "Commits|History" msgstr "Histórico" @@ -201,6 +243,13 @@ msgstr "Copiar SHA do commit para a área de transferência" msgid "Create New Directory" msgstr "Criar Novo Diretório" +msgid "" +"Create a personal access token on your account to pull or push via " +"%{protocol}." +msgstr "" +"Crie um token de acesso pessoal na sua conta para dar pull ou push via " +"%{protocol}." + msgid "Create directory" msgstr "Criar diretório" @@ -219,6 +268,9 @@ msgstr "Fork" msgid "CreateTag|Tag" msgstr "Tag" +msgid "CreateTokenToCloneLink|create a personal access token" +msgstr "CreateTokenToCloneLink|criar um token de acesso pessoal" + msgid "Cron Timezone" msgstr "Fuso horário do cron" @@ -340,6 +392,9 @@ msgstr "Erro ao excluir o agendamento do pipeline" msgid "Files" msgstr "Arquivos" +msgid "Filter by commit message" +msgstr "Filtrar por mensagem de commit" + msgid "Find by path" msgstr "Localizar por caminho" @@ -388,6 +443,15 @@ msgstr "Padrão de intervalo" msgid "Introducing Cycle Analytics" msgstr "Apresentando a Análise de Ciclo" +msgid "Jobs for last month" +msgstr "Jobs no último mês" + +msgid "Jobs for last week" +msgstr "Jobs na última semana" + +msgid "Jobs for last year" +msgstr "Jobs no último ano" + msgid "LFSStatus|Disabled" msgstr "Desabilitado" @@ -553,6 +617,21 @@ msgstr "Agendamento da Pipeline" msgid "Pipeline Schedules" msgstr "Agendamentos da Pipeline" +msgid "PipelineCharts|Failed:" +msgstr "PipelineCharts|Falhou:" + +msgid "PipelineCharts|Overall statistics" +msgstr "PipelineCharts|Estatísticas gerais" + +msgid "PipelineCharts|Success ratio:" +msgstr "PipelineCharts|Taxa de sucesso:" + +msgid "PipelineCharts|Successful:" +msgstr "PipelineCharts|Sucesso:" + +msgid "PipelineCharts|Total:" +msgstr "PipelineCharts|Total:" + msgid "PipelineSchedules|Activated" msgstr "Ativado" @@ -583,6 +662,18 @@ msgstr "Destino" msgid "PipelineSheduleIntervalPattern|Custom" msgstr "Personalizado" +msgid "Pipelines" +msgstr "Pipelines" + +msgid "Pipelines charts" +msgstr "Gráficos de pipelines" + +msgid "Pipeline|all" +msgstr "Pipeline|todos" + +msgid "Pipeline|success" +msgstr "Pipeline|sucesso" + msgid "Pipeline|with stage" msgstr "com etapa" @@ -713,10 +804,10 @@ msgstr "Selecionar fuso horário" msgid "Select target branch" msgstr "Selecionar branch de destino" -msgid "Set a password on your account to pull or push via %{protocol}" +msgid "Set a password on your account to pull or push via %{protocol}." msgstr "" "Defina uma senha para sua conta para aceitar ou entregar código via " -"%{protocol}" +"%{protocol}." msgid "Set up CI" msgstr "Configurar CI" @@ -1032,9 +1123,15 @@ msgstr "Enviar Novo Arquivo" msgid "Upload file" msgstr "Enviar arquivo" +msgid "UploadLink|click to upload" +msgstr "UploadLink|clique para fazer upload" + msgid "Use your global notification setting" msgstr "Utilizar configuração de notificação global" +msgid "View open merge request" +msgstr "Ver merge request aberto" + msgid "VisibilityLevel|Internal" msgstr "Interno" diff --git a/locale/ru/gitlab.po b/locale/ru/gitlab.po new file mode 100644 index 00000000000..4643bed98e2 --- /dev/null +++ b/locale/ru/gitlab.po @@ -0,0 +1,1233 @@ +# SAS <Stepanov.sa@bashkortostan.ru>, 2017. #zanata +# Huang Tao <htve@outlook.com>, 2017. #zanata +msgid "" +msgstr "" +"Project-Id-Version: gitlab 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-28 13:32+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: 2017-07-11 05:13-0400\n" +"Last-Translator: SAS <Stepanov.sa@bashkortostan.ru>\n" +"Language-Team: Russian (https://translate.zanata.org/project/view/GitLab)\n" +"Language: ru\n" +"X-Generator: Zanata 3.9.6\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" + +msgid "%s additional commit has been omitted to prevent performance issues." +msgid_plural "" +"%s additional commits have been omitted to prevent performance issues." +msgstr[0] "" +"%s добавленный коммит был исключен для предотвращения проблем с " +"производительностью." +msgstr[1] "" +"%s добавленные коммиты были исключены для предотвращения проблем с " +"производительностью." +msgstr[2] "" +"%s добавленные коммиты были исключены для предотвращения проблем с " +"производительностью." + +msgid "%d commit" +msgid_plural "%d commits" +msgstr[0] "%d коммит" +msgstr[1] "%d коммит(а|ов)" +msgstr[2] "%d коммит(а|ов)" + +msgid "%{commit_author_link} committed %{commit_timeago}" +msgstr "%{commit_author_link} закоммичено %{commit_timeago}" + +msgid "1 pipeline" +msgid_plural "%d pipelines" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +msgid "A collection of graphs regarding Continuous Integration" +msgstr "" + +msgid "About auto deploy" +msgstr "Автоматическое развертывание" + +msgid "Active" +msgstr "Активный" + +msgid "Activity" +msgstr "Активность" + +msgid "Add Changelog" +msgstr "Добавить в журнал изменений" + +msgid "Add Contribution guide" +msgstr "Добавить руководство для контрибьютеров" + +msgid "Add License" +msgstr "Добавить лицензию" + +msgid "Add an SSH key to your profile to pull or push via SSH." +msgstr "" +"Добавьте ключ SSH в свой профиль, чтобы отправлять или получать код через " +"SSH." + +msgid "Add new directory" +msgstr "Добавить новую директорию" + +msgid "Archived project! Repository is read-only" +msgstr "Архивный проект! Репозиторий доступен только для чтения" + +msgid "Are you sure you want to delete this pipeline schedule?" +msgstr "Вы действительно хотите удалить это расписание конвейера?" + +msgid "Attach a file by drag & drop or %{upload_link}" +msgstr "Приложить файл через drag & drop или %{upload_link}" + +msgid "Branch" +msgid_plural "Branches" +msgstr[0] "Ветка" +msgstr[1] "Ветки" +msgstr[2] "Ветки" + +msgid "" +"Branch <strong>%{branch_name}</strong> was created. To set up auto deploy, " +"choose a GitLab CI Yaml template and commit your changes. " +"%{link_to_autodeploy_doc}" +msgstr "" +"Ветка <strong>%{branch_name}</strong> создана. Для настройки автоматического " +"развертывания выберете GitLab CI Yaml-шаблон и зафиксируйте изменения. " +"%{link_to_autodeploy_doc}" + +msgid "BranchSwitcherPlaceholder|Search branches" +msgstr "BranchSwitcherPlaceholder|Поиск веток" + +msgid "BranchSwitcherTitle|Switch branch" +msgstr "BranchSwitcherTitle|Переключить ветку" + +msgid "Branches" +msgstr "Ветки" + +msgid "Browse Directory" +msgstr "Просмотр директории" + +msgid "Browse File" +msgstr "Просмотр файла" + +msgid "Browse Files" +msgstr "Просмотр файлов" + +msgid "Browse files" +msgstr "Просмотр файлов" + +msgid "ByAuthor|by" +msgstr "ByAuthor|по автору" + +msgid "CI configuration" +msgstr "Настройка CI" + +msgid "Cancel" +msgstr "Отмена" + +msgid "ChangeTypeActionLabel|Pick into branch" +msgstr "ChangeTypeActionLabel|Выбрать в ветке" + +msgid "ChangeTypeActionLabel|Revert in branch" +msgstr "ChangeTypeActionLabel|Отменить в ветке" + +msgid "ChangeTypeAction|Cherry-pick" +msgstr "ChangeTypeAction|Подобрать" + +msgid "ChangeTypeAction|Revert" +msgstr "ChangeTypeAction|Отменить" + +msgid "Changelog" +msgstr "Журнал изменений" + +msgid "Charts" +msgstr "Графики" + +msgid "Cherry-pick this commit" +msgstr "Подобрать в этом коммите" + +msgid "Cherry-pick this merge request" +msgstr "Побрать в этом запросе на слияние" + +msgid "CiStatusLabel|canceled" +msgstr "CiStatusLabel|отменено" + +msgid "CiStatusLabel|created" +msgstr "CiStatusLabel|создано" + +msgid "CiStatusLabel|failed" +msgstr "CiStatusLabel|неудачно" + +msgid "CiStatusLabel|manual action" +msgstr "CiStatusLabel|ручное действие" + +msgid "CiStatusLabel|passed" +msgstr "CiStatusLabel|пройдено" + +msgid "CiStatusLabel|passed with warnings" +msgstr "CiStatusLabel|пройдено с предупреждениями" + +msgid "CiStatusLabel|pending" +msgstr "CiStatusLabel|в ожидании" + +msgid "CiStatusLabel|skipped" +msgstr "CiStatusLabel|пропущено" + +msgid "CiStatusLabel|waiting for manual action" +msgstr "CiStatusLabel|ожидание ручных действий" + +msgid "CiStatusText|blocked" +msgstr "CiStatusText|блокировано" + +msgid "CiStatusText|canceled" +msgstr "CiStatusText|отменено" + +msgid "CiStatusText|created" +msgstr "CiStatusText|создано" + +msgid "CiStatusText|failed" +msgstr "CiStatusText|неудачно" + +msgid "CiStatusText|manual" +msgstr "CiStatusText|ручное" + +msgid "CiStatusText|passed" +msgstr "CiStatusText|пройдено" + +msgid "CiStatusText|pending" +msgstr "CiStatusText|в ожидании" + +msgid "CiStatusText|skipped" +msgstr "CiStatusText|пропущено" + +msgid "CiStatus|running" +msgstr "CiStatus|выполняется" + +msgid "Commit" +msgid_plural "Commits" +msgstr[0] "Коммит" +msgstr[1] "Коммиты" +msgstr[2] "Коммиты" + +msgid "Commit duration in minutes for last 30 commits" +msgstr "" + +msgid "Commit message" +msgstr "Описание коммита" + +msgid "CommitBoxTitle|Commit" +msgstr "CommitBoxTitle|Коммит" + +msgid "CommitMessage|Add %{file_name}" +msgstr "CommitMessage|Добавить %{file_name}" + +msgid "Commits" +msgstr "Коммиты" + +msgid "Commits feed" +msgstr "" + +msgid "Commits|History" +msgstr "Commits|История" + +msgid "Committed by" +msgstr "Коммит" + +msgid "Compare" +msgstr "Сравнение" + +msgid "Contribution guide" +msgstr "Руководство контрибьютора" + +msgid "Contributors" +msgstr "Контрибьюторы" + +msgid "Copy URL to clipboard" +msgstr "Копировать URL в буфер обмена" + +msgid "Copy commit SHA to clipboard" +msgstr "Копировать SHA коммита в буфер обмена" + +msgid "Create New Directory" +msgstr "Создать новую директорию" + +msgid "" +"Create a personal access token on your account to pull or push via " +"%{protocol}." +msgstr "" + +msgid "Create directory" +msgstr "Создать директорию" + +msgid "Create empty bare repository" +msgstr "Создать пустой пустой репозиторий" + +msgid "Create merge request" +msgstr "Создать запрос на объединение" + +msgid "Create new..." +msgstr "Новый" + +msgid "CreateNewFork|Fork" +msgstr "CreateNewFork|Форк" + +msgid "CreateTag|Tag" +msgstr "CreateTag|Тэг" + +msgid "CreateTokenToCloneLink|create a personal access token" +msgstr "" + +msgid "Cron Timezone" +msgstr "Временная зона Cron" + +msgid "Cron syntax" +msgstr "Синтаксис Cron" + +msgid "Custom notification events" +msgstr " Настраиваемые уведомления о событиях" + +msgid "" +"Custom notification levels are the same as participating levels. With custom " +"notification levels you will also receive notifications for select events. " +"To find out more, check out %{notification_link}." +msgstr "" +"Настраиваемые уровни уведомлений аналогичны уровню уведомлений в " +"соответствии с участием. С настраиваемыми уровнями уведомлений вы также " +"будете получать уведомления о выбранных событиях. Чтобы узнать больше, " +"посмотрите %{notification_link}." + +msgid "Cycle Analytics" +msgstr "Аналитика цикла разработки" + +msgid "" +"Cycle Analytics gives an overview of how much time it takes to go from idea " +"to production in your project." +msgstr "" + +msgid "CycleAnalyticsStage|Code" +msgstr "CycleAnalyticsStage|Код" + +msgid "CycleAnalyticsStage|Issue" +msgstr "CycleAnalyticsStage|Обращение" + +msgid "CycleAnalyticsStage|Plan" +msgstr "" + +msgid "CycleAnalyticsStage|Production" +msgstr "" + +msgid "CycleAnalyticsStage|Review" +msgstr "CycleAnalyticsStage|Ревьюв" + +msgid "CycleAnalyticsStage|Staging" +msgstr "" + +msgid "CycleAnalyticsStage|Test" +msgstr "" + +msgid "Define a custom pattern with cron syntax" +msgstr "Определить настраиваемый шаблон с синтаксисом cron" + +msgid "Delete" +msgstr "Удалить" + +msgid "Deploy" +msgid_plural "Deploys" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +msgid "Description" +msgstr "Описание" + +msgid "Directory name" +msgstr "Наименование директории" + +msgid "Don't show again" +msgstr "Не показывать снова" + +msgid "Download" +msgstr "Загрузить" + +msgid "Download tar" +msgstr "Загрузить tar" + +msgid "Download tar.bz2" +msgstr "Загрузить tar.bz2" + +msgid "Download tar.gz" +msgstr "Загрузить tar.gz" + +msgid "Download zip" +msgstr "Загрузить zip" + +msgid "DownloadArtifacts|Download" +msgstr "DownloadArtifacts|Загрузка" + +msgid "DownloadCommit|Email Patches" +msgstr "DownloadCommit|Email-патчи" + +msgid "DownloadCommit|Plain Diff" +msgstr "DownloadCommit|Plain Diff" + +msgid "DownloadSource|Download" +msgstr "DownloadSource|Загрузка" + +msgid "Edit" +msgstr "Редактировать" + +msgid "Edit Pipeline Schedule %{id}" +msgstr "Изменить расписание конвейера %{id}" + +msgid "Every day (at 4:00am)" +msgstr "Ежедневно (в 4:00)" + +msgid "Every month (on the 1st at 4:00am)" +msgstr "Ежемесячно (каждое 1-е число в 4:00)" + +msgid "Every week (Sundays at 4:00am)" +msgstr "Еженедельно (по воскресениями в 4:00)" + +msgid "Failed to change the owner" +msgstr "Не удалось изменить владельца" + +msgid "Failed to remove the pipeline schedule" +msgstr "Не удалось удалить расписание конвейера" + +msgid "Files" +msgstr "Файлы" + +msgid "Filter by commit message" +msgstr "Фильтр по комментариями к коммитам" + +msgid "Find by path" +msgstr "Поиск по пути" + +msgid "Find file" +msgstr "Найти файл" + +msgid "FirstPushedBy|First" +msgstr "" + +msgid "FirstPushedBy|pushed by" +msgstr "" + +msgid "Fork" +msgid_plural "Forks" +msgstr[0] "Форк" +msgstr[1] "Форки" +msgstr[2] "Форки" + +msgid "ForkedFromProjectPath|Forked from" +msgstr "ForkedFromProjectPath|Форк от " + +msgid "From issue creation until deploy to production" +msgstr "" + +msgid "From merge request merge until deploy to production" +msgstr "" + +msgid "Go to your fork" +msgstr "Перейти к вашему форку" + +msgid "GoToYourFork|Fork" +msgstr "GoToYourFork|Форк" + +msgid "Home" +msgstr "Домашняя" + +msgid "Housekeeping successfully started" +msgstr "Очистка успешно запущена" + +msgid "Import repository" +msgstr "Импорт репозитория" + +msgid "Interval Pattern" +msgstr "Шаблон интервала" + +msgid "Introducing Cycle Analytics" +msgstr "" + +msgid "Jobs for last month" +msgstr "" + +msgid "Jobs for last week" +msgstr "" + +msgid "Jobs for last year" +msgstr "" + +msgid "LFSStatus|Disabled" +msgstr "LFSStatus|Отключено" + +msgid "LFSStatus|Enabled" +msgstr "LFSStatus|Включено" + +msgid "Last %d day" +msgid_plural "Last %d days" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +msgid "Last Pipeline" +msgstr "Последний конвейер" + +msgid "Last Update" +msgstr "Последнее обновление" + +msgid "Last commit" +msgstr "Последний коммит" + +msgid "Learn more in the" +msgstr "Узнайте больше в" + +msgid "Learn more in the|pipeline schedules documentation" +msgstr "Подробнее в|документации по расписаниям конвейеров" + +msgid "Leave group" +msgstr "Покинуть группу" + +msgid "Leave project" +msgstr "Покинуть проект" + +msgid "Limited to showing %d event at most" +msgid_plural "Limited to showing %d events at most" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +msgid "Median" +msgstr "Медиана" + +msgid "MissingSSHKeyWarningLink|add an SSH key" +msgstr "MissingSSHKeyWarningLink|добавить ключ SSH" + +msgid "New Issue" +msgid_plural "New Issues" +msgstr[0] "Новое обращение" +msgstr[1] "Новые обращения" +msgstr[2] "Новые обращения" + +msgid "New Pipeline Schedule" +msgstr "Новое расписание конвейера" + +msgid "New branch" +msgstr "Новая ветка" + +msgid "New directory" +msgstr "Новая директория" + +msgid "New file" +msgstr "Новый файл" + +msgid "New issue" +msgstr "Новое обращение" + +msgid "New merge request" +msgstr "Новый запрос на объединение" + +msgid "New schedule" +msgstr "Новое расписание" + +msgid "New snippet" +msgstr "Новый сниппет" + +msgid "New tag" +msgstr "Новый тэг" + +msgid "No repository" +msgstr "Нет репозитория" + +msgid "No schedules" +msgstr "Нет расписания" + +msgid "Not available" +msgstr "" + +msgid "Not enough data" +msgstr "" + +msgid "Notification events" +msgstr "Уведомления о событиях" + +msgid "NotificationEvent|Close issue" +msgstr "NotificationEvent|Обращение закрыто" + +msgid "NotificationEvent|Close merge request" +msgstr "Запрос на объединение закрыт" + +msgid "NotificationEvent|Failed pipeline" +msgstr "NotificationEvent|Неудача в конвейере" + +msgid "NotificationEvent|Merge merge request" +msgstr "NotificationEvent|Объединить запрос на слияние" + +msgid "NotificationEvent|New issue" +msgstr "NotificationEvent|Новое обращение" + +msgid "NotificationEvent|New merge request" +msgstr "NotificationEvent|Новый запрос на слияние" + +msgid "NotificationEvent|New note" +msgstr "NotificationEvent|Новая заметка" + +msgid "NotificationEvent|Reassign issue" +msgstr "NotificationEvent|Переназначить обращение" + +msgid "NotificationEvent|Reassign merge request" +msgstr "NotificationEvent|Переназначить запрос на слияние" + +msgid "NotificationEvent|Reopen issue" +msgstr "NotificationEvent|Переоткрыть обращение" + +msgid "NotificationEvent|Successful pipeline" +msgstr "NotificationEvent|Успешно в конвейере" + +msgid "NotificationLevel|Custom" +msgstr "NotificationLevel|Настраиваемый" + +msgid "NotificationLevel|Disabled" +msgstr "NotificationLevel|Отключено" + +msgid "NotificationLevel|Global" +msgstr "NotificationLevel|Глобальный" + +msgid "NotificationLevel|On mention" +msgstr "NotificationLevel|С упоминанием" + +msgid "NotificationLevel|Participate" +msgstr "NotificationLevel|По участию" + +msgid "NotificationLevel|Watch" +msgstr "NotificationLevel|Отслеживать" + +msgid "OfSearchInADropdown|Filter" +msgstr "OfSearchInADropdown|Фильтр" + +msgid "OpenedNDaysAgo|Opened" +msgstr "OpenedNDaysAgo|Открыто" + +msgid "Options" +msgstr "Настройки" + +msgid "Owner" +msgstr "Владелец" + +msgid "Pipeline" +msgstr "Конвейер" + +msgid "Pipeline Health" +msgstr "" + +msgid "Pipeline Schedule" +msgstr "Расписание конвейера" + +msgid "Pipeline Schedules" +msgstr "Расписания конвейеров" + +msgid "PipelineCharts|Failed:" +msgstr "" + +msgid "PipelineCharts|Overall statistics" +msgstr "" + +msgid "PipelineCharts|Success ratio:" +msgstr "" + +msgid "PipelineCharts|Successful:" +msgstr "" + +msgid "PipelineCharts|Total:" +msgstr "" + +msgid "PipelineSchedules|Activated" +msgstr "PipelineSchedules|Активировано" + +msgid "PipelineSchedules|Active" +msgstr "PipelineSchedules|Активно" + +msgid "PipelineSchedules|All" +msgstr "PipelineSchedules|Все" + +msgid "PipelineSchedules|Inactive" +msgstr "PipelineSchedules|Неактивно" + +msgid "PipelineSchedules|Next Run" +msgstr "PipelineSchedules|Следующий запуск" + +msgid "PipelineSchedules|None" +msgstr "PipelineSchedules|None" + +msgid "PipelineSchedules|Provide a short description for this pipeline" +msgstr "PipelineSchedules|Предоставьте краткое описание этого конвейера" + +msgid "PipelineSchedules|Take ownership" +msgstr "PipelineSchedules|Стать владельцем" + +msgid "PipelineSchedules|Target" +msgstr "PipelineSchedules|Цель" + +msgid "PipelineSheduleIntervalPattern|Custom" +msgstr "PipelineSheduleIntervalPattern|Настраиваемый" + +msgid "Pipelines" +msgstr "" + +msgid "Pipelines charts" +msgstr "" + +msgid "Pipeline|all" +msgstr "" + +msgid "Pipeline|success" +msgstr "" + +msgid "Pipeline|with stage" +msgstr "Pipeline|со стадией" + +msgid "Pipeline|with stages" +msgstr "Pipeline|со стадиями" + +msgid "Project '%{project_name}' queued for deletion." +msgstr "Проект '%{project_name}' добавлен в очередь на удаление." + +msgid "Project '%{project_name}' was successfully created." +msgstr "Проект '%{project_name}' успешно создан." + +msgid "Project '%{project_name}' was successfully updated." +msgstr "Проект '%{project_name}' успешно обновлен." + +msgid "Project '%{project_name}' will be deleted." +msgstr "Проект '%{project_name}' удален." + +msgid "Project access must be granted explicitly to each user." +msgstr "Доступ к проекту должен предоставляться явно каждому пользователю." + +msgid "Project export could not be deleted." +msgstr "Невозможно удалить экспорт проекта." + +msgid "Project export has been deleted." +msgstr "Экспорт проекта удален." + +msgid "" +"Project export link has expired. Please generate a new export from your " +"project settings." +msgstr "" +"Истек срок действия ссылки на проект. Создайте новый экспорт в ваших " +"настройках проекта." + +msgid "Project export started. A download link will be sent by email." +msgstr "" +"Начат экспорт проекта. Ссылка для скачивания будет отправлена по электронной " +"почте." + +msgid "Project home" +msgstr "Домашняя страница проекта" + +msgid "ProjectFeature|Disabled" +msgstr "ProjectFeature|Отключено" + +msgid "ProjectFeature|Everyone with access" +msgstr "ProjectFeature|Все с доступом" + +msgid "ProjectFeature|Only team members" +msgstr "ProjectFeature|Только члены команды" + +msgid "ProjectFileTree|Name" +msgstr "ProjectFileTree|Имя" + +msgid "ProjectLastActivity|Never" +msgstr "ProjectLastActivity|Никогда" + +msgid "ProjectLifecycle|Stage" +msgstr "" + +msgid "ProjectNetworkGraph|Graph" +msgstr "ProjectNetworkGraph|Граф" + +msgid "Read more" +msgstr "" + +msgid "Readme" +msgstr "Readme" + +msgid "RefSwitcher|Branches" +msgstr "RefSwitcher|Ветки" + +msgid "RefSwitcher|Tags" +msgstr "RefSwitcher|Тэги" + +msgid "Related Commits" +msgstr "" + +msgid "Related Deployed Jobs" +msgstr "" + +msgid "Related Issues" +msgstr "" + +msgid "Related Jobs" +msgstr "" + +msgid "Related Merge Requests" +msgstr "Связанные запросы на слияние" + +msgid "Related Merged Requests" +msgstr "Связанные объединенные запросы" + +msgid "Remind later" +msgstr "Напомнить позже" + +msgid "Remove project" +msgstr "Удалить проект" + +msgid "Request Access" +msgstr "Запрос доступа" + +msgid "Revert this commit" +msgstr "Отменить это изменение" + +msgid "Revert this merge request" +msgstr "Отменить этот запрос на слияние" + +msgid "Save pipeline schedule" +msgstr "Сохранить расписание конвейра" + +msgid "Schedule a new pipeline" +msgstr "Расписание нового конвейера" + +msgid "Scheduling Pipelines" +msgstr "Планирование конвейеров" + +msgid "Search branches and tags" +msgstr "Найти ветки и тэги" + +msgid "Select Archive Format" +msgstr "Выбрать формат архива" + +msgid "Select a timezone" +msgstr "Выбор временной зоны" + +msgid "Select target branch" +msgstr "Выбор целевой ветки" + +msgid "Set a password on your account to pull or push via %{protocol}." +msgstr "" +"Установите пароль в своем аккаунте, чтобы отправлять или получать код через " +"%{protocol}." + +msgid "Set up CI" +msgstr "Настройка CI" + +msgid "Set up Koding" +msgstr "Настройка Koding" + +msgid "Set up auto deploy" +msgstr "Настройка автоматического развертывания" + +msgid "SetPasswordToCloneLink|set a password" +msgstr "SetPasswordToCloneLink|установить пароль" + +msgid "Showing %d event" +msgid_plural "Showing %d events" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +msgid "Source code" +msgstr "Исходный код" + +msgid "StarProject|Star" +msgstr "StarProject|Отметить" + +msgid "Start a %{new_merge_request} with these changes" +msgstr "Начать %{new_merge_request} с этих изменений" + +msgid "Switch branch/tag" +msgstr "Переключить ветка/тэг" + +msgid "Tag" +msgid_plural "Tags" +msgstr[0] "Тэг" +msgstr[1] "Тэги" +msgstr[2] "Тэги" + +msgid "Tags" +msgstr "Тэги" + +msgid "Target Branch" +msgstr "Целевая ветка" + +msgid "" +"The coding stage shows the time from the first commit to creating the merge " +"request. The data will automatically be added here once you create your " +"first merge request." +msgstr "" + +msgid "The collection of events added to the data gathered for that stage." +msgstr "" + +msgid "The fork relationship has been removed." +msgstr "Связь форка удалена." + +msgid "" +"The issue stage shows the time it takes from creating an issue to assigning " +"the issue to a milestone, or add the issue to a list on your Issue Board. " +"Begin creating issues to see data for this stage." +msgstr "" +"Стадия обращения время, которое потребуется с момента создания обращения до " +"назначения обращению вехи, или добавления обращения в вашу доску обращений. " +"Начните создавать обращения, чтобы увидеть сведения для этой стадии. " + +msgid "The phase of the development lifecycle." +msgstr "Фаза жизненного цикла разработки." + +msgid "" +"The pipelines schedule runs pipelines in the future, repeatedly, for " +"specific branches or tags. Those scheduled pipelines will inherit limited " +"project access based on their associated user." +msgstr "" +"Расписание конвейеров запускает в будущем неоднократно конвейеры, для " +"определенных ветвей или тэгов. Запланированные конвейеры наследуют " +"ограничения на доступ к проекту на основе связанного с ними пользователя." + +msgid "" +"The planning stage shows the time from the previous step to pushing your " +"first commit. This time will be added automatically once you push your first " +"commit." +msgstr "" + +msgid "" +"The production stage shows the total time it takes between creating an issue " +"and deploying the code to production. The data will be automatically added " +"once you have completed the full idea to production cycle." +msgstr "" + +msgid "The project can be accessed by any logged in user." +msgstr "Доступ к проекту возможен любым зарегистрированным пользователем." + +msgid "The project can be accessed without any authentication." +msgstr "Доступ к проекту возможен без какой-либо проверки подлинности." + +msgid "The repository for this project does not exist." +msgstr "Репозиторий для этого проекта не существует." + +msgid "" +"The review stage shows the time from creating the merge request to merging " +"it. The data will automatically be added after you merge your first merge " +"request." +msgstr "" + +msgid "" +"The staging stage shows the time between merging the MR and deploying code " +"to the production environment. The data will be automatically added once you " +"deploy to production for the first time." +msgstr "" + +msgid "" +"The testing stage shows the time GitLab CI takes to run every pipeline for " +"the related merge request. The data will automatically be added after your " +"first pipeline finishes running." +msgstr "" + +msgid "The time taken by each data entry gathered by that stage." +msgstr "" + +msgid "" +"The value lying at the midpoint of a series of observed values. E.g., " +"between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 =" +" 6." +msgstr "" + +msgid "" +"This means you can not push code until you create an empty repository or " +"import existing one." +msgstr "" +"Это означает, что вы не можете пушить код, пока не создадите пустой " +"репозиторий или не импортируете существующий." + +msgid "Time before an issue gets scheduled" +msgstr "" + +msgid "Time before an issue starts implementation" +msgstr "" + +msgid "Time between merge request creation and merge/close" +msgstr "Время между созданием запроса слияния и слиянием / закрытием" + +msgid "Time until first merge request" +msgstr "" + +msgid "Timeago|%s days ago" +msgstr "Timeago|%s дн(я|ей) назад" + +msgid "Timeago|%s days remaining" +msgstr "Timeago|Осталось %s дн(я|ей)" + +msgid "Timeago|%s hours remaining" +msgstr "Timeago|Осталось %s часов" + +msgid "Timeago|%s minutes ago" +msgstr "Timeago|%s минут назад" + +msgid "Timeago|%s minutes remaining" +msgstr "Timeago|Осталось %s минут(а|ы)" + +msgid "Timeago|%s months ago" +msgstr "Timeago|%s минут(а|ы) назад" + +msgid "Timeago|%s months remaining" +msgstr "Timeago|Осталось %s месяцев(а)" + +msgid "Timeago|%s seconds remaining" +msgstr "Timeago|Осталось %s секунд(ы)" + +msgid "Timeago|%s weeks ago" +msgstr "Timeago|%s недель(и) назад" + +msgid "Timeago|%s weeks remaining" +msgstr "Timeago|Осталось %s недель(и)" + +msgid "Timeago|%s years ago" +msgstr "Timeago|%s лет/года назад" + +msgid "Timeago|%s years remaining" +msgstr "Timeago|Осталось %s лет/года" + +msgid "Timeago|1 day remaining" +msgstr "Timeago|Остался день" + +msgid "Timeago|1 hour remaining" +msgstr "Timeago|Остался час" + +msgid "Timeago|1 minute remaining" +msgstr "Timeago|Осталась одна минута" + +msgid "Timeago|1 month remaining" +msgstr "Timeago|Остался месяц" + +msgid "Timeago|1 week remaining" +msgstr "Timeago|Осталась неделя" + +msgid "Timeago|1 year remaining" +msgstr "Timeago|Остался год" + +msgid "Timeago|Past due" +msgstr "Timeago|Просрочено" + +msgid "Timeago|a day ago" +msgstr "Timeago|день назад" + +msgid "Timeago|a month ago" +msgstr "Timeago|месяц назад" + +msgid "Timeago|a week ago" +msgstr "Timeago|неделю назад" + +msgid "Timeago|a while" +msgstr "Timeago|какое-то время" + +msgid "Timeago|a year ago" +msgstr "Timeago|год назад" + +msgid "Timeago|about %s hours ago" +msgstr "Timeago|около %s часов назад" + +msgid "Timeago|about a minute ago" +msgstr "Timeago|около минуты назад" + +msgid "Timeago|about an hour ago" +msgstr "Timeago|около часа назад" + +msgid "Timeago|in %s days" +msgstr "Timeago|через %s дня(ей)" + +msgid "Timeago|in %s hours" +msgstr "Timeago|через %s часа(ов)" + +msgid "Timeago|in %s minutes" +msgstr "Timeago|через %s минут(ы)" + +msgid "Timeago|in %s months" +msgstr "Timeago|через %s месяц(а|ев)" + +msgid "Timeago|in %s seconds" +msgstr "Timeago|через %s секунд(ы)" + +msgid "Timeago|in %s weeks" +msgstr "Timeago|через %s недели" + +msgid "Timeago|in %s years" +msgstr "Timeago|через %s лет/года" + +msgid "Timeago|in 1 day" +msgstr "Timeago|через день" + +msgid "Timeago|in 1 hour" +msgstr "Timeago|через час" + +msgid "Timeago|in 1 minute" +msgstr "Timeago|через минуту" + +msgid "Timeago|in 1 month" +msgstr "Timeago|через месяц" + +msgid "Timeago|in 1 week" +msgstr "Timeago|через неделю" + +msgid "Timeago|in 1 year" +msgstr "Timeago|через год" + +msgid "Timeago|less than a minute ago" +msgstr "Timeago|менее чем минуту назад" + +msgid "Time|hr" +msgid_plural "Time|hrs" +msgstr[0] "ч" +msgstr[1] "ч" +msgstr[2] "ч" + +msgid "Time|min" +msgid_plural "Time|mins" +msgstr[0] "мин" +msgstr[1] "мин" +msgstr[2] "мин" + +msgid "Time|s" +msgstr "с" + +msgid "Total Time" +msgstr "Общее время" + +msgid "Total test time for all commits/merges" +msgstr "" + +msgid "Unstar" +msgstr "Снять отметку" + +msgid "Upload New File" +msgstr "Выгрузить новый файл" + +msgid "Upload file" +msgstr "Выгрузить файл" + +msgid "UploadLink|click to upload" +msgstr "UploadLink|кликните для выгрузки" + +msgid "Use your global notification setting" +msgstr "Используются глобальный настройки уведомлений" + +msgid "View open merge request" +msgstr "Просмотреть открытый запрос на слияние" + +msgid "VisibilityLevel|Internal" +msgstr "VisibilityLevel|Ограниченный" + +msgid "VisibilityLevel|Private" +msgstr "VisibilityLevel|Приватный" + +msgid "VisibilityLevel|Public" +msgstr "VisibilityLevel|Публичный" + +msgid "Want to see the data? Please ask an administrator for access." +msgstr "" + +msgid "We don't have enough data to show this stage." +msgstr "" + +msgid "Withdraw Access Request" +msgstr "Отменить запрос доступа" + +msgid "" +"You are going to remove %{project_name_with_namespace}.\n" +"Removed project CANNOT be restored!\n" +"Are you ABSOLUTELY sure?" +msgstr "" +"Вы хотите удалить %{project_name_with_namespace}.\n" +"Удаленный проект НЕ МОЖЕТ быть восстановлен!\n" +"Вы АБСОЛЮТНО уверены?" + +msgid "" +"You are going to remove the fork relationship to source project " +"%{forked_from_project}. Are you ABSOLUTELY sure?" +msgstr "" +"Вы собираетесь удалить связь форка с исходным проектом " +"%{forked_from_project}. Вы АБСОЛЮТНО уверены?" + +msgid "" +"You are going to transfer %{project_name_with_namespace} to another owner. " +"Are you ABSOLUTELY sure?" +msgstr "" +"Вы собираетесь передать проект %{project_name_with_namespace} другому " +"владельцу. Вы АБСОЛЮТНО уверены?" + +msgid "You can only add files when you are on a branch" +msgstr "Вы можете добавлять только файлы, когда находитесь в ветке" + +msgid "You have reached your project limit" +msgstr "Вы достигли ограничения в вашем проекте" + +msgid "You must sign in to star a project" +msgstr "Необходимо войти, чтобы оценить проект" + +msgid "You need permission." +msgstr "Вам нужно разрешение." + +msgid "You will not get any notifications via email" +msgstr "Вы не получите никаких уведомлений по электронной почте" + +msgid "You will only receive notifications for the events you choose" +msgstr "Вы будете получать уведомления только о выбранных вами событиях" + +msgid "" +"You will only receive notifications for threads you have participated in" +msgstr "" +"Вы будете получать уведомления только о тех тредах, в которых вы участвовали" + +msgid "You will receive notifications for any activity" +msgstr "Вы будете получать уведомления о любых действиях" + +msgid "" +"You will receive notifications only for comments in which you were " +"@mentioned" +msgstr "" +"Вы будете получать уведомления только для комментариев, в которых вы были " +"@упомянуты" + +msgid "" +"You won't be able to pull or push project code via %{protocol} until you " +"%{set_password_link} on your account" +msgstr "" +"Вы не сможете получать и отправлять код проекта через %{protocol} пока " +"%{set_password_link} в ваш аккаунт" + +msgid "" +"You won't be able to pull or push project code via SSH until you " +"%{add_ssh_key_link} to your profile" +msgstr "" +"Вы не сможете получать и отправлять код проекта через SSH пока " +"%{add_ssh_key_link} в ваш профиль." + +msgid "Your name" +msgstr "Ваше имя" + +msgid "day" +msgid_plural "days" +msgstr[0] "день" +msgstr[1] "дни" +msgstr[2] "дни" + +msgid "new merge request" +msgstr "новый запрос на слияние" + +msgid "notification emails" +msgstr "email для уведомлений" + +msgid "parent" +msgid_plural "parents" +msgstr[0] "источник" +msgstr[1] "источники" +msgstr[2] "источники" + diff --git a/locale/ru/gitlab.po.time_stamp b/locale/ru/gitlab.po.time_stamp new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/locale/ru/gitlab.po.time_stamp diff --git a/locale/uk/gitlab.po b/locale/uk/gitlab.po new file mode 100644 index 00000000000..59a7eb6e1b3 --- /dev/null +++ b/locale/uk/gitlab.po @@ -0,0 +1,1234 @@ +# Андрей Витюк <andruwa13@gmail.com>, 2017. #zanata +# Huang Tao <htve@outlook.com>, 2017. #zanata +msgid "" +msgstr "" +"Project-Id-Version: gitlab 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-28 13:32+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: 2017-07-12 09:05-0400\n" +"Last-Translator: Андрей Витюк <andruwa13@gmail.com>\n" +"Language-Team: Ukrainian (https://translate.zanata.org/project/view/GitLab)\n" +"Language: uk\n" +"X-Generator: Zanata 3.9.6\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +msgid "%s additional commit has been omitted to prevent performance issues." +msgid_plural "" +"%s additional commits have been omitted to prevent performance issues." +msgstr[0] "" +"%s доданий Комміт був виключений для запобігання проблем з продуктивністю." +msgstr[1] "" +"%s доданих коммітів були виключені для запобігання проблем з продуктивністю." +msgstr[2] "" +"%s доданих коммітів були виключені для запобігання проблем з продуктивністю." + +msgid "%d commit" +msgid_plural "%d commits" +msgstr[0] "%d комміт" +msgstr[1] "%d комміта" +msgstr[2] "%d коммітів" + +msgid "%{commit_author_link} committed %{commit_timeago}" +msgstr "%{commit_author_link} комміт %{commit_timeago}" + +msgid "1 pipeline" +msgid_plural "%d pipelines" +msgstr[0] "1 конвеєр" +msgstr[1] "%d конвеєра" +msgstr[2] "%d конвеєрів" + +msgid "A collection of graphs regarding Continuous Integration" +msgstr "Це набір графічних елементів для безперервної інтеграції" + +msgid "About auto deploy" +msgstr "Про авто розгортання" + +msgid "Active" +msgstr "Активний" + +msgid "Activity" +msgstr "Активність" + +msgid "Add Changelog" +msgstr "Додати список змін (Changelog)" + +msgid "Add Contribution guide" +msgstr "Додати керівництво для контрибуторів" + +msgid "Add License" +msgstr "Додати ліцензію" + +msgid "Add an SSH key to your profile to pull or push via SSH." +msgstr "" +"Додати SSH ключа в свій профіль, щоб мати можливість завантажити чи " +"надіслати зміни через SSH." + +msgid "Add new directory" +msgstr "Додати новий каталог" + +msgid "Archived project! Repository is read-only" +msgstr "Заархівований проект! Репозиторій доступний лише для читання" + +msgid "Are you sure you want to delete this pipeline schedule?" +msgstr "Ви впевнені, що хочете видалити цей розклад для Конвеєра?" + +msgid "Attach a file by drag & drop or %{upload_link}" +msgstr "Прикріпити файл за допомогою перетягування або %{upload_link}" + +msgid "Branch" +msgid_plural "Branches" +msgstr[0] "Гілка" +msgstr[1] "Гілки" +msgstr[2] "Гілок" + +msgid "" +"Branch <strong>%{branch_name}</strong> was created. To set up auto deploy, " +"choose a GitLab CI Yaml template and commit your changes. " +"%{link_to_autodeploy_doc}" +msgstr "" +"Гілка <strong>%{branch_name}</strong> створена. Для настройки автоматичного " +"розгортання виберіть GitLab CI Yaml-шаблон і закоммітьте зміни. " +"%{link_to_autodeploy_doc}" + +msgid "BranchSwitcherPlaceholder|Search branches" +msgstr "Пошук гілок" + +msgid "BranchSwitcherTitle|Switch branch" +msgstr "Переключити гілку" + +msgid "Branches" +msgstr "Гілки" + +msgid "Browse Directory" +msgstr "Переглянути каталог" + +msgid "Browse File" +msgstr "Переглянути файл" + +msgid "Browse Files" +msgstr "Перегляд файлів" + +msgid "Browse files" +msgstr "Перегляд файлів" + +msgid "ByAuthor|by" +msgstr "від" + +msgid "CI configuration" +msgstr "Налаштування CI" + +msgid "Cancel" +msgstr "Скасувати" + +msgid "ChangeTypeActionLabel|Pick into branch" +msgstr "Вибрати в гілці" + +msgid "ChangeTypeActionLabel|Revert in branch" +msgstr "Скасувати у гілці" + +msgid "ChangeTypeAction|Cherry-pick" +msgstr "Cherry-pick" + +msgid "ChangeTypeAction|Revert" +msgstr "Скасувати" + +msgid "Changelog" +msgstr "Список змін (Changelog)" + +msgid "Charts" +msgstr "Графіки" + +msgid "Cherry-pick this commit" +msgstr "Cherry-pick в цьому комміті" + +msgid "Cherry-pick this merge request" +msgstr "Cherry-pick в цьому запиті на злиття" + +msgid "CiStatusLabel|canceled" +msgstr "скасовано" + +msgid "CiStatusLabel|created" +msgstr "створено" + +msgid "CiStatusLabel|failed" +msgstr "невдало" + +msgid "CiStatusLabel|manual action" +msgstr "вручну" + +msgid "CiStatusLabel|passed" +msgstr "виконано" + +msgid "CiStatusLabel|passed with warnings" +msgstr "виконано з попередженнями" + +msgid "CiStatusLabel|pending" +msgstr "в очікуванні" + +msgid "CiStatusLabel|skipped" +msgstr "пропущено" + +msgid "CiStatusLabel|waiting for manual action" +msgstr "Очікування ручних дій" + +msgid "CiStatusText|blocked" +msgstr "заблоковано" + +msgid "CiStatusText|canceled" +msgstr "скасовано" + +msgid "CiStatusText|created" +msgstr "створено" + +msgid "CiStatusText|failed" +msgstr "невдало" + +msgid "CiStatusText|manual" +msgstr "вручну" + +msgid "CiStatusText|passed" +msgstr "виконано" + +msgid "CiStatusText|pending" +msgstr "в очікуванні" + +msgid "CiStatusText|skipped" +msgstr "пропущено" + +msgid "CiStatus|running" +msgstr "виконується" + +msgid "Commit" +msgid_plural "Commits" +msgstr[0] "Комміт" +msgstr[1] "Комміта" +msgstr[2] "Коммітів" + +msgid "Commit duration in minutes for last 30 commits" +msgstr "Комміт тривалість у хвилинах за останні 30 коммітів" + +msgid "Commit message" +msgstr "Комміт повідомлення" + +msgid "CommitBoxTitle|Commit" +msgstr "Комміт" + +msgid "CommitMessage|Add %{file_name}" +msgstr "Додати %{file_name}" + +msgid "Commits" +msgstr "Комміти" + +msgid "Commits feed" +msgstr "Канал коммітів" + +msgid "Commits|History" +msgstr "Історія" + +msgid "Committed by" +msgstr "Комміт від" + +msgid "Compare" +msgstr "Порівняти" + +msgid "Contribution guide" +msgstr "Керівництво контрибуторів" + +msgid "Contributors" +msgstr "Контрибутори" + +msgid "Copy URL to clipboard" +msgstr "Скопіювати URL в буфер обміну" + +msgid "Copy commit SHA to clipboard" +msgstr "Скопіювати ідентифікатор в буфер обміну" + +msgid "Create New Directory" +msgstr "Створити новий каталог" + +msgid "" +"Create a personal access token on your account to pull or push via " +"%{protocol}." +msgstr "" +"Створити токен доступу для вашого аккауета, щоб відправляти або отримувати " +"через %{protocol}." + +msgid "Create directory" +msgstr "Створити каталог" + +msgid "Create empty bare repository" +msgstr "Створити порожній репозиторій" + +msgid "Create merge request" +msgstr "Створити запит на злиття" + +msgid "Create new..." +msgstr "Створити..." + +msgid "CreateNewFork|Fork" +msgstr "Форк" + +msgid "CreateTag|Tag" +msgstr "Тег" + +msgid "CreateTokenToCloneLink|create a personal access token" +msgstr "Створити токен для особистого доступу" + +msgid "Cron Timezone" +msgstr "Часовий пояс Cron" + +msgid "Cron syntax" +msgstr "Синтаксис Cron" + +msgid "Custom notification events" +msgstr "Користувацькі налаштування повідомлень про події" + +msgid "" +"Custom notification levels are the same as participating levels. With custom " +"notification levels you will also receive notifications for select events. " +"To find out more, check out %{notification_link}." +msgstr "" +"Спеціальні рівні повідомлення співпадають з рівнем участі. За допомогою " +"спеціальних рівнів сповіщень ви також отримуватимете сповіщення про вибрані " +"події. Щоб дізнатись більше, перегляньте %{notification_link}." + +msgid "Cycle Analytics" +msgstr "Аналіз циклу" + +msgid "" +"Cycle Analytics gives an overview of how much time it takes to go from idea " +"to production in your project." +msgstr "" +"Аналітика циклу дає огляд того, скільки часу потрібно, щоб перейти від ідеї " +"до виробництва у вашому проекті." + +msgid "CycleAnalyticsStage|Code" +msgstr "Код" + +msgid "CycleAnalyticsStage|Issue" +msgstr "Проблема" + +msgid "CycleAnalyticsStage|Plan" +msgstr "Планування" + +msgid "CycleAnalyticsStage|Production" +msgstr "ПРОД" + +msgid "CycleAnalyticsStage|Review" +msgstr "Затвердження" + +msgid "CycleAnalyticsStage|Staging" +msgstr "ДЕВ" + +msgid "CycleAnalyticsStage|Test" +msgstr "Тестування" + +msgid "Define a custom pattern with cron syntax" +msgstr "Визначте власний шаблон за допомогою синтаксису cron" + +msgid "Delete" +msgstr "Видалити" + +msgid "Deploy" +msgid_plural "Deploys" +msgstr[0] "Розгортання" +msgstr[1] "Розгортання" +msgstr[2] "Розгортань" + +msgid "Description" +msgstr "Опис" + +msgid "Directory name" +msgstr "Ім'я каталогу" + +msgid "Don't show again" +msgstr "Не показувати знову" + +msgid "Download" +msgstr "Завантажити" + +msgid "Download tar" +msgstr "Завантажити в форматі tar" + +msgid "Download tar.bz2" +msgstr "Завантажити в форматі tar.bz2" + +msgid "Download tar.gz" +msgstr "Завантажити в форматі tar.gz" + +msgid "Download zip" +msgstr "Завантажити в форматі zip" + +msgid "DownloadArtifacts|Download" +msgstr "Завантажити" + +msgid "DownloadCommit|Email Patches" +msgstr "Email-патчи" + +msgid "DownloadCommit|Plain Diff" +msgstr "Plain Diff" + +msgid "DownloadSource|Download" +msgstr "Завантажити" + +msgid "Edit" +msgstr "Редагувати" + +msgid "Edit Pipeline Schedule %{id}" +msgstr "Редагувати Розклад Конвеєра % {id}" + +msgid "Every day (at 4:00am)" +msgstr "Кожен день (в 4:00 ранку)" + +msgid "Every month (on the 1st at 4:00am)" +msgstr "Кожен місяць (1-го числа о 4:00 ранку)" + +msgid "Every week (Sundays at 4:00am)" +msgstr "Щотижня (в неділю о 4:00 ранку)" + +msgid "Failed to change the owner" +msgstr "Не вдалося змінити власника" + +msgid "Failed to remove the pipeline schedule" +msgstr "Не вдалося видалити розклад Конвеєра" + +msgid "Files" +msgstr "Файли" + +msgid "Filter by commit message" +msgstr "Фільтрувати повідомлення коммітів" + +msgid "Find by path" +msgstr "Пошук по шляху" + +msgid "Find file" +msgstr "Знайти файл" + +msgid "FirstPushedBy|First" +msgstr "Перший" + +msgid "FirstPushedBy|pushed by" +msgstr "Надіслані зміни від" + +msgid "Fork" +msgid_plural "Forks" +msgstr[0] "Форк" +msgstr[1] "Форки" +msgstr[2] "Форків" + +msgid "ForkedFromProjectPath|Forked from" +msgstr "Форк від" + +msgid "From issue creation until deploy to production" +msgstr "З моменту створення проблеми до розгортання на ПРОД" + +msgid "From merge request merge until deploy to production" +msgstr "З об'єднання запиту злиття до розгортання на ПРОД" + +msgid "Go to your fork" +msgstr "Перейти до вашого форку" + +msgid "GoToYourFork|Fork" +msgstr "Форк" + +msgid "Home" +msgstr "Початок" + +msgid "Housekeeping successfully started" +msgstr "Очищення успішно розпочато" + +msgid "Import repository" +msgstr "Імпорт репозеторія" + +msgid "Interval Pattern" +msgstr "Шаблон інтервалу" + +msgid "Introducing Cycle Analytics" +msgstr "Представляємо аналітику циклу" + +msgid "Jobs for last month" +msgstr "Завдання за останній місяць" + +msgid "Jobs for last week" +msgstr "Завдання за останній тиждень" + +msgid "Jobs for last year" +msgstr "Завдання за останній рік" + +msgid "LFSStatus|Disabled" +msgstr "Вимкнено" + +msgid "LFSStatus|Enabled" +msgstr "Увімкнено" + +msgid "Last %d day" +msgid_plural "Last %d days" +msgstr[0] "Останній %d день" +msgstr[1] "Останніх %d дні" +msgstr[2] "Останніх %d днів" + +msgid "Last Pipeline" +msgstr "Останній Конвеєр" + +msgid "Last Update" +msgstr "Останнє оновлення" + +msgid "Last commit" +msgstr "Останній комміт" + +msgid "Learn more in the" +msgstr "Дізнайтесь більше" + +msgid "Learn more in the|pipeline schedules documentation" +msgstr "Детальніше в документації по розкладами конвеєрів" + +msgid "Leave group" +msgstr "Залишити групу" + +msgid "Leave project" +msgstr "Залишити проект" + +msgid "Limited to showing %d event at most" +msgid_plural "Limited to showing %d events at most" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +msgid "Median" +msgstr "Медіана" + +msgid "MissingSSHKeyWarningLink|add an SSH key" +msgstr "додати SSH ключ" + +msgid "New Issue" +msgid_plural "New Issues" +msgstr[0] "Нова проблема" +msgstr[1] "Нові проблеми" +msgstr[2] "Новах проблем" + +msgid "New Pipeline Schedule" +msgstr "Новий розклад Конвеєра" + +msgid "New branch" +msgstr "Нова гілка" + +msgid "New directory" +msgstr "Новий каталог" + +msgid "New file" +msgstr "Новий файл" + +msgid "New issue" +msgstr "Нова проблема" + +msgid "New merge request" +msgstr "Новий запит на злиття" + +msgid "New schedule" +msgstr "Новий Розклад" + +msgid "New snippet" +msgstr "Новий сніппет" + +msgid "New tag" +msgstr "Новий тег" + +msgid "No repository" +msgstr "Немає репозеторія" + +msgid "No schedules" +msgstr "немає Розкладів" + +msgid "Not available" +msgstr "Недоступний" + +msgid "Not enough data" +msgstr "Недостатньо даних" + +msgid "Notification events" +msgstr "Повідомлення про події" + +msgid "NotificationEvent|Close issue" +msgstr "Проблема закрита" + +msgid "NotificationEvent|Close merge request" +msgstr "Запит на об'єднання закритий" + +msgid "NotificationEvent|Failed pipeline" +msgstr "Невдача в конвеєрі" + +msgid "NotificationEvent|Merge merge request" +msgstr "Об'єднати запит на злиття" + +msgid "NotificationEvent|New issue" +msgstr "Нова проблема" + +msgid "NotificationEvent|New merge request" +msgstr "Новий запит на злиття" + +msgid "NotificationEvent|New note" +msgstr "Нова нотатка" + +msgid "NotificationEvent|Reassign issue" +msgstr "Перепризначити проблему" + +msgid "NotificationEvent|Reassign merge request" +msgstr "Перепризначити запит на злиття" + +msgid "NotificationEvent|Reopen issue" +msgstr "Повторне відкриття проблему" + +msgid "NotificationEvent|Successful pipeline" +msgstr "Успішно в Конвеєрі" + +msgid "NotificationLevel|Custom" +msgstr "Власні" + +msgid "NotificationLevel|Disabled" +msgstr "Вимкнено" + +msgid "NotificationLevel|Global" +msgstr "Загальні" + +msgid "NotificationLevel|On mention" +msgstr "Коли вас згадують" + +msgid "NotificationLevel|Participate" +msgstr "Берете участь" + +msgid "NotificationLevel|Watch" +msgstr "Відстежувати" + +msgid "OfSearchInADropdown|Filter" +msgstr "Фільтр" + +msgid "OpenedNDaysAgo|Opened" +msgstr "Відкрито" + +msgid "Options" +msgstr "Параметри" + +msgid "Owner" +msgstr "Власник" + +msgid "Pipeline" +msgstr "Конвеєр" + +msgid "Pipeline Health" +msgstr "Стан Конвеєра" + +msgid "Pipeline Schedule" +msgstr "Розклад Конвеєра" + +msgid "Pipeline Schedules" +msgstr "Розклади Конвеєрів" + +msgid "PipelineCharts|Failed:" +msgstr "Не вдалося:" + +msgid "PipelineCharts|Overall statistics" +msgstr "Загальна статистика" + +msgid "PipelineCharts|Success ratio:" +msgstr "Коефіцієнт успіху:" + +msgid "PipelineCharts|Successful:" +msgstr "Успішні:" + +msgid "PipelineCharts|Total:" +msgstr "Всього:" + +msgid "PipelineSchedules|Activated" +msgstr "Активовано" + +msgid "PipelineSchedules|Active" +msgstr "Активні" + +msgid "PipelineSchedules|All" +msgstr "Всі" + +msgid "PipelineSchedules|Inactive" +msgstr "Неактивні" + +msgid "PipelineSchedules|Next Run" +msgstr "Наступний запуск" + +msgid "PipelineSchedules|None" +msgstr "Немає" + +msgid "PipelineSchedules|Provide a short description for this pipeline" +msgstr "Задайте короткий опис для цього Конвеєру" + +msgid "PipelineSchedules|Take ownership" +msgstr "Стати власником" + +msgid "PipelineSchedules|Target" +msgstr "Ціль" + +msgid "PipelineSheduleIntervalPattern|Custom" +msgstr "Власні" + +msgid "Pipelines" +msgstr "Конвеєри" + +msgid "Pipelines charts" +msgstr "Чарти Конвеєрів" + +msgid "Pipeline|all" +msgstr "всі" + +msgid "Pipeline|success" +msgstr "успіх" + +msgid "Pipeline|with stage" +msgstr "зі стадією" + +msgid "Pipeline|with stages" +msgstr "зі стадіями" + +msgid "Project '%{project_name}' queued for deletion." +msgstr "Проект '%{project_name}' доданий в чергу на видалення." + +msgid "Project '%{project_name}' was successfully created." +msgstr "Проект '%{project_name}' успішно створений." + +msgid "Project '%{project_name}' was successfully updated." +msgstr "Проект '%{project_name}' успішно оновлено." + +msgid "Project '%{project_name}' will be deleted." +msgstr "Проект '%{project_name}' видалений." + +msgid "Project access must be granted explicitly to each user." +msgstr "Доступ до проекту повинен надаватися кожному користувачеві." + +msgid "Project export could not be deleted." +msgstr "Неможливо видалити експорт проекту." + +msgid "Project export has been deleted." +msgstr "Експорт проекту видалений." + +msgid "" +"Project export link has expired. Please generate a new export from your " +"project settings." +msgstr "" +"Закінчився термін дії посилання на проект. Створіть новий експорт в ваших " +"настройках проекту." + +msgid "Project export started. A download link will be sent by email." +msgstr "" +"Розпочато експорт проекту. Посилання для скачування буде надіслана " +"електронною поштою." + +msgid "Project home" +msgstr "Домашня сторінка проекту" + +msgid "ProjectFeature|Disabled" +msgstr "Вимкнено" + +msgid "ProjectFeature|Everyone with access" +msgstr "Все з доступом" + +msgid "ProjectFeature|Only team members" +msgstr "Тільки члени команди" + +msgid "ProjectFileTree|Name" +msgstr "Ім'я" + +msgid "ProjectLastActivity|Never" +msgstr "Ніколи" + +msgid "ProjectLifecycle|Stage" +msgstr "Етап" + +msgid "ProjectNetworkGraph|Graph" +msgstr "Графік" + +msgid "Read more" +msgstr "Докладніше" + +msgid "Readme" +msgstr "Прочитай Мене" + +msgid "RefSwitcher|Branches" +msgstr "Гілки" + +msgid "RefSwitcher|Tags" +msgstr "Теги" + +msgid "Related Commits" +msgstr "Пов'язані Комміти" + +msgid "Related Deployed Jobs" +msgstr "Пов’язані розгорнуті задачі (Jobs)" + +msgid "Related Issues" +msgstr "Пов’язані Проблеми (Issues)" + +msgid "Related Jobs" +msgstr "Пов’язані Задачі (Jobs)" + +msgid "Related Merge Requests" +msgstr "Пов'язані запити на злиття" + +msgid "Related Merged Requests" +msgstr "Пов'язані об'єднані запити" + +msgid "Remind later" +msgstr "Нагадати пізніше" + +msgid "Remove project" +msgstr "Видалити проект" + +msgid "Request Access" +msgstr "Запит доступу" + +msgid "Revert this commit" +msgstr "Скасувати цей комміт" + +msgid "Revert this merge request" +msgstr "Скасувати цей запит на злиття" + +msgid "Save pipeline schedule" +msgstr "Зберегти Розклад Конвеєра" + +msgid "Schedule a new pipeline" +msgstr "Розклад нового конвеєра" + +msgid "Scheduling Pipelines" +msgstr "Планування конвеєрів" + +msgid "Search branches and tags" +msgstr "Пошук гілок та тегів" + +msgid "Select Archive Format" +msgstr "Виберіть формат архіву" + +msgid "Select a timezone" +msgstr "Вибрати часовий пояс" + +msgid "Select target branch" +msgstr "Вибір цільової гілки" + +msgid "Set a password on your account to pull or push via %{protocol}." +msgstr "" +"Встановіть пароль свого облікового запису, щоб відправляти або отримувати " +"код через %{protocol}." + +msgid "Set up CI" +msgstr "Налаштування CI" + +msgid "Set up Koding" +msgstr "Налаштування Koding" + +msgid "Set up auto deploy" +msgstr "Налаштування автоматичне розгортання" + +msgid "SetPasswordToCloneLink|set a password" +msgstr "встановити пароль" + +msgid "Showing %d event" +msgid_plural "Showing %d events" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +msgid "Source code" +msgstr "Код" + +msgid "StarProject|Star" +msgstr "Старт" + +msgid "Start a %{new_merge_request} with these changes" +msgstr "Почати %{new_merge_request} з цих змін" + +msgid "Switch branch/tag" +msgstr "тег" + +msgid "Tag" +msgid_plural "Tags" +msgstr[0] "Тег" +msgstr[1] "Теги" +msgstr[2] "Тегів" + +msgid "Tags" +msgstr "Теги" + +msgid "Target Branch" +msgstr "Цільова гілка" + +msgid "" +"The coding stage shows the time from the first commit to creating the merge " +"request. The data will automatically be added here once you create your " +"first merge request." +msgstr "" + +msgid "The collection of events added to the data gathered for that stage." +msgstr "" + +msgid "The fork relationship has been removed." +msgstr "Зв'язок форка видалена." + +msgid "" +"The issue stage shows the time it takes from creating an issue to assigning " +"the issue to a milestone, or add the issue to a list on your Issue Board. " +"Begin creating issues to see data for this stage." +msgstr "" +"Етап випуску показує, скільки часу потрібно від створення проблеми до " +"присвоєння випуску, або додавання проблеми в вашу дошку проблем. Почніть " +"створювати проблеми, щоб переглядати дані для цього етапу." + +msgid "The phase of the development lifecycle." +msgstr "Фаза життєвого циклу розробки." + +msgid "" +"The pipelines schedule runs pipelines in the future, repeatedly, for " +"specific branches or tags. Those scheduled pipelines will inherit limited " +"project access based on their associated user." +msgstr "" +"Розклад конвеєрів запускає в майбутньому конвеєри, для певних гілок або " +"тегів. Заплановані конвеєри успадковують обмеження на доступ до проекту на " +"основі пов'язаного з ними користувача." + +msgid "" +"The planning stage shows the time from the previous step to pushing your " +"first commit. This time will be added automatically once you push your first " +"commit." +msgstr "" + +msgid "" +"The production stage shows the total time it takes between creating an issue " +"and deploying the code to production. The data will be automatically added " +"once you have completed the full idea to production cycle." +msgstr "" + +msgid "The project can be accessed by any logged in user." +msgstr "Доступ до проекту можливий будь-яким зареєстрованим користувачем." + +msgid "The project can be accessed without any authentication." +msgstr "Доступ до проекту можливий без будь-якої перевірки автентичності." + +msgid "The repository for this project does not exist." +msgstr "Репозиторій для цього проекту не існує." + +msgid "" +"The review stage shows the time from creating the merge request to merging " +"it. The data will automatically be added after you merge your first merge " +"request." +msgstr "" + +msgid "" +"The staging stage shows the time between merging the MR and deploying code " +"to the production environment. The data will be automatically added once you " +"deploy to production for the first time." +msgstr "" + +msgid "" +"The testing stage shows the time GitLab CI takes to run every pipeline for " +"the related merge request. The data will automatically be added after your " +"first pipeline finishes running." +msgstr "" + +msgid "The time taken by each data entry gathered by that stage." +msgstr "" + +msgid "" +"The value lying at the midpoint of a series of observed values. E.g., " +"between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 =" +" 6." +msgstr "" + +msgid "" +"This means you can not push code until you create an empty repository or " +"import existing one." +msgstr "" +"Це означає, що ви не можете відправляти код, поки не створите порожній " +"репозиторій або НЕ імпортуєте існуючий." + +msgid "Time before an issue gets scheduled" +msgstr "" + +msgid "Time before an issue starts implementation" +msgstr "" + +msgid "Time between merge request creation and merge/close" +msgstr "Час між створенням запиту злиття і злиттям або закриттям" + +msgid "Time until first merge request" +msgstr "Час до першого запиту на злиття" + +msgid "Timeago|%s days ago" +msgstr "%s днів тому" + +msgid "Timeago|%s days remaining" +msgstr "%s днів, що залишилися" + +msgid "Timeago|%s hours remaining" +msgstr "%s годин, що залишилися" + +msgid "Timeago|%s minutes ago" +msgstr "%s хвилин тому" + +msgid "Timeago|%s minutes remaining" +msgstr "%s хвилини залишитися" + +msgid "Timeago|%s months ago" +msgstr "%s місяців тому" + +msgid "Timeago|%s months remaining" +msgstr "%s місяці, що залишилися" + +msgid "Timeago|%s seconds remaining" +msgstr "%s секунд, що залишаються" + +msgid "Timeago|%s weeks ago" +msgstr "%s тижнів тому" + +msgid "Timeago|%s weeks remaining" +msgstr "%s тижнів залишилися" + +msgid "Timeago|%s years ago" +msgstr "%s років тому" + +msgid "Timeago|%s years remaining" +msgstr "%s роки, що залишилися" + +msgid "Timeago|1 day remaining" +msgstr "Залишився 1 день" + +msgid "Timeago|1 hour remaining" +msgstr "Залишилась 1 година" + +msgid "Timeago|1 minute remaining" +msgstr "Залишилась 1 хвилина" + +msgid "Timeago|1 month remaining" +msgstr "Залишився 1 місяць" + +msgid "Timeago|1 week remaining" +msgstr "Залишився 1 тиждень" + +msgid "Timeago|1 year remaining" +msgstr "Залишився 1 рік" + +msgid "Timeago|Past due" +msgstr "Прострочені" + +msgid "Timeago|a day ago" +msgstr "годин тому" + +msgid "Timeago|a month ago" +msgstr "місяць тому" + +msgid "Timeago|a week ago" +msgstr "тиждень тому" + +msgid "Timeago|a while" +msgstr "деякий час назад" + +msgid "Timeago|a year ago" +msgstr "рік тому" + +msgid "Timeago|about %s hours ago" +msgstr "Близько %s годин тому" + +msgid "Timeago|about a minute ago" +msgstr "Близько хвилини тому" + +msgid "Timeago|about an hour ago" +msgstr "Близько години тому" + +msgid "Timeago|in %s days" +msgstr "через %s днїв" + +msgid "Timeago|in %s hours" +msgstr "через %s години" + +msgid "Timeago|in %s minutes" +msgstr "через %s хвилини" + +msgid "Timeago|in %s months" +msgstr "через %s місяців" + +msgid "Timeago|in %s seconds" +msgstr "через %s секунд" + +msgid "Timeago|in %s weeks" +msgstr "через %s тижні" + +msgid "Timeago|in %s years" +msgstr "через %s років" + +msgid "Timeago|in 1 day" +msgstr "через день" + +msgid "Timeago|in 1 hour" +msgstr "через годину" + +msgid "Timeago|in 1 minute" +msgstr "через хвилину" + +msgid "Timeago|in 1 month" +msgstr "через місяць" + +msgid "Timeago|in 1 week" +msgstr "через тиждень" + +msgid "Timeago|in 1 year" +msgstr "через рік" + +msgid "Timeago|less than a minute ago" +msgstr "менш хвилини тому" + +msgid "Time|hr" +msgid_plural "Time|hrs" +msgstr[0] "Година" +msgstr[1] "Годині" +msgstr[2] "Годин" + +msgid "Time|min" +msgid_plural "Time|mins" +msgstr[0] "хвилина" +msgstr[1] "хвилині" +msgstr[2] "хвилин" + +msgid "Time|s" +msgstr "секунда" + +msgid "Total Time" +msgstr "Загальний час" + +msgid "Total test time for all commits/merges" +msgstr "Загальний час, щоб перевірити всі фіксації/злиття" + +msgid "Unstar" +msgstr "Зняти позначку" + +msgid "Upload New File" +msgstr "Завантажити новий файл" + +msgid "Upload file" +msgstr "Завантажити файл" + +msgid "UploadLink|click to upload" +msgstr "Натисніть, щоб завантажити" + +msgid "Use your global notification setting" +msgstr "Використовуються глобальний налаштування повідомлень" + +msgid "View open merge request" +msgstr "Перегляд відкритих запитів на злиття" + +msgid "VisibilityLevel|Internal" +msgstr "Внутрішній" + +msgid "VisibilityLevel|Private" +msgstr "Приватний" + +msgid "VisibilityLevel|Public" +msgstr "Публічний" + +msgid "Want to see the data? Please ask an administrator for access." +msgstr "Хочете побачити дані? Будь ласка, попросить у адміністратора доступ." + +msgid "We don't have enough data to show this stage." +msgstr "Ми не маємо достатньо даних для показу цього етапу." + +msgid "Withdraw Access Request" +msgstr "Скасувати запит доступу" + +msgid "" +"You are going to remove %{project_name_with_namespace}.\n" +"Removed project CANNOT be restored!\n" +"Are you ABSOLUTELY sure?" +msgstr "" +"Ви хочете видалити %{project_name_with_namespace}.\n" +"Видалений проект НЕ МОЖЕ бути відновлений!\n" +"Ви АБСОЛЮТНО впевнені?" + +msgid "" +"You are going to remove the fork relationship to source project " +"%{forked_from_project}. Are you ABSOLUTELY sure?" +msgstr "" +"Ви збираєтеся видалити зв'язок з форка з вихідним проектом " +"%{forked_from_project}. Ви АБСОЛЮТНО впевнені?" + +msgid "" +"You are going to transfer %{project_name_with_namespace} to another owner. " +"Are you ABSOLUTELY sure?" +msgstr "" +"Ви збираєтеся передати проект %{project_name_with_namespace} іншому власнику." +" Ви АБСОЛЮТНО впевнені?" + +msgid "You can only add files when you are on a branch" +msgstr "Ви можете додавати тільки файли, коли перебуваєте в гілці" + +msgid "You have reached your project limit" +msgstr "Ви досягли обмеження в вашому проекті" + +msgid "You must sign in to star a project" +msgstr "Необхідно увійти, щоб оцінити проект" + +msgid "You need permission." +msgstr "Вам потрібен дозвіл" + +msgid "You will not get any notifications via email" +msgstr "Ви не отримаєте ніяких повідомлень по електронній пошті" + +msgid "You will only receive notifications for the events you choose" +msgstr "Ви будете отримувати повідомлення тільки про обрані вами події" + +msgid "" +"You will only receive notifications for threads you have participated in" +msgstr "" +"Ви будете отримувати повідомлення тільки про тих темах, в яких ви брали " +"участь" + +msgid "You will receive notifications for any activity" +msgstr "Ви будете отримувати повідомлення про будь-які дії" + +msgid "" +"You will receive notifications only for comments in which you were " +"@mentioned" +msgstr "" +"Ви будете отримувати повідомлення тільки для коментарів, в яких ви були " +"@згадані" + +msgid "" +"You won't be able to pull or push project code via %{protocol} until you " +"%{set_password_link} on your account" +msgstr "" +"Ви не зможете отримувати і відправляти код проекту через %{protocol} поки " +"%{set_password_link} в ваш аккаунт" + +msgid "" +"You won't be able to pull or push project code via SSH until you " +"%{add_ssh_key_link} to your profile" +msgstr "" +"Ви не зможете отримувати і відправляти код проекту через SSH поки " +"%{add_ssh_key_link} в ваш профіль." + +msgid "Your name" +msgstr "Ваше ім'я" + +msgid "day" +msgid_plural "days" +msgstr[0] "день" +msgstr[1] "дні" +msgstr[2] "днів" + +msgid "new merge request" +msgstr "Новий запит на злиття" + +msgid "notification emails" +msgstr "Повідомлення електронною поштою" + +msgid "parent" +msgid_plural "parents" +msgstr[0] "джерело" +msgstr[1] "джерела" +msgstr[2] "джерел" + diff --git a/locale/uk/gitlab.po.time_stamp b/locale/uk/gitlab.po.time_stamp new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/locale/uk/gitlab.po.time_stamp diff --git a/locale/zh_CN/gitlab.po b/locale/zh_CN/gitlab.po index b7a88aadeb9..47b72d7be1a 100644 --- a/locale/zh_CN/gitlab.po +++ b/locale/zh_CN/gitlab.po @@ -4,11 +4,11 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-28 13:32+0200\n" +"POT-Creation-Date: 2017-07-05 08:50-0500\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2017-07-10 09:58-0400\n" +"PO-Revision-Date: 2017-07-12 06:23-0400\n" "Last-Translator: Huang Tao <htve@outlook.com>\n" "Language-Team: Chinese (China) (https://translate.zanata.org/project/view/GitLab)\n" "Language: zh-CN\n" @@ -621,6 +621,12 @@ msgstr "所有" msgid "PipelineSchedules|Inactive" msgstr "未启用" +msgid "PipelineSchedules|Input variable key" +msgstr "输入变量名" + +msgid "PipelineSchedules|Input variable value" +msgstr "输入变量值" + msgid "PipelineSchedules|Next Run" msgstr "下次运行时间" @@ -630,12 +636,18 @@ msgstr "无" msgid "PipelineSchedules|Provide a short description for this pipeline" msgstr "为此流水线提供简短描述" +msgid "PipelineSchedules|Remove variable row" +msgstr "删除变量" + msgid "PipelineSchedules|Take ownership" -msgstr "取得所有者" +msgstr "取得所有权" msgid "PipelineSchedules|Target" msgstr "目标" +msgid "PipelineSchedules|Variables" +msgstr "变量" + msgid "PipelineSheduleIntervalPattern|Custom" msgstr "自定义" @@ -1086,6 +1098,14 @@ msgid "Withdraw Access Request" msgstr "取消权限申请" msgid "" +"You are going to remove %{group_name}.\n" +"Removed groups CANNOT be restored!\n" +"Are you ABSOLUTELY sure?" +msgstr "即将删除 %{group_name}。\n" +"已删除的群组无法恢复!\n" +"确定继续吗?" + +msgid "" "You are going to remove %{project_name_with_namespace}.\n" "Removed project CANNOT be restored!\n" "Are you ABSOLUTELY sure?" diff --git a/locale/zh_HK/gitlab.po b/locale/zh_HK/gitlab.po index f6add31db99..8a4e6da4ea9 100644 --- a/locale/zh_HK/gitlab.po +++ b/locale/zh_HK/gitlab.po @@ -3,13 +3,13 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-28 13:32+0200\n" +"POT-Creation-Date: 2017-07-05 08:50-0500\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2017-07-06 11:26-0400\n" +"PO-Revision-Date: 2017-07-12 06:32-0400\n" "Last-Translator: Huang Tao <htve@outlook.com>\n" -"Language-Team: Chinese (Hong Kong SAR China)\n" +"Language-Team: Chinese (Hong Kong SAR China) (https://translate.zanata.org/project/view/GitLab)\n" "Language: zh-HK\n" "X-Generator: Zanata 3.9.6\n" "Plural-Forms: nplurals=1; plural=0\n" @@ -620,6 +620,12 @@ msgstr "所有" msgid "PipelineSchedules|Inactive" msgstr "未啟用" +msgid "PipelineSchedules|Input variable key" +msgstr "輸入變量名" + +msgid "PipelineSchedules|Input variable value" +msgstr "輸入變量值" + msgid "PipelineSchedules|Next Run" msgstr "下次運行時間" @@ -629,12 +635,18 @@ msgstr "無" msgid "PipelineSchedules|Provide a short description for this pipeline" msgstr "為此流水線提供簡短描述" +msgid "PipelineSchedules|Remove variable row" +msgstr "刪除變量" + msgid "PipelineSchedules|Take ownership" -msgstr "取得所有者" +msgstr "取得所有權" msgid "PipelineSchedules|Target" msgstr "目標" +msgid "PipelineSchedules|Variables" +msgstr "變量" + msgid "PipelineSheduleIntervalPattern|Custom" msgstr "自定義" @@ -1085,6 +1097,14 @@ msgid "Withdraw Access Request" msgstr "取消權限申请" msgid "" +"You are going to remove %{group_name}.\n" +"Removed groups CANNOT be restored!\n" +"Are you ABSOLUTELY sure?" +msgstr "即將刪除 %{group_name}。\n" +"已刪除的群組無法恢復!\n" +"確定繼續嗎?" + +msgid "" "You are going to remove %{project_name_with_namespace}.\n" "Removed project CANNOT be restored!\n" "Are you ABSOLUTELY sure?" diff --git a/rubocop/cop/migration/hash_index.rb b/rubocop/cop/migration/hash_index.rb new file mode 100644 index 00000000000..2cc59691d84 --- /dev/null +++ b/rubocop/cop/migration/hash_index.rb @@ -0,0 +1,51 @@ +require 'set' +require_relative '../../migration_helpers' + +module RuboCop + module Cop + module Migration + # Cop that prevents the use of hash indexes in database migrations + class HashIndex < RuboCop::Cop::Cop + include MigrationHelpers + + MSG = 'hash indexes should be avoided at all costs since they are not ' \ + 'recorded in the PostgreSQL WAL, you should use a btree index instead'.freeze + + NAMES = Set.new([:add_index, :index, :add_concurrent_index]).freeze + + def on_send(node) + return unless in_migration?(node) + + name = node.children[1] + + return unless NAMES.include?(name) + + opts = node.children.last + + return unless opts && opts.type == :hash + + opts.each_node(:pair) do |pair| + next unless hash_key_type(pair) == :sym && + hash_key_name(pair) == :using + + if hash_key_value(pair).to_s == 'hash' + add_offense(pair, :expression) + end + end + end + + def hash_key_type(pair) + pair.children[0].type + end + + def hash_key_name(pair) + pair.children[0].children[0] + end + + def hash_key_value(pair) + pair.children[1].children[0] + end + end + end + end +end diff --git a/rubocop/rubocop.rb b/rubocop/rubocop.rb index f76144275c9..3fbd5b0163c 100644 --- a/rubocop/rubocop.rb +++ b/rubocop/rubocop.rb @@ -13,6 +13,7 @@ require_relative 'cop/migration/add_concurrent_index' require_relative 'cop/migration/add_index' require_relative 'cop/migration/add_timestamps' require_relative 'cop/migration/datetime' +require_relative 'cop/migration/hash_index' require_relative 'cop/migration/remove_concurrent_index' require_relative 'cop/migration/remove_index' require_relative 'cop/migration/reversible_add_column_with_default' diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 68114d149c4..39806901274 100644 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -10,7 +10,7 @@ fi # Only install knapsack after bundle install! Otherwise oddly some native # gems could not be found under some circumstance. No idea why, hours wasted. -retry gem install knapsack fog-aws mime-types +retry gem install knapsack cp config/gitlab.yml.example config/gitlab.yml diff --git a/spec/controllers/dashboard/todos_controller_spec.rb b/spec/controllers/dashboard/todos_controller_spec.rb index 085f3fd8543..4a48621abe1 100644 --- a/spec/controllers/dashboard/todos_controller_spec.rb +++ b/spec/controllers/dashboard/todos_controller_spec.rb @@ -12,6 +12,36 @@ describe Dashboard::TodosController do end describe 'GET #index' do + context 'project authorization' do + it 'renders 404 when user does not have read access on given project' do + unauthorized_project = create(:empty_project, :private) + + get :index, project_id: unauthorized_project.id + + expect(response).to have_http_status(404) + end + + it 'renders 404 when given project does not exists' do + get :index, project_id: 999 + + expect(response).to have_http_status(404) + end + + it 'renders 200 when filtering for "any project" todos' do + get :index, project_id: '' + + expect(response).to have_http_status(200) + end + + it 'renders 200 when user has access on given project' do + authorized_project = create(:empty_project, :public) + + get :index, project_id: authorized_project.id + + expect(response).to have_http_status(200) + end + end + context 'when using pagination' do let(:last_page) { user.todos.page.total_pages } let!(:issues) { create_list(:issue, 2, project: project, assignees: [user]) } diff --git a/spec/controllers/metrics_controller_spec.rb b/spec/controllers/metrics_controller_spec.rb index 8964d89b438..7b0976e3e67 100644 --- a/spec/controllers/metrics_controller_spec.rb +++ b/spec/controllers/metrics_controller_spec.rb @@ -12,7 +12,7 @@ describe MetricsController do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - stub_env('prometheus_multiproc_dir', metrics_multiproc_dir) + allow(Prometheus::Client.configuration).to receive(:multiprocess_files_dir).and_return(metrics_multiproc_dir) allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?).and_return(true) allow(Settings.monitoring).to receive(:ip_whitelist).and_return([whitelisted_ip, whitelisted_ip_range]) end diff --git a/spec/controllers/profiles/accounts_controller_spec.rb b/spec/controllers/profiles/accounts_controller_spec.rb index 2f9d18e3a0e..d387aba227b 100644 --- a/spec/controllers/profiles/accounts_controller_spec.rb +++ b/spec/controllers/profiles/accounts_controller_spec.rb @@ -29,7 +29,7 @@ describe Profiles::AccountsController do end end - [:twitter, :facebook, :google_oauth2, :gitlab, :github, :bitbucket, :crowd, :auth0].each do |provider| + [:twitter, :facebook, :google_oauth2, :gitlab, :github, :bitbucket, :crowd, :auth0, :authentiq].each do |provider| describe "#{provider} provider" do let(:user) { create(:omniauth_user, provider: provider.to_s) } diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 22aad0b3225..18d0be3c103 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -7,14 +7,16 @@ describe Projects::IssuesController do describe "GET #index" do context 'external issue tracker' do + let!(:service) do + create(:custom_issue_tracker_service, project: project, title: 'Custom Issue Tracker', project_url: 'http://test.com') + end + it 'redirects to the external issue tracker' do - external = double(project_path: 'https://example.com/project') - allow(project).to receive(:external_issue_tracker).and_return(external) controller.instance_variable_set(:@project, project) get :index, namespace_id: project.namespace, project_id: project - expect(response).to redirect_to('https://example.com/project') + expect(response).to redirect_to(service.issue_tracker_path) end end @@ -139,19 +141,21 @@ describe Projects::IssuesController do end context 'external issue tracker' do + let!(:service) do + create(:custom_issue_tracker_service, project: project, title: 'Custom Issue Tracker', new_issue_url: 'http://test.com') + end + before do sign_in(user) project.team << [user, :developer] end it 'redirects to the external issue tracker' do - external = double(new_issue_path: 'https://example.com/issues/new') - allow(project).to receive(:external_issue_tracker).and_return(external) controller.instance_variable_set(:@project, project) get :new, namespace_id: project.namespace, project_id: project - expect(response).to redirect_to('https://example.com/issues/new') + expect(response).to redirect_to('http://test.com') end end end @@ -512,6 +516,36 @@ describe Projects::IssuesController do end end + describe 'GET #realtime_changes' do + it_behaves_like 'restricted action', success: 200 + + def go(id:) + get :realtime_changes, + namespace_id: project.namespace.to_param, + project_id: project, + id: id + end + + context 'when an issue was edited by a deleted user' do + let(:deleted_user) { create(:user) } + + before do + project.team << [user, :developer] + + issue.update!(last_edited_by: deleted_user, last_edited_at: Time.now) + + deleted_user.destroy + sign_in(user) + end + + it 'returns 200' do + go(id: issue.iid) + + expect(response).to have_http_status(200) + end + end + end + describe 'GET #edit' do it_behaves_like 'restricted action', success: 200 diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb index 15416a89017..475ceda11fe 100644 --- a/spec/controllers/snippets_controller_spec.rb +++ b/spec/controllers/snippets_controller_spec.rb @@ -186,8 +186,8 @@ describe SnippetsController do end context 'when the snippet description contains a file' do - let(:picture_file) { '/temp/secret56/picture.jpg' } - let(:text_file) { '/temp/secret78/text.txt' } + let(:picture_file) { '/system/temp/secret56/picture.jpg' } + let(:text_file) { '/system/temp/secret78/text.txt' } let(:description) do "Description with picture: ![picture](/uploads#{picture_file}) and "\ "text: [text.txt](/uploads#{text_file})" @@ -208,8 +208,8 @@ describe SnippetsController do snippet = subject expected_description = "Description with picture: "\ - "![picture](/uploads/personal_snippet/#{snippet.id}/secret56/picture.jpg) and "\ - "text: [text.txt](/uploads/personal_snippet/#{snippet.id}/secret78/text.txt)" + "![picture](/uploads/system/personal_snippet/#{snippet.id}/secret56/picture.jpg) and "\ + "text: [text.txt](/uploads/system/personal_snippet/#{snippet.id}/secret78/text.txt)" expect(snippet.description).to eq(expected_description) end diff --git a/spec/controllers/uploads_controller_spec.rb b/spec/controllers/uploads_controller_spec.rb index 01a0659479b..96f719e2b82 100644 --- a/spec/controllers/uploads_controller_spec.rb +++ b/spec/controllers/uploads_controller_spec.rb @@ -102,7 +102,7 @@ describe UploadsController do subject expect(response.body).to match '\"alt\":\"rails_sample\"' - expect(response.body).to match "\"url\":\"/uploads/temp" + expect(response.body).to match "\"url\":\"/uploads/system/temp" end it 'does not create an Upload record' do @@ -119,7 +119,7 @@ describe UploadsController do subject expect(response.body).to match '\"alt\":\"doc_sample.txt\"' - expect(response.body).to match "\"url\":\"/uploads/temp" + expect(response.body).to match "\"url\":\"/uploads/system/temp" end it 'does not create an Upload record' do diff --git a/spec/factories/commits.rb b/spec/factories/commits.rb index 36b9645438a..89e260cf65b 100644 --- a/spec/factories/commits.rb +++ b/spec/factories/commits.rb @@ -4,14 +4,19 @@ FactoryGirl.define do factory :commit do git_commit RepoHelpers.sample_commit project factory: :empty_project - author { build(:author) } initialize_with do new(git_commit, project) end + after(:build) do |commit| + allow(commit).to receive(:author).and_return build(:author) + end + trait :without_author do - author nil + after(:build) do |commit| + allow(commit).to receive(:author).and_return nil + end end end end diff --git a/spec/factories/uploads.rb b/spec/factories/uploads.rb index 1383420fb44..3222c41c3d8 100644 --- a/spec/factories/uploads.rb +++ b/spec/factories/uploads.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :upload do model { build(:project) } - path { "uploads/system/project/avatar/avatar.jpg" } + path { "uploads/-/system/project/avatar/avatar.jpg" } size 100.kilobytes uploader "AvatarUploader" end diff --git a/spec/features/admin/admin_appearance_spec.rb b/spec/features/admin/admin_appearance_spec.rb index 1e2cb8569ec..b9e361328df 100644 --- a/spec/features/admin/admin_appearance_spec.rb +++ b/spec/features/admin/admin_appearance_spec.rb @@ -63,11 +63,11 @@ feature 'Admin Appearance', feature: true do end def logo_selector - '//img[@src^="/uploads/system/appearance/logo"]' + '//img[@src^="/uploads/-/system/appearance/logo"]' end def header_logo_selector - '//img[@src^="/uploads/system/appearance/header_logo"]' + '//img[@src^="/uploads/-/system/appearance/header_logo"]' end def logo_fixture diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 3d7e26c7e19..b939fb5e89e 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -3,7 +3,8 @@ require 'rails_helper' describe 'Issue Boards', feature: true, js: true do include DragTo - let(:project) { create(:empty_project, :public) } + let(:group) { create(:group, :nested) } + let(:project) { create(:empty_project, :public, namespace: group) } let(:board) { create(:board, project: project) } let(:user) { create(:user) } let!(:user2) { create(:user) } diff --git a/spec/features/dashboard/activity_spec.rb b/spec/features/dashboard/activity_spec.rb index ebfe7340eb7..a96270c9147 100644 --- a/spec/features/dashboard/activity_spec.rb +++ b/spec/features/dashboard/activity_spec.rb @@ -1,13 +1,162 @@ require 'spec_helper' -RSpec.describe 'Dashboard Activity', feature: true do +feature 'Dashboard > Activity' do let(:user) { create(:user) } before do sign_in(user) - visit activity_dashboard_path end - it_behaves_like "it has an RSS button with current_user's RSS token" - it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token" + context 'rss' do + before do + visit activity_dashboard_path + end + + it_behaves_like "it has an RSS button with current_user's RSS token" + it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token" + end + + context 'event filters', :js do + let(:project) { create(:empty_project) } + + let(:merge_request) do + create(:merge_request, author: user, source_project: project, target_project: project) + end + + let(:push_event_data) do + { + before: Gitlab::Git::BLANK_SHA, + after: '0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e', + ref: 'refs/heads/new_design', + user_id: user.id, + user_name: user.name, + repository: { + name: project.name, + url: 'localhost/rubinius', + description: '', + homepage: 'localhost/rubinius', + private: true + } + } + end + + let(:note) { create(:note, project: project, noteable: merge_request) } + + let!(:push_event) do + create(:event, :pushed, data: push_event_data, project: project, author: user) + end + + let!(:merged_event) do + create(:event, :merged, project: project, target: merge_request, author: user) + end + + let!(:joined_event) do + create(:event, :joined, project: project, author: user) + end + + let!(:closed_event) do + create(:event, :closed, project: project, target: merge_request, author: user) + end + + let!(:comments_event) do + create(:event, :commented, project: project, target: note, author: user) + end + + before do + project.add_master(user) + + visit activity_dashboard_path + wait_for_requests + end + + scenario 'user should see all events' do + within '.content_list' do + expect(page).to have_content('pushed new branch') + expect(page).to have_content('joined') + expect(page).to have_content('accepted') + expect(page).to have_content('closed') + expect(page).to have_content('commented on') + end + end + + scenario 'user should see only pushed events' do + click_link('Push events') + wait_for_requests + + within '.content_list' do + expect(page).to have_content('pushed new branch') + expect(page).not_to have_content('joined') + expect(page).not_to have_content('accepted') + expect(page).not_to have_content('closed') + expect(page).not_to have_content('commented on') + end + end + + scenario 'user should see only merged events' do + click_link('Merge events') + wait_for_requests + + within '.content_list' do + expect(page).not_to have_content('pushed new branch') + expect(page).not_to have_content('joined') + expect(page).to have_content('accepted') + expect(page).not_to have_content('closed') + expect(page).not_to have_content('commented on') + end + end + + scenario 'user should see only issues events' do + click_link('Issue events') + wait_for_requests + + within '.content_list' do + expect(page).not_to have_content('pushed new branch') + expect(page).not_to have_content('joined') + expect(page).not_to have_content('accepted') + expect(page).to have_content('closed') + expect(page).not_to have_content('commented on') + end + end + + scenario 'user should see only comments events' do + click_link('Comments') + wait_for_requests + + within '.content_list' do + expect(page).not_to have_content('pushed new branch') + expect(page).not_to have_content('joined') + expect(page).not_to have_content('accepted') + expect(page).not_to have_content('closed') + expect(page).to have_content('commented on') + end + end + + scenario 'user should see only joined events' do + click_link('Team') + wait_for_requests + + within '.content_list' do + expect(page).not_to have_content('pushed new branch') + expect(page).to have_content('joined') + expect(page).not_to have_content('accepted') + expect(page).not_to have_content('closed') + expect(page).not_to have_content('commented on') + end + end + + scenario 'user see selected event after page reloading' do + click_link('Push events') + wait_for_requests + visit activity_dashboard_path + wait_for_requests + + within '.content_list' do + expect(page).to have_content('pushed new branch') + expect(page).not_to have_content('joined') + expect(page).not_to have_content('accepted') + expect(page).not_to have_content('closed') + expect(page).not_to have_content('commented on') + end + end + end end diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 54a01e837de..533df7a325c 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Dashboard Groups page', js: true, feature: true do +feature 'Dashboard Groups page', :js do let!(:user) { create :user } let!(:group) { create(:group) } let!(:nested_group) { create(:group, :nested) } @@ -41,7 +41,7 @@ describe 'Dashboard Groups page', js: true, feature: true do fill_in 'filter_groups', with: group.name wait_for_requests - fill_in 'filter_groups', with: "" + fill_in 'filter_groups', with: '' wait_for_requests expect(page).to have_content(group.full_name) diff --git a/spec/features/dashboard_issues_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index f235fef1aa4..9b84f67b555 100644 --- a/spec/features/dashboard_issues_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -1,21 +1,23 @@ require 'spec_helper' -describe "Dashboard Issues filtering", feature: true, js: true do +feature 'Dashboard Issues filtering', js: true do + include SortingHelper + let(:user) { create(:user) } let(:project) { create(:empty_project) } let(:milestone) { create(:milestone, project: project) } - context 'filtering by milestone' do - before do - project.team << [user, :master] - sign_in(user) + let!(:issue) { create(:issue, project: project, author: user, assignees: [user]) } + let!(:issue2) { create(:issue, project: project, author: user, assignees: [user], milestone: milestone) } - create(:issue, project: project, author: user, assignees: [user]) - create(:issue, project: project, author: user, assignees: [user], milestone: milestone) + before do + project.add_master(user) + sign_in(user) - visit_issues - end + visit_issues + end + context 'filtering by milestone' do it 'shows all issues with no milestone' do show_milestone_dropdown @@ -62,6 +64,46 @@ describe "Dashboard Issues filtering", feature: true, js: true do end end + context 'filtering by label' do + let(:label) { create(:label, project: project) } + let!(:label_link) { create(:label_link, label: label, target: issue) } + + it 'shows all issues without filter' do + page.within 'ul.content-list' do + expect(page).to have_content issue.title + expect(page).to have_content issue2.title + end + end + + it 'shows all issues with the selected label' do + page.within '.labels-filter' do + find('.dropdown').click + click_link label.title + end + + page.within 'ul.content-list' do + expect(page).to have_content issue.title + expect(page).not_to have_content issue2.title + end + end + end + + context 'sorting' do + it 'shows sorted issues' do + sorting_by('Oldest updated') + visit_issues + + expect(find('.issues-filters')).to have_content('Oldest updated') + end + + it 'keeps sorting issues after visiting Projects Issues page' do + sorting_by('Oldest updated') + visit project_issues_path(project) + + expect(find('.issues-filters')).to have_content('Oldest updated') + end + end + def show_milestone_dropdown click_button 'Milestone' expect(page).to have_selector('.dropdown-content', visible: true) diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 86ac24ea06e..69c1a2ed89a 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -62,7 +62,7 @@ RSpec.describe 'Dashboard Issues', feature: true do it 'state filter tabs work' do find('#state-closed').click - expect(page).to have_current_path(issues_dashboard_url(assignee_id: current_user.id, scope: 'all', state: 'closed'), url: true) + expect(page).to have_current_path(issues_dashboard_url(assignee_id: current_user.id, state: 'closed'), url: true) end it_behaves_like "it has an RSS button with current_user's RSS token" diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index bb1fb5b3feb..42d6fadc0c1 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' feature 'Dashboard Merge Requests' do include FilterItemSelectHelper + include SortingHelper let(:current_user) { create :user } let(:project) { create(:empty_project) } @@ -109,5 +110,21 @@ feature 'Dashboard Merge Requests' do expect(page).to have_content(assigned_merge_request_from_fork.title) expect(page).to have_content(other_merge_request.title) end + + it 'shows sorted merge requests' do + sorting_by('Oldest updated') + + visit merge_requests_dashboard_path(assignee_id: current_user.id) + + expect(find('.issues-filters')).to have_content('Oldest updated') + end + + it 'keeps sorting merge requests after visiting Projects MR page' do + sorting_by('Oldest updated') + + visit project_merge_requests_path(project) + + expect(find('.issues-filters')).to have_content('Oldest updated') + end end end diff --git a/spec/features/dashboard_milestones_spec.rb b/spec/features/dashboard/milestones_spec.rb index 7a6a448d4c2..7a6a448d4c2 100644 --- a/spec/features/dashboard_milestones_spec.rb +++ b/spec/features/dashboard/milestones_spec.rb diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index bdba22fe9a9..abb9e5eef96 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -61,7 +61,7 @@ feature 'Dashboard Projects' do end end - describe "with a pipeline", clean_gitlab_redis_shared_state: true do + describe 'with a pipeline', clean_gitlab_redis_shared_state: true do let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha) } before do @@ -74,7 +74,50 @@ feature 'Dashboard Projects' do it 'shows that the last pipeline passed' do visit dashboard_projects_path - expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit)}']") + page.within('.controls') do + expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit)}']") + expect(page).to have_css('.ci-status-link') + expect(page).to have_css('.ci-status-icon-success') + expect(page).to have_link('Commit: passed') + end + end + end + + context 'last push widget' do + let(:push_event_data) do + { + before: Gitlab::Git::BLANK_SHA, + after: '0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e', + ref: 'refs/heads/feature', + user_id: user.id, + user_name: user.name, + repository: { + name: project.name, + url: 'localhost/rubinius', + description: '', + homepage: 'localhost/rubinius', + private: true + } + } + end + let!(:push_event) { create(:event, :pushed, data: push_event_data, project: project, author: user) } + + before do + visit dashboard_projects_path + end + + scenario 'shows "Create merge request" button' do + expect(page).to have_content 'You pushed to feature' + + within('#content-body') do + find_link('Create merge request', visible: false).click + end + + expect(page).to have_selector('.merge-request-form') + expect(current_path).to eq project_new_merge_request_path(project) + expect(find('#merge_request_target_project_id').value).to eq project.id.to_s + expect(find('input#merge_request_source_branch').value).to eq 'feature' + expect(find('input#merge_request_target_branch').value).to eq 'master' end end end diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb new file mode 100644 index 00000000000..e1c55d246ab --- /dev/null +++ b/spec/features/issues/issue_detail_spec.rb @@ -0,0 +1,43 @@ +require 'rails_helper' + +feature 'Issue Detail', js: true, feature: true do + let(:user) { create(:user) } + let(:project) { create(:project, :public) } + let(:issue) { create(:issue, project: project, author: user) } + + context 'when user displays the issue' do + before do + visit project_issue_path(project, issue) + wait_for_requests + end + + it 'shows the issue' do + page.within('.issuable-details') do + expect(find('h2')).to have_content(issue.title) + end + end + end + + context 'when edited by a user who is later deleted' do + before do + sign_in(user) + visit project_issue_path(project, issue) + wait_for_requests + + click_link 'Edit' + fill_in 'issue-title', with: 'issue title' + click_button 'Save' + + visit profile_account_path + click_link 'Delete account' + + visit project_issue_path(project, issue) + end + + it 'shows the issue' do + page.within('.issuable-details') do + expect(find('h2')).to have_content(issue.reload.title) + end + end + end +end diff --git a/spec/features/merge_requests/filter_merge_requests_spec.rb b/spec/features/merge_requests/filter_merge_requests_spec.rb index 2a161b83aa0..e8085ec36aa 100644 --- a/spec/features/merge_requests/filter_merge_requests_spec.rb +++ b/spec/features/merge_requests/filter_merge_requests_spec.rb @@ -132,19 +132,13 @@ describe 'Filter merge requests', feature: true do end end - describe 'for assignee and label from issues#index' do + describe 'for assignee and label from mr#index' do let(:search_query) { "assignee:@#{user.username} label:~#{label.title}" } before do - input_filtered_search("assignee:@#{user.username}") - - expect_mr_list_count(1) - expect_tokens([{ name: 'assignee', value: "@#{user.username}" }]) - expect_filtered_search_input_empty - - input_filtered_search_keys("label:~#{label.title}") + input_filtered_search(search_query) - expect_mr_list_count(1) + expect_mr_list_count(0) end context 'assignee and label', js: true do diff --git a/spec/features/participants_autocomplete_spec.rb b/spec/features/participants_autocomplete_spec.rb index 382d83ca051..81b0a2f541b 100644 --- a/spec/features/participants_autocomplete_spec.rb +++ b/spec/features/participants_autocomplete_spec.rb @@ -54,7 +54,8 @@ feature 'Member autocomplete', :js do let(:note) { create(:note_on_commit, project: project, commit_id: project.commit.id) } before do - allow_any_instance_of(Commit).to receive(:author).and_return(author) + allow(User).to receive(:find_by_any_email) + .with(noteable.author_email.downcase).and_return(author) visit project_commit_path(project, noteable) end diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 4fae324d8d5..d18cd3d6adc 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -24,7 +24,6 @@ describe 'Branches', feature: true do repository.branches_sorted_by(:name).first(20).each do |branch| expect(page).to have_content("#{branch.name}") end - expect(page).to have_content("Protected branches can be managed in project settings") end it 'sorts the branches by name' do @@ -130,6 +129,14 @@ describe 'Branches', feature: true do project.team << [user, :master] end + describe 'Initial branches page' do + it 'shows description for admin' do + visit project_branches_path(project) + + expect(page).to have_content("Protected branches can be managed in project settings") + end + end + describe 'Delete protected branch' do before do visit project_protected_branches_path(project) diff --git a/spec/features/projects/issuable_counts_caching_spec.rb b/spec/features/projects/issuable_counts_caching_spec.rb new file mode 100644 index 00000000000..703d1cbd327 --- /dev/null +++ b/spec/features/projects/issuable_counts_caching_spec.rb @@ -0,0 +1,132 @@ +require 'spec_helper' + +describe 'Issuable counts caching', :use_clean_rails_memory_store_caching do + let!(:member) { create(:user) } + let!(:member_2) { create(:user) } + let!(:non_member) { create(:user) } + let!(:project) { create(:empty_project, :public) } + let!(:open_issue) { create(:issue, project: project) } + let!(:confidential_issue) { create(:issue, :confidential, project: project, author: non_member) } + let!(:closed_issue) { create(:issue, :closed, project: project) } + + before do + project.add_developer(member) + project.add_developer(member_2) + end + + it 'caches issuable counts correctly for non-members' do + # We can't use expect_any_instance_of because that uses a single instance. + counts = 0 + + allow_any_instance_of(IssuesFinder).to receive(:count_by_state).and_wrap_original do |m, *args| + counts += 1 + + m.call(*args) + end + + aggregate_failures 'only counts once on first load with no params, and caches for later loads' do + expect { visit project_issues_path(project) } + .to change { counts }.by(1) + + expect { visit project_issues_path(project) } + .not_to change { counts } + end + + aggregate_failures 'uses counts from cache on load from non-member' do + sign_in(non_member) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_out(non_member) + end + + aggregate_failures 'does not use the same cache for a member' do + sign_in(member) + + expect { visit project_issues_path(project) } + .to change { counts }.by(1) + + sign_out(member) + end + + aggregate_failures 'uses the same cache for all members' do + sign_in(member_2) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_out(member_2) + end + + aggregate_failures 'shares caches when params are passed' do + expect { visit project_issues_path(project, author_username: non_member.username) } + .to change { counts }.by(1) + + sign_in(member) + + expect { visit project_issues_path(project, author_username: non_member.username) } + .to change { counts }.by(1) + + sign_in(non_member) + + expect { visit project_issues_path(project, author_username: non_member.username) } + .not_to change { counts } + + sign_in(member_2) + + expect { visit project_issues_path(project, author_username: non_member.username) } + .not_to change { counts } + + sign_out(member_2) + end + + aggregate_failures 'resets caches on issue close' do + Issues::CloseService.new(project, member).execute(open_issue) + + expect { visit project_issues_path(project) } + .to change { counts }.by(1) + + sign_in(member) + + expect { visit project_issues_path(project) } + .to change { counts }.by(1) + + sign_in(non_member) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_in(member_2) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_out(member_2) + end + + aggregate_failures 'does not reset caches on issue update' do + Issues::UpdateService.new(project, member, title: 'new title').execute(open_issue) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_in(member) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_in(non_member) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_in(member_2) + + expect { visit project_issues_path(project) } + .not_to change { counts } + + sign_out(member_2) + end + end +end diff --git a/spec/features/projects/merge_request_button_spec.rb b/spec/features/projects/merge_request_button_spec.rb index 12b4747602d..8cbd26551bc 100644 --- a/spec/features/projects/merge_request_button_spec.rb +++ b/spec/features/projects/merge_request_button_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Merge Request button', feature: true do +feature 'Merge Request button' do shared_examples 'Merge request button only shown when allowed' do let(:user) { create(:user) } let(:project) { create(:project, :public) } @@ -10,16 +10,14 @@ feature 'Merge Request button', feature: true do it 'does not show Create merge request button' do visit url - within("#content-body") do - expect(page).not_to have_link(label) - end + expect(page).not_to have_link(label) end end context 'logged in as developer' do before do sign_in(user) - project.team << [user, :developer] + project.add_developer(user) end it 'shows Create merge request button' do @@ -29,7 +27,7 @@ feature 'Merge Request button', feature: true do visit url - within("#content-body") do + within('#content-body') do expect(page).to have_link(label, href: href) end end @@ -42,7 +40,7 @@ feature 'Merge Request button', feature: true do it 'does not show Create merge request button' do visit url - within("#content-body") do + within('#content-body') do expect(page).not_to have_link(label) end end @@ -57,7 +55,7 @@ feature 'Merge Request button', feature: true do it 'does not show Create merge request button' do visit url - within("#content-body") do + within('#content-body') do expect(page).not_to have_link(label) end end diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index 57dec14b480..698d3b5d3e3 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -41,7 +41,7 @@ feature 'User creates snippet', :js, feature: true do expect(page).to have_content('My Snippet') link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] - expect(link).to match(%r{/uploads/temp/\h{32}/banana_sample\.gif\z}) + expect(link).to match(%r{/uploads/system/temp/\h{32}/banana_sample\.gif\z}) visit(link) expect(page.status_code).to eq(200) @@ -59,7 +59,7 @@ feature 'User creates snippet', :js, feature: true do wait_for_requests link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] - expect(link).to match(%r{/uploads/personal_snippet/#{Snippet.last.id}/\h{32}/banana_sample\.gif\z}) + expect(link).to match(%r{/uploads/system/personal_snippet/#{Snippet.last.id}/\h{32}/banana_sample\.gif\z}) visit(link) expect(page.status_code).to eq(200) @@ -84,7 +84,7 @@ feature 'User creates snippet', :js, feature: true do end expect(page).to have_content('Hello World!') link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] - expect(link).to match(%r{/uploads/personal_snippet/#{Snippet.last.id}/\h{32}/banana_sample\.gif\z}) + expect(link).to match(%r{/uploads/system/personal_snippet/#{Snippet.last.id}/\h{32}/banana_sample\.gif\z}) visit(link) expect(page.status_code).to eq(200) diff --git a/spec/features/snippets/user_edits_snippet_spec.rb b/spec/features/snippets/user_edits_snippet_spec.rb index cff64423873..c9f9741b4bb 100644 --- a/spec/features/snippets/user_edits_snippet_spec.rb +++ b/spec/features/snippets/user_edits_snippet_spec.rb @@ -33,7 +33,7 @@ feature 'User edits snippet', :js, feature: true do wait_for_requests link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] - expect(link).to match(%r{/uploads/personal_snippet/#{snippet.id}/\h{32}/banana_sample\.gif\z}) + expect(link).to match(%r{/uploads/system/personal_snippet/#{snippet.id}/\h{32}/banana_sample\.gif\z}) end it 'updates the snippet to make it internal' do diff --git a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb index 32784de1613..5843f18d89f 100644 --- a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb +++ b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb @@ -18,7 +18,7 @@ feature 'User uploads avatar to group', feature: true do visit group_path(group) - expect(page).to have_selector(%Q(img[src$="/uploads/system/group/avatar/#{group.id}/dk.png"])) + expect(page).to have_selector(%Q(img[src$="/uploads/-/system/group/avatar/#{group.id}/dk.png"])) # Cheating here to verify something that isn't user-facing, but is important expect(group.reload.avatar.file).to exist diff --git a/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb b/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb index 82c356735b9..e8171dcaeb0 100644 --- a/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb +++ b/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb @@ -16,7 +16,7 @@ feature 'User uploads avatar to profile', feature: true do visit user_path(user) - expect(page).to have_selector(%Q(img[src$="/uploads/system/user/avatar/#{user.id}/dk.png"])) + expect(page).to have_selector(%Q(img[src$="/uploads/-/system/user/avatar/#{user.id}/dk.png"])) # Cheating here to verify something that isn't user-facing, but is important expect(user.reload.avatar.file).to exist diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index e0cad1da86a..f5e139685e8 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -59,13 +59,13 @@ describe ApplicationHelper do describe 'project_icon' do it 'returns an url for the avatar' do project = create(:empty_project, avatar: File.open(uploaded_image_temp_path)) - avatar_url = "/uploads/system/project/avatar/#{project.id}/banana_sample.gif" + avatar_url = "/uploads/-/system/project/avatar/#{project.id}/banana_sample.gif" expect(helper.project_icon(project.full_path).to_s) .to eq "<img src=\"#{avatar_url}\" alt=\"Banana sample\" />" allow(ActionController::Base).to receive(:asset_host).and_return(gitlab_host) - avatar_url = "#{gitlab_host}/uploads/system/project/avatar/#{project.id}/banana_sample.gif" + avatar_url = "#{gitlab_host}/uploads/-/system/project/avatar/#{project.id}/banana_sample.gif" expect(helper.project_icon(project.full_path).to_s) .to eq "<img src=\"#{avatar_url}\" alt=\"Banana sample\" />" @@ -88,7 +88,7 @@ describe ApplicationHelper do context 'when there is a matching user' do it 'returns a relative URL for the avatar' do expect(helper.avatar_icon(user.email).to_s) - .to eq("/uploads/system/user/avatar/#{user.id}/banana_sample.gif") + .to eq("/uploads/-/system/user/avatar/#{user.id}/banana_sample.gif") end context 'when an asset_host is set in the config' do @@ -100,14 +100,14 @@ describe ApplicationHelper do it 'returns an absolute URL on that asset host' do expect(helper.avatar_icon(user.email, only_path: false).to_s) - .to eq("#{asset_host}/uploads/system/user/avatar/#{user.id}/banana_sample.gif") + .to eq("#{asset_host}/uploads/-/system/user/avatar/#{user.id}/banana_sample.gif") end end context 'when only_path is set to false' do it 'returns an absolute URL for the avatar' do expect(helper.avatar_icon(user.email, only_path: false).to_s) - .to eq("#{gitlab_host}/uploads/system/user/avatar/#{user.id}/banana_sample.gif") + .to eq("#{gitlab_host}/uploads/-/system/user/avatar/#{user.id}/banana_sample.gif") end end @@ -120,7 +120,7 @@ describe ApplicationHelper do it 'returns a relative URL with the correct prefix' do expect(helper.avatar_icon(user.email).to_s) - .to eq("/gitlab/uploads/system/user/avatar/#{user.id}/banana_sample.gif") + .to eq("/gitlab/uploads/-/system/user/avatar/#{user.id}/banana_sample.gif") end end end @@ -138,14 +138,14 @@ describe ApplicationHelper do context 'when only_path is true' do it 'returns a relative URL for the avatar' do expect(helper.avatar_icon(user, only_path: true).to_s) - .to eq("/uploads/system/user/avatar/#{user.id}/banana_sample.gif") + .to eq("/uploads/-/system/user/avatar/#{user.id}/banana_sample.gif") end end context 'when only_path is false' do it 'returns an absolute URL for the avatar' do expect(helper.avatar_icon(user, only_path: false).to_s) - .to eq("#{gitlab_host}/uploads/system/user/avatar/#{user.id}/banana_sample.gif") + .to eq("#{gitlab_host}/uploads/-/system/user/avatar/#{user.id}/banana_sample.gif") end end end diff --git a/spec/helpers/auth_helper_spec.rb b/spec/helpers/auth_helper_spec.rb index a0e1265efff..c94fedd615b 100644 --- a/spec/helpers/auth_helper_spec.rb +++ b/spec/helpers/auth_helper_spec.rb @@ -70,7 +70,7 @@ describe AuthHelper do end end - [:twitter, :facebook, :google_oauth2, :gitlab, :github, :bitbucket, :crowd, :auth0].each do |provider| + [:twitter, :facebook, :google_oauth2, :gitlab, :github, :bitbucket, :crowd, :auth0, :authentiq].each do |provider| it "returns false if the provider is #{provider}" do expect(helper.unlink_allowed?(provider)).to be true end diff --git a/spec/helpers/emails_helper_spec.rb b/spec/helpers/emails_helper_spec.rb index c68e4f56b05..2390c1f3e5d 100644 --- a/spec/helpers/emails_helper_spec.rb +++ b/spec/helpers/emails_helper_spec.rb @@ -52,7 +52,7 @@ describe EmailsHelper do ) expect(header_logo).to eq( - %{<img style="height: 50px" src="/uploads/system/appearance/header_logo/#{appearance.id}/dk.png" alt="Dk" />} + %{<img style="height: 50px" src="/uploads/-/system/appearance/header_logo/#{appearance.id}/dk.png" alt="Dk" />} ) end end diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb index e3f9d9db9eb..3a246f10283 100644 --- a/spec/helpers/groups_helper_spec.rb +++ b/spec/helpers/groups_helper_spec.rb @@ -11,7 +11,7 @@ describe GroupsHelper do group.avatar = fixture_file_upload(avatar_file_path) group.save! expect(group_icon(group.path).to_s) - .to match("/uploads/system/group/avatar/#{group.id}/banana_sample.gif") + .to match("/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif") end it 'gives default avatar_icon when no avatar is present' do diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index b423a09873b..7789cfa3554 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -244,5 +244,25 @@ describe IssuablesHelper do it { expect(helper.updated_at_by(unedited_issuable)).to eq({}) } it { expect(helper.updated_at_by(edited_issuable)).to eq(edited_updated_at_by) } + + context 'when updated by a deleted user' do + let(:edited_updated_at_by) do + { + updatedAt: edited_issuable.updated_at.to_time.iso8601, + updatedBy: { + name: User.ghost.name, + path: user_path(User.ghost) + } + } + end + + before do + user.destroy + end + + it 'returns "Ghost user" as edited_by' do + expect(helper.updated_at_by(edited_issuable.reload)).to eq(edited_updated_at_by) + end + end end end diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb index 95b4032616e..9aca3987657 100644 --- a/spec/helpers/page_layout_helper_spec.rb +++ b/spec/helpers/page_layout_helper_spec.rb @@ -60,7 +60,7 @@ describe PageLayoutHelper do %w(project user group).each do |type| context "with @#{type} assigned" do it "uses #{type.titlecase} avatar if available" do - object = double(avatar_url: 'http://example.com/uploads/system/avatar.png') + object = double(avatar_url: 'http://example.com/uploads/-/system/avatar.png') assign(type, object) expect(helper.page_image).to eq object.avatar_url diff --git a/spec/javascripts/lib/utils/poll_spec.js b/spec/javascripts/lib/utils/poll_spec.js index 22f30191ab9..2aa7011ca51 100644 --- a/spec/javascripts/lib/utils/poll_spec.js +++ b/spec/javascripts/lib/utils/poll_spec.js @@ -25,23 +25,28 @@ function mockServiceCall(service, response, shouldFail = false) { describe('Poll', () => { const service = jasmine.createSpyObj('service', ['fetch']); - const callbacks = jasmine.createSpyObj('callbacks', ['success', 'error']); + const callbacks = jasmine.createSpyObj('callbacks', ['success', 'error', 'notification']); + + function setup() { + return new Poll({ + resource: service, + method: 'fetch', + successCallback: callbacks.success, + errorCallback: callbacks.error, + notificationCallback: callbacks.notification, + }).makeRequest(); + } afterEach(() => { callbacks.success.calls.reset(); callbacks.error.calls.reset(); + callbacks.notification.calls.reset(); service.fetch.calls.reset(); }); it('calls the success callback when no header for interval is provided', (done) => { mockServiceCall(service, { status: 200 }); - - new Poll({ - resource: service, - method: 'fetch', - successCallback: callbacks.success, - errorCallback: callbacks.error, - }).makeRequest(); + setup(); waitForAllCallsToFinish(service, 1, () => { expect(callbacks.success).toHaveBeenCalled(); @@ -51,15 +56,9 @@ describe('Poll', () => { }); }); - it('calls the error callback whe the http request returns an error', (done) => { + it('calls the error callback when the http request returns an error', (done) => { mockServiceCall(service, { status: 500 }, true); - - new Poll({ - resource: service, - method: 'fetch', - successCallback: callbacks.success, - errorCallback: callbacks.error, - }).makeRequest(); + setup(); waitForAllCallsToFinish(service, 1, () => { expect(callbacks.success).not.toHaveBeenCalled(); @@ -69,15 +68,22 @@ describe('Poll', () => { }); }); + it('skips the error callback when request is aborted', (done) => { + mockServiceCall(service, { status: 0 }, true); + setup(); + + waitForAllCallsToFinish(service, 1, () => { + expect(callbacks.success).not.toHaveBeenCalled(); + expect(callbacks.error).not.toHaveBeenCalled(); + expect(callbacks.notification).toHaveBeenCalled(); + + done(); + }); + }); + it('should call the success callback when the interval header is -1', (done) => { mockServiceCall(service, { status: 200, headers: { 'poll-interval': -1 } }); - - new Poll({ - resource: service, - method: 'fetch', - successCallback: callbacks.success, - errorCallback: callbacks.error, - }).makeRequest().then(() => { + setup().then(() => { expect(callbacks.success).toHaveBeenCalled(); expect(callbacks.error).not.toHaveBeenCalled(); diff --git a/spec/javascripts/vue_shared/components/commit_spec.js b/spec/javascripts/vue_shared/components/commit_spec.js index 1c3188cdda2..d5754aaa9e7 100644 --- a/spec/javascripts/vue_shared/components/commit_spec.js +++ b/spec/javascripts/vue_shared/components/commit_spec.js @@ -22,7 +22,7 @@ describe('Commit component', () => { shortSha: 'b7836edd', title: 'Commit message', author: { - avatar_url: 'https://gitlab.com/uploads/system/user/avatar/300478/avatar.png', + avatar_url: 'https://gitlab.com/uploads/-/system/user/avatar/300478/avatar.png', web_url: 'https://gitlab.com/jschatz1', path: '/jschatz1', username: 'jschatz1', @@ -45,7 +45,7 @@ describe('Commit component', () => { shortSha: 'b7836edd', title: 'Commit message', author: { - avatar_url: 'https://gitlab.com/uploads/system/user/avatar/300478/avatar.png', + avatar_url: 'https://gitlab.com/uploads/-/system/user/avatar/300478/avatar.png', web_url: 'https://gitlab.com/jschatz1', path: '/jschatz1', username: 'jschatz1', diff --git a/spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb b/spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb new file mode 100644 index 00000000000..a910fb105a5 --- /dev/null +++ b/spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe Gitlab::BackgroundMigration::MigrateSystemUploadsToNewFolder do + let(:migration) { described_class.new } + + before do + allow(migration).to receive(:logger).and_return(Logger.new(nil)) + end + + describe '#perform' do + it 'renames the path of system-uploads', truncate: true do + upload = create(:upload, model: create(:empty_project), path: 'uploads/system/project/avatar.jpg') + + migration.perform('uploads/system/', 'uploads/-/system/') + + expect(upload.reload.path).to eq('uploads/-/system/project/avatar.jpg') + end + end +end diff --git a/spec/lib/gitlab/background_migration_spec.rb b/spec/lib/gitlab/background_migration_spec.rb index 64f82fe27b2..4ad69aeba43 100644 --- a/spec/lib/gitlab/background_migration_spec.rb +++ b/spec/lib/gitlab/background_migration_spec.rb @@ -1,46 +1,120 @@ require 'spec_helper' describe Gitlab::BackgroundMigration do + describe '.queue' do + it 'returns background migration worker queue' do + expect(described_class.queue) + .to eq BackgroundMigrationWorker.sidekiq_options['queue'] + end + end + describe '.steal' do - it 'steals jobs from a queue' do - queue = [double(:job, args: ['Foo', [10, 20]])] + context 'when there are enqueued jobs present' do + let(:queue) do + [double(args: ['Foo', [10, 20]], queue: described_class.queue)] + end + + before do + allow(Sidekiq::Queue).to receive(:new) + .with(described_class.queue) + .and_return(queue) + end + + context 'when queue contains unprocessed jobs' do + it 'steals jobs from a queue' do + expect(queue[0]).to receive(:delete).and_return(true) + + expect(described_class).to receive(:perform) + .with('Foo', [10, 20]) + + described_class.steal('Foo') + end + + it 'does not steal job that has already been taken' do + expect(queue[0]).to receive(:delete).and_return(false) + + expect(described_class).not_to receive(:perform) + + described_class.steal('Foo') + end + + it 'does not steal jobs for a different migration' do + expect(described_class).not_to receive(:perform) - allow(Sidekiq::Queue).to receive(:new) - .with(BackgroundMigrationWorker.sidekiq_options['queue']) - .and_return(queue) + expect(queue[0]).not_to receive(:delete) - expect(queue[0]).to receive(:delete) + described_class.steal('Bar') + end + end - expect(described_class).to receive(:perform).with('Foo', [10, 20]) + context 'when one of the jobs raises an error' do + let(:migration) { spy(:migration) } - described_class.steal('Foo') + let(:queue) do + [double(args: ['Foo', [10, 20]], queue: described_class.queue), + double(args: ['Foo', [20, 30]], queue: described_class.queue)] + end + + before do + stub_const("#{described_class}::Foo", migration) + + allow(queue[0]).to receive(:delete).and_return(true) + allow(queue[1]).to receive(:delete).and_return(true) + end + + it 'enqueues the migration again and re-raises the error' do + allow(migration).to receive(:perform).with(10, 20) + .and_raise(Exception, 'Migration error').once + + expect(BackgroundMigrationWorker).to receive(:perform_async) + .with('Foo', [10, 20]).once + + expect { described_class.steal('Foo') }.to raise_error(Exception) + end + end end - it 'does not steal jobs for a different migration' do - queue = [double(:job, args: ['Foo', [10, 20]])] + context 'when there are scheduled jobs present', :sidekiq, :redis do + it 'steals all jobs from the scheduled sets' do + Sidekiq::Testing.disable! do + BackgroundMigrationWorker.perform_in(10.minutes, 'Object') - allow(Sidekiq::Queue).to receive(:new) - .with(BackgroundMigrationWorker.sidekiq_options['queue']) - .and_return(queue) + expect(Sidekiq::ScheduledSet.new).to be_one + expect(described_class).to receive(:perform).with('Object', any_args) - expect(described_class).not_to receive(:perform) + described_class.steal('Object') - expect(queue[0]).not_to receive(:delete) + expect(Sidekiq::ScheduledSet.new).to be_none + end + end + end - described_class.steal('Bar') + context 'when there are enqueued and scheduled jobs present', :sidekiq, :redis do + it 'steals from the scheduled sets queue first' do + Sidekiq::Testing.disable! do + expect(described_class).to receive(:perform) + .with('Object', [1]).ordered + expect(described_class).to receive(:perform) + .with('Object', [2]).ordered + + BackgroundMigrationWorker.perform_async('Object', [2]) + BackgroundMigrationWorker.perform_in(10.minutes, 'Object', [1]) + + described_class.steal('Object') + end + end end end describe '.perform' do - it 'performs a background migration' do - instance = double(:instance) - klass = double(:klass, new: instance) + let(:migration) { spy(:migration) } - expect(described_class).to receive(:const_get) - .with('Foo') - .and_return(klass) + before do + stub_const("#{described_class.name}::Foo", migration) + end - expect(instance).to receive(:perform).with(10, 20) + it 'performs a background migration' do + expect(migration).to receive(:perform).with(10, 20).once described_class.perform('Foo', [10, 20]) end diff --git a/spec/lib/gitlab/cache/request_cache_spec.rb b/spec/lib/gitlab/cache/request_cache_spec.rb new file mode 100644 index 00000000000..5b82c216a13 --- /dev/null +++ b/spec/lib/gitlab/cache/request_cache_spec.rb @@ -0,0 +1,133 @@ +require 'spec_helper' + +describe Gitlab::Cache::RequestCache do + let(:klass) do + Class.new do + extend Gitlab::Cache::RequestCache + + attr_accessor :id, :name, :result, :extra + + def self.name + 'ExpensiveAlgorithm' + end + + def initialize(id, name, result, extra = nil) + self.id = id + self.name = name + self.result = result + self.extra = nil + end + + request_cache def compute(arg) + result << arg + end + + request_cache def repute(arg) + result << arg + end + + def dispute(arg) + result << arg + end + request_cache(:dispute) { extra } + end + end + + let(:algorithm) { klass.new('id', 'name', []) } + + shared_examples 'cache for the same instance' do + it 'does not compute twice for the same argument' do + algorithm.compute(true) + result = algorithm.compute(true) + + expect(result).to eq([true]) + end + + it 'computes twice for the different argument' do + algorithm.compute(true) + result = algorithm.compute(false) + + expect(result).to eq([true, false]) + end + + it 'computes twice for the different class name' do + algorithm.compute(true) + allow(klass).to receive(:name).and_return('CheapAlgo') + result = algorithm.compute(true) + + expect(result).to eq([true, true]) + end + + it 'computes twice for the different method' do + algorithm.compute(true) + result = algorithm.repute(true) + + expect(result).to eq([true, true]) + end + + context 'when request_cache_key is provided' do + before do + klass.request_cache_key do + [id, name] + end + end + + it 'computes twice for the different keys, id' do + algorithm.compute(true) + algorithm.id = 'ad' + result = algorithm.compute(true) + + expect(result).to eq([true, true]) + end + + it 'computes twice for the different keys, name' do + algorithm.compute(true) + algorithm.name = 'same' + result = algorithm.compute(true) + + expect(result).to eq([true, true]) + end + + it 'uses extra method cache key if provided' do + algorithm.dispute(true) # miss + algorithm.extra = true + algorithm.dispute(true) # miss + result = algorithm.dispute(true) # hit + + expect(result).to eq([true, true]) + end + end + end + + context 'when RequestStore is active', :request_store do + it_behaves_like 'cache for the same instance' + + it 'computes once for different instances when keys are the same' do + algorithm.compute(true) + result = klass.new('id', 'name', algorithm.result).compute(true) + + expect(result).to eq([true]) + end + + it 'computes twice if RequestStore starts over' do + algorithm.compute(true) + RequestStore.end! + RequestStore.clear! + RequestStore.begin! + result = algorithm.compute(true) + + expect(result).to eq([true, true]) + end + end + + context 'when RequestStore is inactive' do + it_behaves_like 'cache for the same instance' + + it 'computes twice for different instances even if keys are the same' do + algorithm.compute(true) + result = klass.new('id', 'name', algorithm.result).compute(true) + + expect(result).to eq([true, true]) + end + end +end diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb index bbb3f9912a3..13f0338b6aa 100644 --- a/spec/lib/gitlab/ci/trace/stream_spec.rb +++ b/spec/lib/gitlab/ci/trace/stream_spec.rb @@ -293,5 +293,12 @@ describe Gitlab::Ci::Trace::Stream do it { is_expected.to eq("65") } end + + context 'malicious regexp' do + let(:data) { malicious_text } + let(:regex) { malicious_regexp } + + include_examples 'malicious regexp' + end end end diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index 4259be3f522..a2acd15c8fb 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -174,13 +174,23 @@ describe Gitlab::Database::MigrationHelpers, lib: true do allow(Gitlab::Database).to receive(:mysql?).and_return(false) end - it 'creates a concurrent foreign key' do + it 'creates a concurrent foreign key and validates it' do expect(model).to receive(:disable_statement_timeout) expect(model).to receive(:execute).ordered.with(/NOT VALID/) expect(model).to receive(:execute).ordered.with(/VALIDATE CONSTRAINT/) model.add_concurrent_foreign_key(:projects, :users, column: :user_id) end + + it 'appends a valid ON DELETE statement' do + expect(model).to receive(:disable_statement_timeout) + expect(model).to receive(:execute).with(/ON DELETE SET NULL/) + expect(model).to receive(:execute).ordered.with(/VALIDATE CONSTRAINT/) + + model.add_concurrent_foreign_key(:projects, :users, + column: :user_id, + on_delete: :nullify) + end end end end diff --git a/spec/lib/gitlab/git/branch_spec.rb b/spec/lib/gitlab/git/branch_spec.rb index d1d7ed1d02a..cdf1b8beee3 100644 --- a/spec/lib/gitlab/git/branch_spec.rb +++ b/spec/lib/gitlab/git/branch_spec.rb @@ -7,51 +7,6 @@ describe Gitlab::Git::Branch, seed_helper: true do it { is_expected.to be_kind_of Array } - describe 'initialize' do - let(:commit_id) { 'f00' } - let(:commit_subject) { "My commit".force_encoding('ASCII-8BIT') } - let(:committer) do - Gitaly::FindLocalBranchCommitAuthor.new( - name: generate(:name), - email: generate(:email), - date: Google::Protobuf::Timestamp.new(seconds: 123) - ) - end - let(:author) do - Gitaly::FindLocalBranchCommitAuthor.new( - name: generate(:name), - email: generate(:email), - date: Google::Protobuf::Timestamp.new(seconds: 456) - ) - end - let(:gitaly_branch) do - Gitaly::FindLocalBranchResponse.new( - name: 'foo', commit_id: commit_id, commit_subject: commit_subject, - commit_author: author, commit_committer: committer - ) - end - let(:attributes) do - { - id: commit_id, - message: commit_subject, - authored_date: Time.at(author.date.seconds), - author_name: author.name, - author_email: author.email, - committed_date: Time.at(committer.date.seconds), - committer_name: committer.name, - committer_email: committer.email - } - end - let(:branch) { described_class.new(repository, 'foo', gitaly_branch) } - - it 'parses Gitaly::FindLocalBranchResponse correctly' do - expect(Gitlab::Git::Commit).to receive(:decorate) - .with(hash_including(attributes)).and_call_original - - expect(branch.dereferenced_target.message).to be_utf8 - end - end - describe '#size' do subject { super().size } it { is_expected.to eq(SeedRepo::Repo::BRANCHES.size) } diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb index f20a14155dc..60de91324f0 100644 --- a/spec/lib/gitlab/git/commit_spec.rb +++ b/spec/lib/gitlab/git/commit_spec.rb @@ -64,6 +64,52 @@ describe Gitlab::Git::Commit, seed_helper: true do end end + describe "Commit info from gitaly commit" do + let(:id) { 'f00' } + let(:subject) { "My commit".force_encoding('ASCII-8BIT') } + let(:body) { subject + "My body".force_encoding('ASCII-8BIT') } + let(:committer) do + Gitaly::CommitAuthor.new( + name: generate(:name), + email: generate(:email), + date: Google::Protobuf::Timestamp.new(seconds: 123) + ) + end + let(:author) do + Gitaly::CommitAuthor.new( + name: generate(:name), + email: generate(:email), + date: Google::Protobuf::Timestamp.new(seconds: 456) + ) + end + let(:gitaly_commit) do + Gitaly::GitCommit.new( + id: id, + subject: subject, + body: body, + author: author, + committer: committer + ) + end + let(:commit) { described_class.new(gitaly_commit) } + + it { expect(commit.short_id).to eq(id[0..10]) } + it { expect(commit.id).to eq(id) } + it { expect(commit.sha).to eq(id) } + it { expect(commit.safe_message).to eq(body) } + it { expect(commit.created_at).to eq(Time.at(committer.date.seconds)) } + it { expect(commit.author_email).to eq(author.email) } + it { expect(commit.author_name).to eq(author.name) } + it { expect(commit.committer_name).to eq(committer.name) } + it { expect(commit.committer_email).to eq(committer.email) } + + context 'no body' do + let(:body) { "".force_encoding('ASCII-8BIT') } + + it { expect(commit.safe_message).to eq(subject) } + end + end + context 'Class methods' do describe '.find' do it "should return first head commit if without params" do diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 10fa5f4044b..83d067b2c31 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -45,11 +45,11 @@ describe Gitlab::Git::Repository, seed_helper: true do end it 'gets the branch name from GitalyClient' do - expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name) + expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:default_branch_name) repository.root_ref end - it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :default_branch_name do + it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :default_branch_name do subject { repository.root_ref } end end @@ -132,11 +132,11 @@ describe Gitlab::Git::Repository, seed_helper: true do it { is_expected.not_to include("branch-from-space") } it 'gets the branch names from GitalyClient' do - expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names) + expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:branch_names) subject end - it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :branch_names + it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :branch_names end describe '#tag_names' do @@ -160,11 +160,11 @@ describe Gitlab::Git::Repository, seed_helper: true do it { is_expected.not_to include("v5.0.0") } it 'gets the tag names from GitalyClient' do - expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names) + expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:tag_names) subject end - it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :tag_names + it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :tag_names end shared_examples 'archive check' do |extenstion| @@ -234,33 +234,6 @@ describe Gitlab::Git::Repository, seed_helper: true do it { expect(repository.bare?).to be_truthy } end - describe '#heads' do - let(:heads) { repository.heads } - subject { heads } - - it { is_expected.to be_kind_of Array } - - describe '#size' do - subject { super().size } - it { is_expected.to eq(SeedRepo::Repo::BRANCHES.size) } - end - - context :head do - subject { heads.first } - - describe '#name' do - subject { super().name } - it { is_expected.to eq("feature") } - end - - context :commit do - subject { heads.first.dereferenced_target.sha } - - it { is_expected.to eq("0b4bc9a49b562e85de7cc9e834518ea6828729b9") } - end - end - end - describe '#ref_names' do let(:ref_names) { repository.ref_names } subject { ref_names } @@ -278,42 +251,6 @@ describe Gitlab::Git::Repository, seed_helper: true do end end - describe '#search_files' do - let(:results) { repository.search_files('rails', 'master') } - subject { results } - - it { is_expected.to be_kind_of Array } - - describe '#first' do - subject { super().first } - it { is_expected.to be_kind_of Gitlab::Git::BlobSnippet } - end - - context 'blob result' do - subject { results.first } - - describe '#ref' do - subject { super().ref } - it { is_expected.to eq('master') } - end - - describe '#filename' do - subject { super().filename } - it { is_expected.to eq('CHANGELOG') } - end - - describe '#startline' do - subject { super().startline } - it { is_expected.to eq(35) } - end - - describe '#data' do - subject { super().data } - it { is_expected.to include "Ability to filter by multiple labels" } - end - end - end - describe '#submodule_url_for' do let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:ref) { 'master' } @@ -431,7 +368,7 @@ describe Gitlab::Git::Repository, seed_helper: true do context 'when Gitaly commit_count feature is enabled' do it_behaves_like 'counting commits' - it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Commit, :commit_count do + it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::CommitService, :commit_count do subject { repository.commit_count('master') } end end @@ -521,7 +458,7 @@ describe Gitlab::Git::Repository, seed_helper: true do end it "should refresh the repo's #heads collection" do - head_names = @normal_repo.heads.map { |h| h.name } + head_names = @normal_repo.branches.map { |h| h.name } expect(head_names).to include(new_branch) end @@ -542,7 +479,7 @@ describe Gitlab::Git::Repository, seed_helper: true do eq(normal_repo.rugged.branches["master"].target.oid) ) - head_names = normal_repo.heads.map { |h| h.name } + head_names = normal_repo.branches.map { |h| h.name } expect(head_names).not_to include(new_branch) end @@ -589,10 +526,6 @@ describe Gitlab::Git::Repository, seed_helper: true do expect(@repo.rugged.branches["feature"]).to be_nil end - it "should update the repo's #heads collection" do - expect(@repo.heads).not_to include("feature") - end - after(:all) do FileUtils.rm_rf(TEST_MUTABLE_REPO_PATH) ensure_seeds @@ -1292,12 +1225,12 @@ describe Gitlab::Git::Repository, seed_helper: true do end it 'gets the branches from GitalyClient' do - expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:local_branches) + expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:local_branches) .and_return([]) @repo.local_branches end - it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :local_branches do + it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :local_branches do subject { @repo.local_branches } end end diff --git a/spec/lib/gitlab/gitaly_client/commit_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb index dff5b25c712..93affb12f2b 100644 --- a/spec/lib/gitlab/gitaly_client/commit_spec.rb +++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' -describe Gitlab::GitalyClient::Commit do - let(:diff_stub) { double('Gitaly::Diff::Stub') } +describe Gitlab::GitalyClient::CommitService do let(:project) { create(:project, :repository) } let(:repository) { project.repository } let(:repository_message) { repository.gitaly_repository } @@ -16,7 +15,7 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) + expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) described_class.new(repository).diff_from_parent(commit) end @@ -31,7 +30,7 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: initial_commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) + expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) described_class.new(repository).diff_from_parent(initial_commit) end @@ -61,7 +60,7 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) + expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) described_class.new(repository).commit_deltas(commit) end @@ -76,10 +75,25 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: initial_commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) + expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) described_class.new(repository).commit_deltas(initial_commit) end end end + + describe '#between' do + let(:from) { 'master' } + let(:to) { '4b825dc642cb6eb9a060e54bf8d69288fbee4904' } + it 'sends an RPC request' do + request = Gitaly::CommitsBetweenRequest.new( + repository: repository_message, from: from, to: to + ) + + expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:commits_between) + .with(request, kind_of(Hash)).and_return([]) + + described_class.new(repository).between(from, to) + end + end end diff --git a/spec/lib/gitlab/gitaly_client/notifications_spec.rb b/spec/lib/gitlab/gitaly_client/notification_service_spec.rb index 7404ffe0f06..d9597c4aa78 100644 --- a/spec/lib/gitlab/gitaly_client/notifications_spec.rb +++ b/spec/lib/gitlab/gitaly_client/notification_service_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::GitalyClient::Notifications do +describe Gitlab::GitalyClient::NotificationService do describe '#post_receive' do let(:project) { create(:empty_project) } let(:storage_name) { project.repository_storage } @@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Notifications do subject { described_class.new(project.repository) } it 'sends a post_receive message' do - expect_any_instance_of(Gitaly::Notifications::Stub) + expect_any_instance_of(Gitaly::NotificationService::Stub) .to receive(:post_receive).with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) subject.post_receive diff --git a/spec/lib/gitlab/gitaly_client/ref_spec.rb b/spec/lib/gitlab/gitaly_client/ref_service_spec.rb index 7c090460764..1e8ed9d645b 100644 --- a/spec/lib/gitlab/gitaly_client/ref_spec.rb +++ b/spec/lib/gitlab/gitaly_client/ref_service_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::GitalyClient::Ref do +describe Gitlab::GitalyClient::RefService do let(:project) { create(:empty_project) } let(:storage_name) { project.repository_storage } let(:relative_path) { project.path_with_namespace + '.git' } @@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Ref do describe '#branch_names' do it 'sends a find_all_branch_names message' do - expect_any_instance_of(Gitaly::Ref::Stub) + expect_any_instance_of(Gitaly::RefService::Stub) .to receive(:find_all_branch_names) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .and_return([]) @@ -19,7 +19,7 @@ describe Gitlab::GitalyClient::Ref do describe '#tag_names' do it 'sends a find_all_tag_names message' do - expect_any_instance_of(Gitaly::Ref::Stub) + expect_any_instance_of(Gitaly::RefService::Stub) .to receive(:find_all_tag_names) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .and_return([]) @@ -30,7 +30,7 @@ describe Gitlab::GitalyClient::Ref do describe '#default_branch_name' do it 'sends a find_default_branch_name message' do - expect_any_instance_of(Gitaly::Ref::Stub) + expect_any_instance_of(Gitaly::RefService::Stub) .to receive(:find_default_branch_name) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .and_return(double(name: 'foo')) @@ -41,7 +41,7 @@ describe Gitlab::GitalyClient::Ref do describe '#local_branches' do it 'sends a find_local_branches message' do - expect_any_instance_of(Gitaly::Ref::Stub) + expect_any_instance_of(Gitaly::RefService::Stub) .to receive(:find_local_branches) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .and_return([]) @@ -50,7 +50,7 @@ describe Gitlab::GitalyClient::Ref do end it 'parses and sends the sort parameter' do - expect_any_instance_of(Gitaly::Ref::Stub) + expect_any_instance_of(Gitaly::RefService::Stub) .to receive(:find_local_branches) .with(gitaly_request_with_params(sort_by: :UPDATED_DESC), kind_of(Hash)) .and_return([]) @@ -59,7 +59,7 @@ describe Gitlab::GitalyClient::Ref do end it 'translates known mismatches on sort param values' do - expect_any_instance_of(Gitaly::Ref::Stub) + expect_any_instance_of(Gitaly::RefService::Stub) .to receive(:find_local_branches) .with(gitaly_request_with_params(sort_by: :NAME), kind_of(Hash)) .and_return([]) diff --git a/spec/lib/gitlab/gitaly_client_spec.rb b/spec/lib/gitlab/gitaly_client_spec.rb index ce7b18b784a..558ddb3fbd6 100644 --- a/spec/lib/gitlab/gitaly_client_spec.rb +++ b/spec/lib/gitlab/gitaly_client_spec.rb @@ -16,9 +16,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do 'default' => { 'gitaly_address' => address } }) - expect(Gitaly::Commit::Stub).to receive(:new).with(address, any_args) + expect(Gitaly::CommitService::Stub).to receive(:new).with(address, any_args) - described_class.stub(:commit, 'default') + described_class.stub(:commit_service, 'default') end end @@ -31,9 +31,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do 'default' => { 'gitaly_address' => prefixed_address } }) - expect(Gitaly::Commit::Stub).to receive(:new).with(address, any_args) + expect(Gitaly::CommitService::Stub).to receive(:new).with(address, any_args) - described_class.stub(:commit, 'default') + described_class.stub(:commit_service, 'default') end end end diff --git a/spec/lib/gitlab/route_map_spec.rb b/spec/lib/gitlab/route_map_spec.rb index 21c00c6e5b8..e8feb21e4d7 100644 --- a/spec/lib/gitlab/route_map_spec.rb +++ b/spec/lib/gitlab/route_map_spec.rb @@ -55,6 +55,19 @@ describe Gitlab::RouteMap, lib: true do end describe '#public_path_for_source_path' do + context 'malicious regexp' do + include_examples 'malicious regexp' + + subject do + map = described_class.new(<<-"MAP".strip_heredoc) + - source: '#{malicious_regexp}' + public: '/' + MAP + + map.public_path_for_source_path(malicious_text) + end + end + subject do described_class.new(<<-'MAP'.strip_heredoc) # Team data diff --git a/spec/lib/gitlab/untrusted_regexp_spec.rb b/spec/lib/gitlab/untrusted_regexp_spec.rb new file mode 100644 index 00000000000..66045917cb3 --- /dev/null +++ b/spec/lib/gitlab/untrusted_regexp_spec.rb @@ -0,0 +1,80 @@ +require 'spec_helper' + +describe Gitlab::UntrustedRegexp do + describe '#initialize' do + subject { described_class.new(pattern) } + + context 'invalid regexp' do + let(:pattern) { '[' } + + it { expect { subject }.to raise_error(RegexpError) } + end + end + + describe '#replace_all' do + it 'replaces all instances of the match in a string' do + result = described_class.new('foo').replace_all('foo bar foo', 'oof') + + expect(result).to eq('oof bar oof') + end + end + + describe '#replace' do + it 'replaces the first instance of the match in a string' do + result = described_class.new('foo').replace('foo bar foo', 'oof') + + expect(result).to eq('oof bar foo') + end + end + + describe '#===' do + it 'returns true for a match' do + result = described_class.new('foo') === 'a foo here' + + expect(result).to be_truthy + end + + it 'returns false for no match' do + result = described_class.new('foo') === 'a bar here' + + expect(result).to be_falsy + end + end + + describe '#scan' do + subject { described_class.new(regexp).scan(text) } + context 'malicious regexp' do + let(:text) { malicious_text } + let(:regexp) { malicious_regexp } + + include_examples 'malicious regexp' + end + + context 'no capture group' do + let(:regexp) { '.+' } + let(:text) { 'foo' } + + it 'returns the whole match' do + is_expected.to eq(['foo']) + end + end + + context 'one capture group' do + let(:regexp) { '(f).+' } + let(:text) { 'foo' } + + it 'returns the captured part' do + is_expected.to eq([%w[f]]) + end + end + + context 'two capture groups' do + let(:regexp) { '(f).(o)' } + let(:text) { 'foo' } + + it 'returns the captured parts' do + is_expected.to eq([%w[f o]]) + end + end + end +end diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index c6718827028..daf097f8d51 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -48,6 +48,7 @@ describe Gitlab::UsageData do milestones notes projects + projects_imported_from_github projects_prometheus_active pages_domains protected_branches diff --git a/spec/migrations/add_foreign_key_to_merge_requests_spec.rb b/spec/migrations/add_foreign_key_to_merge_requests_spec.rb new file mode 100644 index 00000000000..d9ad9a585f0 --- /dev/null +++ b/spec/migrations/add_foreign_key_to_merge_requests_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' +require Rails.root.join('db', 'migrate', '20170713104829_add_foreign_key_to_merge_requests.rb') + +describe AddForeignKeyToMergeRequests, :migration do + let(:projects) { table(:projects) } + let(:merge_requests) { table(:merge_requests) } + let(:pipelines) { table(:ci_pipelines) } + + before do + projects.create!(name: 'gitlab', path: 'gitlab-org/gitlab-ce') + pipelines.create!(project_id: projects.first.id, + ref: 'some-branch', + sha: 'abc12345') + + # merge request without a pipeline + create_merge_request(head_pipeline_id: nil) + + # merge request with non-existent pipeline + create_merge_request(head_pipeline_id: 1234) + + # merge reqeust with existing pipeline assigned + create_merge_request(head_pipeline_id: pipelines.first.id) + end + + it 'correctly adds a foreign key to head_pipeline_id' do + migrate! + + expect(merge_requests.first.head_pipeline_id).to be_nil + expect(merge_requests.second.head_pipeline_id).to be_nil + expect(merge_requests.third.head_pipeline_id).to eq pipelines.first.id + end + + def create_merge_request(**opts) + merge_requests.create!(source_project_id: projects.first.id, + target_project_id: projects.first.id, + source_branch: 'some-branch', + target_branch: 'master', **opts) + end +end diff --git a/spec/migrations/clean_appearance_symlinks_spec.rb b/spec/migrations/clean_appearance_symlinks_spec.rb new file mode 100644 index 00000000000..9225dc0d894 --- /dev/null +++ b/spec/migrations/clean_appearance_symlinks_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20170613111224_clean_appearance_symlinks.rb') + +describe CleanAppearanceSymlinks do + let(:migration) { described_class.new } + let(:test_dir) { File.join(Rails.root, "tmp", "tests", "clean_appearance_test") } + let(:uploads_dir) { File.join(test_dir, "public", "uploads") } + let(:new_uploads_dir) { File.join(uploads_dir, "system") } + let(:original_path) { File.join(new_uploads_dir, 'appearance') } + let(:symlink_path) { File.join(uploads_dir, 'appearance') } + + before do + FileUtils.remove_dir(test_dir) if File.directory?(test_dir) + FileUtils.mkdir_p(uploads_dir) + allow(migration).to receive(:base_directory).and_return(test_dir) + allow(migration).to receive(:say) + end + + describe "#up" do + before do + FileUtils.mkdir_p(original_path) + FileUtils.ln_s(original_path, symlink_path) + end + + it 'removes the symlink' do + migration.up + + expect(File.symlink?(symlink_path)).to be(false) + end + end + + describe '#down' do + before do + FileUtils.mkdir_p(File.join(original_path)) + FileUtils.touch(File.join(original_path, 'dummy.file')) + end + + it 'creates a symlink' do + expected_path = File.join(symlink_path, "dummy.file") + migration.down + + expect(File.exist?(expected_path)).to be(true) + expect(File.symlink?(symlink_path)).to be(true) + end + end +end diff --git a/spec/migrations/clean_stage_id_reference_migration_spec.rb b/spec/migrations/clean_stage_id_reference_migration_spec.rb new file mode 100644 index 00000000000..9a581df28a2 --- /dev/null +++ b/spec/migrations/clean_stage_id_reference_migration_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' +require Rails.root.join('db', 'migrate', '20170710083355_clean_stage_id_reference_migration.rb') + +describe CleanStageIdReferenceMigration, :migration, :sidekiq, :redis do + let(:migration_class) { 'MigrateBuildStageIdReference' } + let(:migration) { spy('migration') } + + before do + allow(Gitlab::BackgroundMigration.const_get(migration_class)) + .to receive(:new).and_return(migration) + end + + context 'when there are pending background migrations' do + it 'processes pending jobs synchronously' do + Sidekiq::Testing.disable! do + BackgroundMigrationWorker.perform_in(2.minutes, migration_class, [1, 1]) + BackgroundMigrationWorker.perform_async(migration_class, [1, 1]) + + migrate! + + expect(migration).to have_received(:perform).with(1, 1).twice + end + end + end + context 'when there are no background migrations pending' do + it 'does nothing' do + Sidekiq::Testing.disable! do + migrate! + + expect(migration).not_to have_received(:perform) + end + end + end +end diff --git a/spec/migrations/cleanup_move_system_upload_folder_symlink_spec.rb b/spec/migrations/cleanup_move_system_upload_folder_symlink_spec.rb new file mode 100644 index 00000000000..3a9fa8c7113 --- /dev/null +++ b/spec/migrations/cleanup_move_system_upload_folder_symlink_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require Rails.root.join("db", "post_migrate", "20170717111152_cleanup_move_system_upload_folder_symlink.rb") + +describe CleanupMoveSystemUploadFolderSymlink do + let(:migration) { described_class.new } + let(:test_base) { File.join(Rails.root, 'tmp', 'tests', 'move-system-upload-folder') } + let(:test_folder) { File.join(test_base, '-', 'system') } + + before do + allow(migration).to receive(:base_directory).and_return(test_base) + FileUtils.rm_rf(test_base) + FileUtils.mkdir_p(test_folder) + allow(migration).to receive(:say) + end + + describe '#up' do + before do + FileUtils.ln_s(test_folder, File.join(test_base, 'system')) + end + + it 'removes the symlink' do + migration.up + + expect(File.exist?(File.join(test_base, 'system'))).to be_falsey + end + end + + describe '#down' do + it 'creates the symlink' do + migration.down + + expect(File.symlink?(File.join(test_base, 'system'))).to be_truthy + end + end +end diff --git a/spec/migrations/move_personal_snippets_files_spec.rb b/spec/migrations/move_personal_snippets_files_spec.rb new file mode 100644 index 00000000000..8505c7bf3e3 --- /dev/null +++ b/spec/migrations/move_personal_snippets_files_spec.rb @@ -0,0 +1,180 @@ +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20170612071012_move_personal_snippets_files.rb') + +describe MovePersonalSnippetsFiles do + let(:migration) { described_class.new } + let(:test_dir) { File.join(Rails.root, "tmp", "tests", "move_snippet_files_test") } + let(:uploads_dir) { File.join(test_dir, 'uploads') } + let(:new_uploads_dir) { File.join(uploads_dir, 'system') } + + before do + allow(CarrierWave).to receive(:root).and_return(test_dir) + allow(migration).to receive(:base_directory).and_return(test_dir) + FileUtils.remove_dir(test_dir) if File.directory?(test_dir) + allow(migration).to receive(:say) + end + + describe "#up" do + let(:snippet) do + snippet = create(:personal_snippet) + create_upload('picture.jpg', snippet) + snippet.update(description: markdown_linking_file('picture.jpg', snippet)) + snippet + end + + let(:snippet_with_missing_file) do + snippet = create(:snippet) + create_upload('picture.jpg', snippet, create_file: false) + snippet.update(description: markdown_linking_file('picture.jpg', snippet)) + snippet + end + + it 'moves the files' do + source_path = File.join(uploads_dir, model_file_path('picture.jpg', snippet)) + destination_path = File.join(new_uploads_dir, model_file_path('picture.jpg', snippet)) + + migration.up + + expect(File.exist?(source_path)).to be_falsy + expect(File.exist?(destination_path)).to be_truthy + end + + describe 'updating the markdown' do + it 'includes the new path when the file exists' do + secret = "secret#{snippet.id}" + file_location = "/uploads/system/personal_snippet/#{snippet.id}/#{secret}/picture.jpg" + + migration.up + + expect(snippet.reload.description).to include(file_location) + end + + it 'does not update the markdown when the file is missing' do + secret = "secret#{snippet_with_missing_file.id}" + file_location = "/uploads/personal_snippet/#{snippet_with_missing_file.id}/#{secret}/picture.jpg" + + migration.up + + expect(snippet_with_missing_file.reload.description).to include(file_location) + end + + it 'updates the note markdown' do + secret = "secret#{snippet.id}" + file_location = "/uploads/system/personal_snippet/#{snippet.id}/#{secret}/picture.jpg" + markdown = markdown_linking_file('picture.jpg', snippet) + note = create(:note_on_personal_snippet, noteable: snippet, note: "with #{markdown}") + + migration.up + + expect(note.reload.note).to include(file_location) + end + end + end + + describe "#down" do + let(:snippet) do + snippet = create(:personal_snippet) + create_upload('picture.jpg', snippet, in_new_path: true) + snippet.update(description: markdown_linking_file('picture.jpg', snippet, in_new_path: true)) + snippet + end + + let(:snippet_with_missing_file) do + snippet = create(:personal_snippet) + create_upload('picture.jpg', snippet, create_file: false, in_new_path: true) + snippet.update(description: markdown_linking_file('picture.jpg', snippet, in_new_path: true)) + snippet + end + + it 'moves the files' do + source_path = File.join(new_uploads_dir, model_file_path('picture.jpg', snippet)) + destination_path = File.join(uploads_dir, model_file_path('picture.jpg', snippet)) + + migration.down + + expect(File.exist?(source_path)).to be_falsey + expect(File.exist?(destination_path)).to be_truthy + end + + describe 'updating the markdown' do + it 'includes the new path when the file exists' do + secret = "secret#{snippet.id}" + file_location = "/uploads/personal_snippet/#{snippet.id}/#{secret}/picture.jpg" + + migration.down + + expect(snippet.reload.description).to include(file_location) + end + + it 'keeps the markdown as is when the file is missing' do + secret = "secret#{snippet_with_missing_file.id}" + file_location = "/uploads/system/personal_snippet/#{snippet_with_missing_file.id}/#{secret}/picture.jpg" + + migration.down + + expect(snippet_with_missing_file.reload.description).to include(file_location) + end + + it 'updates the note markdown' do + markdown = markdown_linking_file('picture.jpg', snippet, in_new_path: true) + secret = "secret#{snippet.id}" + file_location = "/uploads/personal_snippet/#{snippet.id}/#{secret}/picture.jpg" + note = create(:note_on_personal_snippet, noteable: snippet, note: "with #{markdown}") + + migration.down + + expect(note.reload.note).to include(file_location) + end + end + end + + describe '#update_markdown' do + it 'escapes sql in the snippet description' do + migration.instance_variable_set('@source_relative_location', '/uploads/personal_snippet') + migration.instance_variable_set('@destination_relative_location', '/uploads/system/personal_snippet') + + secret = '123456789' + filename = 'hello.jpg' + snippet = create(:personal_snippet) + + path_before = "/uploads/personal_snippet/#{snippet.id}/#{secret}/#{filename}" + path_after = "/uploads/system/personal_snippet/#{snippet.id}/#{secret}/#{filename}" + description_before = "Hello world; ![image](#{path_before})'; select * from users;" + description_after = "Hello world; ![image](#{path_after})'; select * from users;" + + migration.update_markdown(snippet.id, secret, filename, description_before) + + expect(snippet.reload.description).to eq(description_after) + end + end + + def create_upload(filename, snippet, create_file: true, in_new_path: false) + secret = "secret#{snippet.id}" + absolute_path = if in_new_path + File.join(new_uploads_dir, model_file_path(filename, snippet)) + else + File.join(uploads_dir, model_file_path(filename, snippet)) + end + + if create_file + FileUtils.mkdir_p(File.dirname(absolute_path)) + FileUtils.touch(absolute_path) + end + + create(:upload, model: snippet, path: "#{secret}/#{filename}", uploader: PersonalFileUploader) + end + + def markdown_linking_file(filename, snippet, in_new_path: false) + markdown = "![#{filename.split('.')[0]}]" + markdown += '(/uploads' + markdown += '/system' if in_new_path + markdown += "/#{model_file_path(filename, snippet)})" + markdown + end + + def model_file_path(filename, snippet) + secret = "secret#{snippet.id}" + + File.join('personal_snippet', snippet.id.to_s, secret, filename) + end +end diff --git a/spec/migrations/move_system_upload_folder_spec.rb b/spec/migrations/move_system_upload_folder_spec.rb new file mode 100644 index 00000000000..b622b4e9536 --- /dev/null +++ b/spec/migrations/move_system_upload_folder_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' +require Rails.root.join("db", "migrate", "20170717074009_move_system_upload_folder.rb") + +describe MoveSystemUploadFolder do + let(:migration) { described_class.new } + let(:test_base) { File.join(Rails.root, 'tmp', 'tests', 'move-system-upload-folder') } + + before do + allow(migration).to receive(:base_directory).and_return(test_base) + FileUtils.rm_rf(test_base) + FileUtils.mkdir_p(test_base) + allow(migration).to receive(:say) + end + + describe '#up' do + let(:test_folder) { File.join(test_base, 'system') } + let(:test_file) { File.join(test_folder, 'file') } + + before do + FileUtils.mkdir_p(test_folder) + FileUtils.touch(test_file) + end + + it 'moves the related folder' do + migration.up + + expect(File.exist?(File.join(test_base, '-', 'system', 'file'))).to be_truthy + end + + it 'creates a symlink linking making the new folder available on the old path' do + migration.up + + expect(File.symlink?(File.join(test_base, 'system'))).to be_truthy + expect(File.exist?(File.join(test_base, 'system', 'file'))).to be_truthy + end + end + + describe '#down' do + let(:test_folder) { File.join(test_base, '-', 'system') } + let(:test_file) { File.join(test_folder, 'file') } + + before do + FileUtils.mkdir_p(test_folder) + FileUtils.touch(test_file) + end + + it 'moves the system folder back to the old location' do + migration.down + + expect(File.exist?(File.join(test_base, 'system', 'file'))).to be_truthy + end + + it 'removes the symlink if it existed' do + FileUtils.ln_s(test_folder, File.join(test_base, 'system')) + + migration.down + + expect(File.directory?(File.join(test_base, 'system'))).to be_truthy + expect(File.symlink?(File.join(test_base, 'system'))).to be_falsey + end + end +end diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 6056d78da4e..528b211c9d6 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -19,17 +19,15 @@ describe Commit, models: true do expect(commit.author).to eq(user) end - it 'caches the author' do - allow(RequestStore).to receive(:active?).and_return(true) + it 'caches the author', :request_store do user = create(:user, email: commit.author_email) - expect_any_instance_of(Commit).to receive(:find_author_by_any_email).and_call_original + expect(User).to receive(:find_by_any_email).and_call_original expect(commit.author).to eq(user) - key = "commit_author:#{commit.author_email}" + key = "Commit:author:#{commit.author_email.downcase}" expect(RequestStore.store[key]).to eq(user) expect(commit.author).to eq(user) - RequestStore.store.clear end end diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 066d7b9307f..770176451fe 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -189,7 +189,7 @@ describe Group, models: true do let!(:group) { create(:group, :access_requestable, :with_avatar) } let(:user) { create(:user) } let(:gitlab_host) { "http://#{Gitlab.config.gitlab.host}" } - let(:avatar_path) { "/uploads/system/group/avatar/#{group.id}/dk.png" } + let(:avatar_path) { "/uploads/-/system/group/avatar/#{group.id}/dk.png" } context 'when avatar file is uploaded' do before do diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 62c4ea01ce1..a4090b37f65 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -44,7 +44,7 @@ describe Namespace, models: true do end context "is case insensitive" do - let(:group) { build(:group, path: "System") } + let(:group) { build(:group, path: "Groups") } it { expect(group).not_to be_valid } end @@ -63,6 +63,14 @@ describe Namespace, models: true do it { is_expected.to respond_to(:has_parent?) } end + describe 'inclusions' do + it { is_expected.to include_module(Gitlab::VisibilityLevel) } + end + + describe '#visibility_level_field' do + it { expect(namespace.visibility_level_field).to eq(:visibility_level) } + end + describe '#to_param' do it { expect(namespace.to_param).to eq(namespace.full_path) } end diff --git a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb b/spec/models/project_services/gitlab_issue_tracker_service_spec.rb index 6ee30e86495..d45e0a441d4 100644 --- a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb +++ b/spec/models/project_services/gitlab_issue_tracker_service_spec.rb @@ -43,7 +43,7 @@ describe GitlabIssueTrackerService, models: true do end it 'gives the correct path' do - expect(service.project_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues") + expect(service.issue_tracker_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues") expect(service.new_issue_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues/new") expect(service.issue_path(432)).to eq("/gitlab/root/#{project.path_with_namespace}/issues/432") end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index e636250c37d..90769b580cd 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -807,7 +807,7 @@ describe Project, models: true do context 'when avatar file is uploaded' do let(:project) { create(:empty_project, :with_avatar) } - let(:avatar_path) { "/uploads/system/project/avatar/#{project.id}/dk.png" } + let(:avatar_path) { "/uploads/-/system/project/avatar/#{project.id}/dk.png" } let(:gitlab_host) { "http://#{Gitlab.config.gitlab.host}" } it 'shows correct url' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 69f2570eec2..a1d6d7e6e0b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1028,7 +1028,7 @@ describe User, models: true do context 'when avatar file is uploaded' do let(:gitlab_host) { "http://#{Gitlab.config.gitlab.host}" } - let(:avatar_path) { "/uploads/system/user/avatar/#{user.id}/dk.png" } + let(:avatar_path) { "/uploads/-/system/user/avatar/#{user.id}/dk.png" } it 'shows correct avatar url' do expect(user.avatar_url).to eq(avatar_path) diff --git a/spec/policies/ci/build_policy_spec.rb b/spec/policies/ci/build_policy_spec.rb index ace95ac7067..9f3212b1a63 100644 --- a/spec/policies/ci/build_policy_spec.rb +++ b/spec/policies/ci/build_policy_spec.rb @@ -103,12 +103,7 @@ describe Ci::BuildPolicy, :models do project.add_developer(user) end - context 'when branch build is assigned to is protected' do - before do - create(:protected_branch, :no_one_can_push, - name: 'some-ref', project: project) - end - + shared_examples 'protected ref' do context 'when build is a manual action' do let(:build) do create(:ci_build, :manual, ref: 'some-ref', pipeline: pipeline) @@ -130,6 +125,43 @@ describe Ci::BuildPolicy, :models do end end + context 'when build is against a protected branch' do + before do + create(:protected_branch, :no_one_can_push, + name: 'some-ref', project: project) + end + + it_behaves_like 'protected ref' + end + + context 'when build is against a protected tag' do + before do + create(:protected_tag, :no_one_can_create, + name: 'some-ref', project: project) + + build.update(tag: true) + end + + it_behaves_like 'protected ref' + end + + context 'when build is against a protected tag but it is not a tag' do + before do + create(:protected_tag, :no_one_can_create, + name: 'some-ref', project: project) + end + + context 'when build is a manual action' do + let(:build) do + create(:ci_build, :manual, ref: 'some-ref', pipeline: pipeline) + end + + it 'includes ability to update build' do + expect(policy).to be_allowed :update_build + end + end + end + context 'when branch build is assigned to is not protected' do context 'when build is a manual action' do let(:build) { create(:ci_build, :manual, pipeline: pipeline) } diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb index beaaf346283..cab3089c6b1 100644 --- a/spec/requests/api/internal_spec.rb +++ b/spec/requests/api/internal_spec.rb @@ -594,10 +594,10 @@ describe API::Internal do # end # # it "calls the Gitaly client with the project's repository" do - # expect(Gitlab::GitalyClient::Notifications). + # expect(Gitlab::GitalyClient::NotificationService). # to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)). # and_call_original - # expect_any_instance_of(Gitlab::GitalyClient::Notifications). + # expect_any_instance_of(Gitlab::GitalyClient::NotificationService). # to receive(:post_receive) # # post api("/internal/notify_post_receive"), valid_params @@ -606,10 +606,10 @@ describe API::Internal do # end # # it "calls the Gitaly client with the wiki's repository if it's a wiki" do - # expect(Gitlab::GitalyClient::Notifications). + # expect(Gitlab::GitalyClient::NotificationService). # to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)). # and_call_original - # expect_any_instance_of(Gitlab::GitalyClient::Notifications). + # expect_any_instance_of(Gitlab::GitalyClient::NotificationService). # to receive(:post_receive) # # post api("/internal/notify_post_receive"), valid_wiki_params @@ -618,7 +618,7 @@ describe API::Internal do # end # # it "returns 500 if the gitaly call fails" do - # expect_any_instance_of(Gitlab::GitalyClient::Notifications). + # expect_any_instance_of(Gitlab::GitalyClient::NotificationService). # to receive(:post_receive).and_raise(GRPC::Unavailable) # # post api("/internal/notify_post_receive"), valid_params @@ -636,10 +636,10 @@ describe API::Internal do # end # # it "calls the Gitaly client with the project's repository" do - # expect(Gitlab::GitalyClient::Notifications). + # expect(Gitlab::GitalyClient::NotificationService). # to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)). # and_call_original - # expect_any_instance_of(Gitlab::GitalyClient::Notifications). + # expect_any_instance_of(Gitlab::GitalyClient::NotificationService). # to receive(:post_receive) # # post api("/internal/notify_post_receive"), valid_params @@ -648,10 +648,10 @@ describe API::Internal do # end # # it "calls the Gitaly client with the wiki's repository if it's a wiki" do - # expect(Gitlab::GitalyClient::Notifications). + # expect(Gitlab::GitalyClient::NotificationService). # to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)). # and_call_original - # expect_any_instance_of(Gitlab::GitalyClient::Notifications). + # expect_any_instance_of(Gitlab::GitalyClient::NotificationService). # to receive(:post_receive) # # post api("/internal/notify_post_receive"), valid_wiki_params diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index fa704f23857..6dbde8bad31 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -442,7 +442,7 @@ describe API::Projects do post api('/projects', user), project project_id = json_response['id'] - expect(json_response['avatar_url']).to eq("http://localhost/uploads/system/project/avatar/#{project_id}/banana_sample.gif") + expect(json_response['avatar_url']).to eq("http://localhost/uploads/-/system/project/avatar/#{project_id}/banana_sample.gif") end it 'sets a project as allowing merge even if build fails' do diff --git a/spec/requests/openid_connect_spec.rb b/spec/requests/openid_connect_spec.rb index ebba28ba8ce..a927de952d0 100644 --- a/spec/requests/openid_connect_spec.rb +++ b/spec/requests/openid_connect_spec.rb @@ -79,7 +79,7 @@ describe 'OpenID Connect requests' do 'email_verified' => true, 'website' => 'https://example.com', 'profile' => 'http://localhost/alice', - 'picture' => "http://localhost/uploads/system/user/avatar/#{user.id}/dk.png" + 'picture' => "http://localhost/uploads/-/system/user/avatar/#{user.id}/dk.png" }) end end diff --git a/spec/rubocop/cop/migration/hash_index_spec.rb b/spec/rubocop/cop/migration/hash_index_spec.rb new file mode 100644 index 00000000000..9a8576a19e5 --- /dev/null +++ b/spec/rubocop/cop/migration/hash_index_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' + +require 'rubocop' +require 'rubocop/rspec/support' + +require_relative '../../../../rubocop/cop/migration/hash_index' + +describe RuboCop::Cop::Migration::HashIndex do + include CopHelper + + subject(:cop) { described_class.new } + + context 'in migration' do + before do + allow(cop).to receive(:in_migration?).and_return(true) + end + + it 'registers an offense when creating a hash index' do + inspect_source(cop, 'def change; add_index :table, :column, using: :hash; end') + + aggregate_failures do + expect(cop.offenses.size).to eq(1) + expect(cop.offenses.map(&:line)).to eq([1]) + end + end + + it 'registers an offense when creating a concurrent hash index' do + inspect_source(cop, 'def change; add_concurrent_index :table, :column, using: :hash; end') + + aggregate_failures do + expect(cop.offenses.size).to eq(1) + expect(cop.offenses.map(&:line)).to eq([1]) + end + end + + it 'registers an offense when creating a hash index using t.index' do + inspect_source(cop, 'def change; t.index :table, :column, using: :hash; end') + + aggregate_failures do + expect(cop.offenses.size).to eq(1) + expect(cop.offenses.map(&:line)).to eq([1]) + end + end + end + + context 'outside of migration' do + it 'registers no offense' do + inspect_source(cop, 'def change; index :table, :column, using: :hash; end') + + expect(cop.offenses.size).to eq(0) + end + end +end diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 194332f62c6..ba07c01d43f 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -40,7 +40,7 @@ describe Ci::CreatePipelineService, :services do it 'increments the prometheus counter' do expect(Gitlab::Metrics).to receive(:counter) - .with(:pipelines_created_count, "Pipelines created count") + .with(:pipelines_created_total, "Counter of pipelines created") .and_call_original pipeline diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index 3f77ed10069..c493c08a7ae 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -108,7 +108,7 @@ describe GitPushService, services: true do it { is_expected.to include(id: @commit.id) } it { is_expected.to include(message: @commit.safe_message) } - it { is_expected.to include(timestamp: @commit.date.xmlschema) } + it { expect(subject[:timestamp].in_time_zone).to eq(@commit.date.in_time_zone) } it do is_expected.to include( url: [ @@ -163,7 +163,7 @@ describe GitPushService, services: true do execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master' ) end end - + context "Sends System Push data" do it "when pushing on a branch" do expect(SystemHookPushWorker).to receive(:perform_async).with(@push_data, :push_hooks) diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index f1e00c1163b..4fc5eb0a527 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -383,7 +383,7 @@ describe NotificationService, services: true do before do build_team(note.project) reset_delivered_emails! - allow_any_instance_of(Commit).to receive(:author).and_return(@u_committer) + allow(note.noteable).to receive(:author).and_return(@u_committer) update_custom_notification(:new_note, @u_guest_custom, resource: project) update_custom_notification(:new_note, @u_custom_global) end diff --git a/spec/services/projects/participants_service_spec.rb b/spec/services/projects/participants_service_spec.rb index d75851134ee..3688f6d4e23 100644 --- a/spec/services/projects/participants_service_spec.rb +++ b/spec/services/projects/participants_service_spec.rb @@ -13,7 +13,7 @@ describe Projects::ParticipantsService, services: true do groups = participants.groups expect(groups.size).to eq 1 - expect(groups.first[:avatar_url]).to eq("/uploads/system/group/avatar/#{group.id}/dk.png") + expect(groups.first[:avatar_url]).to eq("/uploads/-/system/group/avatar/#{group.id}/dk.png") end it 'should return an url for the avatar with relative url' do @@ -24,7 +24,7 @@ describe Projects::ParticipantsService, services: true do groups = participants.groups expect(groups.size).to eq 1 - expect(groups.first[:avatar_url]).to eq("/gitlab/uploads/system/group/avatar/#{group.id}/dk.png") + expect(groups.first[:avatar_url]).to eq("/gitlab/uploads/-/system/group/avatar/#{group.id}/dk.png") end end end diff --git a/spec/services/users/migrate_to_ghost_user_service_spec.rb b/spec/services/users/migrate_to_ghost_user_service_spec.rb index 9e1edf1ac30..e52ecd6d614 100644 --- a/spec/services/users/migrate_to_ghost_user_service_spec.rb +++ b/spec/services/users/migrate_to_ghost_user_service_spec.rb @@ -7,16 +7,32 @@ describe Users::MigrateToGhostUserService, services: true do context "migrating a user's associated records to the ghost user" do context 'issues' do - include_examples "migrating a deleted user's associated records to the ghost user", Issue do - let(:created_record) { create(:issue, project: project, author: user) } - let(:assigned_record) { create(:issue, project: project, assignee: user) } + context 'deleted user is present as both author and edited_user' do + include_examples "migrating a deleted user's associated records to the ghost user", Issue, [:author, :last_edited_by] do + let(:created_record) do + create(:issue, project: project, author: user, last_edited_by: user) + end + end + end + + context 'deleted user is present only as edited_user' do + include_examples "migrating a deleted user's associated records to the ghost user", Issue, [:last_edited_by] do + let(:created_record) { create(:issue, project: project, author: create(:user), last_edited_by: user) } + end end end context 'merge requests' do - include_examples "migrating a deleted user's associated records to the ghost user", MergeRequest do - let(:created_record) { create(:merge_request, source_project: project, author: user, target_branch: "first") } - let(:assigned_record) { create(:merge_request, source_project: project, assignee: user, target_branch: 'second') } + context 'deleted user is present as both author and merge_user' do + include_examples "migrating a deleted user's associated records to the ghost user", MergeRequest, [:author, :merge_user] do + let(:created_record) { create(:merge_request, source_project: project, author: user, merge_user: user, target_branch: "first") } + end + end + + context 'deleted user is present only as both merge_user' do + include_examples "migrating a deleted user's associated records to the ghost user", MergeRequest, [:merge_user] do + let(:created_record) { create(:merge_request, source_project: project, merge_user: user, target_branch: "first") } + end end end @@ -33,9 +49,8 @@ describe Users::MigrateToGhostUserService, services: true do end context 'award emoji' do - include_examples "migrating a deleted user's associated records to the ghost user", AwardEmoji do + include_examples "migrating a deleted user's associated records to the ghost user", AwardEmoji, [:user] do let(:created_record) { create(:award_emoji, user: user) } - let(:author_alias) { :user } context "when the awardable already has an award emoji of the same name assigned to the ghost user" do let(:awardable) { create(:issue) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b8ed1e18de0..5d5715b10ff 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,7 +3,6 @@ SimpleCovEnv.start! ENV["RAILS_ENV"] ||= 'test' ENV["IN_MEMORY_APPLICATION_SETTINGS"] = 'true' -# ENV['prometheus_multiproc_dir'] = 'tmp/prometheus_multiproc_dir_test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' diff --git a/spec/support/malicious_regexp_shared_examples.rb b/spec/support/malicious_regexp_shared_examples.rb new file mode 100644 index 00000000000..ac5d22298bb --- /dev/null +++ b/spec/support/malicious_regexp_shared_examples.rb @@ -0,0 +1,8 @@ +shared_examples 'malicious regexp' do + let(:malicious_text) { 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!' } + let(:malicious_regexp) { '(?i)^(([a-z])+.)+[A-Z]([a-z])+$' } + + it 'takes under a second' do + expect { Timeout.timeout(1) { subject } }.not_to raise_error + end +end diff --git a/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb index dcc562c684b..855051921f0 100644 --- a/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb +++ b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb @@ -1,6 +1,6 @@ require "spec_helper" -shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class| +shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class, fields| record_class_name = record_class.to_s.titleize.downcase let(:project) { create(:project) } @@ -11,6 +11,7 @@ shared_examples "migrating a deleted user's associated records to the ghost user context "for a #{record_class_name} the user has created" do let!(:record) { created_record } + let(:migrated_fields) { fields || [:author] } it "does not delete the #{record_class_name}" do service.execute @@ -18,22 +19,20 @@ shared_examples "migrating a deleted user's associated records to the ghost user expect(record_class.find_by_id(record.id)).to be_present end - it "migrates the #{record_class_name} so that the 'Ghost User' is the #{record_class_name} owner" do + it "blocks the user before migrating #{record_class_name}s to the 'Ghost User'" do service.execute - migrated_record = record_class.find_by_id(record.id) - - if migrated_record.respond_to?(:author) - expect(migrated_record.author).to eq(User.ghost) - else - expect(migrated_record.send(author_alias)).to eq(User.ghost) - end + expect(user).to be_blocked end - it "blocks the user before migrating #{record_class_name}s to the 'Ghost User'" do + it 'migrates all associated fields to te "Ghost user"' do service.execute - expect(user).to be_blocked + migrated_record = record_class.find_by_id(record.id) + + migrated_fields.each do |field| + expect(migrated_record.public_send(field)).to eq(User.ghost) + end end context "race conditions" do diff --git a/spec/support/sidekiq.rb b/spec/support/sidekiq.rb index 5478fea4e64..d143014692d 100644 --- a/spec/support/sidekiq.rb +++ b/spec/support/sidekiq.rb @@ -8,4 +8,8 @@ RSpec.configure do |config| config.after(:each, :sidekiq) do Sidekiq::Worker.clear_all end + + config.after(:each, :sidekiq, :redis) do + Sidekiq.redis { |redis| redis.flushdb } + end end diff --git a/spec/support/sorting_helper.rb b/spec/support/sorting_helper.rb new file mode 100644 index 00000000000..577518d726c --- /dev/null +++ b/spec/support/sorting_helper.rb @@ -0,0 +1,18 @@ +# Helper allows you to sort items +# +# Params +# value - value for sorting +# +# Usage: +# include SortingHelper +# +# sorting_by('Oldest updated') +# +module SortingHelper + def sorting_by(value) + find('button.dropdown-toggle').click + page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do + click_link value + end + end +end diff --git a/spec/uploaders/attachment_uploader_spec.rb b/spec/uploaders/attachment_uploader_spec.rb index d82dbe871d5..04ee6e9bfad 100644 --- a/spec/uploaders/attachment_uploader_spec.rb +++ b/spec/uploaders/attachment_uploader_spec.rb @@ -5,7 +5,7 @@ describe AttachmentUploader do describe "#store_dir" do it "stores in the system dir" do - expect(uploader.store_dir).to start_with("uploads/system/user") + expect(uploader.store_dir).to start_with("uploads/-/system/user") end it "uses the old path when using object storage" do diff --git a/spec/uploaders/avatar_uploader_spec.rb b/spec/uploaders/avatar_uploader_spec.rb index 201fe6949aa..1dc574699d8 100644 --- a/spec/uploaders/avatar_uploader_spec.rb +++ b/spec/uploaders/avatar_uploader_spec.rb @@ -5,7 +5,7 @@ describe AvatarUploader do describe "#store_dir" do it "stores in the system dir" do - expect(uploader.store_dir).to start_with("uploads/system/user") + expect(uploader.store_dir).to start_with("uploads/-/system/user") end it "uses the old path when using object storage" do diff --git a/spec/uploaders/file_mover_spec.rb b/spec/uploaders/file_mover_spec.rb index 896cb410ed5..d7c1b390f9a 100644 --- a/spec/uploaders/file_mover_spec.rb +++ b/spec/uploaders/file_mover_spec.rb @@ -4,11 +4,11 @@ describe FileMover do let(:filename) { 'banana_sample.gif' } let(:file) { fixture_file_upload(Rails.root.join('spec', 'fixtures', filename)) } let(:temp_description) do - 'test ![banana_sample](/uploads/temp/secret55/banana_sample.gif) same ![banana_sample]'\ - '(/uploads/temp/secret55/banana_sample.gif)' + 'test ![banana_sample](/uploads/system/temp/secret55/banana_sample.gif) same ![banana_sample]'\ + '(/uploads/system/temp/secret55/banana_sample.gif)' end let(:temp_file_path) { File.join('secret55', filename).to_s } - let(:file_path) { File.join('uploads', 'personal_snippet', snippet.id.to_s, 'secret55', filename).to_s } + let(:file_path) { File.join('uploads', 'system', 'personal_snippet', snippet.id.to_s, 'secret55', filename).to_s } let(:snippet) { create(:personal_snippet, description: temp_description) } @@ -28,8 +28,8 @@ describe FileMover do expect(snippet.reload.description) .to eq( - "test ![banana_sample](/uploads/personal_snippet/#{snippet.id}/secret55/banana_sample.gif)"\ - " same ![banana_sample](/uploads/personal_snippet/#{snippet.id}/secret55/banana_sample.gif)" + "test ![banana_sample](/uploads/system/personal_snippet/#{snippet.id}/secret55/banana_sample.gif)"\ + " same ![banana_sample](/uploads/system/personal_snippet/#{snippet.id}/secret55/banana_sample.gif)" ) end @@ -50,8 +50,8 @@ describe FileMover do expect(snippet.reload.description) .to eq( - "test ![banana_sample](/uploads/temp/secret55/banana_sample.gif)"\ - " same ![banana_sample](/uploads/temp/secret55/banana_sample.gif)" + "test ![banana_sample](/uploads/system/temp/secret55/banana_sample.gif)"\ + " same ![banana_sample](/uploads/system/temp/secret55/banana_sample.gif)" ) end diff --git a/spec/uploaders/personal_file_uploader_spec.rb b/spec/uploaders/personal_file_uploader_spec.rb index fb92f2ae3ab..eb55e8ebd24 100644 --- a/spec/uploaders/personal_file_uploader_spec.rb +++ b/spec/uploaders/personal_file_uploader_spec.rb @@ -10,7 +10,7 @@ describe PersonalFileUploader do dynamic_segment = "personal_snippet/#{snippet.id}" - expect(described_class.absolute_path(upload)).to end_with("#{dynamic_segment}/secret/foo.jpg") + expect(described_class.absolute_path(upload)).to end_with("/system/#{dynamic_segment}/secret/foo.jpg") end end @@ -19,7 +19,7 @@ describe PersonalFileUploader do uploader = described_class.new(snippet, 'secret') allow(uploader).to receive(:file).and_return(double(extension: 'txt', filename: 'file_name')) - expected_url = "/uploads/personal_snippet/#{snippet.id}/secret/file_name" + expected_url = "/uploads/system/personal_snippet/#{snippet.id}/secret/file_name" expect(uploader.to_h).to eq( alt: 'file_name', |