diff options
36 files changed, 281 insertions, 76 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4047a5b6f32..6966f08b951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ documentation](doc/development/changelog.md) for instructions on adding your own entry. +## 9.0.6 (2017-04-21) + +- Bugfix: POST /projects/:id/hooks and PUT /projects/:id/hook/:hook_id no longer ignore the the job_events param in the V4 API. !10586 +- Fix MR widget bug that merged a MR when Merge when pipeline succeeds was clicked via the dropdown. !10611 +- Fix PlantUML integration in GFM. !10651 +- Show sub-nav under Merge Requests when issue tracker is non-default. !10658 +- Fix restricted project visibility setting available to users. +- Removed orphaned notification settings without a namespace. +- Fix issue's note cache expiration after delete. (mhasbini) +- Display custom hook error messages when automatic merge is enabled. +- Fix filtered search input width for IE. + ## 9.0.5 (2017-04-10) - Add shortcuts and counters to MRs and issues in navbar. diff --git a/app/assets/javascripts/blob/blob_fork_suggestion.js b/app/assets/javascripts/blob/blob_fork_suggestion.js index aa9a4e1c99a..3baf81905fe 100644 --- a/app/assets/javascripts/blob/blob_fork_suggestion.js +++ b/app/assets/javascripts/blob/blob_fork_suggestion.js @@ -1,15 +1,63 @@ -function BlobForkSuggestion(openButton, cancelButton, suggestionSection) { - if (openButton) { - openButton.addEventListener('click', () => { +const defaults = { + // Buttons that will show the `suggestionSections` + // has `data-fork-path`, and `data-action` + openButtons: [], + // Update the href(from `openButton` -> `data-fork-path`) + // whenever a `openButton` is clicked + forkButtons: [], + // Buttons to hide the `suggestionSections` + cancelButtons: [], + // Section to show/hide + suggestionSections: [], + // Pieces of text that need updating depending on the action, `edit`, `replace`, `delete` + actionTextPieces: [], +}; + +class BlobForkSuggestion { + constructor(options) { + this.elementMap = Object.assign({}, defaults, options); + this.onClickWrapper = this.onClick.bind(this); + + document.addEventListener('click', this.onClickWrapper); + } + + showSuggestionSection(forkPath, action = 'edit') { + [].forEach.call(this.elementMap.suggestionSections, (suggestionSection) => { suggestionSection.classList.remove('hidden'); }); + + [].forEach.call(this.elementMap.forkButtons, (forkButton) => { + forkButton.setAttribute('href', forkPath); + }); + + [].forEach.call(this.elementMap.actionTextPieces, (actionTextPiece) => { + // eslint-disable-next-line no-param-reassign + actionTextPiece.textContent = action; + }); } - if (cancelButton) { - cancelButton.addEventListener('click', () => { + hideSuggestionSection() { + [].forEach.call(this.elementMap.suggestionSections, (suggestionSection) => { suggestionSection.classList.add('hidden'); }); } + + onClick(e) { + const el = e.target; + + if ([].includes.call(this.elementMap.openButtons, el)) { + const { forkPath, action } = el.dataset; + this.showSuggestionSection(forkPath, action); + } + + if ([].includes.call(this.elementMap.cancelButtons, el)) { + this.hideSuggestionSection(); + } + } + + destroy() { + document.removeEventListener('click', this.onClickWrapper); + } } export default BlobForkSuggestion; diff --git a/app/assets/javascripts/commons/polyfills.js b/app/assets/javascripts/commons/polyfills.js index 3253eebd9b5..cb054a2a197 100644 --- a/app/assets/javascripts/commons/polyfills.js +++ b/app/assets/javascripts/commons/polyfills.js @@ -1,6 +1,7 @@ // ECMAScript polyfills import 'core-js/fn/array/find'; import 'core-js/fn/array/from'; +import 'core-js/fn/array/includes'; import 'core-js/fn/object/assign'; import 'core-js/fn/promise'; import 'core-js/fn/string/code-point-at'; diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index 02a7df9b2a0..20db2698ba8 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -91,11 +91,13 @@ const ShortcutsBlob = require('./shortcuts_blob'); fileBlobPermalinkUrl, }); - new BlobForkSuggestion( - document.querySelector('.js-edit-blob-link-fork-toggler'), - document.querySelector('.js-cancel-fork-suggestion'), - document.querySelector('.js-file-fork-suggestion-section'), - ); + new BlobForkSuggestion({ + openButtons: document.querySelectorAll('.js-edit-blob-link-fork-toggler'), + forkButtons: document.querySelectorAll('.js-fork-suggestion-button'), + cancelButtons: document.querySelectorAll('.js-cancel-fork-suggestion-button'), + suggestionSections: document.querySelectorAll('.js-file-fork-suggestion-section'), + actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'), + }); } switch (page) { diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 4b3ab03a69c..3736e1ffcbb 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -14,15 +14,6 @@ module BlobHelper options[:link_opts]) end - def fork_path(project = @project, ref = @ref, path = @path, options = {}) - continue_params = { - to: edit_path, - notice: edit_in_new_fork_notice, - notice_now: edit_in_new_fork_notice_now - } - namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params) - end - def edit_blob_link(project = @project, ref = @ref, path = @path, options = {}) blob = options.delete(:blob) blob ||= project.repository.blob_at(ref, path) rescue nil @@ -37,7 +28,16 @@ module BlobHelper elsif !current_user || (current_user && can_modify_blob?(blob, project, ref)) link_to 'Edit', edit_path(project, ref, path, options), class: "#{common_classes} btn-sm" elsif current_user && can?(current_user, :fork_project, project) - button_tag 'Edit', class: "#{common_classes} js-edit-blob-link-fork-toggler" + continue_params = { + to: edit_path, + notice: edit_in_new_fork_notice, + notice_now: edit_in_new_fork_notice_now + } + fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params) + + button_tag 'Edit', + class: "#{common_classes} js-edit-blob-link-fork-toggler", + data: { action: 'edit', fork_path: fork_path } end end @@ -48,21 +48,25 @@ module BlobHelper return unless blob + common_classes = "btn btn-#{btn_class}" + if !on_top_of_branch?(project, ref) - button_tag label, class: "btn btn-#{btn_class} disabled has-tooltip", title: "You can only #{action} files when you are on a branch", data: { container: 'body' } + button_tag label, class: "#{common_classes} disabled has-tooltip", title: "You can only #{action} files when you are on a branch", data: { container: 'body' } elsif blob.lfs_pointer? - button_tag label, class: "btn btn-#{btn_class} disabled has-tooltip", title: "It is not possible to #{action} files that are stored in LFS using the web interface", data: { container: 'body' } + button_tag label, class: "#{common_classes} disabled has-tooltip", title: "It is not possible to #{action} files that are stored in LFS using the web interface", data: { container: 'body' } elsif can_modify_blob?(blob, project, ref) - button_tag label, class: "btn btn-#{btn_class}", 'data-target' => "#modal-#{modal_type}-blob", 'data-toggle' => 'modal' + button_tag label, class: "#{common_classes}", 'data-target' => "#modal-#{modal_type}-blob", 'data-toggle' => 'modal' elsif can?(current_user, :fork_project, project) continue_params = { - to: request.fullpath, + to: request.fullpath, notice: edit_in_new_fork_notice + " Try to #{action} this file again.", notice_now: edit_in_new_fork_notice_now } fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params) - link_to label, fork_path, class: "btn btn-#{btn_class}", method: :post + button_tag label, + class: "#{common_classes} js-edit-blob-link-fork-toggler", + data: { action: action, fork_path: fork_path } end end diff --git a/app/views/projects/blob/_header.html.haml b/app/views/projects/blob/_header.html.haml index 7a4a293548c..d46e4534497 100644 --- a/app/views/projects/blob/_header.html.haml +++ b/app/views/projects/blob/_header.html.haml @@ -38,10 +38,15 @@ - if current_user = replace_blob_link = delete_blob_link + - if current_user .js-file-fork-suggestion-section.file-fork-suggestion.hidden %span.file-fork-suggestion-note - You don't have permission to edit this file. Try forking this project to edit the file. - = link_to 'Fork', fork_path, method: :post, class: 'btn btn-grouped btn-inverted btn-new' - %button.js-cancel-fork-suggestion.btn.btn-grouped{ type: 'button' } + You're not allowed to + %span.js-file-fork-suggestion-section-action + edit + files in this project directly. Please fork this project, + make your changes there, and submit a merge request. + = link_to 'Fork', nil, method: :post, class: 'js-fork-suggestion-button btn btn-grouped btn-inverted btn-new' + %button.js-cancel-fork-suggestion-button.btn.btn-grouped{ type: 'button' } Cancel diff --git a/changelogs/unreleased/2120-issues-search-bar-not-picking-up.yml b/changelogs/unreleased/2120-issues-search-bar-not-picking-up.yml deleted file mode 100644 index 706609b7baf..00000000000 --- a/changelogs/unreleased/2120-issues-search-bar-not-picking-up.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Fix filtered search input width for IE -merge_request: -author: diff --git a/changelogs/unreleased/30457-expire-note-destroy.yml b/changelogs/unreleased/30457-expire-note-destroy.yml deleted file mode 100644 index f5c89da68a9..00000000000 --- a/changelogs/unreleased/30457-expire-note-destroy.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Fix issue's note cache expiration after delete -merge_request: -author: mhasbini diff --git a/changelogs/unreleased/30779-show-mr-subnav-issue-tracker.yml b/changelogs/unreleased/30779-show-mr-subnav-issue-tracker.yml deleted file mode 100644 index 59f8942911c..00000000000 --- a/changelogs/unreleased/30779-show-mr-subnav-issue-tracker.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Show sub-nav under Merge Requests when issue tracker is non-default. -merge_request: 10658 -author: diff --git a/changelogs/unreleased/fix-29125.yml b/changelogs/unreleased/fix-29125.yml deleted file mode 100644 index 00b5e8c0a2a..00000000000 --- a/changelogs/unreleased/fix-29125.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Display custom hook error messages when automatic merge is enabled -merge_request: -author: diff --git a/changelogs/unreleased/fix-jobs-enabled-parameter.yml b/changelogs/unreleased/fix-jobs-enabled-parameter.yml new file mode 100644 index 00000000000..5f73b66837f --- /dev/null +++ b/changelogs/unreleased/fix-jobs-enabled-parameter.yml @@ -0,0 +1,4 @@ +--- +title: Replace builds_enabled with jobs_enabled in projects API v4 +merge_request: 10786 +author: winniehell diff --git a/changelogs/unreleased/fix-orphan-notification-settings.yml b/changelogs/unreleased/fix-orphan-notification-settings.yml deleted file mode 100644 index 7595b033336..00000000000 --- a/changelogs/unreleased/fix-orphan-notification-settings.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Removed orphaned notification settings without a namespace -merge_request: -author: diff --git a/changelogs/unreleased/fix-project-visibility-setting.yml b/changelogs/unreleased/fix-project-visibility-setting.yml deleted file mode 100644 index 0fc219ccf52..00000000000 --- a/changelogs/unreleased/fix-project-visibility-setting.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Fix restricted project visibility setting available to users -merge_request: -author: diff --git a/changelogs/unreleased/mr-widget-bug-fix.yml b/changelogs/unreleased/mr-widget-bug-fix.yml deleted file mode 100644 index 9af29d3927e..00000000000 --- a/changelogs/unreleased/mr-widget-bug-fix.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix MR widget bug that merged a MR when Merge when pipeline succeeds was clicked - via the dropdown -merge_request: 10611 -author: diff --git a/changelogs/unreleased/plantuml-filter-after-highlight.yml b/changelogs/unreleased/plantuml-filter-after-highlight.yml deleted file mode 100644 index f438bfd2bf7..00000000000 --- a/changelogs/unreleased/plantuml-filter-after-highlight.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Fix PlantUML integration in GFM -merge_request: 10651 -author: diff --git a/changelogs/unreleased/zj-api-fix-build-events.yml b/changelogs/unreleased/zj-api-fix-build-events.yml deleted file mode 100644 index 7700d8dcd22..00000000000 --- a/changelogs/unreleased/zj-api-fix-build-events.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Bugfix: POST /projects/:id/hooks and PUT /projects/:id/hook/:hook_id no longer ignore the the job_events param in the V4 API" -merge_request: 10586 -author: diff --git a/doc/development/fe_guide/style_guide_js.md b/doc/development/fe_guide/style_guide_js.md index 038a689c09a..1d2b0558948 100644 --- a/doc/development/fe_guide/style_guide_js.md +++ b/doc/development/fe_guide/style_guide_js.md @@ -71,6 +71,16 @@ See [our current .eslintrc][eslintrc] for specific rules and patterns. /* global Cookies */ /* global jQuery */ ``` + +- Use up to 3 parameters for a function or class. If you need more accept an Object instead. + + ```javascript + // bad + fn(p1, p2, p3, p4) {} + + // good + fn(options) {} + ``` #### Modules, Imports, and Exports - Use ES module syntax to import modules diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature index 536c24b6882..d81bc9802bc 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -117,6 +117,8 @@ Feature: Project Source Browse Files And I click on ".gitignore" file in repo And I see the ".gitignore" And I click on "Replace" + Then I should see a Fork/Cancel combo + And I click button "Fork" Then I should see a notice about a new fork having been created When I click on "Replace" And I replace it with a text file @@ -265,6 +267,8 @@ Feature: Project Source Browse Files And I click on ".gitignore" file in repo And I see the ".gitignore" And I click on "Delete" + Then I should see a Fork/Cancel combo + And I click button "Fork" Then I should see a notice about a new fork having been created When I click on "Delete" And I fill the commit message diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index d52fa10c337..f5e8f7a7c32 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -377,7 +377,6 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I should see a Fork/Cancel combo' do expect(page).to have_link 'Fork' expect(page).to have_button 'Cancel' - expect(page).to have_content 'You don\'t have permission to edit this file. Try forking this project to edit the file.' end step 'I should see a notice about a new fork having been created' do diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 50842370947..db4b31b55bc 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -11,7 +11,7 @@ module API optional :issues_enabled, type: Boolean, desc: 'Flag indication if the issue tracker is enabled' optional :merge_requests_enabled, type: Boolean, desc: 'Flag indication if merge requests are enabled' optional :wiki_enabled, type: Boolean, desc: 'Flag indication if the wiki is enabled' - optional :builds_enabled, type: Boolean, desc: 'Flag indication if builds are enabled' + optional :jobs_enabled, type: Boolean, desc: 'Flag indication if jobs are enabled' optional :snippets_enabled, type: Boolean, desc: 'Flag indication if snippets are enabled' optional :shared_runners_enabled, type: Boolean, desc: 'Flag indication if shared runners are enabled for that project' optional :container_registry_enabled, type: Boolean, desc: 'Flag indication if the container registry is enabled for that project' @@ -103,6 +103,7 @@ module API end post do attrs = declared_params(include_missing: false) + attrs[:builds_enabled] = attrs.delete(:jobs_enabled) if attrs.has_key?(:jobs_enabled) project = ::Projects::CreateService.new(current_user, attrs).execute if project.saved? @@ -205,7 +206,7 @@ module API # CE at_least_one_of_ce = [ - :builds_enabled, + :jobs_enabled, :container_registry_enabled, :default_branch, :description, @@ -236,6 +237,8 @@ module API authorize! :rename_project, user_project if attrs[:name].present? authorize! :change_visibility_level, user_project if attrs[:visibility].present? + attrs[:builds_enabled] = attrs.delete(:jobs_enabled) if attrs.has_key?(:jobs_enabled) + result = ::Projects::UpdateService.new(user_project, current_user, attrs).execute if result[:status] == :success diff --git a/spec/javascripts/blob/blob_fork_suggestion_spec.js b/spec/javascripts/blob/blob_fork_suggestion_spec.js new file mode 100644 index 00000000000..d0d64d75957 --- /dev/null +++ b/spec/javascripts/blob/blob_fork_suggestion_spec.js @@ -0,0 +1,37 @@ +import BlobForkSuggestion from '~/blob/blob_fork_suggestion'; + +describe('BlobForkSuggestion', () => { + let blobForkSuggestion; + + const openButtons = [document.createElement('div')]; + const forkButtons = [document.createElement('a')]; + const cancelButtons = [document.createElement('div')]; + const suggestionSections = [document.createElement('div')]; + const actionTextPieces = [document.createElement('div')]; + + beforeEach(() => { + blobForkSuggestion = new BlobForkSuggestion({ + openButtons, + forkButtons, + cancelButtons, + suggestionSections, + actionTextPieces, + }); + }); + + afterEach(() => { + blobForkSuggestion.destroy(); + }); + + it('showSuggestionSection', () => { + blobForkSuggestion.showSuggestionSection('/foo', 'foo'); + expect(suggestionSections[0].classList.contains('hidden')).toEqual(false); + expect(forkButtons[0].getAttribute('href')).toEqual('/foo'); + expect(actionTextPieces[0].textContent).toEqual('foo'); + }); + + it('hideSuggestionSection', () => { + blobForkSuggestion.hideSuggestionSection(); + expect(suggestionSections[0].classList.contains('hidden')).toEqual(true); + }); +}); diff --git a/spec/javascripts/vue_pipelines_index/async_button_spec.js b/spec/javascripts/pipelines/async_button_spec.js index 28c9c7ab282..28c9c7ab282 100644 --- a/spec/javascripts/vue_pipelines_index/async_button_spec.js +++ b/spec/javascripts/pipelines/async_button_spec.js diff --git a/spec/javascripts/vue_pipelines_index/empty_state_spec.js b/spec/javascripts/pipelines/empty_state_spec.js index bb47a28d9fe..bb47a28d9fe 100644 --- a/spec/javascripts/vue_pipelines_index/empty_state_spec.js +++ b/spec/javascripts/pipelines/empty_state_spec.js diff --git a/spec/javascripts/vue_pipelines_index/error_state_spec.js b/spec/javascripts/pipelines/error_state_spec.js index f667d351f72..f667d351f72 100644 --- a/spec/javascripts/vue_pipelines_index/error_state_spec.js +++ b/spec/javascripts/pipelines/error_state_spec.js diff --git a/spec/javascripts/vue_pipelines_index/mock_data.js b/spec/javascripts/pipelines/mock_data.js index 2365a662b9f..2365a662b9f 100644 --- a/spec/javascripts/vue_pipelines_index/mock_data.js +++ b/spec/javascripts/pipelines/mock_data.js diff --git a/spec/javascripts/vue_pipelines_index/nav_controls_spec.js b/spec/javascripts/pipelines/nav_controls_spec.js index 601eebce38a..601eebce38a 100644 --- a/spec/javascripts/vue_pipelines_index/nav_controls_spec.js +++ b/spec/javascripts/pipelines/nav_controls_spec.js diff --git a/spec/javascripts/vue_pipelines_index/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index 53931d67ad7..53931d67ad7 100644 --- a/spec/javascripts/vue_pipelines_index/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js diff --git a/spec/javascripts/vue_pipelines_index/pipelines_actions_spec.js b/spec/javascripts/pipelines/pipelines_actions_spec.js index c89dacbcd93..c89dacbcd93 100644 --- a/spec/javascripts/vue_pipelines_index/pipelines_actions_spec.js +++ b/spec/javascripts/pipelines/pipelines_actions_spec.js diff --git a/spec/javascripts/vue_pipelines_index/pipelines_artifacts_spec.js b/spec/javascripts/pipelines/pipelines_artifacts_spec.js index 9724b63d957..9724b63d957 100644 --- a/spec/javascripts/vue_pipelines_index/pipelines_artifacts_spec.js +++ b/spec/javascripts/pipelines/pipelines_artifacts_spec.js diff --git a/spec/javascripts/vue_pipelines_index/pipelines_spec.js b/spec/javascripts/pipelines/pipelines_spec.js index e9c05f74ce6..e9c05f74ce6 100644 --- a/spec/javascripts/vue_pipelines_index/pipelines_spec.js +++ b/spec/javascripts/pipelines/pipelines_spec.js diff --git a/spec/javascripts/vue_pipelines_index/pipelines_store_spec.js b/spec/javascripts/pipelines/pipelines_store_spec.js index 10ff0c6bb84..10ff0c6bb84 100644 --- a/spec/javascripts/vue_pipelines_index/pipelines_store_spec.js +++ b/spec/javascripts/pipelines/pipelines_store_spec.js diff --git a/spec/javascripts/vue_pipelines_index/stage_spec.js b/spec/javascripts/pipelines/stage_spec.js index 66b57a82363..66b57a82363 100644 --- a/spec/javascripts/vue_pipelines_index/stage_spec.js +++ b/spec/javascripts/pipelines/stage_spec.js diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 74bc4847247..40365585a56 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -24,6 +24,7 @@ describe API::Projects, :api do namespace: user.namespace, merge_requests_enabled: false, issues_enabled: false, wiki_enabled: false, + builds_enabled: false, snippets_enabled: false) end let(:project_member3) do @@ -342,6 +343,7 @@ describe API::Projects, :api do project = attributes_for(:project, { path: 'camelCasePath', issues_enabled: false, + jobs_enabled: false, merge_requests_enabled: false, wiki_enabled: false, only_allow_merge_if_pipeline_succeeds: false, @@ -351,6 +353,8 @@ describe API::Projects, :api do post api('/projects', user), project + expect(response).to have_http_status(201) + project.each_pair do |k, v| next if %i[has_external_issue_tracker issues_enabled merge_requests_enabled wiki_enabled].include?(k) expect(json_response[k.to_s]).to eq(v) @@ -1078,7 +1082,9 @@ describe API::Projects, :api do it 'returns 400 when nothing sent' do project_param = {} + put api("/projects/#{project.id}", user), project_param + expect(response).to have_http_status(400) expect(json_response['error']).to match('at least one parameter must be provided') end @@ -1086,7 +1092,9 @@ describe API::Projects, :api do context 'when unauthenticated' do it 'returns authentication error' do project_param = { name: 'bar' } + put api("/projects/#{project.id}"), project_param + expect(response).to have_http_status(401) end end @@ -1094,8 +1102,11 @@ describe API::Projects, :api do context 'when authenticated as project owner' do it 'updates name' do project_param = { name: 'bar' } + put api("/projects/#{project.id}", user), project_param + expect(response).to have_http_status(200) + project_param.each_pair do |k, v| expect(json_response[k.to_s]).to eq(v) end @@ -1103,8 +1114,11 @@ describe API::Projects, :api do it 'updates visibility_level' do project_param = { visibility: 'public' } + put api("/projects/#{project3.id}", user), project_param + expect(response).to have_http_status(200) + project_param.each_pair do |k, v| expect(json_response[k.to_s]).to eq(v) end @@ -1113,17 +1127,23 @@ describe API::Projects, :api do it 'updates visibility_level from public to private' do project3.update_attributes({ visibility_level: Gitlab::VisibilityLevel::PUBLIC }) project_param = { visibility: 'private' } + put api("/projects/#{project3.id}", user), project_param + expect(response).to have_http_status(200) + project_param.each_pair do |k, v| expect(json_response[k.to_s]).to eq(v) end + expect(json_response['visibility']).to eq('private') end it 'does not update name to existing name' do project_param = { name: project3.name } + put api("/projects/#{project.id}", user), project_param + expect(response).to have_http_status(400) expect(json_response['message']['name']).to eq(['has already been taken']) end @@ -1139,8 +1159,23 @@ describe API::Projects, :api do it 'updates path & name to existing path & name in different namespace' do project_param = { path: project4.path, name: project4.name } + put api("/projects/#{project3.id}", user), project_param + expect(response).to have_http_status(200) + + project_param.each_pair do |k, v| + expect(json_response[k.to_s]).to eq(v) + end + end + + it 'updates jobs_enabled' do + project_param = { jobs_enabled: true } + + put api("/projects/#{project3.id}", user), project_param + + expect(response).to have_http_status(200) + project_param.each_pair do |k, v| expect(json_response[k.to_s]).to eq(v) end diff --git a/vendor/gitlab-ci-yml/OpenShift.gitlab-ci.yml b/vendor/gitlab-ci-yml/OpenShift.gitlab-ci.yml index d3bb388a1e7..636cb0a9a99 100644 --- a/vendor/gitlab-ci-yml/OpenShift.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/OpenShift.gitlab-ci.yml @@ -41,7 +41,7 @@ review: APP: $CI_COMMIT_REF_NAME APP_HOST: $CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$OPENSHIFT_DOMAIN environment: - name: review/$CI_COMMIT_REF_SLUG + name: review/$CI_COMMIT_REF_NAME url: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$OPENSHIFT_DOMAIN on_stop: stop-review only: @@ -59,7 +59,7 @@ stop-review: APP: $CI_COMMIT_REF_NAME GIT_STRATEGY: none environment: - name: review/$CI_COMMIT_REF_SLUG + name: review/$CI_COMMIT_REF_NAME action: stop only: - branches diff --git a/vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml b/vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml new file mode 100644 index 00000000000..555a51d35b9 --- /dev/null +++ b/vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml @@ -0,0 +1,84 @@ +# Explanation on the scripts: +# https://gitlab.com/gitlab-examples/kubernetes-deploy/blob/master/README.md +image: registry.gitlab.com/gitlab-examples/kubernetes-deploy + +variables: + # Application deployment domain + KUBE_DOMAIN: domain.example.com + +stages: + - build + - test + - review + - staging + - canary + - production + - cleanup + +build: + stage: build + script: + - command build + only: + - branches + +canary: + stage: canary + script: + - command canary + environment: + name: production + url: http://$CI_PROJECT_NAME.$KUBE_DOMAIN + when: manual + only: + - master + +production: + stage: production + script: + - command deploy + environment: + name: production + url: http://$CI_PROJECT_NAME.$KUBE_DOMAIN + when: manual + only: + - master + +staging: + stage: staging + script: + - command deploy + environment: + name: staging + url: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN + only: + - master + +review: + stage: review + script: + - command deploy + environment: + name: review/$CI_COMMIT_REF_NAME + url: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN + on_stop: stop_review + only: + - branches + except: + - master + +stop_review: + stage: cleanup + variables: + GIT_STRATEGY: none + script: + - command destroy + environment: + name: review/$CI_COMMIT_REF_NAME + action: stop + when: manual + allow_failure: true + only: + - branches + except: + - master diff --git a/vendor/gitlab-ci-yml/autodeploy/Kubernetes.gitlab-ci.yml b/vendor/gitlab-ci-yml/autodeploy/Kubernetes.gitlab-ci.yml index c644560647f..ee830ec2eb0 100644 --- a/vendor/gitlab-ci-yml/autodeploy/Kubernetes.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/autodeploy/Kubernetes.gitlab-ci.yml @@ -23,8 +23,6 @@ build: production: stage: production - variables: - CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME.$KUBE_DOMAIN script: - command deploy environment: @@ -36,8 +34,6 @@ production: staging: stage: staging - variables: - CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN script: - command deploy environment: @@ -48,8 +44,6 @@ staging: review: stage: review - variables: - CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN script: - command deploy environment: |