Commit 4ccbe188 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 1745dd29ef1f
......@@ -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;
},
......
......@@ -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);
},
},
};
......
......@@ -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"
......
......@@ -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/)
......@@ -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.
......@@ -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
......
......@@ -300,6 +300,7 @@ new Kubernetes cluster to your project:
"iam:AttachRolePolicy",
"iam:CreateRole",
"iam:CreateInstanceProfile",
"iam:CreateServiceLinkedRole",
"iam:GetRole",
"iam:ListRoles",
"iam:PassRole",
......
......@@ -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);
});
});
});
});
......@@ -56,6 +56,13 @@ def stub_lfs_object_storage(**params)
**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,
......
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