Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-10-28 15:09:42 +00:00
parent d2f4295270
commit 03cd4f8da4
43 changed files with 851 additions and 444 deletions

View File

@ -186,6 +186,7 @@ gem 'rack-timeout', '~> 0.5.1', require: 'rack/timeout/base'
group :puma do group :puma do
gem 'puma', '~> 5.3.1', require: false gem 'puma', '~> 5.3.1', require: false
gem 'puma_worker_killer', '~> 0.3.1', require: false gem 'puma_worker_killer', '~> 0.3.1', require: false
gem 'sd_notify', '~> 0.1.0', require: false
end end
# State machine # State machine

View File

@ -1153,6 +1153,7 @@ GEM
addressable (>= 2.3.5) addressable (>= 2.3.5)
faraday (> 0.8, < 2.0) faraday (> 0.8, < 2.0)
scientist (1.6.0) scientist (1.6.0)
sd_notify (0.1.0)
securecompare (1.0.0) securecompare (1.0.0)
seed-fu (2.3.7) seed-fu (2.3.7)
activerecord (>= 3.1) activerecord (>= 3.1)
@ -1605,6 +1606,7 @@ DEPENDENCIES
rugged (~> 1.1) rugged (~> 1.1)
sanitize (~> 5.2.1) sanitize (~> 5.2.1)
sassc-rails (~> 2.1.0) sassc-rails (~> 2.1.0)
sd_notify (~> 0.1.0)
seed-fu (~> 2.3.7) seed-fu (~> 2.3.7)
selenium-webdriver (~> 3.142) selenium-webdriver (~> 3.142)
sentry-raven (~> 3.1) sentry-raven (~> 3.1)

View File

@ -20,7 +20,12 @@ export default () => {
} = domEl.dataset; } = domEl.dataset;
const apolloProvider = new VueApollo({ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(), defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
}); });
// eslint-disable-next-line no-new // eslint-disable-next-line no-new

View File

@ -557,6 +557,14 @@ export default {
v-if="shouldShowMergeControls" v-if="shouldShowMergeControls"
class="gl-display-flex gl-align-items-center gl-flex-wrap" class="gl-display-flex gl-align-items-center gl-flex-wrap"
> >
<merge-train-helper-icon
v-if="shouldRenderMergeTrainHelperIcon"
:merge-train-when-pipeline-succeeds-docs-path="
mr.mergeTrainWhenPipelineSucceedsDocsPath
"
class="gl-mx-3"
/>
<gl-form-checkbox <gl-form-checkbox
v-if="canRemoveSourceBranch" v-if="canRemoveSourceBranch"
id="remove-source-branch-input" id="remove-source-branch-input"
@ -575,13 +583,6 @@ export default {
:is-disabled="isSquashReadOnly" :is-disabled="isSquashReadOnly"
class="gl-mx-3" class="gl-mx-3"
/> />
<merge-train-helper-icon
v-if="shouldRenderMergeTrainHelperIcon"
:merge-train-when-pipeline-succeeds-docs-path="
mr.mergeTrainWhenPipelineSucceedsDocsPath
"
/>
</div> </div>
<template v-else> <template v-else>
<div class="bold js-resolve-mr-widget-items-message gl-ml-3"> <div class="bold js-resolve-mr-widget-items-message gl-ml-3">

View File

@ -146,13 +146,6 @@
* Blame file * Blame file
*/ */
&.blame { &.blame {
//
// IMPORTANT PERFORMANCE OPTIMIZATION
//
// When viewinng a blame with many commits a lot of content is rendered on the page.
// The line below ensures that we only render what is visible to the user, thus reducing TBT in the browser.
content-visibility: auto;
table { table {
border: 0; border: 0;
margin: 0; margin: 0;
@ -167,12 +160,6 @@
} }
td { td {
//
// IMPORTANT PERFORMANCE OPTIMIZATION
//
// When viewinng a blame with many commits a lot of content is rendered on the page.
// The line below ensures that we only render what is visible to the user, thus reducing TBT in the browser.
content-visibility: auto;
border-top: 0; border-top: 0;
border-bottom: 0; border-bottom: 0;
@ -235,6 +222,21 @@
color: $gray-900; color: $gray-900;
} }
} }
//
// IMPORTANT PERFORMANCE OPTIMIZATION
//
// When viewinng a blame with many commits a lot of content is rendered on the page.
// Two selectors below ensure that we only render what is visible to the user, thus reducing TBT in the browser.
.commit {
content-visibility: auto;
contain-intrinsic-size: 1px 3em;
}
code .line {
content-visibility: auto;
contain-intrinsic-size: 1px 1.1875rem;
}
} }
&.logs { &.logs {

View File

@ -15,7 +15,7 @@ module UpdateHighestRole
# Schedule a Sidekiq job to update the highest role for a User # Schedule a Sidekiq job to update the highest role for a User
# #
# The job will be called outside of a transaction in order to ensure the changes # The job will be called outside of a transaction in order to ensure the changes
# to be commited before attempting to update the highest role. # to be committed before attempting to update the highest role.
# The exlusive lease will not be released after completion to prevent multiple jobs # The exlusive lease will not be released after completion to prevent multiple jobs
# being executed during the defined timeout. # being executed during the defined timeout.
def update_highest_role def update_highest_role

View File

@ -155,6 +155,50 @@ Reply by email should now be working.
1. Find the `incoming_email` section in `config/gitlab.yml`, enable the feature 1. Find the `incoming_email` section in `config/gitlab.yml`, enable the feature
and fill in the details for your specific IMAP server and email account (see [examples](#configuration-examples) below). and fill in the details for your specific IMAP server and email account (see [examples](#configuration-examples) below).
If you use systemd units to manage GitLab:
1. Add `gitlab-mailroom.service` as a dependency to `gitlab.target`:
```shell
sudo systemctl edit gitlab.target
```
In the editor that opens, add the following and save the file:
```plaintext
[Unit]
Wants=gitlab-mailroom.service
```
1. If you run Redis and PostgreSQL on the same machine, you should add a
dependency on Redis. Run:
```shell
sudo systemctl edit gitlab-mailroom.service
```
In the editor that opens, add the following and save the file:
```plaintext
[Unit]
Wants=redis-server.service
After=redis-server.service
```
1. Start `gitlab-mailroom.service`:
```shell
sudo systemctl start gitlab-mailroom.service
```
1. Verify that everything is configured correctly:
```shell
sudo -u git -H bundle exec rake gitlab:incoming_email:check RAILS_ENV=production
```
If you use the SysV init script to manage GitLab:
1. Enable `mail_room` in the init script at `/etc/default/gitlab`: 1. Enable `mail_room` in the init script at `/etc/default/gitlab`:
```shell ```shell

View File

@ -132,11 +132,11 @@ The Pages daemon doesn't listen to the outside world.
https: false https: false
artifacts_server: false artifacts_server: false
external_http: ["127.0.0.1:8090"] external_http: ["127.0.0.1:8090"]
secret_file: /home/git/gitlab/gitlab-pages/gitlab-pages-secret secret_file: /home/git/gitlab/gitlab-pages-secret
``` ```
1. Add the following configuration file to 1. Add the following configuration file to
`/home/git/gitlab/gitlab-pages/gitlab-pages.conf`, and be sure to change `/home/git/gitlab-pages/gitlab-pages.conf`, and be sure to change
`example.io` to the FQDN from which you want to serve GitLab Pages and `example.io` to the FQDN from which you want to serve GitLab Pages and
`gitlab.example.com` to the URL of your GitLab instance: `gitlab.example.com` to the URL of your GitLab instance:
@ -159,12 +159,27 @@ The Pages daemon doesn't listen to the outside world.
sudo -u git -H openssl rand -base64 32 > /home/git/gitlab/gitlab-pages-secret sudo -u git -H openssl rand -base64 32 > /home/git/gitlab/gitlab-pages-secret
``` ```
1. Edit `/etc/default/gitlab` and set `gitlab_pages_enabled` to `true` in 1. To enable the pages daemon:
order to enable the pages daemon:
```ini - If your system uses systemd as init, run:
gitlab_pages_enabled=true
``` ```shell
sudo systemctl edit gitlab.target
```
In the editor that opens, add the following and save the file:
```plaintext
[Unit]
Wants=gitlab-pages.service
```
- If your system uses SysV init instead, edit `/etc/default/gitlab` and set
`gitlab_pages_enabled` to `true`:
```ini
gitlab_pages_enabled=true
```
1. Copy the `gitlab-pages` NGINX configuration file: 1. Copy the `gitlab-pages` NGINX configuration file:

View File

@ -103,39 +103,15 @@ If you have followed the official installation guide to [install GitLab from
source](../install/installation.md), run the following command to restart GitLab: source](../install/installation.md), run the following command to restart GitLab:
```shell ```shell
# For systems running systemd
sudo systemctl restart gitlab.target
# For systems running SysV init
sudo service gitlab restart sudo service gitlab restart
``` ```
The output should be similar to this:
```plaintext
Shutting down GitLab Puma
Shutting down GitLab Sidekiq
Shutting down GitLab Workhorse
Shutting down GitLab MailRoom
...
GitLab is not running.
Starting GitLab Puma
Starting GitLab Sidekiq
Starting GitLab Workhorse
Starting GitLab MailRoom
...
The GitLab Puma web server with pid 28059 is running.
The GitLab Sidekiq job dispatcher with pid 28176 is running.
The GitLab Workhorse with pid 28122 is running.
The GitLab MailRoom email processor with pid 28114 is running.
GitLab and all its components are up and running.
```
This should restart Puma, Sidekiq, GitLab Workhorse, and [Mailroom](reply_by_email.md) This should restart Puma, Sidekiq, GitLab Workhorse, and [Mailroom](reply_by_email.md)
(if enabled). The init service file that does all the magic can be found on (if enabled).
your server in `/etc/init.d/gitlab`.
---
If you are using other init systems, like `systemd`, you can check the
[GitLab Recipes](https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init) repository for some unofficial services. These are
**not** officially supported so use them at your own risk.
## Helm chart installations ## Helm chart installations

View File

@ -185,7 +185,7 @@ POST /projects/:id/repository/files/:file_path
```shell ```shell
curl --request POST --header 'PRIVATE-TOKEN: <your_access_token>' \ curl --request POST --header 'PRIVATE-TOKEN: <your_access_token>' \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname",
"content": "some content", "commit_message": "create a new file"}' \ "content": "some content", "commit_message": "create a new file"}' \
"https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb" "https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb"
``` ```
@ -221,7 +221,7 @@ PUT /projects/:id/repository/files/:file_path
```shell ```shell
curl --request PUT --header 'PRIVATE-TOKEN: <your_access_token>' \ curl --request PUT --header 'PRIVATE-TOKEN: <your_access_token>' \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname",
"content": "some content", "commit_message": "update file"}' \ "content": "some content", "commit_message": "update file"}' \
"https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb" "https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb"
``` ```
@ -268,7 +268,7 @@ DELETE /projects/:id/repository/files/:file_path
```shell ```shell
curl --request DELETE --header 'PRIVATE-TOKEN: <your_access_token>' \ curl --request DELETE --header 'PRIVATE-TOKEN: <your_access_token>' \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname",
"commit_message": "delete file"}' \ "commit_message": "delete file"}' \
"https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb" "https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb"
``` ```

View File

@ -81,7 +81,8 @@ microservice_a:
trigger: trigger:
include: include:
- project: 'my-group/my-pipeline-library' - project: 'my-group/my-pipeline-library'
file: 'path/to/ci-config.yml' ref: 'main'
file: '/path/to/child-pipeline.yml'
``` ```
The maximum number of entries that are accepted for `trigger:include:` is three. The maximum number of entries that are accepted for `trigger:include:` is three.
@ -98,7 +99,7 @@ microservice_a:
strategy: depend strategy: depend
``` ```
## Merge Request child pipelines ## Merge request child pipelines
To trigger a child pipeline as a [Merge Request Pipeline](merge_request_pipelines.md) we need to: To trigger a child pipeline as a [Merge Request Pipeline](merge_request_pipelines.md) we need to:
@ -149,7 +150,7 @@ microservice_a:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9.
Instead of running a child pipeline from a static YAML file, you can define a job that runs Instead of running a child pipeline from a static YAML file, you can define a job that runs
your own script to generate a YAML file, which is then [used to trigger a child pipeline](../yaml/index.md#trigger-child-pipeline-with-generated-configuration-file). your own script to generate a YAML file, which is then used to trigger a child pipeline.
This technique can be very powerful in generating pipelines targeting content that changed or to This technique can be very powerful in generating pipelines targeting content that changed or to
build a matrix of targets and architectures. build a matrix of targets and architectures.
@ -171,6 +172,31 @@ configuration for jobs, like scripts, that use the Windows runner would use `\`.
In GitLab 12.9, the child pipeline could fail to be created in certain cases, causing the parent pipeline to fail. In GitLab 12.9, the child pipeline could fail to be created in certain cases, causing the parent pipeline to fail.
This is [resolved](https://gitlab.com/gitlab-org/gitlab/-/issues/209070) in GitLab 12.10. This is [resolved](https://gitlab.com/gitlab-org/gitlab/-/issues/209070) in GitLab 12.10.
### Dynamic child pipeline example
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9.
You can trigger a child pipeline from a [dynamically generated configuration file](../pipelines/parent_child_pipelines.md#dynamic-child-pipelines):
```yaml
generate-config:
stage: build
script: generate-ci-config > generated-config.yml
artifacts:
paths:
- generated-config.yml
child-pipeline:
stage: test
trigger:
include:
- artifact: generated-config.yml
job: generate-config
```
The `generated-config.yml` is extracted from the artifacts and used as the configuration
for triggering the child pipeline.
## Nested child pipelines ## Nested child pipelines
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/29651) in GitLab 13.4. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/29651) in GitLab 13.4.

View File

@ -177,7 +177,7 @@ deploy:
``` ```
In a parent pipeline, it runs the `test` job that subsequently runs a child pipeline, In a parent pipeline, it runs the `test` job that subsequently runs a child pipeline,
and the [`strategy: depend` option](../yaml/index.md#linking-pipelines-with-triggerstrategy) makes the `test` job wait until the child pipeline has finished. and the [`strategy: depend` option](../yaml/index.md#triggerstrategy) makes the `test` job wait until the child pipeline has finished.
The parent pipeline runs the `deploy` job in the next stage, that requires a resource from the `production` resource group. The parent pipeline runs the `deploy` job in the next stage, that requires a resource from the `production` resource group.
If the process mode is `oldest_first`, it executes the jobs from the oldest pipelines, meaning the `deploy` job is going to be executed next. If the process mode is `oldest_first`, it executes the jobs from the oldest pipelines, meaning the `deploy` job is going to be executed next.

View File

@ -113,6 +113,9 @@ This means that whenever a new tag is pushed on project A, the job runs and the
`stage: deploy` ensures that this job runs only after all jobs with `stage: deploy` ensures that this job runs only after all jobs with
`stage: test` complete successfully. `stage: test` complete successfully.
NOTE:
You [cannot use the API to start `when:manual` trigger jobs](https://gitlab.com/gitlab-org/gitlab/-/issues/284086).
## Triggering a pipeline from a webhook ## Triggering a pipeline from a webhook
To trigger a job from a webhook of another project you need to add the following To trigger a job from a webhook of another project you need to add the following

View File

@ -3802,31 +3802,19 @@ deploystacks:
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/8997) in GitLab Premium 11.8. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/8997) in GitLab Premium 11.8.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8. > - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8.
Use `trigger` to define a downstream pipeline trigger. When GitLab starts a `trigger` job, Use `trigger` to start a downstream pipeline that is either:
a downstream pipeline is created.
Jobs with `trigger` can only use a [limited set of keywords](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file). - [A multi-project pipeline](../pipelines/multi_project_pipelines.md).
For example, you can't run commands with [`script`](#script), [`before_script`](#before_script), - [A child pipeline](../pipelines/parent_child_pipelines.md).
or [`after_script`](#after_script).
You can use this keyword to create two different types of downstream pipelines: **Keyword type**: Job keyword. You can use it only as part of a job.
- [Multi-project pipelines](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file) **Possible inputs**:
- [Child pipelines](../pipelines/parent_child_pipelines.md)
In [GitLab 13.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/197140/), you can - For multi-project pipelines, path to the downstream project.
view which job triggered a downstream pipeline. In the [pipeline graph](../pipelines/index.md#visualize-pipelines), - For child pipelines, path to the child pipeline CI/CD configuration file.
hover over the downstream pipeline job.
In [GitLab 13.5 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/201938), you **Example of `trigger` for multi-project pipeline**:
can use [`when:manual`](#when) in the same job as `trigger`. In GitLab 13.4 and
earlier, using them together causes the error `jobs:#{job-name} when should be on_success, on_failure or always`.
You [cannot start `manual` trigger jobs with the API](https://gitlab.com/gitlab-org/gitlab/-/issues/284086).
#### Basic `trigger` syntax for multi-project pipelines
You can configure a downstream trigger by using the `trigger` keyword
with a full path to a downstream project:
```yaml ```yaml
rspec: rspec:
@ -3838,47 +3826,7 @@ staging:
trigger: my/deployment trigger: my/deployment
``` ```
#### Complex `trigger` syntax for multi-project pipelines **Example of `trigger` for child pipelines**:
You can configure a branch name that GitLab uses to create
a downstream pipeline with:
```yaml
rspec:
stage: test
script: bundle exec rspec
staging:
stage: deploy
trigger:
project: my/deployment
branch: stable
```
To mirror the status from a triggered pipeline:
```yaml
trigger_job:
trigger:
project: my/project
strategy: depend
```
To mirror the status from an upstream pipeline:
```yaml
upstream_bridge:
stage: test
needs:
pipeline: other/project
```
#### `trigger` syntax for child pipeline
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/16094) in GitLab 12.7.
To create a [child pipeline](../pipelines/parent_child_pipelines.md), specify the path to the
YAML file that contains the configuration of the child pipeline:
```yaml ```yaml
trigger_job: trigger_job:
@ -3886,71 +3834,36 @@ trigger_job:
include: path/to/child-pipeline.yml include: path/to/child-pipeline.yml
``` ```
Similar to [multi-project pipelines](../pipelines/multi_project_pipelines.md#mirror-status-of-a-triggered-pipeline-in-the-trigger-job), **Additional details**:
it's possible to mirror the status from a triggered pipeline:
```yaml - Jobs with `trigger` can only use a [limited set of keywords](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file).
trigger_job: For example, you can't run commands with [`script`](#script), [`before_script`](#before_script),
trigger: or [`after_script`](#after_script).
include: - In [GitLab 13.5 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/201938), you
- local: path/to/child-pipeline.yml can use [`when:manual`](#when) in the same job as `trigger`. In GitLab 13.4 and
strategy: depend earlier, using them together causes the error `jobs:#{job-name} when should be on_success, on_failure or always`.
``` - In [GitLab 13.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/197140/), you can
view which job triggered a downstream pipeline in the [pipeline graph](../pipelines/index.md#visualize-pipelines).
##### Trigger child pipeline with generated configuration file **Related topics**:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9. - [Multi-project pipeline configuration examples](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file).
- [Child pipeline configuration examples](../pipelines/parent_child_pipelines.md#examples).
- To force a rebuild of a specific branch, tag, or commit, you can
[use an API call with a trigger token](../triggers/index.md).
The trigger token is different than the `trigger` keyword.
You can also trigger a child pipeline from a [dynamically generated configuration file](../pipelines/parent_child_pipelines.md#dynamic-child-pipelines): #### `trigger:strategy`
```yaml Use `trigger:strategy` to force the `trigger` job to wait for the downstream pipeline to complete
generate-config: before it is marked as **success**.
stage: build
script: generate-ci-config > generated-config.yml
artifacts:
paths:
- generated-config.yml
child-pipeline: This behavior is different than the default, which is for the `trigger` job to be marked as
stage: test **success** as soon as the downstream pipeline is created.
trigger:
include:
- artifact: generated-config.yml
job: generate-config
```
The `generated-config.yml` is extracted from the artifacts and used as the configuration This setting makes your pipeline execution linear rather than parallel.
for triggering the child pipeline.
##### Trigger child pipeline with files from another project **Example of `trigger:strategy`**:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/205157) in GitLab 13.5.
To trigger child pipelines with files from another private project under the same
GitLab instance, use [`include:file`](#includefile):
```yaml
child-pipeline:
trigger:
include:
- project: 'my-group/my-pipeline-library'
ref: 'main'
file: '/path/to/child-pipeline.yml'
```
#### Linking pipelines with `trigger:strategy`
By default, the `trigger` job completes with the `success` status
as soon as the downstream pipeline is created.
To force the `trigger` job to wait for the downstream (multi-project or child) pipeline to complete, use
`strategy: depend`. This setting makes the trigger job wait with a "running" status until the triggered
pipeline completes. At that point, the `trigger` job completes and displays the same status as
the downstream job.
This setting can help keep your pipeline execution linear. In the following example, jobs from
subsequent stages wait for the triggered pipeline to successfully complete before
starting, which reduces parallelization.
```yaml ```yaml
trigger_job: trigger_job:
@ -3959,14 +3872,8 @@ trigger_job:
strategy: depend strategy: depend
``` ```
#### Trigger a pipeline by API call In this example, jobs from subsequent stages wait for the triggered pipeline to
successfully complete before starting.
To force a rebuild of a specific branch, tag, or commit, you can use an API call
with a trigger token.
The trigger token is different than the [`trigger`](#trigger) keyword.
[Read more in the triggers documentation.](../triggers/index.md)
### `interruptible` ### `interruptible`
@ -4109,7 +4016,7 @@ deployment:
script: echo "Deploying..." script: echo "Deploying..."
``` ```
You must define [`strategy: depend`](#linking-pipelines-with-triggerstrategy) You must define [`strategy: depend`](#triggerstrategy)
with the `trigger` keyword. This ensures that the lock isn't released until the downstream pipeline with the `trigger` keyword. This ensures that the lock isn't released until the downstream pipeline
finishes. finishes.

View File

@ -234,54 +234,65 @@ Migration tests depend on what the migration does exactly, the most common types
#### Example of a data migration test #### Example of a data migration test
This spec tests the This spec tests the
[`db/post_migrate/20170526185842_migrate_pipeline_stages.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/db/post_migrate/20170526185842_migrate_pipeline_stages.rb) [`db/post_migrate/20200723040950_migrate_incident_issues_to_incident_type.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/post_migrate/20200723040950_migrate_incident_issues_to_incident_type.rb)
migration. You can find the complete spec in migration. You can find the complete spec in
[`spec/migrations/migrate_pipeline_stages_spec.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/spec/migrations/migrate_pipeline_stages_spec.rb). [`spec/migrations/migrate_incident_issues_to_incident_type_spec.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/migrations/migrate_incident_issues_to_incident_type_spec.rb).
```ruby ```ruby
require 'spec_helper' # frozen_string_literal: true
require 'spec_helper'
require_migration! require_migration!
RSpec.describe MigratePipelineStages do RSpec.describe MigrateIncidentIssuesToIncidentType do
# Create test data - pipeline and CI/CD jobs. let(:migration) { described_class.new }
let(:jobs) { table(:ci_builds) }
let(:stages) { table(:ci_stages) }
let(:pipelines) { table(:ci_pipelines) }
let(:projects) { table(:projects) } let(:projects) { table(:projects) }
let(:namespaces) { table(:namespaces) }
let(:labels) { table(:labels) }
let(:issues) { table(:issues) }
let(:label_links) { table(:label_links) }
let(:label_props) { IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES }
let(:namespace) { namespaces.create!(name: 'foo', path: 'foo') }
let!(:project) { projects.create!(namespace_id: namespace.id) }
let(:label) { labels.create!(project_id: project.id, **label_props) }
let!(:incident_issue) { issues.create!(project_id: project.id) }
let!(:other_issue) { issues.create!(project_id: project.id) }
# Issue issue_type enum
let(:issue_type) { 0 }
let(:incident_type) { 1 }
before do before do
projects.create!(id: 123, name: 'gitlab1', path: 'gitlab1') label_links.create!(target_id: incident_issue.id, label_id: label.id, target_type: 'Issue')
pipelines.create!(id: 1, project_id: 123, ref: 'master', sha: 'adf43c3a')
jobs.create!(id: 1, commit_id: 1, project_id: 123, stage_idx: 2, stage: 'build')
jobs.create!(id: 2, commit_id: 1, project_id: 123, stage_idx: 1, stage: 'test')
end end
# Test just the up migration. describe '#up' do
it 'correctly migrates pipeline stages' do it 'updates the incident issue type' do
expect(stages.count).to be_zero expect { migrate! }
.to change { incident_issue.reload.issue_type }
.from(issue_type)
.to(incident_type)
migrate! expect(other_issue.reload.issue_type).to eql(issue_type)
expect(stages.count).to eq 2
expect(stages.all.pluck(:name)).to match_array %w[test build]
end
# Test a reversible migration.
it 'correctly migrates up and down pipeline stages' do
reversible_migration do |migration|
# Expectations will run before the up migration,
# and then again after the down migration
migration.before -> {
expect(stages.count).to be_zero
}
# Expectations will run after the up migration.
migration.after -> {
expect(stages.count).to eq 2
expect(stages.all.pluck(:name)).to match_array %w[test build]
}
end end
end
describe '#down' do
let!(:incident_issue) { issues.create!(project_id: project.id, issue_type: issue_type) }
it 'updates the incident issue type' do
migration.up
expect { migration.down }
.to change { incident_issue.reload.issue_type }
.from(incident_type)
.to(issue_type)
expect(other_issue.reload.issue_type).to eql(issue_type)
end
end
end end
``` ```
@ -357,41 +368,62 @@ end
### Example background migration test ### Example background migration test
This spec tests the This spec tests the
[`lib/gitlab/background_migration/archive_legacy_traces.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/lib/gitlab/background_migration/archive_legacy_traces.rb) [`lib/gitlab/background_migration/backfill_draft_status_on_merge_requests.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/background_migration/backfill_draft_status_on_merge_requests.rb)
background migration. You can find the complete spec on background migration. You can find the complete spec on
[`spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb) [`spec/lib/gitlab/background_migration/backfill_draft_status_on_merge_requests_spec.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/lib/gitlab/background_migration/backfill_draft_status_on_merge_requests_spec.rb)
```ruby ```ruby
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::BackgroundMigration::ArchiveLegacyTraces, schema: 20180529152628 do RSpec.describe Gitlab::BackgroundMigration::BackfillDraftStatusOnMergeRequests do
include TraceHelpers let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:merge_requests) { table(:merge_requests) }
let(:namespaces) { table(:namespaces) } let(:group) { namespaces.create!(name: 'gitlab', path: 'gitlab') }
let(:projects) { table(:projects) } let(:project) { projects.create!(namespace_id: group.id) }
let(:builds) { table(:ci_builds) }
let(:job_artifacts) { table(:ci_job_artifacts) }
before do let(:draft_prefixes) { ["[Draft]", "(Draft)", "Draft:", "Draft", "[WIP]", "WIP:", "WIP"] }
namespaces.create!(id: 123, name: 'gitlab1', path: 'gitlab1')
projects.create!(id: 123, name: 'gitlab1', path: 'gitlab1', namespace_id: 123) def create_merge_request(params)
@build = builds.create!(id: 1, project_id: 123, status: 'success', type: 'Ci::Build') common_params = {
target_project_id: project.id,
target_branch: 'feature1',
source_branch: 'master'
}
merge_requests.create!(common_params.merge(params))
end end
context 'when trace file exists at the right place' do context "for MRs with #draft? == true titles but draft attribute false" do
let(:mr_ids) { merge_requests.all.collect(&:id) }
before do before do
create_legacy_trace(@build, 'trace in file') draft_prefixes.each do |prefix|
(1..4).each do |n|
create_merge_request(
title: "#{prefix} This is a title",
draft: false,
state_id: n
)
end
end
end end
it 'correctly archive legacy traces' do it "updates all open draft merge request's draft field to true" do
expect(job_artifacts.count).to eq(0) mr_count = merge_requests.all.count
expect(File.exist?(legacy_trace_path(@build))).to be_truthy
described_class.new.perform(1, 1) expect { subject.perform(mr_ids.first, mr_ids.last) }
.to change { MergeRequest.where(draft: false).count }
.from(mr_count).to(mr_count - draft_prefixes.length)
end
expect(job_artifacts.count).to eq(1) it "marks successful slices as completed" do
expect(File.exist?(legacy_trace_path(@build))).to be_falsy expect(subject).to receive(:mark_job_as_succeeded).with(mr_ids.first, mr_ids.last)
expect(File.read(archived_trace_path(job_artifacts.first))).to eq('trace in file')
subject.perform(mr_ids.first, mr_ids.last)
end end
end end
end end

View File

@ -423,6 +423,49 @@ echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf
# Grant permission to the socket to all members of the redis group # Grant permission to the socket to all members of the redis group
echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf
# Add git to the redis group
sudo usermod -aG redis git
```
### Supervise Redis with systemd
If your distribution uses systemd init and the output of the following command is `notify`,
you do not need to make any changes:
```shell
systemctl show --value --property=Type redis-server.service
```
If the output is **not** `notify`, run:
```shell
# Configure Redis to not daemonize, but be supervised by systemd instead and disable the pidfile
sudo sed -i \
-e 's/^daemonize yes$/daemonize no/' \
-e 's/^supervised no$/supervised systemd/' \
-e 's/^pidfile/# pidfile/' /etc/redis/redis.conf
sudo chown redis:redis /etc/redis/redis.conf
# Make the same changes to the systemd unit file
sudo mkdir -p /etc/systemd/system/redis-server.service.d
sudo tee /etc/systemd/system/redis-server.service.d/10fix_type.conf <<EOF
[Service]
Type=notify
PIDFile=
EOF
# Reload the redis service
sudo systemctl daemon-reload
# Activate the changes to redis.conf
sudo systemctl restart redis-server.service
```
### Leave Redis unsupervised
If your system uses SysV init, run these commands:
```shell
# Create the directory which contains the socket # Create the directory which contains the socket
sudo mkdir -p /var/run/redis sudo mkdir -p /var/run/redis
sudo chown redis:redis /var/run/redis sudo chown redis:redis /var/run/redis
@ -435,9 +478,6 @@ fi
# Activate the changes to redis.conf # Activate the changes to redis.conf
sudo service redis-server restart sudo service redis-server restart
# Add git to the redis group
sudo usermod -aG redis git
``` ```
## 8. GitLab ## 8. GitLab
@ -687,17 +727,124 @@ sudo -u git -H editor config.toml
For more information about configuring Gitaly see For more information about configuring Gitaly see
[the Gitaly documentation](../administration/gitaly/index.md). [the Gitaly documentation](../administration/gitaly/index.md).
### Install the service
GitLab has always supported SysV init scripts, which are widely supported and portable, but now systemd is the standard for service supervision and is used by all major Linux distributions. You should use native systemd services if you can to benefit from automatic restarts, better sandboxing and resource control.
#### Install systemd units
Use these steps if you use systemd as init. Otherwise, follow the [SysV init script steps](#install-sysv-init-script).
Copy the services and run `systemctl daemon-reload` so that systemd picks them up:
```shell
cd /home/git/gitlab
sudo mkdir -p /usr/local/lib/systemd/system
sudo cp lib/support/systemd/* /usr/local/lib/systemd/system/
sudo systemctl daemon-reload
```
The units provided by GitLab make very little assumptions about where you are running Redis and PostgreSQL.
If you installed GitLab in another directory or as a user other than the default, you need to change these values in the units as well.
For example, if you're running Redis and PostgreSQL on the same machine as GitLab, you should:
- Edit the Puma service:
```shell
sudo systemctl edit gitlab-puma.service
```
In the editor that opens, add the following and save the file:
```plaintext
[Unit]
Wants=redis-server.service postgresql.service
After=redis-server.service postgresql.service
```
- Edit the Sidekiq service:
```shell
sudo systemctl edit gitlab-sidekiq.service
```
Add the following and save the file:
```plaintext
[Unit]
Wants=redis-server.service postgresql.service
After=redis-server.service postgresql.service
```
`systemctl edit` installs drop-in configuration files at `/etc/systemd/system/<name of the unit>.d/override.conf`, so your local configuration is not overwritten when updating the unit files later. To split up your drop-in configuration files, you can add the above snippets to `.conf` files under `/etc/systemd/system/<name of the unit>.d/`.
If you manually made changes to the unit files or added drop-in configuration files (without using `systemctl edit`), run the following command for them to take effect:
```shell
sudo systemctl daemon-reload
```
Make GitLab start on boot:
```shell
sudo systemctl enable gitlab.target
```
#### Install SysV init script
Use these steps if you use the SysV init script. If you use systemd, follow the [systemd unit steps](#install-systemd-units).
Download the init script (is `/etc/init.d/gitlab`):
```shell
cd /home/git/gitlab
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
```
And if you are installing with a non-default folder or user, copy and edit the defaults file:
```shell
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
```
If you installed GitLab in another directory or as a user other than the default, you should change these settings in `/etc/default/gitlab`. Do not edit `/etc/init.d/gitlab` as it is changed on upgrade.
Make GitLab start on boot:
```shell
sudo update-rc.d gitlab defaults 21
# or if running this on a machine running systemd
sudo systemctl daemon-reload
sudo systemctl enable gitlab.service
```
### Set up Logrotate
```shell
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
```
### Start Gitaly ### Start Gitaly
Gitaly must be running for the next section. Gitaly must be running for the next section.
```shell - To start Gitaly using systemd:
gitlab_path=/home/git/gitlab
gitaly_path=/home/git/gitaly
sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids/gitaly.pid \ ```shell
$gitaly_path/_build/bin/gitaly $gitaly_path/config.toml >> $gitlab_path/log/gitaly.log 2>&1 &" sudo systemctl start gitlab-gitaly.service
``` ```
- To manually start Gitaly for SysV:
```shell
gitlab_path=/home/git/gitlab
gitaly_path=/home/git/gitaly
sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids/gitaly.pid \
$gitaly_path/_build/bin/gitaly $gitaly_path/config.toml >> $gitlab_path/log/gitaly.log 2>&1 &"
```
### Initialize Database and Activate Advanced Features ### Initialize Database and Activate Advanced Features
@ -724,34 +871,6 @@ The `secrets.yml` file stores encryption keys for sessions and secure variables.
Backup `secrets.yml` someplace safe, but don't store it in the same place as your database backups. Backup `secrets.yml` someplace safe, but don't store it in the same place as your database backups.
Otherwise, your secrets are exposed if one of your backups is compromised. Otherwise, your secrets are exposed if one of your backups is compromised.
### Install Init Script
Download the init script (is `/etc/init.d/gitlab`):
```shell
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
```
And if you are installing with a non-default folder or user, copy and edit the defaults file:
```shell
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
```
If you installed GitLab in another directory or as a user other than the default, you should change these settings in `/etc/default/gitlab`. Do not edit `/etc/init.d/gitlab` as it is changed on upgrade.
Make GitLab start on boot:
```shell
sudo update-rc.d gitlab defaults 21
```
### Set up Logrotate
```shell
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
```
### Check Application Status ### Check Application Status
Check if GitLab and its environment are configured correctly: Check if GitLab and its environment are configured correctly:
@ -782,9 +901,11 @@ sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_
### Start Your GitLab Instance ### Start Your GitLab Instance
```shell ```shell
# For systems running systemd
sudo systemctl start gitlab.target
# For systems running SysV init
sudo service gitlab start sudo service gitlab start
# or
sudo /etc/init.d/gitlab restart
``` ```
## 9. NGINX ## 9. NGINX
@ -857,6 +978,10 @@ nginx: configuration file /etc/nginx/nginx.conf test failed
### Restart ### Restart
```shell ```shell
# For systems running systemd
sudo systemctl restart nginx.service
# For systems running SysV init
sudo service nginx restart sudo service nginx restart
``` ```
@ -889,7 +1014,10 @@ earlier and login. After login, you can change the username if you wish.
**Enjoy!** **Enjoy!**
You can use `sudo service gitlab start` and `sudo service gitlab stop` to start and stop GitLab. To start and stop GitLab when using:
- systemd units: use `sudo systemctl start gitlab.target` or `sudo systemctl stop gitlab.target`.
- The SysV init script: use `sudo service gitlab start` or `sudo service gitlab stop`.
## Advanced Setup Tips ## Advanced Setup Tips

View File

@ -101,8 +101,9 @@ Make sure to follow all steps below:
gitlab_url: http://127.0.0.1/gitlab gitlab_url: http://127.0.0.1/gitlab
``` ```
1. Make sure you have copied the supplied init script and the defaults file 1. Make sure you have copied either the supplied systemd services, or the init
as stated in the [installation guide](installation.md#install-init-script). script and the defaults file, as stated in the
[installation guide](installation.md#install-the-service).
Then, edit `/etc/default/gitlab` and set in `gitlab_workhorse_options` the Then, edit `/etc/default/gitlab` and set in `gitlab_workhorse_options` the
`-authBackend` setting to read like: `-authBackend` setting to read like:

View File

@ -306,8 +306,8 @@ and [Helm Chart deployments](https://docs.gitlab.com/charts/). They come with ap
### 14.5.0 ### 14.5.0
When `make` is run, Gitaly builds are now created in `_build/bin` and no longer in the root directory of the source directory. If you When `make` is run, Gitaly builds are now created in `_build/bin` and no longer in the root directory of the source directory. If you
are using a source install, update paths to these binaries in your init scripts by are using a source install, update paths to these binaries in your [systemd unit files](upgrading_from_source.md#configure-systemd-units)
[following the documentation](upgrading_from_source.md#init-script). or [init scripts](upgrading_from_source.md#configure-sysv-init-script) by [following the documentation](upgrading_from_source.md).
### 14.4.0 ### 14.4.0

View File

@ -20,6 +20,10 @@ It's useful to make a backup just in case things go south. Depending on the inst
### 1. Stop server ### 1. Stop server
```shell ```shell
# For systems running systemd
sudo systemctl stop gitlab.target
# For systems running SysV init
sudo service gitlab stop sudo service gitlab stop
``` ```
@ -108,6 +112,11 @@ Please follow the [install instruction](../integration/elasticsearch.md#install-
### 9. Start application ### 9. Start application
```shell ```shell
# For systems running systemd
sudo systemctl start gitlab.target
sudo systemctl restart nginx.service
# For systems running SysV init
sudo service gitlab start sudo service gitlab start
sudo service nginx restart sudo service nginx restart
``` ```

View File

@ -54,6 +54,10 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
### 2. Stop server ### 2. Stop server
```shell ```shell
# For systems running systemd
sudo systemctl stop gitlab.target
# For systems running SysV init
sudo service gitlab stop sudo service gitlab stop
``` ```
@ -230,7 +234,29 @@ ActionMailer::Base.delivery_method = :smtp
See [`smtp_settings.rb.sample`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/initializers/smtp_settings.rb.sample#L13) as an example. See [`smtp_settings.rb.sample`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/initializers/smtp_settings.rb.sample#L13) as an example.
#### Init script #### Configure systemd units
If using the SysV init script, see [Configure SysV init script](#configure-sysv-init-script).
Check if the systemd units have been updated:
```shell
cd /home/git/gitlab
git diff origin/PREVIOUS_BRANCH:lib/support/systemd origin/BRANCH:lib/support/systemd
```
Copy them over:
```shell
sudo mkdir -p /usr/local/lib/systemd/system
sudo cp lib/support/systemd/* /usr/local/lib/systemd/system/
sudo systemctl daemon-reload
```
#### Configure SysV init script
If using systemd units, see [Configure systemd units](#configure-systemd-units).
There might be new configuration options available for There might be new configuration options available for
[`gitlab.default.example`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/support/init.d/gitlab.default.example). [`gitlab.default.example`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/support/init.d/gitlab.default.example).
@ -250,7 +276,7 @@ cd /home/git/gitlab
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
``` ```
For Ubuntu 16.04.1 LTS: If you are using the init script on a system running systemd as init, because you have not switched to native systemd units yet, run:
```shell ```shell
sudo systemctl daemon-reload sudo systemctl daemon-reload
@ -342,6 +368,11 @@ sudo -u git -H make
### 15. Start application ### 15. Start application
```shell ```shell
# For systems running systemd
sudo systemctl start gitlab.target
sudo systemctl restart nginx.service
# For systems running SysV init
sudo service gitlab start sudo service gitlab start
sudo service nginx restart sudo service nginx restart
``` ```

View File

@ -125,8 +125,6 @@ You can also use [Kroki](https://kroki.io) to create a wide variety of diagrams.
#### Mermaid #### Mermaid
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/15107) in GitLab 10.3.
Visit the [official page](https://mermaidjs.github.io/) for more details. The Visit the [official page](https://mermaidjs.github.io/) for more details. The
[Mermaid Live Editor](https://mermaid-js.github.io/mermaid-live-editor/) helps you [Mermaid Live Editor](https://mermaid-js.github.io/mermaid-live-editor/) helps you
learn Mermaid and debug issues in your Mermaid code. Use it to identify and resolve learn Mermaid and debug issues in your Mermaid code. Use it to identify and resolve
@ -211,7 +209,7 @@ Sometimes you want to :monkey: around a bit and add some :star2: to your :speech
You can use it to point out a :bug: or warn about :speak_no_evil: patches. And if someone improves your really :snail: code, send them some :birthday:. People :heart: you for that. You can use it to point out a :bug: or warn about :speak_no_evil: patches. And if someone improves your really :snail: code, send them some :birthday:. People :heart: you for that.
If you're new to this, don't be :fearful:. You can join the emoji :family:. All you need to do is to look up one of the supported codes. If you're new to this, don't be :fearful:. You can join the emoji :family:. Just look up one of the supported codes.
Consult the [Emoji Cheat Sheet](https://www.emojicopy.com) for a list of all supported emoji codes. :thumbsup: Consult the [Emoji Cheat Sheet](https://www.emojicopy.com) for a list of all supported emoji codes. :thumbsup:
``` ```
@ -222,7 +220,7 @@ Sometimes you want to <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/ma
You can use it to point out a<img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/bug.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> or warn about <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/speak_no_evil.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> patches. If someone improves your really <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/snail.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> code, send them some <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/birthday.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. People <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/heart.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> you for that. You can use it to point out a<img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/bug.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> or warn about <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/speak_no_evil.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> patches. If someone improves your really <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/snail.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> code, send them some <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/birthday.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. People <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/heart.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> you for that.
If you're new to this, don't be <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/fearful.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. You can join the emoji <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/family.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. All you need to do is to look up one of the supported codes. If you're new to this, don't be <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/fearful.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. You can join the emoji <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/family.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. Just look up one of the supported codes.
Consult the [Emoji Cheat Sheet](https://www.webfx.com/tools/emoji-cheat-sheet/) for a list of all supported emoji codes. <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/thumbsup.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> Consult the [Emoji Cheat Sheet](https://www.webfx.com/tools/emoji-cheat-sheet/) for a list of all supported emoji codes. <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/thumbsup.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">
@ -244,8 +242,6 @@ this font installed by default.
### Front matter ### Front matter
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/23331) in GitLab 11.6.
Front matter is metadata included at the beginning of a Markdown document, preceding Front matter is metadata included at the beginning of a Markdown document, preceding
the content. This data can be used by static site generators like [Jekyll](https://jekyllrb.com/docs/front-matter/), the content. This data can be used by static site generators like [Jekyll](https://jekyllrb.com/docs/front-matter/),
[Hugo](https://gohugo.io/content-management/front-matter/), and many other applications. [Hugo](https://gohugo.io/content-management/front-matter/), and many other applications.
@ -356,18 +352,18 @@ in a [code block](#code-spans-and-blocks) with the language declared as `math` i
on a separate line: on a separate line:
````markdown ````markdown
This math is inline $`a^2+b^2=c^2`$. This math is inline: $`a^2+b^2=c^2`$.
This is on a separate line: This math is on a separate line:
```math ```math
a^2+b^2=c^2 a^2+b^2=c^2
``` ```
```` ````
This math is inline $`a^2+b^2=c^2`$. This math is inline: $`a^2+b^2=c^2`$.
This is on a separate line This math is on a separate line:
```math ```math
a^2+b^2=c^2 a^2+b^2=c^2
@ -408,16 +404,17 @@ To create a task list, follow the format of an ordered or unordered list:
### Table of contents ### Table of contents
A table of contents is an unordered list that links to subheadings in the document. A table of contents is an unordered list that links to subheadings in the document.
To add a table of contents to a Markdown file, wiki page, issue request, or merge request
description, add either the `[[_TOC_]]` or `[TOC]` tag on its own line.
NOTE:
You can add a table of contents to issues and merge requests, but you can't add one You can add a table of contents to issues and merge requests, but you can't add one
to notes or comments. to notes or comments. Add either the `[[_TOC_]]` or `[TOC]` tag on its own line
to the **Description** field of any of the supported content types:
- Markdown files.
- Wiki pages.
- Issues.
- Merge requests.
```markdown ```markdown
This is an intro sentence to my Wiki page. This sentence introduces my wiki page.
[[_TOC_]] [[_TOC_]]
@ -579,7 +576,7 @@ by starting the lines of the blockquote with `>`:
Quote break. Quote break.
> This is a very long line that is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote. > This very long line is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote.
``` ```
> Blockquotes help you emulate reply text. > Blockquotes help you emulate reply text.
@ -587,7 +584,7 @@ Quote break.
Quote break. Quote break.
> This is a very long line that is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote. > This very long line is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote.
#### Multiline blockquote #### Multiline blockquote
@ -706,7 +703,7 @@ puts markdown.to_html
``` ```
No language indicated, so no syntax highlighting. No language indicated, so no syntax highlighting.
s = "There is no highlighting for this." s = "No highlighting is shown for this line."
But let's throw in a <b>tag</b>. But let's throw in a <b>tag</b>.
``` ```
```` ````
@ -733,13 +730,13 @@ puts markdown.to_html
```plaintext ```plaintext
No language indicated, so no syntax highlighting. No language indicated, so no syntax highlighting.
s = "There is no highlighting for this." s = "No highlighting is shown for this line."
But let's throw in a <b>tag</b>. But let's throw in a <b>tag</b>.
``` ```
### Emphasis ### Emphasis
There are multiple ways to emphasize text in Markdown. You can italicize, bold, strikethrough, In Markdown, you can emphasize text in multiple ways. You can italicize, bold, strikethrough,
and combine these emphasis styles together. and combine these emphasis styles together.
Strikethrough is not part of the core Markdown standard, but is part of GitLab Flavored Markdown. Strikethrough is not part of the core Markdown standard, but is part of GitLab Flavored Markdown.
@ -819,9 +816,9 @@ Do not edit the following codeblock. It uses HTML to skip the Vale ReferenceLink
This reference tag is a mix of letters and numbers. [^footnote-42] This reference tag is a mix of letters and numbers. [^footnote-42]
&#91;^1]: This is the text inside a footnote. &#91;^1]: This text is inside a footnote.
&#91;^footnote-42]: This is another footnote. &#91;^footnote-42]: This text is another footnote.
</code></pre> </code></pre>
A footnote reference tag looks like this:[^1] A footnote reference tag looks like this:[^1]
@ -833,9 +830,9 @@ Do not delete the single space before the [^1] and [^footnotes] references below
These are used to force the Vale ReferenceLinks check to skip these examples. These are used to force the Vale ReferenceLinks check to skip these examples.
--> -->
[^1]: This is the text inside a footnote. [^1]: This text is inside a footnote.
[^footnote-42]: This is another footnote. [^footnote-42]: This text is another footnote.
### Headers ### Headers
@ -893,8 +890,8 @@ Would generate the following link IDs:
1. `this-header-has-spaces-in-it-2` 1. `this-header-has-spaces-in-it-2`
1. `this-header-has-3-5-in-it-and-parentheses` 1. `this-header-has-3-5-in-it-and-parentheses`
Note that the emoji processing happens before the header IDs are generated, so the Emoji processing happens before the header IDs are generated. The
emoji is converted to an image which is then removed from the ID. emoji is converted to an image, which is then removed from the ID.
### Horizontal Rule ### Horizontal Rule
@ -934,7 +931,7 @@ Reference-style (hover to see title text):
</code></pre> </code></pre>
<!-- <!--
DO NOT change the name of markdown_logo.png. This is used for a test in DO NOT change the name of markdown_logo.png. This file is used for a test in
spec/controllers/help_controller_spec.rb. spec/controllers/help_controller_spec.rb.
--> -->
@ -951,7 +948,7 @@ Do not change to a reference style link.
![alt text](img/markdown_logo.png "Title Text") ![alt text](img/markdown_logo.png "Title Text")
In the rare case where you need to set a specific height or width for an image, In the rare case where you must set a specific height or width for an image,
you can use the `img` HTML tag instead of Markdown and set its `height` and you can use the `img` HTML tag instead of Markdown and set its `height` and
`width` parameters. `width` parameters.
@ -1129,8 +1126,8 @@ These details <em>remain</em> <b>hidden</b> until expanded.
### Line breaks ### Line breaks
A line break is inserted (a new paragraph starts) if the previous text is A line break is inserted (a new paragraph starts) if the previous text is
ended with two newlines, like when you hit <kbd>Enter</kbd> twice in a row. If you only ended with two newlines, like when you press <kbd>Enter</kbd> twice in a row. If you only
use one newline (hit <kbd>Enter</kbd> once), the next sentence remains part of the use one newline (select <kbd>Enter</kbd> once), the next sentence remains part of the
same paragraph. Use this approach if you want to keep long lines from wrapping, and keep same paragraph. Use this approach if you want to keep long lines from wrapping, and keep
them editable: them editable:
@ -1156,7 +1153,8 @@ in the *same paragraph*.
#### Newlines #### Newlines
GitLab Flavored Markdown adheres to the Markdown specification in how [paragraphs and line breaks are handled](https://spec.commonmark.org/current/). GitLab Flavored Markdown adheres to the Markdown specification for handling
[paragraphs and line breaks](https://spec.commonmark.org/current/).
A paragraph is one or more consecutive lines of text, separated by one or A paragraph is one or more consecutive lines of text, separated by one or
more blank lines (two newlines at the end of the first paragraph), as [explained above](#line-breaks). more blank lines (two newlines at the end of the first paragraph), as [explained above](#line-breaks).
@ -1178,25 +1176,25 @@ A new line due to the previous backslash.
### Links ### Links
There are two ways to create links, inline-style and reference-style: You can create links two ways: inline-style and reference-style. For example:
<!-- <!--
Do not edit the following codeblock. It uses HTML to skip the Vale ReferenceLinks test. Do not edit the following codeblock. It uses HTML to skip the Vale ReferenceLinks test.
--> -->
<pre class="highlight"><code>- This is an [inline-style link](https://www.google.com) <pre class="highlight"><code>- This line shows an [inline-style link](https://www.google.com)
- This is a [link to a repository file in the same directory](index.md) - This line shows a [link to a repository file in the same directory](index.md)
- This is a [relative link to a readme one directory higher](../index.md) - This line shows a [relative link to a readme one directory higher](../index.md)
- This is a [link that also has title text](https://www.google.com "This link takes you to Google!") - This line shows a [link that also has title text](https://www.google.com "This link takes you to Google!")
Using header ID anchors: Using header ID anchors:
- This links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview) - This line links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview)
- This links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links) - This line links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links)
Using references: Using references:
- This is a [reference-style link, see below][Arbitrary case-insensitive reference text] - This line shows a [reference-style link, see below][Arbitrary case-insensitive reference text]
- You can [use numbers for reference-style link definitions, see below][1] - You can [use numbers for reference-style link definitions, see below][1]
- Or leave it empty and use the [link text itself][], see below. - Or leave it empty and use the [link text itself][], see below.
@ -1207,15 +1205,15 @@ Some text to show that the reference links can follow later.
&#91;link text itself]: https://www.reddit.com &#91;link text itself]: https://www.reddit.com
</code></pre> </code></pre>
- This is an [inline-style link](https://www.google.com) - This line shows an [inline-style link](https://www.google.com)
- This is a [link to a repository file in the same directory](index.md) - This line shows a [link to a repository file in the same directory](index.md)
- This is a [relative link to a README one directory higher](../index.md) - This line shows a [relative link to a README one directory higher](../index.md)
- This is a [link that also has title text](https://www.google.com "This link takes you to Google!") - This line shows a [link that also has title text](https://www.google.com "This link takes you to Google!")
Using header ID anchors: Using header ID anchors:
- This links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview) - This line links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview)
- This links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links) - This line links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links)
Using references: Using references:
@ -1224,7 +1222,7 @@ The example below uses in-line links to pass the Vale ReferenceLinks test.
Do not change to reference style links. Do not change to reference style links.
--> -->
- This is a [reference-style link, see below](https://www.mozilla.org/en-US/) - This line is a [reference-style link, see below](https://www.mozilla.org/en-US/)
- You can [use numbers for reference-style link definitions, see below](https://slashdot.org) - You can [use numbers for reference-style link definitions, see below](https://slashdot.org)
- Or leave it empty and use the [link text itself](https://www.reddit.com), see below. - Or leave it empty and use the [link text itself](https://www.reddit.com), see below.
@ -1232,7 +1230,7 @@ Some text to show that the reference links can follow later.
NOTE: NOTE:
Relative links do not allow the referencing of project files in a wiki Relative links do not allow the referencing of project files in a wiki
page, or a wiki page in a project file. The reason for this is that a wiki is always page, or a wiki page in a project file. The reason: a wiki is always
in a separate Git repository in GitLab. For example, `[I'm a reference-style link](style)` in a separate Git repository in GitLab. For example, `[I'm a reference-style link](style)`
points the link to `wikis/style` only when the link is inside of a wiki Markdown file. points the link to `wikis/style` only when the link is inside of a wiki Markdown file.
@ -1261,14 +1259,14 @@ GitLab Flavored Markdown auto-links almost any URL you put into your text:
<!-- vale gitlab.Spelling = YES --> <!-- vale gitlab.Spelling = YES -->
### Lists ### Lists
Ordered and unordered lists can be created. You can create ordered and unordered lists.
For an ordered list, add the number you want the list For an ordered list, add the number you want the list
to start with, like `1.`, followed by a space, at the start of each line for ordered lists. to start with, like `1.`, followed by a space, at the start of each line for ordered lists.
After the first number, it does not matter what number you use, ordered lists are After the first number, it does not matter what number you use. Ordered lists are
numbered automatically by vertical order, so repeating `1.` for all items in the numbered automatically by vertical order, so repeating `1.` for all items in the
same list is common. If you start with a number other than `1.`, it uses that as the first same list is common. If you start with a number other than `1.`, it uses that as the first
number, and count up from there. number, and counts up from there.
Examples: Examples:
@ -1360,10 +1358,9 @@ Example:
--- ---
If the paragraph of the first item is not indented with the proper number of spaces, If the first item's paragraph isn't indented with the proper number of spaces,
the paragraph appears outside the list, instead of properly indented under the list item. the paragraph appears outside the list, instead of properly indented under the list item.
For example:
Example:
```markdown ```markdown
1. First ordered list item 1. First ordered list item
@ -1455,13 +1452,13 @@ use `<br>` tags to force a cell to have multiple lines:
```markdown ```markdown
| Name | Details | | Name | Details |
| --- | --- | | --- | --- |
| Item1 | This is on one line | | Item1 | This text is on one line |
| Item2 | This item has:<br>- Multiple items<br>- That we want listed separately | | Item2 | This item has:<br>- Multiple items<br>- That we want listed separately |
``` ```
| Name | Details | | Name | Details |
| --- | --- | | --- | --- |
| Item1 | This is on one line | | Item1 | This text is on one line |
| Item2 | This item has:<br>- Multiple items<br>- That we want listed separately | | Item2 | This item has:<br>- Multiple items<br>- That we want listed separately |
You can use HTML formatting in GitLab itself to add [task lists](#task-lists) with checkboxes, You can use HTML formatting in GitLab itself to add [task lists](#task-lists) with checkboxes,

View File

@ -0,0 +1,17 @@
[Unit]
Description=GitLab Gitaly
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
ExecStart=/home/git/gitaly/_build/bin/gitaly /home/git/gitaly/config.toml
Restart=on-failure
SyslogIdentifier=gitlab-gitaly
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target

View File

@ -0,0 +1,19 @@
[Unit]
Description=GitLab Mailroom
PartOf=gitlab.target
After=network.target
StartLimitIntervalSec=100s
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
ExecStart=/usr/local/bin/bundle exec mail_room --log-exit-as json --quiet --config /home/git/gitlab/config/mail_room.yml
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-mailroom
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target

View File

@ -0,0 +1,19 @@
[Unit]
Description=GitLab Pages
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target gitlab-puma.service
Wants=gitlab-puma.service
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
ExecStart=/home/git/gitlab-pages/gitlab-pages -config /home/git/gitlab-pages/gitlab-pages.conf
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-pages
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target

View File

@ -0,0 +1,26 @@
[Unit]
Description=GitLab
Conflicts=gitlab.service
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target
StartLimitIntervalSec=100s
[Service]
Type=notify
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
ExecStart=/usr/local/bin/bundle exec puma --config /home/git/gitlab/config/puma.rb --environment production --pidfile /home/git/gitlab/tmp/pids/puma.pid
ExecReload=/usr/bin/kill -USR2 $MAINPID
PIDFile=/home/git/gitlab/tmp/pids/puma.pid
# puma can be slow to start
TimeoutStartSec=120
WatchdogSec=10
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-puma
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target

View File

@ -0,0 +1,22 @@
[Unit]
Description=GitLab Sidekiq
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target
JoinsNamespaceOf=gitlab-puma.service
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
ExecStart=/usr/local/bin/bundle exec sidekiq --config /home/git/gitlab/config/sidekiq_queues.yml --environment production
ExecStop=/usr/local/bin/bundle exec sidekiqctl stop /run/gitlab/sidekiq.pid
PIDFile=/home/git/gitlab/tmp/pids/sidekiq.pid
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-sidekiq
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target

View File

@ -0,0 +1,21 @@
[Unit]
Description=GitLab Workhorse
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target gitlab-puma.service
Wants=gitlab-puma.service
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
Environment=PATH=/home/git/gitlab-workhorse:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=/home/git/gitlab-workhorse/gitlab-workhorse -listenUmask 0 -listenNetwork unix -listenAddr /home/git/gitlab/tmp/sockets/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080 -authSocket /home/git/gitlab/tmp/sockets/gitlab.socket -documentRoot /home/git/gitlab/public -secretPath /home/git/gitlab/.gitlab_workhorse_secret
ExecReload=/usr/bin/kill -USR2 $MAINPID
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-workhorse
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target

View File

@ -0,0 +1,8 @@
[Unit]
Description=Slice to bundle all GitLab services
Before=slices.target
[Slice]
MemoryAccounting=true
IOAccounting=true
CPUAccounting=true

View File

@ -0,0 +1,6 @@
[Unit]
Description=GitLab
Wants=gitlab-gitaly.service gitlab-puma.service gitlab-sidekiq.service gitlab-workhorse.service
[Install]
WantedBy=multi-user.target

View File

@ -1,29 +0,0 @@
# frozen_string_literal: true
module SystemCheck
module App
class InitScriptExistsCheck < SystemCheck::BaseCheck
set_name 'Init script exists?'
set_skip_reason 'skipped (omnibus-gitlab has no init script)'
def skip?
omnibus_gitlab?
end
def check?
script_path = '/etc/init.d/gitlab'
File.exist?(script_path)
end
def show_error
try_fixing_it(
'Install the init script'
)
for_more_information(
see_installation_guide_section('Install Init Script')
)
fix_and_rerun
end
end
end
end

View File

@ -1,47 +0,0 @@
# frozen_string_literal: true
module SystemCheck
module App
class InitScriptUpToDateCheck < SystemCheck::BaseCheck
SCRIPT_PATH = '/etc/init.d/gitlab'
set_name 'Init script up-to-date?'
set_skip_reason 'skipped (omnibus-gitlab has no init script)'
def skip?
return true if omnibus_gitlab?
unless init_file_exists?
self.skip_reason = "can't check because of previous errors"
true
end
end
def check?
recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
recipe_content = File.read(recipe_path)
script_content = File.read(SCRIPT_PATH)
recipe_content == script_content
end
def show_error
try_fixing_it(
'Re-download the init script'
)
for_more_information(
see_installation_guide_section('Install Init Script')
)
fix_and_rerun
end
private
def init_file_exists?
File.exist?(SCRIPT_PATH)
end
end
end
end

View File

@ -0,0 +1,39 @@
# frozen_string_literal: true
module SystemCheck
module App
class SystemdUnitFilesOrInitScriptExistCheck < SystemCheck::BaseCheck
set_name 'Systemd unit files or init script exist?'
set_skip_reason 'skipped (omnibus-gitlab has neither init script nor systemd units)'
def skip?
omnibus_gitlab?
end
def check?
unit_paths = [
'/usr/local/lib/systemd/system/gitlab-gitaly.service',
'/usr/local/lib/systemd/system/gitlab-mailroom.service',
'/usr/local/lib/systemd/system/gitlab-puma.service',
'/usr/local/lib/systemd/system/gitlab-sidekiq.service',
'/usr/local/lib/systemd/system/gitlab.slice',
'/usr/local/lib/systemd/system/gitlab.target',
'/usr/local/lib/systemd/system/gitlab-workhorse.service'
]
script_path = '/etc/init.d/gitlab'
unit_paths.all? { |s| File.exist?(s) } || File.exist?(script_path)
end
def show_error
try_fixing_it(
'Install the Service'
)
for_more_information(
see_installation_guide_section('Install the Service')
)
fix_and_rerun
end
end
end
end

View File

@ -0,0 +1,80 @@
# frozen_string_literal: true
module SystemCheck
module App
class SystemdUnitFilesOrInitScriptUpToDateCheck < SystemCheck::BaseCheck
SCRIPT_PATH = '/etc/init.d/gitlab'
UNIT_PATHS = [
'/usr/local/lib/systemd/system/gitlab-gitaly.service',
'/usr/local/lib/systemd/system/gitlab-mailroom.service',
'/usr/local/lib/systemd/system/gitlab-puma.service',
'/usr/local/lib/systemd/system/gitlab-sidekiq.service',
'/usr/local/lib/systemd/system/gitlab.slice',
'/usr/local/lib/systemd/system/gitlab.target',
'/usr/local/lib/systemd/system/gitlab-workhorse.service'
].freeze
set_name 'Systemd unit files or init script up-to-date?'
set_skip_reason 'skipped (omnibus-gitlab has neither init script nor systemd units)'
def skip?
return true if omnibus_gitlab?
unless unit_files_exist? || init_file_exists?
self.skip_reason = "can't check because of previous errors"
true
end
end
def check?
if unit_files_exist?
return unit_files_up_to_date?
end
init_file_up_to_date?
end
def show_error
try_fixing_it(
'Install the Service'
)
for_more_information(
see_installation_guide_section('Install the Service')
)
fix_and_rerun
end
private
def init_file_exists?
File.exist?(SCRIPT_PATH)
end
def unit_files_exist?
UNIT_PATHS.all? { |s| File.exist?(s) }
end
def init_file_up_to_date?
recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
recipe_content = File.read(recipe_path)
script_content = File.read(SCRIPT_PATH)
recipe_content == script_content
end
def unit_files_up_to_date?
UNIT_PATHS.all? do |unit|
unit_name = File.basename(unit)
recipe_path = Rails.root.join('lib/support/systemd/', unit_name)
recipe_content = File.read(recipe_path)
unit_content = File.read(unit)
recipe_content == unit_content
end
end
end
end
end

View File

@ -2,20 +2,21 @@
module SystemCheck module SystemCheck
module IncomingEmail module IncomingEmail
class InitdConfiguredCheck < SystemCheck::BaseCheck class MailRoomEnabledCheck < SystemCheck::BaseCheck
set_name 'Init.d configured correctly?' include ::SystemCheck::InitHelpers
set_name 'Mailroom enabled?'
def skip? def skip?
omnibus_gitlab? omnibus_gitlab?
end end
def check? def check?
mail_room_configured? mail_room_enabled? || mail_room_configured?
end end
def show_error def show_error
try_fixing_it( try_fixing_it(
'Enable mail_room in the init.d configuration.' 'Enable mail_room'
) )
for_more_information( for_more_information(
'doc/administration/reply_by_email.md' 'doc/administration/reply_by_email.md'
@ -25,6 +26,13 @@ module SystemCheck
private private
def mail_room_enabled?
target = '/usr/local/lib/systemd/system/gitlab.target'
service = '/usr/local/lib/systemd/system/gitlab-mailroom.service'
File.exist?(target) && File.exist?(service) && systemd_get_wants('gitlab.target').include?("gitlab-mailroom.service")
end
def mail_room_configured? def mail_room_configured?
path = '/etc/default/gitlab' path = '/etc/default/gitlab'
File.exist?(path) && File.read(path).include?('mail_room_enabled=true') File.exist?(path) && File.read(path).include?('mail_room_enabled=true')

View File

@ -3,12 +3,13 @@
module SystemCheck module SystemCheck
module IncomingEmail module IncomingEmail
class MailRoomRunningCheck < SystemCheck::BaseCheck class MailRoomRunningCheck < SystemCheck::BaseCheck
include ::SystemCheck::InitHelpers
set_name 'MailRoom running?' set_name 'MailRoom running?'
def skip? def skip?
return true if omnibus_gitlab? return true if omnibus_gitlab?
unless mail_room_configured? unless mail_room_enabled? || mail_room_configured?
self.skip_reason = "can't check because of previous errors" self.skip_reason = "can't check because of previous errors"
true true
end end
@ -20,10 +21,10 @@ module SystemCheck
def show_error def show_error
try_fixing_it( try_fixing_it(
sudo_gitlab('RAILS_ENV=production bin/mail_room start') 'Start mail_room'
) )
for_more_information( for_more_information(
see_installation_guide_section('Install Init Script'), 'doc/administration/incoming_email.md',
'see log/mail_room.log for possible errors' 'see log/mail_room.log for possible errors'
) )
fix_and_rerun fix_and_rerun
@ -31,6 +32,13 @@ module SystemCheck
private private
def mail_room_enabled?
target = '/usr/local/lib/systemd/system/gitlab.target'
service = '/usr/local/lib/systemd/system/gitlab-mailroom.service'
File.exist?(target) && File.exist?(service) && systemd_get_wants('gitlab.target').include?("gitlab-mailroom.service")
end
def mail_room_configured? def mail_room_configured?
path = '/etc/default/gitlab' path = '/etc/default/gitlab'
File.exist?(path) && File.read(path).include?('mail_room_enabled=true') File.exist?(path) && File.read(path).include?('mail_room_enabled=true')

View File

@ -14,7 +14,7 @@ module SystemCheck
end end
if Rails.env.production? if Rails.env.production?
checks << SystemCheck::IncomingEmail::InitdConfiguredCheck checks << SystemCheck::IncomingEmail::MailRoomEnabledCheck
checks << SystemCheck::IncomingEmail::MailRoomRunningCheck checks << SystemCheck::IncomingEmail::MailRoomRunningCheck
end end

View File

@ -0,0 +1,24 @@
# frozen_string_literal: true
require 'open3'
module SystemCheck
module InitHelpers
# Return the Wants= of a unit, empty if the unit doesn't exist
def systemd_get_wants(unitname)
stdout, _stderr, status = Open3.capture3("systemctl", "--no-pager", "show", unitname)
unless status
return []
end
wantsline = stdout.lines.find { |line| line.start_with?("Wants=") }
unless wantsline
return []
end
wantsline.delete_prefix("Wants=").strip.split
end
end
end

View File

@ -23,8 +23,8 @@ module SystemCheck
SystemCheck::App::UploadsDirectoryExistsCheck, SystemCheck::App::UploadsDirectoryExistsCheck,
SystemCheck::App::UploadsPathPermissionCheck, SystemCheck::App::UploadsPathPermissionCheck,
SystemCheck::App::UploadsPathTmpPermissionCheck, SystemCheck::App::UploadsPathTmpPermissionCheck,
SystemCheck::App::InitScriptExistsCheck, SystemCheck::App::SystemdUnitFilesOrInitScriptExistCheck,
SystemCheck::App::InitScriptUpToDateCheck, SystemCheck::App::SystemdUnitFilesOrInitScriptUpToDateCheck,
SystemCheck::App::ProjectsHaveNamespaceCheck, SystemCheck::App::ProjectsHaveNamespaceCheck,
SystemCheck::App::RedisVersionCheck, SystemCheck::App::RedisVersionCheck,
SystemCheck::App::RubyVersionCheck, SystemCheck::App::RubyVersionCheck,

View File

@ -39,6 +39,12 @@ module SystemCheck
if (cluster_count == 1 && worker_count > 0) || (cluster_count == 0 && worker_count == 1) if (cluster_count == 1 && worker_count > 0) || (cluster_count == 0 && worker_count == 1)
$stdout.puts "#{cluster_count}/#{worker_count}".color(:green) $stdout.puts "#{cluster_count}/#{worker_count}".color(:green)
elsif File.symlink?('/run/systemd/units/invocation:gitlab-sidekiq.service')
$stdout.puts "#{cluster_count}/#{worker_count}".color(:red)
try_fixing_it(
'sudo systemctl restart gitlab-sidekiq.service'
)
fix_and_rerun
else else
$stdout.puts "#{cluster_count}/#{worker_count}".color(:red) $stdout.puts "#{cluster_count}/#{worker_count}".color(:red)
try_fixing_it( try_fixing_it(

View File

@ -126,7 +126,7 @@ class SchemaRegenerator
# In order to properly reset the database and re-run migrations # In order to properly reset the database and re-run migrations
# the schema migrations for new migrations must be removed. # the schema migrations for new migrations must be removed.
def remove_schema_migration_files def remove_schema_migration_files
(untracked_schema_migrations + commited_schema_migrations).each do |schema_migration| (untracked_schema_migrations + committed_schema_migrations).each do |schema_migration|
FileUtils.rm(schema_migration) FileUtils.rm(schema_migration)
end end
end end
@ -144,7 +144,7 @@ class SchemaRegenerator
# List of untracked schema migrations # List of untracked schema migrations
# #
# Get a list of schema migrations that have been committed since the last # Get a list of schema migrations that have been committed since the last
def commited_schema_migrations def committed_schema_migrations
git_command = "git diff --name-only --diff-filter=A #{merge_base} -- #{SCHEMA_MIGRATIONS_DIR}" git_command = "git diff --name-only --diff-filter=A #{merge_base} -- #{SCHEMA_MIGRATIONS_DIR}"
run(git_command).chomp.split("\n") run(git_command).chomp.split("\n")
end end

View File

@ -86,12 +86,12 @@ describe('Multi-file store mutations', () => {
mutations.SET_EMPTY_STATE_SVGS(localState, { mutations.SET_EMPTY_STATE_SVGS(localState, {
emptyStateSvgPath: 'emptyState', emptyStateSvgPath: 'emptyState',
noChangesStateSvgPath: 'noChanges', noChangesStateSvgPath: 'noChanges',
committedStateSvgPath: 'commited', committedStateSvgPath: 'committed',
}); });
expect(localState.emptyStateSvgPath).toBe('emptyState'); expect(localState.emptyStateSvgPath).toBe('emptyState');
expect(localState.noChangesStateSvgPath).toBe('noChanges'); expect(localState.noChangesStateSvgPath).toBe('noChanges');
expect(localState.committedStateSvgPath).toBe('commited'); expect(localState.committedStateSvgPath).toBe('committed');
}); });
}); });

View File

@ -408,7 +408,7 @@ describe('Dashboard', () => {
}); });
}); });
describe('when all requests have been commited by the store', () => { describe('when all requests have been committed by the store', () => {
beforeEach(() => { beforeEach(() => {
store.commit(`monitoringDashboard/${types.SET_INITIAL_STATE}`, { store.commit(`monitoringDashboard/${types.SET_INITIAL_STATE}`, {
currentEnvironmentName: 'production', currentEnvironmentName: 'production',

View File

@ -28,7 +28,7 @@ RSpec.describe SystemCheck::IncomingEmailCheck do
it 'runs IMAP and mailroom checks' do it 'runs IMAP and mailroom checks' do
expect(SystemCheck).to receive(:run).with('Reply by email', [ expect(SystemCheck).to receive(:run).with('Reply by email', [
SystemCheck::IncomingEmail::ImapAuthenticationCheck, SystemCheck::IncomingEmail::ImapAuthenticationCheck,
SystemCheck::IncomingEmail::InitdConfiguredCheck, SystemCheck::IncomingEmail::MailRoomEnabledCheck,
SystemCheck::IncomingEmail::MailRoomRunningCheck SystemCheck::IncomingEmail::MailRoomRunningCheck
]) ])
@ -43,7 +43,7 @@ RSpec.describe SystemCheck::IncomingEmailCheck do
it 'runs mailroom checks' do it 'runs mailroom checks' do
expect(SystemCheck).to receive(:run).with('Reply by email', [ expect(SystemCheck).to receive(:run).with('Reply by email', [
SystemCheck::IncomingEmail::InitdConfiguredCheck, SystemCheck::IncomingEmail::MailRoomEnabledCheck,
SystemCheck::IncomingEmail::MailRoomRunningCheck SystemCheck::IncomingEmail::MailRoomRunningCheck
]) ])