Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-04-23 03:09:51 +00:00
parent b158645575
commit 8ab8bc5d07
19 changed files with 254 additions and 25 deletions

View File

@ -12,6 +12,7 @@ module Ci
TEST_REPORT_FILE_TYPES = %w[junit].freeze
COVERAGE_REPORT_FILE_TYPES = %w[cobertura].freeze
ACCESSIBILITY_REPORT_FILE_TYPES = %w[accessibility].freeze
NON_ERASABLE_FILE_TYPES = %w[trace].freeze
TERRAFORM_REPORT_FILE_TYPES = %w[terraform].freeze
DEFAULT_FILE_NAMES = {
@ -21,6 +22,7 @@ module Ci
metrics_referee: nil,
network_referee: nil,
junit: 'junit.xml',
accessibility: 'gl-accessibility.json',
codequality: 'gl-code-quality-report.json',
sast: 'gl-sast-report.json',
dependency_scanning: 'gl-dependency-scanning-report.json',
@ -54,6 +56,7 @@ module Ci
# All these file formats use `raw` as we need to store them uncompressed
# for Frontend to fetch the files and do analysis
# When they will be only used by backend, they can be `gzipped`.
accessibility: :raw,
codequality: :raw,
sast: :raw,
dependency_scanning: :raw,
@ -99,6 +102,10 @@ module Ci
with_file_types(TEST_REPORT_FILE_TYPES)
end
scope :accessibility_reports, -> do
with_file_types(ACCESSIBILITY_REPORT_FILE_TYPES)
end
scope :coverage_reports, -> do
with_file_types(COVERAGE_REPORT_FILE_TYPES)
end
@ -138,7 +145,8 @@ module Ci
lsif: 15, # LSIF data for code navigation
dotenv: 16,
cobertura: 17,
terraform: 18 # Transformed json
terraform: 18, # Transformed json
accessibility: 19
}
enum file_format: {

View File

@ -37,14 +37,17 @@ your app.
For a complete overview of these methodologies and GitLab CI/CD,
read the [Introduction to CI/CD with GitLab](introduction/index.md).
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For a video demonstration of GitLab CI/CD, see [Demo: CI/CD with GitLab](https://www.youtube.com/watch?v=1iXFbchozdY).
<div class="video-fallback">
Video demonstration of GitLab CI/CD: <a href="https://www.youtube.com/watch?v=1iXFbchozdY">Demo: CI/CD with GitLab</a>.
</div>
<figure class="video-container">
<iframe src="https://www.youtube.com/embed/1iXFbchozdY" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
## Getting started
GitLab CI/CD is configured by a file called `.gitlab-ci.yml` placed
at the repository's root. The scripts set in this file are executed
by the [GitLab Runner](https://docs.gitlab.com/runner/).
at the repository's root. This file creates a [pipeline](pipelines/index.md), which runs for changes to the code in the repository. Pipelines consist of one or more stages that run in order and can each contain one or more jobs that run in parallel. These jobs (or scripts) get executed by the [GitLab Runner](https://docs.gitlab.com/runner/) agent.
To get started with GitLab CI/CD, we recommend you read through
the following documents:
@ -74,25 +77,32 @@ for all the attributes you can set and use.
NOTE: **Note:**
GitLab CI/CD and [shared runners](runners/README.md#shared-specific-and-group-runners) are enabled in GitLab.com and available for all users, limited only to the [user's pipelines quota](../user/gitlab_com/index.md#shared-runners).
## Configuration
## Concepts
GitLab CI/CD supports numerous configuration options:
GitLab CI/CD uses a number of concepts to describe and run your build and deploy.
| Configuration | Description |
| Concept | Description |
|:--------------|:-------------|
| [Pipelines](pipelines/index.md) | Structure your CI/CD process through pipelines. |
| [Environment variables](variables/README.md) | Reuse values based on a variable/value key pair. |
| [Environments](environments.md) | Deploy your application to different environments (e.g., staging, production). |
| [Job artifacts](pipelines/job_artifacts.md) | Output, use, and reuse job artifacts. |
| [Cache dependencies](caching/index.md) | Cache your dependencies for a faster execution. |
| [GitLab Runner](https://docs.gitlab.com/runner/) | Configure your own GitLab Runners to execute your scripts. |
## Configuration
GitLab CI/CD supports numerous configuration options:
| Configuration | Description |
|:--------------|:-------------|
| [Schedule pipelines](pipelines/schedules.md) | Schedule pipelines to run as often as you need. |
| [Custom path for `.gitlab-ci.yml`](pipelines/settings.md#custom-ci-configuration-path) | Define a custom path for the CI/CD configuration file. |
| [Git submodules for CI/CD](git_submodules.md) | Configure jobs for using Git submodules.|
| [SSH keys for CI/CD](ssh_keys/README.md) | Using SSH keys in your CI pipelines. |
| [Pipelines triggers](triggers/README.md) | Trigger pipelines through the API. |
| [Pipeline triggers](triggers/README.md) | Trigger pipelines through the API. |
| [Pipelines for Merge Requests](merge_request_pipelines/index.md) | Design a pipeline structure for running a pipeline in merge requests. |
| [Integrate with Kubernetes clusters](../user/project/clusters/index.md) | Connect your project to Google Kubernetes Engine (GKE) or an existing Kubernetes cluster. |
| [GitLab Runner](https://docs.gitlab.com/runner/) | Configure your own GitLab Runners to execute your scripts. |
| [Optimize GitLab and Runner for large repositories](large_repositories/index.md) | Recommended strategies for handling large repos. |
| [`.gitlab-ci.yml` full reference](yaml/README.md) | All the attributes you can use with GitLab CI/CD. |

View File

@ -89,6 +89,18 @@ store:
-----END CERTIFICATE-----" >> /kaniko/ssl/certs/ca-certificates.crt
```
## Video walkthrough of a working example
The [Least Privilege Container Builds with Kaniko on GitLab](https://www.youtube.com/watch?v=d96ybcELpFs)
video is a walkthrough of the [Kaniko Docker Build](https://gitlab.com/guided-explorations/containers/kaniko-docker-build)
Guided Exploration project pipeline. It was tested on:
- [GitLab.com Shared Runners](../../user/gitlab_com/index.md#shared-runners)
- [The Kubernetes Runner executor](https://docs.gitlab.com/runner/executors/kubernetes.html)
The example can be copied to your own group or instance for testing. More details
on what other GitLab CI patterns are demonstrated are available at the project page.
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues

View File

@ -18,6 +18,8 @@ You can configure your job to use JUnit test reports, and GitLab will display a
report on the merge request so that it's easier and faster to identify the
failure without having to check the entire log.
If you don't use Merge Requests but still want to see the JUnit output without searching through job logs, the full [JUnit test reports](#viewing-junit-test-reports-on-gitlab) are available in the pipeline detail view.
## Use cases
Consider the following workflow:
@ -241,7 +243,7 @@ This feature comes with the `:junit_pipeline_view` feature flag disabled by defa
feature is disabled due to some performance issues with very large data sets.
When [the performance is improved](https://gitlab.com/groups/gitlab-org/-/epics/2854), the feature will be enabled by default.
To enable this feature, ask a GitLab administrator with Rails console access to run the
To enable this feature, ask a GitLab administrator with [Rails console access](../administration/feature_flags.md#how-to-enable-and-disable-features-behind-flags) to run the
following command:
```ruby

View File

@ -864,3 +864,10 @@ if [[ -d "/builds/gitlab-examples/ci-debug-trace/.git" ]]; then
...
```
## Video walkthrough of a working example
The [Managing the Complex Configuration Data Management Monster Using GitLab](https://www.youtube.com/watch?v=v4ZOJ96hAck) video is a walkthrough of the [Complex Config Data Monorepo](https://gitlab.com/guided-explorations/config-data-top-scope/config-data-subscope/config-data-monorepo) working example project. It explains how multiple levels of group CI/CD variables can be combined with environment-scoped project variables for complex configuration of application builds or deployments.
The example can be copied to your own group or instance for testing. More details
on what other GitLab CI patterns are demonstrated are available at the project page.

View File

@ -90,8 +90,9 @@ GitLab uses [RE2 syntax](https://github.com/google/re2/wiki/Syntax) for regular
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/385) in [GitLab Starter](https://about.gitlab.com/pricing/) 8.12.
You can turn on a predefined blacklist of files which won't be allowed to be
pushed to a repository.
Secrets such as credential files, SSH private keys, and other files containing secrets should never be committed to source control.
GitLab allows you to turn on a predefined blacklist of files which won't be allowed to be
pushed to a repository, stopping those commits from reaching the remote repository.
By selecting the checkbox *Prevent committing secrets to Git*, GitLab prevents
pushes to the repository when a file matches a regular expression as read from

View File

@ -75,9 +75,9 @@ count as active users in the subscription period in which they were originally a
- Members with Guest permissions on an Ultimate subscription.
- GitLab-created service accounts: `Ghost User` and `Support Bot`.
##### User Statistics
##### Users statistics
To view a breakdown of the users within your instance, including active, billable, and blocked, go to **Admin Area > Overview > Dashboard** and select **Users Statistics** in the **Users** section.
To view a breakdown of the users within your instance, including active, billable, and blocked, go to **Admin Area > Overview > Dashboard** and select **Users statistics** in the **Users** section.
For more details, see [Users statistics](../user/admin_area/index.md#users-statistics).
NOTE: **Note:**

View File

@ -16,10 +16,13 @@ If a project's repository contains a `Dockerfile` at its root, Auto Build uses
`docker build` to create a Docker image.
If you're also using Auto Review Apps and Auto Deploy, and you choose to provide
your own `Dockerfile`, you must expose your application to port `5000`, as the
[default Helm chart](https://gitlab.com/gitlab-org/charts/auto-deploy-app) assumes
this port is available. You can override the default values by
[customizing the Auto Deploy Helm chart](customize.md#custom-helm-chart).
your own `Dockerfile`, you must either:
- Expose your application to port `5000`, as the
[default Helm chart](https://gitlab.com/gitlab-org/charts/auto-deploy-app)
assumes this port is available.
- Override the default values by
[customizing the Auto Deploy Helm chart](customize.md#custom-helm-chart).
### Auto Build using Heroku buildpacks
@ -78,8 +81,8 @@ Auto Test runs the appropriate tests for your application using
[Heroku buildpacks](https://devcenter.heroku.com/articles/buildpacks) by analyzing
your project to detect the language and framework. Several languages and
frameworks are detected automatically, but if your language is not detected,
create a [custom buildpack](customize.md#custom-buildpacks). Check the
[currently supported languages](index.md#currently-supported-languages).
you may be able to create a [custom buildpack](customize.md#custom-buildpacks).
Check the [currently supported languages](index.md#currently-supported-languages).
Auto Test uses tests you already have in your application. If there are no
tests, it's up to you to add them.

View File

@ -15,6 +15,13 @@ This helps reducing risk and allows you to easily manage which features to enabl
GitLab offers a Feature Flags interface that allows you to create, toggle and
remove feature flags.
<div class="video-fallback">
<a href="https://www.youtube.com/watch?v=5tw2p6lwXxo">Watch</a> a use case between Feature Flags and Sentry Error Tracking
</div>
<figure class="video-container">
<iframe src="https://www.youtube.com/embed/5tw2p6lwXxo" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
## How it works
Underneath, GitLab uses [unleash](https://github.com/Unleash/unleash), a feature

View File

@ -199,7 +199,7 @@ of commits to the fewest, and displayed on a nice graph:
## Repository graph
The repository graph displays visually the Git flow strategy used in that repository:
The repository graph displays the history of the repository network visually, including branches and merges. This can help you visualize the Git flow strategy used in the repository:
![repository Git flow](img/repo_graph.png)

View File

@ -14,7 +14,7 @@ module Gitlab
ALLOWED_KEYS =
%i[junit codequality sast dependency_scanning container_scanning
dast performance license_management license_scanning metrics lsif
dotenv cobertura terraform].freeze
dotenv cobertura terraform accessibility].freeze
attributes ALLOWED_KEYS
@ -37,6 +37,7 @@ module Gitlab
validates :dotenv, array_of_strings_or_string: true
validates :cobertura, array_of_strings_or_string: true
validates :terraform, array_of_strings_or_string: true
validates :accessibility, array_of_strings_or_string: true
end
end

View File

@ -8,12 +8,14 @@ stages:
a11y:
stage: accessibility
image: registry.gitlab.com/gitlab-org/ci-cd/accessibility:5.3.0-gitlab.2
image: registry.gitlab.com/gitlab-org/ci-cd/accessibility:5.3.0-gitlab.3
script: /gitlab-accessibility.sh $a11y_urls
allow_failure: true
artifacts:
when: always
expose_as: 'Accessibility Reports'
paths: ['reports/']
reports:
accessibility: reports/gl-accessibility.json
rules:
- if: $a11y_urls

View File

@ -139,6 +139,36 @@ FactoryBot.define do
end
end
trait :accessibility do
file_type { :accessibility }
file_format { :raw }
after(:build) do |artifact, _evaluator|
artifact.file = fixture_file_upload(
Rails.root.join('spec/fixtures/accessibility/pa11y_with_errors.json'), 'application/json')
end
end
trait :accessibility_with_invalid_url do
file_type { :accessibility }
file_format { :raw }
after(:build) do |artifact, _evaluator|
artifact.file = fixture_file_upload(
Rails.root.join('spec/fixtures/accessibility/pa11y_with_invalid_url.json'), 'application/json')
end
end
trait :accessibility_without_errors do
file_type { :accessibility }
file_format { :raw }
after(:build) do |artifact, _evaluator|
artifact.file = fixture_file_upload(
Rails.root.join('spec/fixtures/accessibility/pa11y_without_errors.json'), 'application/json')
end
end
trait :cobertura do
file_type { :cobertura }
file_format { :gzip }

View File

@ -0,0 +1,109 @@
{
"total": 1,
"passes": 0,
"errors": 10,
"results": {
"https://about.gitlab.com/": [
{
"code": "WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.NoContent",
"type": "error",
"typeCode": 1,
"message": "Anchor element found with a valid href attribute, but no link content has been supplied.",
"context": "<a href=\"/\" class=\"navbar-brand animated\"><svg height=\"36\" viewBox=\"0 0 1...</a>",
"selector": "#main-nav > div:nth-child(1) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a href=\"/stages-devops-lifecycle/\" class=\"main-nav-link\">Product</a>",
"selector": "#main-nav > div:nth-child(2) > ul > li:nth-child(1) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a href=\"/pricing/\" class=\"main-nav-link\">Pricing</a>",
"selector": "#main-nav > div:nth-child(2) > ul > li:nth-child(2) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a href=\"/resources/\" class=\"main-nav-link\">Resources</a>",
"selector": "#main-nav > div:nth-child(2) > ul > li:nth-child(3) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a href=\"/blog/\" class=\"main-nav-link\">Blog</a>",
"selector": "#main-nav > div:nth-child(2) > ul > li:nth-child(4) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a href=\"/support/\" class=\"main-nav-link\">Support</a>",
"selector": "#main-nav > div:nth-child(2) > ul > li:nth-child(5) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a href=\"/jobs/\" class=\"main-nav-link\">Jobs</a>",
"selector": "#main-nav > div:nth-child(2) > ul > li:nth-child(6) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 2.82:1. Recommendation: change background to #d1470c.",
"context": "<a class=\"btn btn-nav-cta btn-nav-link-cta\" href=\"/free-trial\">\nGet free trial\n</a>",
"selector": "#main-nav > div:nth-child(2) > ul > div:nth-child(8) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a class=\"main-nav-link sign-up\" href=\"https://gitlab.com/explore\" target=\"_blank\">\nExplore\n</a>",
"selector": "#main-nav > div:nth-child(2) > ul > div:nth-child(9) > li:nth-child(1) > a",
"runner": "htmlcs",
"runnerExtras": {}
},
{
"code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"type": "error",
"typeCode": 1,
"message": "This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.05:1. Recommendation: change background to #767676.",
"context": "<a class=\"main-nav-link sign-up\" href=\"https://gitlab.com/users/sign_in\">\nSign in\n</a>",
"selector": "#main-nav > div:nth-child(2) > ul > div:nth-child(9) > li:nth-child(2) > a",
"runner": "htmlcs",
"runnerExtras": {}
}
]
}
}

View File

@ -0,0 +1,12 @@
{
"total": 1,
"passes": 0,
"errors": 0,
"results": {
"": [
{
"message": "Protocol error (Page.navigate): Cannot navigate to invalid URL"
}
]
}
}

View File

@ -0,0 +1,8 @@
{
"total": 1,
"passes": 1,
"errors": 0,
"results": {
"https://pa11y.org/": []
}
}

View File

@ -47,6 +47,7 @@ describe Gitlab::Ci::Config::Entry::Reports do
:dotenv | 'build.dotenv'
:cobertura | 'cobertura-coverage.xml'
:terraform | 'tfplan.json'
:accessibility | 'gl-accessibility.json'
end
with_them do

View File

@ -70,6 +70,22 @@ describe Ci::JobArtifact do
end
end
describe '.accessibility_reports' do
subject { described_class.accessibility_reports }
context 'when there is an accessibility report' do
let(:artifact) { create(:ci_job_artifact, :accessibility) }
it { is_expected.to eq([artifact]) }
end
context 'when there are no accessibility report' do
let(:artifact) { create(:ci_job_artifact, :archive) }
it { is_expected.to be_empty }
end
end
describe '.coverage_reports' do
subject { described_class.coverage_reports }

View File

@ -38,7 +38,7 @@ describe Ci::RetryBuildService do
job_artifacts_codequality job_artifacts_metrics scheduled_at
job_variables waiting_for_resource_at job_artifacts_metrics_referee
job_artifacts_network_referee job_artifacts_dotenv
job_artifacts_cobertura needs].freeze
job_artifacts_cobertura needs job_artifacts_accessibility].freeze
IGNORE_ACCESSORS =
%i[type lock_version target_url base_tags trace_sections