diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-27 09:06:29 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-27 09:06:29 +0000 |
commit | c02f53288a838166a28518983fae3b80ca5936d8 (patch) | |
tree | cd8af90618ac55809e7782bad09246874876f7c2 | |
parent | 688e33953d34ab8cd348d02ce79d8fdfe5353a03 (diff) | |
download | gitlab-ce-c02f53288a838166a28518983fae3b80ca5936d8.tar.gz |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/tracking.js | 27 | ||||
-rw-r--r-- | doc/administration/geo/replication/troubleshooting.md | 10 | ||||
-rw-r--r-- | doc/api/graphql/getting_started.md | 61 | ||||
-rw-r--r-- | doc/development/migration_style_guide.md | 6 | ||||
-rw-r--r-- | doc/gitlab-basics/start-using-git.md | 65 | ||||
-rw-r--r-- | doc/user/project/clusters/add_remove_clusters.md | 1 | ||||
-rw-r--r-- | spec/frontend/tracking_spec.js | 66 | ||||
-rw-r--r-- | spec/support/helpers/stub_object_storage.rb | 7 |
9 files changed, 165 insertions, 84 deletions
diff --git a/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue b/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue index 0e489b28593..3b92ead8859 100644 --- a/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue +++ b/app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue @@ -48,6 +48,12 @@ export default { }, }, computed: { + tracking() { + return { + // eslint-disable-next-line no-underscore-dangle + category: this.$options._componentTag, + }; + }, showLoadingState() { return this.subscribed === null; }, diff --git a/app/assets/javascripts/tracking.js b/app/assets/javascripts/tracking.js index 7c0097fbe37..a17b8a047c0 100644 --- a/app/assets/javascripts/tracking.js +++ b/app/assets/javascripts/tracking.js @@ -73,20 +73,25 @@ export default class Tracking { return handlers; } - static mixin(opts) { + static mixin(opts = {}) { return { - data() { - return { - tracking: { - // eslint-disable-next-line no-underscore-dangle - category: this.$options.name || this.$options._componentTag, - }, - }; + computed: { + trackingCategory() { + const localCategory = this.tracking ? this.tracking.category : null; + return localCategory || opts.category; + }, + trackingOptions() { + return { ...opts, ...this.tracking }; + }, }, methods: { - track(action, data) { - const category = opts.category || data.category || this.tracking.category; - Tracking.event(category || 'unspecified', action, { ...opts, ...this.tracking, ...data }); + track(action, data = {}) { + const category = data.category || this.trackingCategory; + const options = { + ...this.trackingOptions, + ...data, + }; + Tracking.event(category, action, options); }, }, }; diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index d2fe02abbab..435919d8fe0 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -115,10 +115,12 @@ Any **secondary** nodes should point only to read-only instances. #### Can Geo detect the current node correctly? -Geo finds the current machine's name in `/etc/gitlab/gitlab.rb` by first looking -for `gitlab_rails['geo_node_name']`. If it is not defined, then it defaults to -the external URL defined in e.g. `external_url "http://gitlab.example.com"`. To -get a machine's name, run: +Geo finds the current machine's name in `/etc/gitlab/gitlab.rb` by: + +- Using the `gitlab_rails['geo_node_name']` setting. +- If that is not defined, using the `external_url` setting. + +To get a machine's name, run: ```sh sudo gitlab-rails runner "puts GeoNode.current_node_name" diff --git a/doc/api/graphql/getting_started.md b/doc/api/graphql/getting_started.md index aab8c26ae99..961d4da8c1e 100644 --- a/doc/api/graphql/getting_started.md +++ b/doc/api/graphql/getting_started.md @@ -22,8 +22,8 @@ to use as a bearer token. Example: ```sh -GRAPHQL_TOKEN = <your-token> -curl 'http://gitlab.com/api/graphql' --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"} +GRAPHQL_TOKEN=<your-token> +curl 'https://gitlab.com/api/graphql' --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"}" ``` ### GraphiQL @@ -86,18 +86,17 @@ Example: Get a specific project and the title of Issue #2. ```graphql query { - project(fullPath: "gitlab-org/graphql-sandbox") { - name - issue(iid: "2") { - title - } - } - } + project(fullPath: "gitlab-org/graphql-sandbox") { + name + issue(iid: "2") { + title + } + } +} ``` -### The root node +### Graph traversal -Any field defined in [`QueryType`](https://gitlab.com/gitlab-org/gitlab/tree/master/app/graphql/types/query_type.rb) will be exposed as a root node. When retrieving child nodes use: - the `edges { node { } }` syntax. @@ -121,32 +120,14 @@ query { } ``` -More on schema definitions: -[graphql-ruby docs](https://graphql-ruby.org/schema/definition) - More about queries: -[GraphQL docs](https://graphql.org/learn/queries/) and -[graphql-ruby docs](https://graphql-ruby.org/queries/executing_queries) +[GraphQL docs](https://graphql.org/learn/queries/) ### Authorization -Authorization uses the same engine as the Rails app. So if you've signed in to GitLab -and use GraphiQL, all queries will be performed as you, the signed in user. - -See the [authorization section](../../development/api_graphql_styleguide.html#authorization) of the StyleGuide -for implementation details. - -### Resolvers - -A resolver is how we define how the records requested by the client are retrieved, collected, -and assembled into the response. - -The [GraphQL API StyleGuide](../../development/api_graphql_styleguide.md#resolvers) has more details -about the implementation of resolvers. - -More about resolvers: -[GraphQL Docs](https://graphql.org/learn/execution/) and -[graphql-ruby docs](https://graphql-ruby.org/fields/resolvers.html) +Authorization uses the same engine as the GitLab application (and GitLab.com). So if you've signed in to GitLab +and use GraphiQL, all queries will be performed as you, the signed in user. For more information, see the +[GitLab API documentation](../README.md#authentication). ### Mutations @@ -197,7 +178,7 @@ mutation { body discussion { id - } + } } errors } @@ -253,12 +234,8 @@ You should get something like the following output: We've asked for the note details, but it doesn't exist anymore, so we get `null`. -The [GraphQL API StyleGuide](../../development/api_graphql_styleguide.md#mutations) has more details -about implementation of mutations. - More about mutations: -[GraphQL Docs](https://graphql.org/learn/queries/#mutations) and -[graphql-ruby docs](https://graphql-ruby.org/mutations/mutation_classes.html) +[GraphQL Docs](https://graphql.org/learn/queries/#mutations). ### Introspective queries @@ -301,8 +278,7 @@ query IssueTypes { ``` More about introspection: -[GraphQL docs](https://graphql.org/learn/introspection/) and -[graphql-ruby docs](https://graphql-ruby.org/schema/introspection.html) +[GraphQL docs](https://graphql.org/learn/introspection/) ## Sorting @@ -382,5 +358,4 @@ query { ``` More on pagination and cursors: -[GraphQL docs](https://graphql.org/learn/pagination/) and -[graphql-ruby docs](https://graphql-ruby.org/relay/connections.html#cursors) +[GraphQL docs](https://graphql.org/learn/pagination/) diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md index 32c4313a1ed..6301ba778bc 100644 --- a/doc/development/migration_style_guide.md +++ b/doc/development/migration_style_guide.md @@ -517,9 +517,3 @@ _namespaces_ that have a `project_id`. The `path` column for these rows will be renamed to their previous value followed by an integer. For example: `users` would turn into `users0` - -### Moving migrations from EE to CE - -When migrations need to be moved from GitLab Enterprise Edition to GitLab Community Edition, -a migration file should be moved from `ee/db/{post_,}migrate` directory in the `gitlab` project to `db/{post_,}migrate` directory in the `gitlab-foss` project. This way -the schema number remains intact, there is no need to modify old migrations, and proper columns, tables or data are added in the Community Edition. diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md index 1f43b151d5d..097794d39a7 100644 --- a/doc/gitlab-basics/start-using-git.md +++ b/doc/gitlab-basics/start-using-git.md @@ -61,10 +61,12 @@ To verify that you entered your email correctly, type: git config --global user.email ``` -You'll need to do this only once, since you are using the `--global` option. It tells -Git to always use this information for anything you do on that system. If you want -to override this with a different username or email address for specific projects or repositories, -you can run the command without the `--global` option when you’re in that project, and that will default to `--local`. You can read more on how Git manages configurations in the [Git Config](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration) documentation. +You'll need to do this only once, since you are using the `--global` option. It +tells Git to always use this information for anything you do on that system. If +you want to override this with a different username or email address for specific +projects or repositories, you can run the command without the `--global` option +when you’re in that project, and that will default to `--local`. You can read more +on how Git manages configurations in the [Git Config](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration) documentation. ## Check your information @@ -102,7 +104,10 @@ files to your local computer, automatically preserving the Git connection with t remote repository. You can either clone it via HTTPS or [SSH](../ssh/README.md). If you chose to clone -it via HTTPS, you'll have to enter your credentials every time you pull and push. You can read more about credential storage in the [Git Credentials documentation](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage). With SSH, you enter your credentials only once. +it via HTTPS, you'll have to enter your credentials every time you pull and push. +You can read more about credential storage in the +[Git Credentials documentation](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage). +With SSH, you enter your credentials only once. You can find both paths (HTTPS and SSH) by navigating to your project's landing page and clicking **Clone**. GitLab will prompt you with both paths, from which you can copy @@ -113,8 +118,8 @@ As an example, consider this repository path: - HTTPS: `https://gitlab.com/gitlab-org/gitlab.git` - SSH: `git@gitlab.com:gitlab-org/gitlab.git` -To get started, open a terminal window in the directory you wish to clone the repository -files into, and run one of the following commands. +To get started, open a terminal window in the directory you wish to clone the +repository files into, and run one of the following commands. Clone via HTTPS: @@ -134,9 +139,9 @@ on it locally. ### Switch to the master branch -You are always in a branch when working with Git. The main branch is the master branch, -but you can use the same command to switch to a different branch by changing `master` -to the branch name. +You are always in a branch when working with Git. The main branch is the master +branch, but you can use the same command to switch to a different branch by +changing `master` to the branch name. ```bash git checkout master @@ -145,10 +150,10 @@ git checkout master ### Download the latest changes in the project To work on an up-to-date copy of the project (it is important to do this every time -you start working on a project), you `pull` to get all the changes made by users since -the last time you cloned or pulled the project. Use `master` for the `<name-of-branch>` -to get the main branch code, or the branch name of the branch you are currently working -in. +you start working on a project), you `pull` to get all the changes made by users +since the last time you cloned or pulled the project. Use `master` for the +`<name-of-branch>` to get the main branch code, or the branch name of the branch +you are currently working in. ```bash git pull <REMOTE> <name-of-branch> @@ -156,10 +161,11 @@ git pull <REMOTE> <name-of-branch> When you clone a repository, `REMOTE` is typically `origin`. This is where the repository was cloned from, and it indicates the SSH or HTTPS URL of the repository -on the remote server. `<name-of-branch>` is usually `master`, but it may be any existing -branch. You can create additional named remotes and branches as necessary. +on the remote server. `<name-of-branch>` is usually `master`, but it may be any +existing branch. You can create additional named remotes and branches as necessary. -You can learn more on how Git manages remote repositories in the [Git Remote documentation](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes). +You can learn more on how Git manages remote repositories in the +[Git Remote documentation](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes). ### View your remote repositories @@ -184,9 +190,9 @@ so use something easy to remember and type. ### Create a branch -To create a new branch, to work from without affecting the `master` branch, type the -following (spaces won't be recognized in the branch name, so you will need to use a -hyphen or underscore): +To create a new branch, to work from without affecting the `master` branch, type +the following (spaces won't be recognized in the branch name, so you will need to +use a hyphen or underscore): ```bash git checkout -b <name-of-branch> @@ -245,6 +251,10 @@ The `.` character means _all file changes in the current directory and all subdi ### Send changes to GitLab.com +NOTE: **Note:** +To create a merge request from a fork to an upstream repository, see the +[forking workflow](../user/project/repository/forking_workflow.md) + To push all local commits (saved changes) to the remote repository: ```bash @@ -301,6 +311,21 @@ git checkout <name-of-branch> git merge master ``` +### Synchronize changes in a forked repository with the upstream + +[Forking a repository](../user/project/repository/forking_workflow.md lets you create +a copy of a repository in your namespace. Changes made to your copy of the repository +are not synchronized automatically with the original. +Your local fork (copy) contains changes made by you only, so to keep the project +in sync with the original project, you need to `pull` from the original repository. + +You must [create a link to the remote repository](#add-a-remote-repository) to pull +changes from the original repository. It is common to call this remote the `upstream`. + +You can now use the `upstream` as a [`<remote>` to `pull` new updates](#download-the-latest-changes-in-the-project) +from the original repository, and use the `origin` +to [push local changes](#send-changes-to-gitlabcom) and create merge requests. + <!-- ## Troubleshooting Include any troubleshooting steps that you can foresee. If you know beforehand what issues diff --git a/doc/user/project/clusters/add_remove_clusters.md b/doc/user/project/clusters/add_remove_clusters.md index a1f437b6e54..6a0377f118d 100644 --- a/doc/user/project/clusters/add_remove_clusters.md +++ b/doc/user/project/clusters/add_remove_clusters.md @@ -300,6 +300,7 @@ new Kubernetes cluster to your project: "iam:AttachRolePolicy", "iam:CreateRole", "iam:CreateInstanceProfile", + "iam:CreateServiceLinkedRole", "iam:GetRole", "iam:ListRoles", "iam:PassRole", diff --git a/spec/frontend/tracking_spec.js b/spec/frontend/tracking_spec.js index 964f8b8787e..c3c52844c2c 100644 --- a/spec/frontend/tracking_spec.js +++ b/spec/frontend/tracking_spec.js @@ -177,4 +177,70 @@ describe('Tracking', () => { expect(eventSpy).toHaveBeenCalledWith('_category_', 'nested_event', {}); }); }); + + describe('tracking mixin', () => { + describe('trackingOptions', () => { + it('return the options defined on initialisation', () => { + const mixin = Tracking.mixin({ foo: 'bar' }); + expect(mixin.computed.trackingOptions()).toEqual({ foo: 'bar' }); + }); + + it('local tracking value override and extend options', () => { + const mixin = Tracking.mixin({ foo: 'bar' }); + // the value of this in the vue lifecyle is different, but this serve the tests purposes + mixin.computed.tracking = { foo: 'baz', baz: 'bar' }; + expect(mixin.computed.trackingOptions()).toEqual({ foo: 'baz', baz: 'bar' }); + }); + }); + + describe('trackingCategory', () => { + it('return the category set in the component properties first', () => { + const mixin = Tracking.mixin({ category: 'foo' }); + mixin.computed.tracking = { + category: 'bar', + }; + expect(mixin.computed.trackingCategory()).toBe('bar'); + }); + + it('return the category set in the options', () => { + const mixin = Tracking.mixin({ category: 'foo' }); + expect(mixin.computed.trackingCategory()).toBe('foo'); + }); + + it('if no category is selected returns undefined', () => { + const mixin = Tracking.mixin(); + expect(mixin.computed.trackingCategory()).toBe(undefined); + }); + }); + + describe('track', () => { + let eventSpy; + let mixin; + + beforeEach(() => { + eventSpy = jest.spyOn(Tracking, 'event').mockReturnValue(); + mixin = Tracking.mixin(); + mixin = { + ...mixin.computed, + ...mixin.methods, + }; + }); + + it('calls the event method', () => { + mixin.trackingCategory = mixin.trackingCategory(); + mixin.trackingOptions = mixin.trackingOptions(); + + mixin.track('foo'); + expect(eventSpy).toHaveBeenCalledWith(undefined, 'foo', {}); + }); + + it('give precedence to data for category and options', () => { + mixin.trackingCategory = mixin.trackingCategory(); + mixin.trackingOptions = mixin.trackingOptions(); + const data = { category: 'foo', label: 'baz' }; + mixin.track('foo', data); + expect(eventSpy).toHaveBeenCalledWith('foo', 'foo', data); + }); + }); + }); }); diff --git a/spec/support/helpers/stub_object_storage.rb b/spec/support/helpers/stub_object_storage.rb index 3f7002b8768..392300a4436 100644 --- a/spec/support/helpers/stub_object_storage.rb +++ b/spec/support/helpers/stub_object_storage.rb @@ -56,6 +56,13 @@ module StubObjectStorage **params) end + def stub_package_file_object_storage(**params) + stub_object_storage_uploader(config: Gitlab.config.packages.object_store, + uploader: ::Packages::PackageFileUploader, + remote_directory: 'packages', + **params) + end + def stub_uploads_object_storage(uploader = described_class, **params) stub_object_storage_uploader(config: Gitlab.config.uploads.object_store, uploader: uploader, |