Commit b806264d authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 34ab9be9
...@@ -79,6 +79,9 @@ module Types ...@@ -79,6 +79,9 @@ module Types
field :gitlab_commit, GraphQL::STRING_TYPE, field :gitlab_commit, GraphQL::STRING_TYPE,
null: true, null: true,
description: "GitLab commit SHA attributed to the Error based on the release version" description: "GitLab commit SHA attributed to the Error based on the release version"
field :gitlab_commit_path, GraphQL::STRING_TYPE,
null: true,
description: "Path to the GitLab page for the GitLab commit attributed to the error"
def first_seen def first_seen
DateTime.parse(object.first_seen) DateTime.parse(object.first_seen)
......
...@@ -284,7 +284,6 @@ module ApplicationSettingsHelper ...@@ -284,7 +284,6 @@ module ApplicationSettingsHelper
:unique_ips_limit_enabled, :unique_ips_limit_enabled,
:unique_ips_limit_per_user, :unique_ips_limit_per_user,
:unique_ips_limit_time_window, :unique_ips_limit_time_window,
:updating_name_disabled_for_users,
:usage_ping_enabled, :usage_ping_enabled,
:instance_statistics_visibility_private, :instance_statistics_visibility_private,
:user_default_external, :user_default_external,
......
...@@ -4,6 +4,7 @@ module ErrorTracking ...@@ -4,6 +4,7 @@ module ErrorTracking
class ProjectErrorTrackingSetting < ApplicationRecord class ProjectErrorTrackingSetting < ApplicationRecord
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
include ReactiveCaching include ReactiveCaching
include Gitlab::Routing
SENTRY_API_ERROR_TYPE_BAD_REQUEST = 'bad_request_for_sentry_api' SENTRY_API_ERROR_TYPE_BAD_REQUEST = 'bad_request_for_sentry_api'
SENTRY_API_ERROR_TYPE_MISSING_KEYS = 'missing_keys_in_sentry_response' SENTRY_API_ERROR_TYPE_MISSING_KEYS = 'missing_keys_in_sentry_response'
...@@ -141,6 +142,7 @@ module ErrorTracking ...@@ -141,6 +142,7 @@ module ErrorTracking
def add_gitlab_issue_details(issue) def add_gitlab_issue_details(issue)
issue.gitlab_commit = match_gitlab_commit(issue.first_release_version) issue.gitlab_commit = match_gitlab_commit(issue.first_release_version)
issue.gitlab_commit_path = project_commit_path(project, issue.gitlab_commit) if issue.gitlab_commit
issue issue
end end
......
...@@ -13,11 +13,6 @@ class UserPolicy < BasePolicy ...@@ -13,11 +13,6 @@ class UserPolicy < BasePolicy
desc "The user is blocked" desc "The user is blocked"
condition(:blocked_user, scope: :subject, score: 0) { @subject.blocked? } condition(:blocked_user, scope: :subject, score: 0) { @subject.blocked? }
condition(:updating_name_disabled_for_users) do
::Gitlab::CurrentSettings.current_application_settings
.updating_name_disabled_for_users
end
rule { ~restricted_public_level }.enable :read_user rule { ~restricted_public_level }.enable :read_user
rule { ~anonymous }.enable :read_user rule { ~anonymous }.enable :read_user
...@@ -27,8 +22,8 @@ class UserPolicy < BasePolicy ...@@ -27,8 +22,8 @@ class UserPolicy < BasePolicy
enable :update_user_status enable :update_user_status
end end
rule { can?(:update_user) & ( admin | ~updating_name_disabled_for_users ) }.enable :update_name
rule { default }.enable :read_user_profile rule { default }.enable :read_user_profile
rule { (private_profile | blocked_user) & ~(user_is_self | admin) }.prevent :read_user_profile rule { (private_profile | blocked_user) & ~(user_is_self | admin) }.prevent :read_user_profile
end end
UserPolicy.prepend_if_ee('EE::UserPolicy')
...@@ -9,6 +9,7 @@ module ErrorTracking ...@@ -9,6 +9,7 @@ module ErrorTracking
:first_release_last_commit, :first_release_last_commit,
:first_release_short_version, :first_release_short_version,
:gitlab_commit, :gitlab_commit,
:gitlab_commit_path,
:first_seen, :first_seen,
:frequency, :frequency,
:gitlab_issue, :gitlab_issue,
......
...@@ -54,7 +54,6 @@ module Users ...@@ -54,7 +54,6 @@ module Users
def discard_read_only_attributes def discard_read_only_attributes
discard_synced_attributes discard_synced_attributes
discard_name unless name_updatable?
end end
def discard_synced_attributes def discard_synced_attributes
...@@ -65,14 +64,6 @@ module Users ...@@ -65,14 +64,6 @@ module Users
end end
end end
def discard_name
params.delete(:name)
end
def name_updatable?
can?(current_user, :update_name, @user)
end
def assign_attributes def assign_attributes
@user.assign_attributes(params.except(*identity_attributes)) unless params.empty? @user.assign_attributes(params.except(*identity_attributes)) unless params.empty?
end end
......
...@@ -51,13 +51,8 @@ ...@@ -51,13 +51,8 @@
= f.check_box :user_show_add_ssh_key_message, class: 'form-check-input' = f.check_box :user_show_add_ssh_key_message, class: 'form-check-input'
= f.label :user_show_add_ssh_key_message, class: 'form-check-label' do = f.label :user_show_add_ssh_key_message, class: 'form-check-label' do
= _("Inform users without uploaded SSH keys that they can't push over SSH until one is added") = _("Inform users without uploaded SSH keys that they can't push over SSH until one is added")
.form-group
= f.label :updating_name_disabled_for_users, _('User restrictions'), class: 'label-bold'
.form-check
= f.check_box :updating_name_disabled_for_users, class: 'form-check-input'
= f.label :updating_name_disabled_for_users, class: 'form-check-label' do
= _("Prevent users from changing their profile name")
= render_if_exists 'admin/application_settings/updating_name_disabled_for_users', form: f
= render_if_exists 'admin/application_settings/availability_on_namespace_setting', form: f = render_if_exists 'admin/application_settings/availability_on_namespace_setting', form: f
= f.submit _('Save changes'), class: 'btn btn-success qa-save-changes-button' = f.submit _('Save changes'), class: 'btn btn-success qa-save-changes-button'
- if user.read_only_attribute?(:name) - if user.read_only_attribute?(:name)
= form.text_field :name, required: true, readonly: true, wrapper: { class: 'col-md-9 qa-full-name rspec-full-name' }, = form.text_field :name, required: true, readonly: true, wrapper: { class: 'col-md-9 qa-full-name rspec-full-name' },
help: s_("Profiles|Your name was automatically set based on your %{provider_label} account, so people you know can recognize you") % { provider_label: attribute_provider_label(:name) } help: s_("Profiles|Your name was automatically set based on your %{provider_label} account, so people you know can recognize you") % { provider_label: attribute_provider_label(:name) }
- elsif can?(current_user, :update_name, user)
= form.text_field :name, label: s_('Profiles|Full name'), required: true, title: s_("Profiles|Using emojis in names seems fun, but please try to set a status message instead"), wrapper: { class: 'col-md-9 qa-full-name rspec-full-name' }, help: s_("Profiles|Enter your name, so people you know can recognize you")
- else - else
= form.text_field :name, required: true, readonly: true, wrapper: { class: 'col-md-9 qa-full-name rspec-full-name' }, = form.text_field :name, label: s_('Profiles|Full name'), required: true, title: s_("Profiles|Using emojis in names seems fun, but please try to set a status message instead"), wrapper: { class: 'col-md-9 qa-full-name rspec-full-name' }, help: s_("Profiles|Enter your name, so people you know can recognize you")
help: s_("Profiles|The ability to update your name has been disabled by your administrator.")
---
title: Add gitlab_commit_path to Sentry Error Details Response
merge_request: 22803
author:
type: added
...@@ -229,13 +229,15 @@ module Gitlab ...@@ -229,13 +229,15 @@ module Gitlab
# Allow access to GitLab API from other domains # Allow access to GitLab API from other domains
config.middleware.insert_before Warden::Manager, Rack::Cors do config.middleware.insert_before Warden::Manager, Rack::Cors do
headers_to_expose = %w[Link X-Total X-Total-Pages X-Per-Page X-Page X-Next-Page X-Prev-Page X-Gitlab-Blob-Id X-Gitlab-Commit-Id X-Gitlab-Content-Sha256 X-Gitlab-Encoding X-Gitlab-File-Name X-Gitlab-File-Path X-Gitlab-Last-Commit-Id X-Gitlab-Ref X-Gitlab-Size]
allow do allow do
origins Gitlab.config.gitlab.url origins Gitlab.config.gitlab.url
resource '/api/*', resource '/api/*',
credentials: true, credentials: true,
headers: :any, headers: :any,
methods: :any, methods: :any,
expose: %w[Link X-Total X-Total-Pages X-Per-Page X-Page X-Next-Page X-Prev-Page] expose: headers_to_expose
end end
# Cross-origin requests must not have the session cookie available # Cross-origin requests must not have the session cookie available
...@@ -245,7 +247,7 @@ module Gitlab ...@@ -245,7 +247,7 @@ module Gitlab
credentials: false, credentials: false,
headers: :any, headers: :any,
methods: :any, methods: :any,
expose: %w[Link X-Total X-Total-Pages X-Per-Page X-Page X-Next-Page X-Prev-Page] expose: headers_to_expose
end end
end end
......
...@@ -5721,6 +5721,11 @@ type SentryDetailedError { ...@@ -5721,6 +5721,11 @@ type SentryDetailedError {
""" """
gitlabCommit: String gitlabCommit: String
"""
Path to the GitLab page for the GitLab commit attributed to the error
"""
gitlabCommitPath: String
""" """
ID (global ID) of the error ID (global ID) of the error
""" """
......
...@@ -15576,6 +15576,20 @@ ...@@ -15576,6 +15576,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "gitlabCommitPath",
"description": "Path to the GitLab page for the GitLab commit attributed to the error",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "id", "name": "id",
"description": "ID (global ID) of the error", "description": "ID (global ID) of the error",
......
...@@ -895,6 +895,7 @@ Autogenerated return type of RemoveAwardEmoji ...@@ -895,6 +895,7 @@ Autogenerated return type of RemoveAwardEmoji
| `firstReleaseShortVersion` | String | Release version the error was first seen | | `firstReleaseShortVersion` | String | Release version the error was first seen |
| `lastReleaseShortVersion` | String | Release version the error was last seen | | `lastReleaseShortVersion` | String | Release version the error was last seen |
| `gitlabCommit` | String | GitLab commit SHA attributed to the Error based on the release version | | `gitlabCommit` | String | GitLab commit SHA attributed to the Error based on the release version |
| `gitlabCommitPath` | String | Path to the GitLab page for the GitLab commit attributed to the error |
## SentryErrorFrequency ## SentryErrorFrequency
......
...@@ -10,7 +10,7 @@ last_updated: 2019-03-06 ...@@ -10,7 +10,7 @@ last_updated: 2019-03-06
# Testing a Phoenix application with GitLab CI/CD # Testing a Phoenix application with GitLab CI/CD
[Phoenix][phoenix-site] is a web development framework written in [Elixir][elixir-site], which is a [Phoenix](https://phoenixframework.org) is a web development framework written in [Elixir](https://elixir-lang.org), which is a
functional language designed for productivity and maintainability that runs on the functional language designed for productivity and maintainability that runs on the
[Erlang VM](https://www.erlang.org). Erlang VM is really really fast and can handle very large numbers of [Erlang VM](https://www.erlang.org). Erlang VM is really really fast and can handle very large numbers of
simultaneous users. simultaneous users.
...@@ -27,8 +27,8 @@ and the GitLab UI. ...@@ -27,8 +27,8 @@ and the GitLab UI.
### What is Phoenix? ### What is Phoenix?
[Phoenix][phoenix-site] is a web development framework written in [Elixir][elixir-site] very useful [Phoenix](https://phoenixframework.org) is a web development framework written in [Elixir](https://elixir-lang.org) it's very useful
to build fast, reliable, and high-performance applications, as it uses [Erlang VM](https://www.erlang.org). for building fast, reliable, and high-performance applications, as it uses [Erlang VM](https://www.erlang.org).
Many components and concepts are similar to Ruby on Rails or Python's Django. High developer Many components and concepts are similar to Ruby on Rails or Python's Django. High developer
productivity and high application performance are only a few advantages on learning how to use it. productivity and high application performance are only a few advantages on learning how to use it.
...@@ -45,27 +45,27 @@ Phoenix can run in any OS where Erlang is supported: ...@@ -45,27 +45,27 @@ Phoenix can run in any OS where Erlang is supported:
- Fedora - Fedora
- Raspbian - Raspbian
Check the [Phoenix learning guide][phoenix-learning-guide] for more information. Check the [Phoenix learning guide](https://hexdocs.pm/phoenix/learning.html) for more information.
### What is Elixir? ### What is Elixir?
[Elixir][elixir-site] is a dynamic, functional language created to use all the maturity of Erlang [Elixir](https://elixir-lang.org) is a dynamic, functional language created to use all the maturity of Erlang
(30 years old!) in these days, in an easy way. It has similarities with Ruby, specially on syntax, (30 years old!) in these days, in an easy way. It has similarities with Ruby, specially on syntax,
so Ruby developers are quite excited with the rapid growing of Elixir. A full-stack Ruby developer so Ruby developers are quite excited with the rapid growing of Elixir. A full-stack Ruby developer
can learn how to use Elixir and Phoenix in just a few weeks! can learn how to use Elixir and Phoenix in just a few weeks!
In Elixir we have a command called `mix`, which is a helper to create projects, testing, run In Elixir we have a command called `mix`, which is a helper to create projects, testing, run
migrations and [much more][elixir-mix]. We'll use it later on in this tutorial. migrations and [much more](https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix). We'll use it later on in this tutorial.
Check the [Elixir documentation][elixir-docs] for more information. Check the [Elixir documentation](https://elixir-lang.org/getting-started/introduction) for more information.
## Requirements ## Requirements
To follow this tutorial, you'll need to have installed: To follow this tutorial, you'll need to have installed:
- Elixir [installation instructions][elixir-install] - Elixir [installation instructions](https://elixir-lang.org/install)
- Phoenix Framework [installation instructions][phoenix-install] - Phoenix Framework [installation instructions](https://hexdocs.pm/phoenix/installation.html)
- PostgreSQL (if you need to use MySQL server, check [Phoenix instructions][phoenix-mysql]) - PostgreSQL (if you need to use MySQL server, check [Phoenix instructions](https://hexdocs.pm/phoenix/ecto.html#using-mysql))
### Create a new Phoenix project ### Create a new Phoenix project
...@@ -100,7 +100,7 @@ this case, we'll only create an empty database. ...@@ -100,7 +100,7 @@ this case, we'll only create an empty database.
First, we need to navigate to our recently created project's directory, and then execute again First, we need to navigate to our recently created project's directory, and then execute again
`mix`. This time, `mix` will receive the parameter `ecto.create`, which is the task to create our `mix`. This time, `mix` will receive the parameter `ecto.create`, which is the task to create our
new database. [Ecto][ecto] is the database wrapper for Elixir. new database. [Ecto](https://hexdocs.pm/ecto/Ecto.html) is the database wrapper for Elixir.
When we do run `mix` the first time after creating our project, it will compile our files to When we do run `mix` the first time after creating our project, it will compile our files to
bytecode, which will be interpreted by Erlang VM. In the next times, it will only compile our bytecode, which will be interpreted by Erlang VM. In the next times, it will only compile our
...@@ -123,7 +123,7 @@ The database for HelloGitlabCi.Repo has been created ...@@ -123,7 +123,7 @@ The database for HelloGitlabCi.Repo has been created
> **Note:** > **Note:**
Phoenix assumes that our PostgreSQL database will have a `postgres` user account with the correct Phoenix assumes that our PostgreSQL database will have a `postgres` user account with the correct
permissions and a password of `postgres`. If it's not your case, check permissions and a password of `postgres`. If it's not your case, check
[Ecto's instructions][ecto-repo]. [Ecto's instructions](https://hexdocs.pm/ecto/Ecto.html#module-repositories).
### Start Phoenix server ### Start Phoenix server
...@@ -151,7 +151,7 @@ point `localhost` to `127.0.0.1`. ...@@ -151,7 +151,7 @@ point `localhost` to `127.0.0.1`.
Great, now we have a local Phoenix Server running our app. Great, now we have a local Phoenix Server running our app.
Locally, our application is running in an `iex` session. [iex][iex] stands for Interactive Elixir. Locally, our application is running in an `iex` session. [iex](https://elixir-lang.org/getting-started/introduction.html#interactive-mode) stands for Interactive Elixir.
In this interactive mode, we can type any Elixir expression and get its result. To exit `iex`, we In this interactive mode, we can type any Elixir expression and get its result. To exit `iex`, we
need to press `Ctrl+C` twice. So, when we need to stop the Phoenix server, we have to hit `Ctrl+C` need to press `Ctrl+C` twice. So, when we need to stop the Phoenix server, we have to hit `Ctrl+C`
twice. twice.
...@@ -245,17 +245,16 @@ Our test was successful. It's time to push our files to GitLab. ...@@ -245,17 +245,16 @@ Our test was successful. It's time to push our files to GitLab.
The first step is to create a new file called `.gitlab-ci.yml` in `hello_gitlab_ci` directory of our The first step is to create a new file called `.gitlab-ci.yml` in `hello_gitlab_ci` directory of our
project. project.
- The fastest and easiest way to do this, is to click on **Set up CI** on project's main page: - The easiest way to do this is to click on **Set up CI/CD** on project's main page:
![Set up CI](img/setup-ci.png) ![Set up CI](img/set_up_ci_v12_6.png)
- On next screen, we can select a template ready to go. Click on **Apply a GitLab CI/CD Yaml - On the next screen, we can use a template with Elixir tests already included. Click on **Apply a template** and select **Elixir**:
template** and select **Elixir**:
![Select template](img/select-template.png) ![Select template](img/select_template_v12_6.png)
This template file tells GitLab CI/CD about what we wish to do every time a new commit is made. This template file tells GitLab CI/CD about what we wish to do every time a new commit is made.
However, we have to adapt it to run a Phoenix app. However, we have to adapt it slightly to run a Phoenix app.
- The first line tells GitLab what Docker image will be used. - The first line tells GitLab what Docker image will be used.
...@@ -263,21 +262,21 @@ project. ...@@ -263,21 +262,21 @@ project.
our application? This virtual machine must have all dependencies to run our application. This is our application? This virtual machine must have all dependencies to run our application. This is
where a Docker image is needed. The correct image will provide the entire system for us. where a Docker image is needed. The correct image will provide the entire system for us.
As a suggestion, you can use [trenpixster's elixir image][docker-image], which already has all As we are focusing on testing (not deploying), you can use the [elixir:latest](https://hub.docker.com/_/elixir) docker image, which already has the
dependencies for Phoenix installed, such as Elixir, Erlang, NodeJS and PostgreSQL: dependencies for running Phoenix tests installed, such as Elixir and Erlang:
```yml ```yml
image: trenpixster/elixir:latest image: elixir:latest
``` ```
- At `services` session, we'll only use `postgres`, so we'll delete `mysql` and `redis` lines: - We'll only use `postgres`, so we can delete the `mysql` and `redis` lines from the `services` section:
```yml ```yml
services: services:
- postgres:latest - postgres:latest
``` ```
- Now, we'll create a new entry called `variables`, before `before_script` session: - Now, we'll create a new section called `variables`, before the `before_script` section:
```yml ```yml
variables: variables:
...@@ -288,54 +287,56 @@ project. ...@@ -288,54 +287,56 @@ project.
MIX_ENV: "test" MIX_ENV: "test"
``` ```
Here, we are setting up the values for GitLab CI/CD authenticate into PostgreSQL, as we did on Above, we set up the values for GitLab CI/CD to authenticate into PostgreSQL, like we did in
`config/test.exs` earlier. `config/test.exs` earlier. The `POSTGRES_USER` and `POSTGRES_PASSWORD` values
are used by the `postgres` service to create a user with those credentials.
- In `before_script` session, we'll add some commands to prepare everything to the test: - In the `before_script` section, we'll add some commands to prepare everything for the test:
```yml ```yml
before_script: before_script:
- apt-get update && apt-get -y install postgresql-client - mix local.rebar --force
- mix local.hex --force - mix local.hex --force
- mix deps.get --only test - mix deps.get --only test
- mix ecto.create - mix ecto.create
- mix ecto.migrate - mix ecto.migrate
``` ```
It's important to install `postgresql-client` to let GitLab CI/CD access PostgreSQL and create our This ensures that [rebar3](https://www.rebar3.org) and [hex](https://hex.pm) are both installed
database with the login information provided earlier. More important is to respect the indentation, before attempting to fetch the dependencies that are required to run the tests. Next, the `postgres` db
to avoid syntax errors when running the build. is created and migrated with `ecto`, to ensure it's up-to-date.
- And finally, we'll let `mix` session intact. - Finally, we'll leave the `mix` section unchanged.
Let's take a look at the completed file after the editions: Let's take a look at the updated file after the changes:
```yml ```yml
image: trenpixster/elixir:latest image: elixir:latest
services: services:
- postgres:latest - postgres:latest
variables: variables:
POSTGRES_DB: test_test POSTGRES_DB: hello_gitlab_ci_test
POSTGRES_HOST: postgres POSTGRES_HOST: postgres
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: "postgres" POSTGRES_PASSWORD: "postgres"
MIX_ENV: "test" MIX_ENV: "test"
before_script: before_script:
- apt-get update && apt-get -y install postgresql-client - mix local.rebar --force
- mix deps.get - mix local.hex --force
- mix deps.get --only test
- mix ecto.create - mix ecto.create
- mix ecto.migrate - mix ecto.migrate
mix: mix:
script: script:
- mix test - mix test
``` ```
For safety, we can check if we get any syntax errors before submitting this file to GitLab. Copy the For safety, we can check if we get any syntax errors before submitting this file to GitLab. Copy the
contents of `.gitlab-ci.yml` and paste it on [GitLab CI/CD Lint tool][ci-lint]. Please note that contents of `.gitlab-ci.yml` and paste it on [GitLab CI/CD Lint tool](https://gitlab.com/ci/lint). Please note that
this link will only work for logged in users. this link will only work for logged in users.
## Watching the build ## Watching the build
...@@ -374,7 +375,7 @@ see if our latest code is running without errors. ...@@ -374,7 +375,7 @@ see if our latest code is running without errors.
When we finish this edition, GitLab will start another build and show a **build running** badge. It When we finish this edition, GitLab will start another build and show a **build running** badge. It
is expected, after all we just configured GitLab CI/CD to do this for every push! But you may think is expected, after all we just configured GitLab CI/CD to do this for every push! But you may think
"Why run build and tests for simple things like editing README.md?" and it is a good question. "Why run build and tests for simple things like editing README.md?" and it is a good question.
For changes that don't affect your application, you can add the keyword [`[ci skip]`][skipping-jobs] For changes that don't affect your application, you can add the keyword [`[ci skip]`](../../yaml/README.md#skipping-jobs)
to commit message and the build related to that commit will be skipped. to commit message and the build related to that commit will be skipped.
In the end, we finally got our pretty green build succeeded badge! By outputting the result on the In the end, we finally got our pretty green build succeeded badge! By outputting the result on the
...@@ -389,34 +390,12 @@ code permanently working. GitLab CI/CD is a time saving powerful tool to help us ...@@ -389,34 +390,12 @@ code permanently working. GitLab CI/CD is a time saving powerful tool to help us
organized and working. organized and working.
As we could see in this post, GitLab CI/CD is really really easy to configure and use. We have [many As we could see in this post, GitLab CI/CD is really really easy to configure and use. We have [many
other reasons][ci-reasons] to keep using GitLab CI/CD. The benefits to our teams will be huge! other reasons](https://about.gitlab.com/blog/2015/02/03/7-reasons-why-you-should-be-using-ci/) to keep
using GitLab CI/CD. The benefits to our teams will be huge!
## References ## References
- [GitLab CI/CD introductory guide][ci-guide] - [GitLab CI/CD introductory guide](https://about.gitlab.com/blog/2015/12/14/getting-started-with-gitlab-and-gitlab-ci)
- [GitLab CI/CD full Documentation][ci-docs] - [GitLab CI/CD full Documentation](../../README.md)
- [GitLab Runners documentation][gitlab-runners] - [GitLab Runners documentation](../../runners/README.md)
- [Using Docker images documentation][using-docker] - [Using Docker images documentation](../../docker/using_docker_images.md)
- [Example project: Hello GitLab CI/CD on GitLab][hello-gitlab]
[phoenix-site]: https://phoenixframework.org/ "Phoenix Framework"
[phoenix-learning-guide]: https://hexdocs.pm/phoenix/learning.html "Phoenix Learning Guide"
[phoenix-install]: https://hexdocs.pm/phoenix/installation.html "Phoenix Installation"
[phoenix-mysql]: https://hexdocs.pm/phoenix/ecto.html#using-mysql "Phoenix with MySQL"
[elixir-site]: https://elixir-lang.org/ "Elixir"
[elixir-mix]: https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html "Introduction to mix"
[elixir-docs]: https://elixir-lang.org/getting-started/introduction.html "Elixir Documentation"
[elixir-install]: https://elixir-lang.org/install.html "Elixir Installation"
[ecto]: https://hexdocs.pm/ecto/Ecto.html "Ecto"
[ecto-repo]: https://hexdocs.pm/ecto/Ecto.html#module-repositories "Ecto Repositories"
[mix-ecto]: https://hexdocs.pm/ecto/Mix.Tasks.Ecto.Create.html "mix and Ecto"
[iex]: https://elixir-lang.org/getting-started/introduction.html#interactive-mode "Interactive Mode"
[ci-lint]: https://gitlab.com/ci/lint "CI Lint Tool"
[ci-reasons]: https://about.gitlab.com/blog/2015/02/03/7-reasons-why-you-should-be-using-ci/ "7 Reasons Why You Should Be Using CI"
[ci-guide]: https://about.gitlab.com/blog/2015/12/14/getting-started-with-gitlab-and-gitlab-ci/ "Getting Started With GitLab And GitLab CI/CD"
[ci-docs]: ../../README.md "GitLab CI/CD Documentation"
[skipping-jobs]: ../../yaml/README.md#skipping-jobs "Skipping Jobs"
[gitlab-runners]: ../../runners/README.md "GitLab Runners Documentation"
[docker-image]: https://hub.docker.com/r/trenpixster/elixir/ "Elixir Docker Image"
[using-docker]: ../../docker/using_docker_images.md "Using Docker Images"
[hello-gitlab]: https://gitlab.com/Hostert/hello_gitlab_ci "Hello GitLab CI/CD"
...@@ -117,7 +117,7 @@ Once a lifetime for personal access tokens is set, GitLab will: ...@@ -117,7 +117,7 @@ Once a lifetime for personal access tokens is set, GitLab will:
allowed lifetime. Three hours is given to allow administrators to change the allowed lifetime, allowed lifetime. Three hours is given to allow administrators to change the allowed lifetime,
or remove it, before revocation takes place. or remove it, before revocation takes place.
## Disabling user profile name changes **(CORE ONLY)** ## Disabling user profile name changes **(PREMIUM ONLY)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/24605) in GitLab 12.7. > [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/24605) in GitLab 12.7.
......
...@@ -142,7 +142,6 @@ module API ...@@ -142,7 +142,6 @@ module API
requires :sourcegraph_url, type: String, desc: 'The configured Sourcegraph instance URL' requires :sourcegraph_url, type: String, desc: 'The configured Sourcegraph instance URL'
end end
optional :terminal_max_session_time, type: Integer, desc: 'Maximum time for web terminal websocket connection (in seconds). Set to 0 for unlimited time.' optional :terminal_max_session_time, type: Integer, desc: 'Maximum time for web terminal websocket connection (in seconds). Set to 0 for unlimited time.'
optional :updating_name_disabled_for_users, type: Boolean, desc: 'Flag indicating if users are permitted to update their profile name'
optional :usage_ping_enabled, type: Boolean, desc: 'Every week GitLab will report license usage back to GitLab, Inc.' optional :usage_ping_enabled, type: Boolean, desc: 'Every week GitLab will report license usage back to GitLab, Inc.'
optional :instance_statistics_visibility_private, type: Boolean, desc: 'When set to `true` Instance statistics will only be available to admins' optional :instance_statistics_visibility_private, type: Boolean, desc: 'When set to `true` Instance statistics will only be available to admins'
optional :local_markdown_version, type: Integer, desc: 'Local markdown version, increase this value when any cached markdown should be invalidated' optional :local_markdown_version, type: Integer, desc: 'Local markdown version, increase this value when any cached markdown should be invalidated'
......
...@@ -16,6 +16,7 @@ module Gitlab ...@@ -16,6 +16,7 @@ module Gitlab
:first_seen, :first_seen,
:frequency, :frequency,
:gitlab_commit, :gitlab_commit,
:gitlab_commit_path,
:gitlab_issue, :gitlab_issue,
:gitlab_project, :gitlab_project,
:id, :id,
......
...@@ -16,6 +16,12 @@ module Gitlab ...@@ -16,6 +16,12 @@ module Gitlab
environment: ::Gitlab.dev_env_or_com?, environment: ::Gitlab.dev_env_or_com?,
enabled_ratio: 1, enabled_ratio: 1,
tracking_category: 'Growth::Acquisition::Experiment::SignUpFlow' tracking_category: 'Growth::Acquisition::Experiment::SignUpFlow'
},
paid_signup_flow: {
feature_toggle: :paid_signup_flow,
environment: ::Gitlab.dev_env_or_com?,
enabled_ratio: 0.1,
tracking_category: 'Growth::Acquisition::Experiment::PaidSignUpFlow'
} }
}.freeze }.freeze
......
...@@ -6576,6 +6576,9 @@ msgstr "" ...@@ -6576,6 +6576,9 @@ msgstr ""
msgid "Edit Deploy Key" msgid "Edit Deploy Key"
msgstr "" msgstr ""
msgid "Edit Geo Node"
msgstr ""
msgid "Edit Group Hook" msgid "Edit Group Hook"
msgstr "" msgstr ""
...@@ -8303,6 +8306,9 @@ msgstr "" ...@@ -8303,6 +8306,9 @@ msgstr ""
msgid "Geo Designs" msgid "Geo Designs"
msgstr "" msgstr ""
msgid "Geo Node Form"
msgstr ""
msgid "Geo Nodes" msgid "Geo Nodes"
msgstr "" msgstr ""
...@@ -11969,6 +11975,9 @@ msgstr "" ...@@ -11969,6 +11975,9 @@ msgstr ""
msgid "New Environment" msgid "New Environment"
msgstr "" msgstr ""
msgid "New Geo Node"
msgstr ""
msgid "New Group" msgid "New Group"
msgstr "" msgstr ""
......
...@@ -102,13 +102,6 @@ describe Admin::ApplicationSettingsController do ...@@ -102,13 +102,6 @@ describe Admin::ApplicationSettingsController do
expect(ApplicationSetting.current.minimum_password_length).to eq(10) expect(ApplicationSetting.current.minimum_password_length).to eq(10)
end end
it 'updates updating_name_disabled_for_users setting' do
put :update, params: { application_setting: { updating_name_disabled_for_users: true } }
expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.updating_name_disabled_for_users).to eq(true)
end
context 'external policy classification settings' do context 'external policy classification settings' do
let(:settings) do let(:settings) do
{ {
......
...@@ -257,28 +257,6 @@ describe Admin::UsersController do ...@@ -257,28 +257,6 @@ describe Admin::UsersController do
end end
describe 'POST update' do describe 'POST update' do
context 'updating name' do
context 'when the ability to update their name is disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: true)
end
it 'updates the name' do
params = {
id: user.to_param,
user: {
name: 'New Name'
}
}
put :update, params: params
expect(response).to redirect_to(admin_user_path(user))
expect(user.reload.name).to eq('New Name')
end
end
end
context 'when the password has changed' do context 'when the password has changed' do
def update_password(user, password, password_confirmation = nil) def update_password(user, password, password_confirmation = nil)
params = { params = {
......
...@@ -81,54 +81,6 @@ describe ProfilesController, :request_store do ...@@ -81,54 +81,6 @@ describe ProfilesController, :request_store do
expect(ldap_user.location).to eq('City, Country') expect(ldap_user.location).to eq('City, Country')
end end
context 'updating name' do
subject { put :update, params: { user: { name: 'New Name' } } }
context 'when the ability to update thier name is not disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: false)
sign_in(user)
end
it 'updates the name' do
subject
expect(response.status).to eq(302)
expect(user.reload.name).to eq('New Name')
end
end
context 'when the ability to update their name is disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: true)
end
context 'as a regular user' do
it 'does not update the name' do
sign_in(user)
subject
expect(response.status).to eq(302)
expect(user.reload.name).not_to eq('New Name')
end
end
context 'as an admin user' do
it 'updates the name' do
admin = create(:admin)
sign_in(admin)
subject
expect(response.status).to eq(302)
expect(admin.reload.name).to eq('New Name')
end
end
end
end
it 'allows setting a user status' do it 'allows setting a user status' do
sign_in(user) sign_in(user)
......
...@@ -224,7 +224,12 @@ describe Projects::ErrorTrackingController do ...@@ -224,7 +224,12 @@ describe Projects::ErrorTrackingController do
let(:error) { build(:detailed_error_tracking_error) } let(:error) { build(:detailed_error_tracking_error) }
it 'returns an error' do it 'returns an error' do
expected_error = error.as_json.except('first_release_version').merge({ 'gitlab_commit' => nil }) expected_error = error.as_json.except('first_release_version').merge(
{
'gitlab_commit' => nil,
'gitlab_commit_path' => nil
}
)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('error_tracking/issue_detailed') expect(response).to match_response_schema('error_tracking/issue_detailed')
......
...@@ -34,7 +34,7 @@ FactoryBot.define do ...@@ -34,7 +34,7 @@ FactoryBot.define do
last_release_last_commit { '9ad419c86' } last_release_last_commit { '9ad419c86' }
first_release_short_version { 'abc123' } first_release_short_version { 'abc123' }
last_release_short_version { 'abc123' } last_release_short_version { 'abc123' }
first_release_version { '123456' } first_release_version { '12345678' }
skip_create skip_create
end end
......
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
"last_release_last_commit": { "type": ["string", "null"] }, "last_release_last_commit": { "type": ["string", "null"] },
"first_release_short_version": { "type": ["string", "null"] }, "first_release_short_version": { "type": ["string", "null"] },
"last_release_short_version": { "type": ["string", "null"] }, "last_release_short_version": { "type": ["string", "null"] },
"gitlab_commit": { "type": ["string", "null"] } "gitlab_commit": { "type": ["string", "null"] },
"gitlab_commit_path": { "type": ["string", "null"] }
}, },
"additionalProperties": false "additionalProperties": false
} }
...@@ -31,6 +31,7 @@ describe GitlabSchema.types['SentryDetailedError'] do ...@@ -31,6 +31,7 @@ describe GitlabSchema.types['SentryDetailedError'] do
firstReleaseShortVersion firstReleaseShortVersion
lastReleaseShortVersion lastReleaseShortVersion
gitlabCommit gitlabCommit
gitlabCommitPath
] ]
is_expected.to have_graphql_fields(*expected_fields) is_expected.to have_graphql_fields(*expected_fields)
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe ErrorTracking::ProjectErrorTrackingSetting do describe ErrorTracking::ProjectErrorTrackingSetting do
include ReactiveCachingHelpers include ReactiveCachingHelpers
include Gitlab::Routing
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
...@@ -213,7 +214,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do ...@@ -213,7 +214,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
describe '#issue_details' do describe '#issue_details' do
let(:issue) { build(:detailed_error_tracking_error) } let(:issue) { build(:detailed_error_tracking_error) }
let(:sentry_client) { double('sentry_client', issue_details: issue) } let(:sentry_client) { double('sentry_client', issue_details: issue) }
let(:commit_id) { '123456' } let(:commit_id) { issue.first_release_version }
let(:result) do let(:result) do
subject.issue_details subject.issue_details
...@@ -230,6 +231,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do ...@@ -230,6 +231,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
it { expect(result).to eq(issue: issue) } it { expect(result).to eq(issue: issue) }
it { expect(result[:issue].first_release_version).to eq(commit_id) } it { expect(result[:issue].first_release_version).to eq(commit_id) }
it { expect(result[:issue].gitlab_commit).to eq(nil) } it { expect(result[:issue].gitlab_commit).to eq(nil) }
it { expect(result[:issue].gitlab_commit_path).to eq(nil) }
context 'when release version is nil' do context 'when release version is nil' do
before do before do
...@@ -237,6 +239,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do ...@@ -237,6 +239,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
end end
it { expect(result[:issue].gitlab_commit).to eq(nil) } it { expect(result[:issue].gitlab_commit).to eq(nil) }
it { expect(result[:issue].gitlab_commit_path).to eq(nil) }
end end
context 'when repo commit matches first relase version' do context 'when repo commit matches first relase version' do
...@@ -248,6 +251,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do ...@@ -248,6 +251,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
end end
it { expect(result[:issue].gitlab_commit).to eq(commit_id) } it { expect(result[:issue].gitlab_commit).to eq(commit_id) }
it { expect(result[:issue].gitlab_commit_path).to eq("/#{project.namespace.path}/#{project.path}/commit/#{commit_id}") }
end end
end end
......
...@@ -48,36 +48,4 @@ describe UserPolicy do ...@@ -48,36 +48,4 @@ describe UserPolicy do
describe "updating a user" do describe "updating a user" do
it_behaves_like 'changing a user', :update_user it_behaves_like 'changing a user', :update_user
end end
describe "updating a user's name" do
context 'when the ability to update their name is not disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: false)
end
it_behaves_like 'changing a user', :update_name
end
context 'when the ability to update their name is disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: true)
end
context 'for a regular user' do
it { is_expected.not_to be_allowed(:update_name) }
end
context 'for a ghost user' do
let(:current_user) { create(:user, :ghost) }
it { is_expected.not_to be_allowed(:update_name) }
end
context 'for an admin user' do
let(:current_user) { create(:admin) }
it { is_expected.to be_allowed(:update_name) }
end
end
end
end end
...@@ -136,14 +136,6 @@ describe API::Settings, 'Settings' do ...@@ -136,14 +136,6 @@ describe API::Settings, 'Settings' do
expect(json_response['performance_bar_allowed_group_id']).to eq(group.id) expect(json_response['performance_bar_allowed_group_id']).to eq(group.id)
end end
it "supports updating_name_disabled_for_users" do
put api("/application/settings", admin),
params: { updating_name_disabled_for_users: true }
expect(response).to have_gitlab_http_status(200)
expect(json_response['updating_name_disabled_for_users']).to eq(true)
end
it "supports legacy performance_bar_enabled" do it "supports legacy performance_bar_enabled" do
put api("/application/settings", admin), put api("/application/settings", admin),
params: { params: {
......
...@@ -645,21 +645,6 @@ describe API::Users do ...@@ -645,21 +645,6 @@ describe API::Users do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
context 'updating name' do
context 'when the ability to update their name is disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: true)
end
it 'updates the user with new name' do
put api("/users/#{user.id}", admin), params: { name: 'New Name' }
expect(response).to have_gitlab_http_status(200)
expect(json_response['name']).to eq('New Name')
end
end
end
it "updates user with new bio" do it "updates user with new bio" do
put api("/users/#{user.id}", admin), params: { bio: 'new test bio' } put api("/users/#{user.id}", admin), params: { bio: 'new test bio' }
......
...@@ -6,46 +6,6 @@ describe Users::UpdateService do ...@@ -6,46 +6,6 @@ describe Users::UpdateService do
let(:user) { create(:user) } let(:user) { create(:user) }
describe '#execute' do describe '#execute' do
context 'updating name' do
context 'when the ability to update their name is not disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: false)
end
it 'updates the name' do
result = update_user(user, name: 'New Name')
expect(result).to eq(status: :success)
expect(user.name).to eq('New Name')
end
end
context 'when the ability to update their name is disabled for users' do
before do
stub_application_setting(updating_name_disabled_for_users: true)
end
context 'executing as a regular user' do
it 'does not update the name' do
result = update_user(user, name: 'New Name')
expect(result).to eq(status: :success)
expect(user.name).not_to eq('New Name')
end
end
context 'executing as an admin user' do
it 'updates the name' do
admin = create(:admin)
result = described_class.new(admin, { user: user, name: 'New Name' }).execute
expect(result).to eq(status: :success)
expect(user.name).to eq('New Name')
end
end
end
end
it 'updates time preferences' do it 'updates time preferences' do
result = update_user(user, timezone: 'Europe/Warsaw', time_display_relative: true, time_format_in_24h: false) result = update_user(user, timezone: 'Europe/Warsaw', time_display_relative: true, time_format_in_24h: false)
......
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