From 1911283d5c6d55f1fbef30309fb458e9785a3e83 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Wed, 14 Nov 2018 09:44:16 +0100 Subject: Clarify wiki permissions --- doc/user/permissions.md | 3 ++- doc/user/project/wiki/index.md | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/user/permissions.md b/doc/user/permissions.md index 1fd230a41aa..0ccc934183f 100644 --- a/doc/user/permissions.md +++ b/doc/user/permissions.md @@ -42,6 +42,8 @@ The following table depicts the various user permission levels in a project. | See a job log | ✓ [^3] | ✓ | ✓ | ✓ | ✓ | | Download and browse job artifacts | ✓ [^3] | ✓ | ✓ | ✓ | ✓ | | View wiki pages | ✓ [^1] | ✓ | ✓ | ✓ | ✓ | +| Create and edit wiki pages | | | ✓ | ✓ | ✓ | +| Delete wiki pages | | | | ✓ | ✓ | | View license management reports **[ULTIMATE]** | ✓ [^1] | ✓ | ✓ | ✓ | ✓ | | View Security reports **[ULTIMATE]** | ✓ [^1] | ✓ | ✓ | ✓ | ✓ | | Pull project code | [^1] | ✓ | ✓ | ✓ | ✓ | @@ -70,7 +72,6 @@ The following table depicts the various user permission levels in a project. | Force push to non-protected branches | | | ✓ | ✓ | ✓ | | Remove non-protected branches | | | ✓ | ✓ | ✓ | | Add tags | | | ✓ | ✓ | ✓ | -| Write a wiki | | | ✓ | ✓ | ✓ | | Cancel and retry jobs | | | ✓ | ✓ | ✓ | | Create or update commit status | | | ✓ | ✓ | ✓ | | Update a container registry | | | ✓ | ✓ | ✓ | diff --git a/doc/user/project/wiki/index.md b/doc/user/project/wiki/index.md index 127a30d6669..532247a98cd 100644 --- a/doc/user/project/wiki/index.md +++ b/doc/user/project/wiki/index.md @@ -12,10 +12,6 @@ You can create Wiki pages in the web interface or [locally using Git](#adding-and-editing-wiki-pages-locally) since every Wiki is a separate Git repository. ->**Note:** -A [permission level][permissions] of **Guest** is needed to view a Wiki and -**Developer** is needed to create and edit Wiki pages. - ## First time creating the Home page The first time you visit a Wiki, you will be directed to create the Home page. @@ -28,6 +24,9 @@ message. ## Creating a new wiki page +NOTE: **Note:** +A [permission level][permissions] of **Developer** is needed to create Wiki pages. + Create a new page by clicking the **New page** button that can be found in all wiki pages. You will be asked to fill in the page name from which GitLab will create the path to the page. You can specify a full path for the new file @@ -58,12 +57,18 @@ repository, you will have to upload them again. ## Editing a wiki page +NOTE: **Note:** +A [permission level][permissions] of **Developer** is needed to edit Wiki pages. + To edit a page, simply click on the **Edit** button. From there on, you can change its content. When done, click **Save changes** for the changes to take effect. ## Deleting a wiki page +NOTE: **Note:** +A [permission level][permissions] of **Maintainer** is needed to delete Wiki pages. + You can find the **Delete** button only when editing a page. Click on it and confirm you want the page to be deleted. -- cgit v1.2.1 From db218d882998eba8c3d84b86ac9bf307347d3462 Mon Sep 17 00:00:00 2001 From: Luke Duncalfe Date: Thu, 28 Feb 2019 03:34:22 +0000 Subject: Add a link to the gitaly repo's guide The gitaly repository's Beginner's Guide documentation is an excellent source of information that should be read first. --- doc/development/gitaly.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/development/gitaly.md b/doc/development/gitaly.md index d5fc403bf8b..bb203c3f4ba 100644 --- a/doc/development/gitaly.md +++ b/doc/development/gitaly.md @@ -3,6 +3,12 @@ [Gitaly](https://gitlab.com/gitlab-org/gitaly) is a high-level Git RPC service used by GitLab CE/EE, Workhorse and GitLab-Shell. +## Beginner's guide + +Start by reading the gitaly repository's +[Beginner's guide to Gitaly contributions](https://gitlab.com/gitlab-org/gitaly/blob/master/doc/beginners_guide.md). +It describes how to setup gitaly, the various components of gitaly and what they do, and how to run its test suites. + ## Developing new Git features Starting with GitLab 10.8, all new Git features should be developed in -- cgit v1.2.1 From 9444e7b918e5f1dfa18fca47ad153d0c2f2f4dfe Mon Sep 17 00:00:00 2001 From: Mike Cave Date: Thu, 28 Feb 2019 05:44:19 +0000 Subject: Update backup_restore.md instructions for Google Cloud Storage bucket configuration to specify required access control option --- doc/raketasks/backup_restore.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index 069c87f921a..050a2a7d92d 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -382,6 +382,8 @@ an access key from the Google console first: 1. Select "Interoperability" and create an access key 1. Make note of the "Access Key" and "Secret" and replace them in the configurations below +1. In the buckets advanced settings ensure the Access Control option "Set object-level + and bucket-level permissions" is selected 1. Make sure you already have a bucket created For Omnibus GitLab packages: -- cgit v1.2.1 From 59a3b6f45b0ebed10ce80e075b8cd717aa268551 Mon Sep 17 00:00:00 2001 From: moyuru Date: Sat, 2 Mar 2019 23:46:45 +0000 Subject: Fix authorized applications count --- app/views/doorkeeper/applications/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/doorkeeper/applications/index.html.haml b/app/views/doorkeeper/applications/index.html.haml index 1f5c70a6c6e..b6333743bf7 100644 --- a/app/views/doorkeeper/applications/index.html.haml +++ b/app/views/doorkeeper/applications/index.html.haml @@ -52,7 +52,7 @@ .oauth-authorized-applications.prepend-top-20.append-bottom-default - if user_oauth_applications? %h5 - = _("Authorized applications (%{size})") % { size: @authorized_tokens.size } + = _("Authorized applications (%{size})") % { size: @authorized_apps.size } - if @authorized_tokens.any? .table-responsive -- cgit v1.2.1 From e725411006d27c833703c0099367818df48af1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 5 Mar 2019 13:07:06 +0200 Subject: update default omnibus upload path small explanation here (by @balasankarc): https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests/2777#note_131420508 --- doc/administration/uploads.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/administration/uploads.md b/doc/administration/uploads.md index 9dfe085425f..9154794a09d 100644 --- a/doc/administration/uploads.md +++ b/doc/administration/uploads.md @@ -18,7 +18,7 @@ below. >**Notes:** For historical reasons, uploads are stored into a base directory, which by default is `uploads/-/system`. It is strongly discouraged to change this configuration option on an existing GitLab installation. -_The uploads are stored by default in `/var/opt/gitlab/gitlab-rails/uploads/-/system`._ +_The uploads are stored by default in `/var/opt/gitlab/gitlab-rails/uploads`._ 1. To change the storage path for example to `/mnt/storage/uploads`, edit `/etc/gitlab/gitlab.rb` and add the following line: -- cgit v1.2.1 From 8c7e666c422c208ebc13e5e0b7d1e33a06193adb Mon Sep 17 00:00:00 2001 From: Dennis Tang Date: Tue, 5 Mar 2019 00:19:41 +0000 Subject: Reduce height of instance system message - Reduces height of instance system header and footer to 16px - Pulls the system message up to better fit the container --- app/assets/stylesheets/framework/system_messages.scss | 2 +- app/assets/stylesheets/framework/variables.scss | 2 +- ...0-change-pixel-size-of-instance-header-footer-message-to-16px.yml | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/58410-change-pixel-size-of-instance-header-footer-message-to-16px.yml diff --git a/app/assets/stylesheets/framework/system_messages.scss b/app/assets/stylesheets/framework/system_messages.scss index 3d66136938f..e5edddec71e 100644 --- a/app/assets/stylesheets/framework/system_messages.scss +++ b/app/assets/stylesheets/framework/system_messages.scss @@ -12,7 +12,7 @@ p { @include str-truncated(100%); - margin-top: 0; + margin-top: -1px; margin-bottom: 0; } } diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 1639e73a66a..42a161cc9a1 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -277,7 +277,7 @@ $general-hover-transition-duration: 100ms; $general-hover-transition-curve: linear; $highlight-changes-color: rgb(235, 255, 232); $performance-bar-height: 35px; -$system-header-height: 35px; +$system-header-height: 16px; $system-footer-height: $system-header-height; $flash-height: 52px; $context-header-height: 60px; diff --git a/changelogs/unreleased/58410-change-pixel-size-of-instance-header-footer-message-to-16px.yml b/changelogs/unreleased/58410-change-pixel-size-of-instance-header-footer-message-to-16px.yml new file mode 100644 index 00000000000..3e494847e75 --- /dev/null +++ b/changelogs/unreleased/58410-change-pixel-size-of-instance-header-footer-message-to-16px.yml @@ -0,0 +1,5 @@ +--- +title: Reduce height of instance system header and footer +merge_request: 25752 +author: +type: changed -- cgit v1.2.1 From fbf638a49446faae96dad4ad1538a010906f975a Mon Sep 17 00:00:00 2001 From: Max Winterstein Date: Wed, 6 Mar 2019 22:40:21 +0100 Subject: Unify behaviour of 'Copy commit SHA to clipboard' --- app/assets/javascripts/jobs/components/commit_block.vue | 2 +- changelogs/unreleased/MaxWinterstein-master-patch-23232.yml | 5 +++++ spec/javascripts/jobs/components/commit_block_spec.js | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/MaxWinterstein-master-patch-23232.yml diff --git a/app/assets/javascripts/jobs/components/commit_block.vue b/app/assets/javascripts/jobs/components/commit_block.vue index 7076a79dd5d..b651a6e4bfb 100644 --- a/app/assets/javascripts/jobs/components/commit_block.vue +++ b/app/assets/javascripts/jobs/components/commit_block.vue @@ -39,7 +39,7 @@ export default { diff --git a/changelogs/unreleased/MaxWinterstein-master-patch-23232.yml b/changelogs/unreleased/MaxWinterstein-master-patch-23232.yml new file mode 100644 index 00000000000..8fb9f1057fe --- /dev/null +++ b/changelogs/unreleased/MaxWinterstein-master-patch-23232.yml @@ -0,0 +1,5 @@ +--- +title: Unify behaviour of 'Copy commit SHA to clipboard' to use full commit SHA. +merge_request: 25829 +author: Max Winterstein +type: changed diff --git a/spec/javascripts/jobs/components/commit_block_spec.js b/spec/javascripts/jobs/components/commit_block_spec.js index 98eba3ac976..c02f564d01a 100644 --- a/spec/javascripts/jobs/components/commit_block_spec.js +++ b/spec/javascripts/jobs/components/commit_block_spec.js @@ -9,6 +9,7 @@ describe('Commit block', () => { const props = { commit: { short_id: '1f0fb84f', + id: '1f0fb84fb6770d74d97eee58118fd3909cd4f48c', commit_path: 'commit/1f0fb84fb6770d74d97eee58118fd3909cd4f48c', title: 'Update README.md', }, @@ -42,7 +43,7 @@ describe('Commit block', () => { it('renders clipboard button', () => { expect(vm.$el.querySelector('button').getAttribute('data-clipboard-text')).toEqual( - props.commit.short_id, + props.commit.id, ); }); }); -- cgit v1.2.1 From 177f992eb2e56f34ccdda03ee62122585f0d2644 Mon Sep 17 00:00:00 2001 From: Cindy Pallares Date: Sun, 10 Mar 2019 21:38:14 -0500 Subject: Add registry to dev arch docs --- doc/development/architecture.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/development/architecture.md b/doc/development/architecture.md index ae880e3deb6..115c8cfb9ff 100644 --- a/doc/development/architecture.md +++ b/doc/development/architecture.md @@ -158,6 +158,18 @@ TODO TODO +### Registry + +The registry is what users use to store their own Docker images. The bundled +registry uses nginx as a load balancer and GitLab as an authentication manager. +Whenever a client requests to pull or push an image from the registry, it will +return a `401` response along with a header detailing where to get an +authentication token, in this case the GitLab instance. The client will then +request a pull or push auth token from GitLab and retry the original request +to the registry. Learn more about [token authentication](https://docs.docker.com/registry/spec/auth/token/). + +An external registry can also be configured to use GitLab as an auth endpoint. + ## GitLab by Request Type GitLab provides two "interfaces" for end users to access the service: -- cgit v1.2.1 From 9ff9047402f0d94a0633ce285123af1a568ced8c Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Feb 2019 09:22:04 +0000 Subject: Merge branch 'winh-dequarantine-labels-autocomplete' into 'master' Move gfm_autocomplete_spec.rb out of quarantine Closes #57995 and #56843 See merge request gitlab-org/gitlab-ce!25542 (cherry picked from commit 2dcbc0fa5657ab5c4ed46c5c84b8674faec36ea8) --- jest.config.js | 1 + spec/features/issues/gfm_autocomplete_spec.rb | 84 +------------------- spec/frontend/gfm_auto_complete_spec.js | 94 ++++++++++++++++++++++- spec/javascripts/fixtures/autocomplete_sources.rb | 40 ++++++++++ 4 files changed, 134 insertions(+), 85 deletions(-) create mode 100644 spec/javascripts/fixtures/autocomplete_sources.rb diff --git a/jest.config.js b/jest.config.js index efbf2e602c1..4e346005b8a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,6 +18,7 @@ module.exports = { moduleNameMapper: { '^~(.*)$': '/app/assets/javascripts$1', '^ee(.*)$': '/ee/app/assets/javascripts$1', + '^fixtures(.*)$': '/spec/javascripts/fixtures$1', '^helpers(.*)$': '/spec/frontend/helpers$1', '^vendor(.*)$': '/vendor/assets/javascripts$1', '\\.(jpg|jpeg|png|svg)$': '/spec/frontend/__mocks__/file_mock.js', diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 986f3823275..8eb413bdd8d 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -278,12 +278,7 @@ describe 'GFM autocomplete', :js do end end - # This context has just one example in each contexts in order to improve spec performance. - context 'labels', :quarantine do - let!(:backend) { create(:label, project: project, title: 'backend') } - let!(:bug) { create(:label, project: project, title: 'bug') } - let!(:feature_proposal) { create(:label, project: project, title: 'feature proposal') } - + context 'labels' do it 'opens autocomplete menu for Labels when field starts with text with item escaping HTML characters' do create(:label, project: project, title: label_xss_title) @@ -298,83 +293,6 @@ describe 'GFM autocomplete', :js do expect(find('.atwho-view-ul').text).to have_content('alert label') end end - - context 'when no labels are assigned' do - it 'shows labels' do - note = find('#note-body') - - # It should show all the labels on "~". - type(note, '~') - wait_for_requests - expect_labels(shown: [backend, bug, feature_proposal]) - - # It should show all the labels on "/label ~". - type(note, '/label ~') - expect_labels(shown: [backend, bug, feature_proposal]) - - # It should show all the labels on "/relabel ~". - type(note, '/relabel ~') - expect_labels(shown: [backend, bug, feature_proposal]) - - # It should show no labels on "/unlabel ~". - type(note, '/unlabel ~') - expect_labels(not_shown: [backend, bug, feature_proposal]) - end - end - - context 'when some labels are assigned' do - before do - issue.labels << [backend] - end - - it 'shows labels' do - note = find('#note-body') - - # It should show all the labels on "~". - type(note, '~') - wait_for_requests - expect_labels(shown: [backend, bug, feature_proposal]) - - # It should show only unset labels on "/label ~". - type(note, '/label ~') - expect_labels(shown: [bug, feature_proposal], not_shown: [backend]) - - # It should show all the labels on "/relabel ~". - type(note, '/relabel ~') - expect_labels(shown: [backend, bug, feature_proposal]) - - # It should show only set labels on "/unlabel ~". - type(note, '/unlabel ~') - expect_labels(shown: [backend], not_shown: [bug, feature_proposal]) - end - end - - context 'when all labels are assigned' do - before do - issue.labels << [backend, bug, feature_proposal] - end - - it 'shows labels' do - note = find('#note-body') - - # It should show all the labels on "~". - type(note, '~') - wait_for_requests - expect_labels(shown: [backend, bug, feature_proposal]) - - # It should show no labels on "/label ~". - type(note, '/label ~') - expect_labels(not_shown: [backend, bug, feature_proposal]) - - # It should show all the labels on "/relabel ~". - type(note, '/relabel ~') - expect_labels(shown: [backend, bug, feature_proposal]) - - # It should show all the labels on "/unlabel ~". - type(note, '/unlabel ~') - expect_labels(shown: [backend, bug, feature_proposal]) - end - end end shared_examples 'autocomplete suggestions' do diff --git a/spec/frontend/gfm_auto_complete_spec.js b/spec/frontend/gfm_auto_complete_spec.js index c7008c780d6..b79e6e0fe7b 100644 --- a/spec/frontend/gfm_auto_complete_spec.js +++ b/spec/frontend/gfm_auto_complete_spec.js @@ -6,17 +6,21 @@ import GfmAutoComplete from '~/gfm_auto_complete'; import 'vendor/jquery.caret'; import 'vendor/jquery.atwho'; +import { TEST_HOST } from 'helpers/test_constants'; +import labelsFixture from 'fixtures/autocomplete_sources/labels.json'; // eslint-disable-line import/no-unresolved + describe('GfmAutoComplete', () => { const gfmAutoCompleteCallbacks = GfmAutoComplete.prototype.getDefaultCallbacks.call({ fetchData: () => {}, }); let atwhoInstance; - let items; let sorterValue; describe('DefaultOptions.sorter', () => { describe('assets loading', () => { + let items; + beforeEach(() => { jest.spyOn(GfmAutoComplete, 'isLoading').mockReturnValue(true); @@ -61,7 +65,7 @@ describe('GfmAutoComplete', () => { atwhoInstance = { setting: {} }; const query = 'query'; - items = []; + const items = []; const searchKey = 'searchKey'; gfmAutoCompleteCallbacks.sorter.call(atwhoInstance, query, items, searchKey); @@ -250,4 +254,90 @@ describe('GfmAutoComplete', () => { ).toBe('
  • grp/proj#5 Some Issue
  • '); }); }); + + describe('labels', () => { + const dataSources = { + labels: `${TEST_HOST}/autocomplete_sources/labels`, + }; + + const allLabels = labelsFixture; + const assignedLabels = allLabels.filter(label => label.set); + const unassignedLabels = allLabels.filter(label => !label.set); + + let autocomplete; + let $textarea; + + beforeEach(() => { + autocomplete = new GfmAutoComplete(dataSources); + $textarea = $(''); + autocomplete.setup($textarea, { labels: true }); + }); + + afterEach(() => { + autocomplete.destroy(); + }); + + const triggerDropdown = text => { + $textarea + .trigger('focus') + .val(text) + .caret('pos', -1); + $textarea.trigger('keyup'); + + return new Promise(window.requestAnimationFrame); + }; + + const getDropdownItems = () => { + const dropdown = document.getElementById('at-view-labels'); + const items = dropdown.getElementsByTagName('li'); + return [].map.call(items, item => item.textContent.trim()); + }; + + const expectLabels = ({ input, output }) => + triggerDropdown(input).then(() => { + expect(getDropdownItems()).toEqual(output.map(label => label.title)); + }); + + describe('with no labels assigned', () => { + beforeEach(() => { + autocomplete.cachedData['~'] = [...unassignedLabels]; + }); + + it.each` + input | output + ${'~'} | ${unassignedLabels} + ${'/label ~'} | ${unassignedLabels} + ${'/relabel ~'} | ${unassignedLabels} + ${'/unlabel ~'} | ${[]} + `('$input shows $output.length labels', expectLabels); + }); + + describe('with some labels assigned', () => { + beforeEach(() => { + autocomplete.cachedData['~'] = allLabels; + }); + + it.each` + input | output + ${'~'} | ${allLabels} + ${'/label ~'} | ${unassignedLabels} + ${'/relabel ~'} | ${allLabels} + ${'/unlabel ~'} | ${assignedLabels} + `('$input shows $output.length labels', expectLabels); + }); + + describe('with all labels assigned', () => { + beforeEach(() => { + autocomplete.cachedData['~'] = [...assignedLabels]; + }); + + it.each` + input | output + ${'~'} | ${assignedLabels} + ${'/label ~'} | ${[]} + ${'/relabel ~'} | ${assignedLabels} + ${'/unlabel ~'} | ${assignedLabels} + `('$input shows $output.length labels', expectLabels); + }); + }); }); diff --git a/spec/javascripts/fixtures/autocomplete_sources.rb b/spec/javascripts/fixtures/autocomplete_sources.rb new file mode 100644 index 00000000000..c117fb7cd24 --- /dev/null +++ b/spec/javascripts/fixtures/autocomplete_sources.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', type: :controller do + include JavaScriptFixturesHelpers + + set(:admin) { create(:admin) } + set(:group) { create(:group, name: 'frontend-fixtures') } + set(:project) { create(:project, namespace: group, path: 'autocomplete-sources-project') } + set(:issue) { create(:issue, project: project) } + + before(:all) do + clean_frontend_fixtures('autocomplete_sources/') + end + + before do + sign_in(admin) + end + + it 'autocomplete_sources/labels.json' do |example| + issue.labels << create(:label, project: project, title: 'bug') + issue.labels << create(:label, project: project, title: 'critical') + + create(:label, project: project, title: 'feature') + create(:label, project: project, title: 'documentation') + + get :labels, + format: :json, + params: { + namespace_id: group.path, + project_id: project.path, + type: issue.class.name, + type_id: issue.id + } + + expect(response).to be_success + store_frontend_fixture(response, example.description) + end +end -- cgit v1.2.1 From aeffdd2acd4e8083c2b65e8908969c4ed03541df Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Mon, 11 Mar 2019 11:30:19 +0100 Subject: Increase timeout for gfm_auto_complete_spec.js --- spec/frontend/gfm_auto_complete_spec.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/frontend/gfm_auto_complete_spec.js b/spec/frontend/gfm_auto_complete_spec.js index b79e6e0fe7b..9c0b8d676e0 100644 --- a/spec/frontend/gfm_auto_complete_spec.js +++ b/spec/frontend/gfm_auto_complete_spec.js @@ -7,8 +7,12 @@ import 'vendor/jquery.caret'; import 'vendor/jquery.atwho'; import { TEST_HOST } from 'helpers/test_constants'; +import { setTestTimeout } from 'helpers/timeout'; + import labelsFixture from 'fixtures/autocomplete_sources/labels.json'; // eslint-disable-line import/no-unresolved +setTestTimeout(500); + describe('GfmAutoComplete', () => { const gfmAutoCompleteCallbacks = GfmAutoComplete.prototype.getDefaultCallbacks.call({ fetchData: () => {}, -- cgit v1.2.1 From 2458a10379f3e8a5e91a38ee76375465121c86d5 Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Sun, 10 Mar 2019 19:03:34 +0900 Subject: Update 'DevOps and Game Dev with GitLab CI/CD' doc Signed-off-by: Takuya Noguchi --- .../devops_and_game_dev_with_gitlab_ci_cd/index.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md b/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md index 90a8f5917f8..908cf85980e 100644 --- a/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md +++ b/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md @@ -4,7 +4,7 @@ author_gitlab: blitzgren level: intermediate article_type: tutorial date: 2018-03-07 -last_updated: 2019-03-06 +last_updated: 2019-03-11 --- # DevOps and Game Dev with GitLab CI/CD @@ -21,7 +21,7 @@ and the basics of game development. Our [demo game](http://gitlab-game-demo.s3-website-us-east-1.amazonaws.com/) consists of a simple spaceship traveling in space that shoots by clicking the mouse in a given direction. -Creating a strong CI/CD pipeline at the beginning of developing another game, [Dark Nova](http://darknova.io/about), +Creating a strong CI/CD pipeline at the beginning of developing another game, [Dark Nova](http://darknova.io/), was essential for the fast pace the team worked at. This tutorial will build upon my [previous introductory article](https://ryanhallcs.wordpress.com/2017/03/15/devops-and-game-dev/) and go through the following steps: @@ -38,8 +38,8 @@ This will also provide boilerplate code for starting a browser-based game with the following components: - Written in [Typescript](https://www.typescriptlang.org/) and [PhaserJs](https://phaser.io) -- Building, running, and testing with [Gulp](http://gulpjs.com/) -- Unit tests with [Chai](http://chaijs.com/) and [Mocha](https://mochajs.org/) +- Building, running, and testing with [Gulp](https://gulpjs.com) +- Unit tests with [Chai](https://www.chaijs.com) and [Mocha](https://mochajs.org/) - CI/CD with GitLab - Hosting the codebase on GitLab.com - Hosting the game on AWS @@ -318,7 +318,7 @@ allowing us to run our tests by every push. Our entire `.gitlab-ci.yml` file should now look like this: ```yml -image: node:6 +image: node:10 build: stage: build @@ -413,7 +413,7 @@ use root security credentials. Proper IAM credential management is beyond the sc article, but AWS will remind you that using root credentials is unadvised and against their best practices, as they should. Feel free to follow best practices and use a custom IAM user's credentials, which will be the same two credentials (Key ID and Secret). It's a good idea to -fully understand [IAM Best Practices in AWS](http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html). We need to add these credentials to GitLab: +fully understand [IAM Best Practices in AWS](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html). We need to add these credentials to GitLab: 1. Log into your AWS account and go to the [Security Credentials page](https://console.aws.amazon.com/iam/home#/security_credential) 1. Click the **Access Keys** section and **Create New Access Key**. Create the key and keep the id and secret around, you'll need them later @@ -455,7 +455,7 @@ Be sure to update the region and S3 URL in that last script command to fit your Our final configuration file `.gitlab-ci.yml` looks like: ```yml -image: node:6 +image: node:10 build: stage: build @@ -503,7 +503,7 @@ deploy: ## Conclusion Within the [demo repository](https://gitlab.com/blitzgren/gitlab-game-demo) you can also find a handful of boilerplate code to get -[Typescript](https://www.typescriptlang.org/), [Mocha](https://mochajs.org/), [Gulp](http://gulpjs.com/) and [Phaser](https://phaser.io) all playing +[Typescript](https://www.typescriptlang.org/), [Mocha](https://mochajs.org/), [Gulp](https://gulpjs.com/) and [Phaser](https://phaser.io) all playing together nicely with GitLab CI/CD, which is the result of lessons learned while making [Dark Nova](http://darknova.io/). Using a combination of free and open source software, we have a full CI/CD pipeline, a game foundation, and unit tests, all running and deployed at every push to master - with shockingly little code. @@ -522,6 +522,6 @@ Here are some ideas to further investigate that can speed up or improve your pip - [Yarn](https://yarnpkg.com) instead of npm - Set up a custom [Docker](../../../ci/docker/using_docker_images.md#define-image-and-services-from-gitlab-ciyml) image that can preload dependencies and tools (like AWS CLI) -- Forward a [custom domain](http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html) to your game's S3 static website +- Forward a [custom domain](https:/docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html) to your game's S3 static website - Combine jobs if you find it unnecessary for a small project - Avoid the queues and set up your own [custom GitLab CI/CD runner](https://about.gitlab.com/2016/03/01/gitlab-runner-with-docker/) -- cgit v1.2.1 From af3307f7b4fdf2a02f94e246f84e336c7b89f3a0 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Mon, 11 Mar 2019 14:47:36 +0100 Subject: Add getJSONFixture() helper to Jest --- jest.config.js | 1 - spec/frontend/gfm_auto_complete_spec.js | 5 +++-- spec/frontend/helpers/fixtures.js | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 spec/frontend/helpers/fixtures.js diff --git a/jest.config.js b/jest.config.js index 4e346005b8a..efbf2e602c1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,7 +18,6 @@ module.exports = { moduleNameMapper: { '^~(.*)$': '/app/assets/javascripts$1', '^ee(.*)$': '/ee/app/assets/javascripts$1', - '^fixtures(.*)$': '/spec/javascripts/fixtures$1', '^helpers(.*)$': '/spec/frontend/helpers$1', '^vendor(.*)$': '/vendor/assets/javascripts$1', '\\.(jpg|jpeg|png|svg)$': '/spec/frontend/__mocks__/file_mock.js', diff --git a/spec/frontend/gfm_auto_complete_spec.js b/spec/frontend/gfm_auto_complete_spec.js index 9c0b8d676e0..675bc660755 100644 --- a/spec/frontend/gfm_auto_complete_spec.js +++ b/spec/frontend/gfm_auto_complete_spec.js @@ -8,11 +8,12 @@ import 'vendor/jquery.atwho'; import { TEST_HOST } from 'helpers/test_constants'; import { setTestTimeout } from 'helpers/timeout'; - -import labelsFixture from 'fixtures/autocomplete_sources/labels.json'; // eslint-disable-line import/no-unresolved +import { getJSONFixture } from 'helpers/fixtures'; setTestTimeout(500); +const labelsFixture = getJSONFixture('autocomplete_sources/labels.json'); + describe('GfmAutoComplete', () => { const gfmAutoCompleteCallbacks = GfmAutoComplete.prototype.getDefaultCallbacks.call({ fetchData: () => {}, diff --git a/spec/frontend/helpers/fixtures.js b/spec/frontend/helpers/fixtures.js new file mode 100644 index 00000000000..f96f27c4d80 --- /dev/null +++ b/spec/frontend/helpers/fixtures.js @@ -0,0 +1,24 @@ +/* eslint-disable import/prefer-default-export, global-require, import/no-dynamic-require */ + +import fs from 'fs'; +import path from 'path'; + +// jest-util is part of Jest +// eslint-disable-next-line import/no-extraneous-dependencies +import { ErrorWithStack } from 'jest-util'; + +const fixturesBasePath = path.join(process.cwd(), 'spec', 'javascripts', 'fixtures'); + +export function getJSONFixture(relativePath, ee = false) { + const absolutePath = path.join(fixturesBasePath, ee ? 'ee' : '', relativePath); + if (!fs.existsSync(absolutePath)) { + throw new ErrorWithStack( + `Fixture file ${relativePath} does not exist. + +Did you run bin/rake karma:fixtures?`, + getJSONFixture, + ); + } + + return require(absolutePath); +} -- cgit v1.2.1 From 0cabb555f0ba3afd74dbb9814bdeae6fc9651df2 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 4 Mar 2019 16:35:38 +0100 Subject: Backport Gitlab::Ci::Model from EE This backports the EE changes to Gitlab::Ci::Model back into CE, ensuring the code is the same for both versions. --- lib/gitlab/ci/model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/ci/model.rb b/lib/gitlab/ci/model.rb index fbdb84c0522..1625cb841b6 100644 --- a/lib/gitlab/ci/model.rb +++ b/lib/gitlab/ci/model.rb @@ -8,7 +8,7 @@ module Gitlab end def model_name - @model_name ||= ActiveModel::Name.new(self, nil, self.name.split("::").last) + @model_name ||= ActiveModel::Name.new(self, nil, self.name.demodulize) end end end -- cgit v1.2.1 From 5d654a224fef19adec43ca7f8a7da51c131616fc Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 5 Mar 2019 16:02:32 +0100 Subject: Refactor Gitlab::Favicon for EE This moves the development favicon name in Gitlab::Favicon to a separate method, allowing EE to redefine it to return a custom favicon. --- lib/gitlab/favicon.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/favicon.rb b/lib/gitlab/favicon.rb index 1ae2f9dfd93..6e31064f737 100644 --- a/lib/gitlab/favicon.rb +++ b/lib/gitlab/favicon.rb @@ -10,7 +10,7 @@ module Gitlab elsif Gitlab::Utils.to_boolean(ENV['CANARY']) 'favicon-yellow.png' elsif Rails.env.development? - 'favicon-blue.png' + development_favicon else 'favicon.png' end @@ -18,6 +18,12 @@ module Gitlab ActionController::Base.helpers.image_path(image_name, host: host) end + def development_favicon + # This is a separate method so that EE can return a different favicon + # for development environments. + 'favicon-blue.png' + end + def status_overlay(status_name) path = File.join( 'ci_favicons', -- cgit v1.2.1 From 31fb547f6c648f1929c665cb7b11c271a13e24ff Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 5 Mar 2019 16:09:33 +0100 Subject: Backport Gitaly dynamic timeouts from EE EE added the ability to set timeouts when handling blobs. Since there's no particular reason for this to be EE specific we can just backport this to CE. --- lib/gitlab/git/repository.rb | 4 ++-- lib/gitlab/gitaly_client/ref_service.rb | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 35dd042ba6a..7d6851a4b8d 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -344,12 +344,12 @@ module Gitlab end end - def new_blobs(newrev) + def new_blobs(newrev, dynamic_timeout: nil) return [] if newrev.blank? || newrev == ::Gitlab::Git::BLANK_SHA strong_memoize("new_blobs_#{newrev}") do wrapped_gitaly_errors do - gitaly_ref_client.list_new_blobs(newrev, REV_LIST_COMMIT_LIMIT) + gitaly_ref_client.list_new_blobs(newrev, REV_LIST_COMMIT_LIMIT, dynamic_timeout: dynamic_timeout) end end end diff --git a/lib/gitlab/gitaly_client/ref_service.rb b/lib/gitlab/gitaly_client/ref_service.rb index d5633d167ac..6f6698607d9 100644 --- a/lib/gitlab/gitaly_client/ref_service.rb +++ b/lib/gitlab/gitaly_client/ref_service.rb @@ -84,15 +84,22 @@ module Gitlab commits end - def list_new_blobs(newrev, limit = 0) + def list_new_blobs(newrev, limit = 0, dynamic_timeout: nil) request = Gitaly::ListNewBlobsRequest.new( repository: @gitaly_repo, commit_id: newrev, limit: limit ) + timeout = + if dynamic_timeout + [dynamic_timeout, GitalyClient.medium_timeout].min + else + GitalyClient.medium_timeout + end + response = GitalyClient - .call(@storage, :ref_service, :list_new_blobs, request, timeout: GitalyClient.medium_timeout) + .call(@storage, :ref_service, :list_new_blobs, request, timeout: timeout) response.flat_map do |msg| # Returns an Array of Gitaly::NewBlobObject objects -- cgit v1.2.1 From 018fc6c696bc2f557211102b163154439b1fc589 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 8 Mar 2019 16:31:42 +0100 Subject: Backport allow_mirror_update for Chain::Command This backports the allow_mirror_update update field for Chain::Command from EE to CE. There's no particular reason to keep this in EE. Doing so would require refactoring of CE as there currently is no easy way to inject new Struct members into the Chain::Command class. --- lib/gitlab/ci/pipeline/chain/command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/ci/pipeline/chain/command.rb b/lib/gitlab/ci/pipeline/chain/command.rb index 7b77e86feae..bf9f03f6134 100644 --- a/lib/gitlab/ci/pipeline/chain/command.rb +++ b/lib/gitlab/ci/pipeline/chain/command.rb @@ -11,7 +11,7 @@ module Gitlab :trigger_request, :schedule, :merge_request, :ignore_skip_ci, :save_incompleted, :seeds_block, :variables_attributes, :push_options, - :chat_data + :chat_data, :allow_mirror_update ) do include Gitlab::Utils::StrongMemoize -- cgit v1.2.1 From e9d1393e8d68134e51819c72524cc84265a0acf8 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Tue, 26 Feb 2019 13:39:59 +0100 Subject: Rename initialDiscussion to firstNote in NoteableDiscussion --- .../javascripts/notes/components/noteable_discussion.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index fc51998935d..fd3cc859545 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -106,7 +106,7 @@ export default { 'showJumpToNextDiscussion', ]), author() { - return this.initialDiscussion.author; + return this.firstNote.author; }, canReply() { return this.getNoteableData.current_user.can_create_note; @@ -117,7 +117,7 @@ export default { hasReplies() { return this.discussion.notes.length > 1; }, - initialDiscussion() { + firstNote() { return this.discussion.notes.slice(0, 1)[0]; }, replies() { @@ -247,7 +247,7 @@ export default { if (this.isReplying) { this.$nextTick(() => { // Pass an extra key to separate reply and note edit forms - this.initAutoSave({ ...this.initialDiscussion, ...this.discussion }, ['Reply']); + this.initAutoSave({ ...this.firstNote, ...this.discussion }, ['Reply']); }); } else { this.disposeAutoSave(); @@ -390,8 +390,8 @@ Please check your network connection and try again.`;