Commit c02f5328 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 688e3395
...@@ -48,6 +48,12 @@ export default { ...@@ -48,6 +48,12 @@ export default {
}, },
}, },
computed: { computed: {
tracking() {
return {
// eslint-disable-next-line no-underscore-dangle
category: this.$options._componentTag,
};
},
showLoadingState() { showLoadingState() {
return this.subscribed === null; return this.subscribed === null;
}, },
......
...@@ -73,20 +73,25 @@ export default class Tracking { ...@@ -73,20 +73,25 @@ export default class Tracking {
return handlers; return handlers;
} }
static mixin(opts) { static mixin(opts = {}) {
return { return {
data() { computed: {
return { trackingCategory() {
tracking: { const localCategory = this.tracking ? this.tracking.category : null;
// eslint-disable-next-line no-underscore-dangle return localCategory || opts.category;
category: this.$options.name || this.$options._componentTag, },
}, trackingOptions() {
}; return { ...opts, ...this.tracking };
},
}, },
methods: { methods: {
track(action, data) { track(action, data = {}) {
const category = opts.category || data.category || this.tracking.category; const category = data.category || this.trackingCategory;
Tracking.event(category || 'unspecified', action, { ...opts, ...this.tracking, ...data }); const options = {
...this.trackingOptions,
...data,
};
Tracking.event(category, action, options);
}, },
}, },
}; };
......
...@@ -115,10 +115,12 @@ Any **secondary** nodes should point only to read-only instances. ...@@ -115,10 +115,12 @@ Any **secondary** nodes should point only to read-only instances.
#### Can Geo detect the current node correctly? #### Can Geo detect the current node correctly?
Geo finds the current machine's name in `/etc/gitlab/gitlab.rb` by first looking Geo finds the current machine's name in `/etc/gitlab/gitlab.rb` by:
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 - Using the `gitlab_rails['geo_node_name']` setting.
get a machine's name, run: - If that is not defined, using the `external_url` setting.
To get a machine's name, run:
```sh ```sh
sudo gitlab-rails runner "puts GeoNode.current_node_name" sudo gitlab-rails runner "puts GeoNode.current_node_name"
......
...@@ -22,8 +22,8 @@ to use as a bearer token. ...@@ -22,8 +22,8 @@ to use as a bearer token.
Example: Example:
```sh ```sh
GRAPHQL_TOKEN = <your-token> 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}}\"} curl 'https://gitlab.com/api/graphql' --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"}"
``` ```
### GraphiQL ### GraphiQL
...@@ -86,18 +86,17 @@ Example: Get a specific project and the title of Issue #2. ...@@ -86,18 +86,17 @@ Example: Get a specific project and the title of Issue #2.
```graphql ```graphql
query { query {
project(fullPath: "gitlab-org/graphql-sandbox") { project(fullPath: "gitlab-org/graphql-sandbox") {
name name
issue(iid: "2") { issue(iid: "2") {
title 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: When retrieving child nodes use:
- the `edges { node { } }` syntax. - the `edges { node { } }` syntax.
...@@ -121,32 +120,14 @@ query { ...@@ -121,32 +120,14 @@ query {
} }
``` ```
More on schema definitions:
[graphql-ruby docs](https://graphql-ruby.org/schema/definition)
More about queries: More about queries:
[GraphQL docs](https://graphql.org/learn/queries/) and [GraphQL docs](https://graphql.org/learn/queries/)
[graphql-ruby docs](https://graphql-ruby.org/queries/executing_queries)
### Authorization ### Authorization
Authorization uses the same engine as the Rails app. So if you've signed in to GitLab 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. 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).
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)
### Mutations ### Mutations
...@@ -197,7 +178,7 @@ mutation { ...@@ -197,7 +178,7 @@ mutation {
body body
discussion { discussion {
id id
} }
} }
errors errors
} }
...@@ -253,12 +234,8 @@ You should get something like the following output: ...@@ -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`. 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: More about mutations:
[GraphQL Docs](https://graphql.org/learn/queries/#mutations) and [GraphQL Docs](https://graphql.org/learn/queries/#mutations).
[graphql-ruby docs](https://graphql-ruby.org/mutations/mutation_classes.html)
### Introspective queries ### Introspective queries
...@@ -301,8 +278,7 @@ query IssueTypes { ...@@ -301,8 +278,7 @@ query IssueTypes {
``` ```
More about introspection: More about introspection:
[GraphQL docs](https://graphql.org/learn/introspection/) and [GraphQL docs](https://graphql.org/learn/introspection/)
[graphql-ruby docs](https://graphql-ruby.org/schema/introspection.html)
## Sorting ## Sorting
...@@ -382,5 +358,4 @@ query { ...@@ -382,5 +358,4 @@ query {
``` ```
More on pagination and cursors: More on pagination and cursors:
[GraphQL docs](https://graphql.org/learn/pagination/) and [GraphQL docs](https://graphql.org/learn/pagination/)
[graphql-ruby docs](https://graphql-ruby.org/relay/connections.html#cursors)
...@@ -517,9 +517,3 @@ _namespaces_ that have a `project_id`. ...@@ -517,9 +517,3 @@ _namespaces_ that have a `project_id`.
The `path` column for these rows will be renamed to their previous value followed The `path` column for these rows will be renamed to their previous value followed
by an integer. For example: `users` would turn into `users0` 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.
...@@ -61,10 +61,12 @@ To verify that you entered your email correctly, type: ...@@ -61,10 +61,12 @@ To verify that you entered your email correctly, type:
git config --global user.email git config --global user.email
``` ```
You'll need to do this only once, since you are using the `--global` option. It tells You'll need to do this only once, since you are using the `--global` option. It
Git to always use this information for anything you do on that system. If you want tells Git to always use this information for anything you do on that system. If
to override this with a different username or email address for specific projects or repositories, you want to override this with a different username or email address for specific
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. 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 ## Check your information
...@@ -102,7 +104,10 @@ files to your local computer, automatically preserving the Git connection with t ...@@ -102,7 +104,10 @@ files to your local computer, automatically preserving the Git connection with t
remote repository. remote repository.
You can either clone it via HTTPS or [SSH](../ssh/README.md). If you chose to clone 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 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 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: ...@@ -113,8 +118,8 @@ As an example, consider this repository path:
- HTTPS: `https://gitlab.com/gitlab-org/gitlab.git` - HTTPS: `https://gitlab.com/gitlab-org/gitlab.git`
- SSH: `git@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 To get started, open a terminal window in the directory you wish to clone the
files into, and run one of the following commands. repository files into, and run one of the following commands.
Clone via HTTPS: Clone via HTTPS:
...@@ -134,9 +139,9 @@ on it locally. ...@@ -134,9 +139,9 @@ on it locally.
### Switch to the master branch ### Switch to the master branch
You are always in a branch when working with Git. The main branch is the master branch, You are always in a branch when working with Git. The main branch is the master
but you can use the same command to switch to a different branch by changing `master` branch, but you can use the same command to switch to a different branch by
to the branch name. changing `master` to the branch name.
```bash ```bash
git checkout master git checkout master
...@@ -145,10 +150,10 @@ git checkout master ...@@ -145,10 +150,10 @@ git checkout master
### Download the latest changes in the project ### 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 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 you start working on a project), you `pull` to get all the changes made by users
the last time you cloned or pulled the project. Use `master` for the `<name-of-branch>` since the last time you cloned or pulled the project. Use `master` for the
to get the main branch code, or the branch name of the branch you are currently working `<name-of-branch>` to get the main branch code, or the branch name of the branch
in. you are currently working in.
```bash ```bash
git pull <REMOTE> <name-of-branch> git pull <REMOTE> <name-of-branch>
...@@ -156,10 +161,11 @@ 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 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 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 on the remote server. `<name-of-branch>` is usually `master`, but it may be any
branch. You can create additional named remotes and branches as necessary. 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 ### View your remote repositories
...@@ -184,9 +190,9 @@ so use something easy to remember and type. ...@@ -184,9 +190,9 @@ so use something easy to remember and type.
### Create a branch ### Create a branch
To create a new branch, to work from without affecting the `master` branch, type the To create a new branch, to work from without affecting the `master` branch, type
following (spaces won't be recognized in the branch name, so you will need to use a the following (spaces won't be recognized in the branch name, so you will need to
hyphen or underscore): use a hyphen or underscore):
```bash ```bash
git checkout -b <name-of-branch> git checkout -b <name-of-branch>
...@@ -245,6 +251,10 @@ The `.` character means _all file changes in the current directory and all subdi ...@@ -245,6 +251,10 @@ The `.` character means _all file changes in the current directory and all subdi
### Send changes to GitLab.com ### 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: To push all local commits (saved changes) to the remote repository:
```bash ```bash
...@@ -301,6 +311,21 @@ git checkout <name-of-branch> ...@@ -301,6 +311,21 @@ git checkout <name-of-branch>
git merge master 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 <!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
...@@ -300,6 +300,7 @@ new Kubernetes cluster to your project: ...@@ -300,6 +300,7 @@ new Kubernetes cluster to your project:
"iam:AttachRolePolicy", "iam:AttachRolePolicy",
"iam:CreateRole", "iam:CreateRole",
"iam:CreateInstanceProfile", "iam:CreateInstanceProfile",
"iam:CreateServiceLinkedRole",
"iam:GetRole", "iam:GetRole",
"iam:ListRoles", "iam:ListRoles",
"iam:PassRole", "iam:PassRole",
......
...@@ -177,4 +177,70 @@ describe('Tracking', () => { ...@@ -177,4 +177,70 @@ describe('Tracking', () => {
expect(eventSpy).toHaveBeenCalledWith('_category_', 'nested_event', {}); 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);
});
});
});
}); });
...@@ -56,6 +56,13 @@ module StubObjectStorage ...@@ -56,6 +56,13 @@ module StubObjectStorage
**params) **params)
end 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) def stub_uploads_object_storage(uploader = described_class, **params)
stub_object_storage_uploader(config: Gitlab.config.uploads.object_store, stub_object_storage_uploader(config: Gitlab.config.uploads.object_store,
uploader: uploader, uploader: uploader,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment