+
Pipelines** page. If everything runs OK (no non-zero
-return values), you get a green check mark associated with the commit. This makes it easy to see
-whether a commit caused any of the tests to fail before you even look at the job (test) log. Many projects use
-GitLab's CI service to run the test suite, so developers get immediate feedback if they broke
-something.
+1. [Ensure you have runners available](#ensure-you-have-runners-available) to run your jobs.
+ If you don't have a runner, [install GitLab Runner](https://docs.gitlab.com/runner/install/)
+ and [register a runner](https://docs.gitlab.com/runner/register/) for your instance, project, or group.
+1. [Create a `.gitlab-ci.yml` file](#create-a-gitlab-ciyml-file)
+ at the root of your repository. This file is where you define your CI/CD jobs.
-It's also common to use pipelines to automatically deploy
-tested code to staging and production environments.
+When you commit the file to your repository, the runner runs your jobs.
+The job results [are displayed in a pipeline](#view-the-status-of-your-pipeline-and-jobs).
-If you're already familiar with general CI/CD concepts, you can review which
-[pipeline architectures](../pipelines/pipeline_architectures.md) can be used
-in your projects. If you're coming over to GitLab from Jenkins, you can check out
-our [reference](../migration/jenkins.md) for converting your pre-existing pipelines
-over to our format.
+### Ensure you have runners available
-This guide assumes that you have:
+In GitLab, runners are agents that run your CI/CD jobs.
-- A working GitLab instance of version 8.0+ or are using
- [GitLab.com](https://gitlab.com).
-- A project in GitLab that you would like to use CI for.
-- Maintainer or owner access to the project
+You might already have runners available for your project, including
+[shared runners](../runners/README.md#shared-runners), which are
+available to all projects in your GitLab instance.
-Let's break it down to pieces and work on solving the GitLab CI/CD puzzle.
+To view available runners:
-## Creating a `.gitlab-ci.yml` file
+- Go to **Settings > CI/CD** and expand **Runners**.
-Before you create `.gitlab-ci.yml` let's first explain in brief what this is
-all about.
+As long as you have at least one runner that's active, with a green circle next to it,
+you have a runner available to process your jobs.
-### What is `.gitlab-ci.yml`
+If no runners are listed on the **Runners** page in the UI, you or an administrator
+must [install GitLab Runner](https://docs.gitlab.com/runner/install/) and
+[register](https://docs.gitlab.com/runner/register/) at least one runner.
-The `.gitlab-ci.yml` file is where you configure what CI does with your project.
-It lives in the root of your repository.
+If you are testing CI/CD, you can install GitLab Runner and register runners on your local machine.
+When your CI/CD jobs run, they will run on your local machine.
-On any push to your repository, GitLab will look for the `.gitlab-ci.yml`
-file and start jobs on _runners_ according to the contents of the file,
-for that commit.
+### Create a `.gitlab-ci.yml` file
-Because `.gitlab-ci.yml` is in the repository and is version controlled, old
-versions still build successfully, forks can easily make use of CI, branches can
-have different pipelines and jobs, and you have a single source of truth for CI.
-You can read more about the reasons why we are using `.gitlab-ci.yml` [in our
-blog about it](https://about.gitlab.com/blog/2015/05/06/why-were-replacing-gitlab-ci-jobs-with-gitlab-ci-dot-yml/).
+The `.gitlab-ci.yml` file is a [YAML](https://en.wikipedia.org/wiki/YAML) file where
+you configure specific instructions for GitLab CI/CD.
-### Creating a simple `.gitlab-ci.yml` file
+In this file, you define:
-You need to create a file named `.gitlab-ci.yml` in the root directory of your
-repository. This is a [YAML](https://en.wikipedia.org/wiki/YAML) file
-so you have to pay extra attention to indentation. Always use spaces, not tabs.
+- The structure and order of jobs that the runner should execute.
+- The decisions the runner should make when specific conditions are encountered.
-Below is an example for a Ruby on Rails project:
+For example, you might want to run a suite of tests when you commit to
+any branch except `master`. When you commit to `master`, you want
+to run the same suite, but also publish your application.
-```yaml
-default:
- image: ruby:2.5
- before_script:
- - apt-get update
- - apt-get install -y sqlite3 libsqlite3-dev nodejs
- - ruby -v
- - which ruby
- - gem install bundler --no-document
- - bundle install --jobs $(nproc) "${FLAGS[@]}"
+All of this is defined in the `.gitlab-ci.yml` file.
-rspec:
- script:
- - bundle exec rspec
+To create a `.gitlab-ci.yml` file:
-rubocop:
- script:
- - bundle exec rubocop
-```
+1. Go to **Project overview > Details**.
+1. Above the file list, select the branch you want to commit to,
+ click the plus icon, then select **New file**:
-This is the simplest possible configuration that will work for most Ruby
-applications:
+ ![New file](img/new_file_v13_6.png)
-1. Define two jobs `rspec` and `rubocop` (the names are arbitrary) with
- different commands to be executed.
-1. Before every job, the commands defined by `before_script` are executed.
+1. For the **File name** type `.gitlab-ci.yml` and in the larger window,
+ paste this sample code:
-The `.gitlab-ci.yml` file defines sets of jobs with constraints of how and when
-they should be run. The jobs are defined as top-level elements with a name (in
-our case `rspec` and `rubocop`) and always have to contain the `script` keyword.
-Jobs are used to create jobs, which are then picked by
-[runners](../runners/README.md) and executed within the environment of the runner.
+ ```yaml
+ build-job:
+ stage: build
+ script:
+ - echo "Hello, $GITLAB_USER_LOGIN!"
-What is important is that each job is run independently from each other.
+ test-job1:
+ stage: test
+ script:
+ - echo "This job tests something"
-If you want to check whether the `.gitlab-ci.yml` of your project is valid, there is a
-[CI Lint tool](../lint.md) available in every project.
+ test-job2:
+ stage: test
+ script:
+ - echo "This job tests something, but takes more time than test-job1."
+ - echo "After the echo commands complete, it runs the sleep command for 20 seconds"
+ - echo "which simulates a test that runs 20 seconds longer than test-job1"
+ - sleep 20
-You can use the [CI/CD configuration visualization](../yaml/visualization.md) to
-see a graphical representation of your `.gitlab-ci.yml`.
+ deploy-prod:
+ stage: deploy
+ script:
+ - echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
+ ```
-For more information and a complete `.gitlab-ci.yml` syntax, please read
-[the reference documentation on `.gitlab-ci.yml`](../yaml/README.md).
+ `$GITLAB_USER_LOGIN` and `$CI_COMMIT_BRANCH` are
+ [predefined variables](../variables/predefined_variables.md)
+ that populate when the job runs.
-TIP: **Tip:**
-A GitLab team member has made an [unofficial visual pipeline editor](https://unofficial.gitlab.tools/visual-pipelines/).
-There is a [plan to make it an official part of GitLab](https://gitlab.com/groups/gitlab-org/-/epics/4069)
-in the future, but it's available for anyone who wants to try it at the above link.
+1. Click **Commit changes**.
-### Push `.gitlab-ci.yml` to GitLab
+The pipeline starts when the commit is committed.
-After you've created a `.gitlab-ci.yml`, you should add it to your Git repository
-and push it to GitLab.
+#### `.gitlab-ci.yml` tips
-```shell
-git add .gitlab-ci.yml
-git commit -m "Add .gitlab-ci.yml"
-git push origin master
-```
+- If you want the runner to use a Docker image to run the jobs, edit the `.gitlab-ci.yml` file
+ to include your image name:
-Now if you go to the **Pipelines** page you will see that the pipeline is
-pending.
+ ```yaml
+ default:
+ image: ruby:2.7.2
+ ```
-NOTE: **Note:**
-If you have a [mirrored repository where GitLab pulls from](../../user/project/repository/repository_mirroring.md#pulling-from-a-remote-repository),
-you may need to enable pipeline triggering in your project's
-**Settings > Repository > Pull from a remote repository > Trigger pipelines for mirror updates**.
+ This command tells the runner to use a Ruby image from Docker Hub.
-You can also go to the **Commits** page and notice the little pause icon next
-to the commit SHA.
+- To validate your `.gitlab-ci.yml` file, use the
+ [CI Lint tool](../lint.md), which is available in every project.
+- You can also use [CI/CD configuration visualization](../yaml/visualization.md) to
+ view a graphical representation of your `.gitlab-ci.yml` file.
+- For the complete `.gitlab-ci.yml` syntax, see
+ [the `.gitlab-ci.yml` reference topic](../yaml/README.md).
-![New commit pending](img/new_commit.png)
+### View the status of your pipeline and jobs
-Clicking on it you will be directed to the jobs page for that specific commit.
+When you committed your changes, a pipeline started.
-![Single commit jobs page](img/single_commit_status_pending.png)
+To view your pipeline:
-Notice that there is a pending job which is named after what we wrote in
-`.gitlab-ci.yml`. "stuck" indicates that there is no runner configured
-yet for this job.
+- Go **CI/CD > Pipelines**.
-The next step is to configure a runner so that it picks the pending jobs.
+ A pipeline with three stages should be displayed:
-## Configuring a runner
+ ![Three stages](img/three_stages_v13_6.png)
-In GitLab, runners run the jobs that you define in `.gitlab-ci.yml`. A runner
-can be a virtual machine, a VPS, a bare-metal machine, a Docker container, or
-even a cluster of containers. GitLab and the runner communicate through an API,
-so the only requirement is that the runner's machine has network access to the
-GitLab server.
+- To view a visual representation of your pipeline, click the pipeline ID.
-A runner can be specific to a certain project or serve multiple projects in
-GitLab. If it serves all projects, it's called a _shared runner_.
+ ![Pipeline graph](img/pipeline_graph_v13_6.png)
-Find more information about runners in the
-[runner](../runners/README.md) documentation.
+- To view details of a job, click the job name, for example, `deploy-prod`.
-The official runner supported by GitLab is written in Go.
-View [the documentation](https://docs.gitlab.com/runner/).
+ ![Job details](img/job_details_v13_6.png)
-For a runner to be available in GitLab, you must:
-
-1. [Install GitLab Runner](https://docs.gitlab.com/runner/install/).
-1. [Register a runner for your group or project](https://docs.gitlab.com/runner/register/).
-
-When a runner is available, you can view it by
-clicking **Settings > CI/CD** and expanding **Runners**.
-
-![Activated runners](img/runners_activated.png)
-
-### Shared runners
-
-If you use [GitLab.com](https://gitlab.com/), you can use the **shared runners**
-provided by GitLab.
-
-These are special virtual machines that run on GitLab's infrastructure and can
-build any project.
-
-To enable shared runners, go to your project's or group's
-**Settings > CI/CD** and click **Enable shared runners**.
-
-[Read more about shared runners](../runners/README.md#shared-runners).
-
-## Viewing the status of your pipeline and jobs
-
-After configuring the runner successfully, you should see the status of your
-last commit change from _pending_ to either _running_, _success_ or _failed_.
-
-You can view all pipelines by going to the **Pipelines** page in your project.
-
-![Commit status](img/pipelines_status.png)
-
-Or you can view all jobs, by going to the **Pipelines ➔ Jobs** page.
-
-![Commit status](img/builds_status.png)
-
-By clicking on a job's status, you will be able to see the log of that job.
-This is important to diagnose why a job failed or acted differently than
-you expected.
-
-![Build log](img/build_log.png)
-
-You are also able to view the status of any commit in the various pages in
-GitLab, such as **Commits** and **Merge requests**.
-
-## Additional resources
-
-Visit the [examples README](../examples/README.md) to see a list of examples using GitLab
-CI with various languages.
-
-For help making your new pipelines faster and more efficient, see the
-[pipeline efficiency documentation](../pipelines/pipeline_efficiency.md).
+If the job status is `stuck`, check to ensure a runner is probably configured for the project.
diff --git a/doc/ci/quick_start/img/build_log.png b/doc/ci/quick_start/img/build_log.png
deleted file mode 100644
index 16698629edc..00000000000
Binary files a/doc/ci/quick_start/img/build_log.png and /dev/null differ
diff --git a/doc/ci/quick_start/img/builds_status.png b/doc/ci/quick_start/img/builds_status.png
deleted file mode 100644
index b4aeeb988d2..00000000000
Binary files a/doc/ci/quick_start/img/builds_status.png and /dev/null differ
diff --git a/doc/ci/quick_start/img/job_details_v13_6.png b/doc/ci/quick_start/img/job_details_v13_6.png
new file mode 100644
index 00000000000..e94287f90ba
Binary files /dev/null and b/doc/ci/quick_start/img/job_details_v13_6.png differ
diff --git a/doc/ci/quick_start/img/new_commit.png b/doc/ci/quick_start/img/new_commit.png
deleted file mode 100644
index 507eb93ac0c..00000000000
Binary files a/doc/ci/quick_start/img/new_commit.png and /dev/null differ
diff --git a/doc/ci/quick_start/img/new_file_v13_6.png b/doc/ci/quick_start/img/new_file_v13_6.png
new file mode 100644
index 00000000000..c71923f9b90
Binary files /dev/null and b/doc/ci/quick_start/img/new_file_v13_6.png differ
diff --git a/doc/ci/quick_start/img/pipeline_graph_v13_6.png b/doc/ci/quick_start/img/pipeline_graph_v13_6.png
new file mode 100644
index 00000000000..fcf7e02d1f3
Binary files /dev/null and b/doc/ci/quick_start/img/pipeline_graph_v13_6.png differ
diff --git a/doc/ci/quick_start/img/pipelines_status.png b/doc/ci/quick_start/img/pipelines_status.png
deleted file mode 100644
index 39a77a26b25..00000000000
Binary files a/doc/ci/quick_start/img/pipelines_status.png and /dev/null differ
diff --git a/doc/ci/quick_start/img/single_commit_status_pending.png b/doc/ci/quick_start/img/single_commit_status_pending.png
deleted file mode 100644
index ffc7054d3b0..00000000000
Binary files a/doc/ci/quick_start/img/single_commit_status_pending.png and /dev/null differ
diff --git a/doc/ci/quick_start/img/three_stages_v13_6.png b/doc/ci/quick_start/img/three_stages_v13_6.png
new file mode 100644
index 00000000000..a6c049e3e6c
Binary files /dev/null and b/doc/ci/quick_start/img/three_stages_v13_6.png differ
diff --git a/lib/api/lint.rb b/lib/api/lint.rb
index 01faa41cb19..58181adaa93 100644
--- a/lib/api/lint.rb
+++ b/lib/api/lint.rb
@@ -17,9 +17,9 @@ module API
status 200
response = if error.blank?
- { status: 'valid', errors: [] }
+ { status: 'valid', errors: [], warnings: result.warnings }
else
- { status: 'invalid', errors: [error] }
+ { status: 'invalid', errors: [error], warnings: result.warnings }
end
response.tap do |response|
diff --git a/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
index 3789f0edc1c..b534dad9593 100644
--- a/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
@@ -28,11 +28,8 @@ dependency_scanning:
.ds-analyzer:
extends: dependency_scanning
allow_failure: true
- rules:
- - if: $DEPENDENCY_SCANNING_DISABLED
- when: never
- - if: $CI_COMMIT_BRANCH &&
- $GITLAB_FEATURES =~ /\bdependency_scanning\b/
+ # `rules` must be overridden explicitly by each child job
+ # see https://gitlab.com/gitlab-org/gitlab/-/issues/218444
script:
- /analyzer run
diff --git a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
index a51cb61da6d..671e2346fcb 100644
--- a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
@@ -30,10 +30,8 @@ sast:
.sast-analyzer:
extends: sast
allow_failure: true
- rules:
- - if: $SAST_DISABLED
- when: never
- - if: $CI_COMMIT_BRANCH
+ # `rules` must be overridden explicitly by each child job
+ # see https://gitlab.com/gitlab-org/gitlab/-/issues/218444
script:
- /analyzer run
diff --git a/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml
index 6ebff102ccb..466981594cf 100644
--- a/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml
@@ -14,6 +14,8 @@ variables:
stage: test
image: "$SECURE_ANALYZERS_PREFIX/secrets:$SECRETS_ANALYZER_VERSION"
services: []
+ # `rules` must be overridden explicitly by each child job
+ # see https://gitlab.com/gitlab-org/gitlab/-/issues/218444
artifacts:
reports:
secret_detection: gl-secret-detection-report.json
diff --git a/lib/gitlab/graphql/docs/templates/default.md.haml b/lib/gitlab/graphql/docs/templates/default.md.haml
index ec052943589..97df4233905 100644
--- a/lib/gitlab/graphql/docs/templates/default.md.haml
+++ b/lib/gitlab/graphql/docs/templates/default.md.haml
@@ -14,6 +14,8 @@
CAUTION: **Caution:**
Fields that are deprecated are marked with **{warning-solid}**.
+ Items (fields, enums, etc) that have been removed according to our [deprecation process](../index.md#deprecation-process) can be found
+ in [Removed Items](../removed_items.md).
\
:plain
diff --git a/package.json b/package.json
index 2bdf7f644c9..cc1f4eb1bc8 100644
--- a/package.json
+++ b/package.json
@@ -48,7 +48,7 @@
"@gitlab/visual-review-tools": "1.6.1",
"@rails/actioncable": "^6.0.3-3",
"@rails/ujs": "^6.0.3-2",
- "@sourcegraph/code-host-integration": "0.0.50",
+ "@sourcegraph/code-host-integration": "0.0.52",
"@toast-ui/editor": "^2.5.0",
"@toast-ui/vue-editor": "^2.5.0",
"apollo-cache-inmemory": "^1.6.6",
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index d7d1278159b..f159f0e6099 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -95,7 +95,8 @@ RSpec.describe Projects::MergeRequestsController do
project,
merge_request,
'json',
- diff_head: true))
+ diff_head: true,
+ view: 'inline'))
end
end
diff --git a/spec/frontend/diffs/components/diff_view_spec.js b/spec/frontend/diffs/components/diff_view_spec.js
index 20ac844fe00..4d90112d8f6 100644
--- a/spec/frontend/diffs/components/diff_view_spec.js
+++ b/spec/frontend/diffs/components/diff_view_spec.js
@@ -49,12 +49,29 @@ describe('DiffView', () => {
expect(wrapper.find(DiffExpansionCell).exists()).toBe(true);
});
- it('renders a comment row', () => {
- const wrapper = createWrapper({
- diffLines: [{ renderCommentRow: true, left: { lineDraft: {} } }],
- });
- expect(wrapper.find(DiffCommentCell).exists()).toBe(true);
- });
+ it.each`
+ type | side | container | sides | total
+ ${'parallel'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${2}
+ ${'parallel'} | ${'right'} | ${'.new'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${2}
+ ${'inline'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} } }} | ${1}
+ ${'inline'} | ${'right'} | ${'.new'} | ${{ right: { lineDraft: {} } }} | ${1}
+ ${'inline'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${1}
+ `(
+ 'renders a $type comment row with comment cell on $side',
+ ({ type, container, sides, total }) => {
+ const wrapper = createWrapper({
+ diffLines: [{ renderCommentRow: true, ...sides }],
+ inline: type === 'inline',
+ });
+ expect(wrapper.findAll(DiffCommentCell).length).toBe(total);
+ expect(
+ wrapper
+ .find(container)
+ .find(DiffCommentCell)
+ .exists(),
+ ).toBe(true);
+ },
+ );
it('renders a draft row', () => {
const wrapper = createWrapper({
diff --git a/spec/graphql/types/commit_type_spec.rb b/spec/graphql/types/commit_type_spec.rb
index d222287270d..e9bc7f6bb94 100644
--- a/spec/graphql/types/commit_type_spec.rb
+++ b/spec/graphql/types/commit_type_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe GitlabSchema.types['Commit'] do
it 'contains attributes related to commit' do
expect(described_class).to have_graphql_fields(
:id, :sha, :title, :description, :description_html, :message, :title_html, :authored_date,
- :author_name, :author_gravatar, :author, :web_url, :web_path, :latest_pipeline,
+ :author_name, :author_gravatar, :author, :web_url, :web_path,
:pipelines, :signature_html
)
end
diff --git a/spec/graphql/types/grafana_integration_type_spec.rb b/spec/graphql/types/grafana_integration_type_spec.rb
index b4658db08d7..816264c36c8 100644
--- a/spec/graphql/types/grafana_integration_type_spec.rb
+++ b/spec/graphql/types/grafana_integration_type_spec.rb
@@ -7,7 +7,6 @@ RSpec.describe GitlabSchema.types['GrafanaIntegration'] do
%i[
id
grafana_url
- token
enabled
created_at
updated_at
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index 9133143cf56..558fc479af1 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe GitlabSchema.types['Issue'] do
fields = %i[id iid title description state reference author assignees updated_by participants labels milestone due_date
confidential discussion_locked upvotes downvotes user_notes_count user_discussions_count web_path web_url relative_position
emails_disabled subscribed time_estimate total_time_spent human_time_estimate human_total_time_spent closed_at created_at updated_at task_completion_status
- designs design_collection alert_management_alert severity current_user_todos moved moved_to]
+ design_collection alert_management_alert severity current_user_todos moved moved_to]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
diff --git a/spec/graphql/types/merge_request_type_spec.rb b/spec/graphql/types/merge_request_type_spec.rb
index a7512506100..8800250b103 100644
--- a/spec/graphql/types/merge_request_type_spec.rb
+++ b/spec/graphql/types/merge_request_type_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
diff_refs diff_stats diff_stats_summary
force_remove_source_branch merge_status in_progress_merge_commit_sha
merge_error allow_collaboration should_be_rebased rebase_commit_sha
- rebase_in_progress merge_commit_message default_merge_commit_message
+ rebase_in_progress default_merge_commit_message
merge_ongoing mergeable_discussions_state web_url
source_branch_exists target_branch_exists
upvotes downvotes head_pipeline pipelines task_completion_status
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb
index 3580959fde0..c085c3bdbd9 100644
--- a/spec/helpers/diff_helper_spec.rb
+++ b/spec/helpers/diff_helper_spec.rb
@@ -358,4 +358,30 @@ RSpec.describe DiffHelper do
expect(diff_file_path_text(diff_file, max: 10)).to eq("...open.rb")
end
end
+
+ describe 'unified_diff_lines_view_type' do
+ before do
+ controller.params[:view] = 'parallel'
+ end
+
+ describe 'unified diffs enabled' do
+ before do
+ stub_feature_flags(unified_diff_lines: true)
+ end
+
+ it 'returns inline view' do
+ expect(helper.unified_diff_lines_view_type(project)).to eq 'inline'
+ end
+ end
+
+ describe 'unified diffs disabled' do
+ before do
+ stub_feature_flags(unified_diff_lines: false)
+ end
+
+ it 'returns parallel view' do
+ expect(helper.unified_diff_lines_view_type(project)).to eq :parallel
+ end
+ end
+ end
end
diff --git a/spec/requests/api/graphql/project/grafana_integration_spec.rb b/spec/requests/api/graphql/project/grafana_integration_spec.rb
index 688959e622d..9b24698f40c 100644
--- a/spec/requests/api/graphql/project/grafana_integration_spec.rb
+++ b/spec/requests/api/graphql/project/grafana_integration_spec.rb
@@ -45,7 +45,6 @@ RSpec.describe 'Getting Grafana Integration' do
it_behaves_like 'a working graphql query'
- specify { expect(integration_data['token']).to eql grafana_integration.masked_token }
specify { expect(integration_data['grafanaUrl']).to eql grafana_integration.grafana_url }
specify do
diff --git a/spec/requests/api/graphql/project/issue/designs/notes_spec.rb b/spec/requests/api/graphql/project/issue/designs/notes_spec.rb
index e25453510d5..a671ddc7ab1 100644
--- a/spec/requests/api/graphql/project/issue/designs/notes_spec.rb
+++ b/spec/requests/api/graphql/project/issue/designs/notes_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe 'Getting designs related to an issue' do
post_graphql(query(note_fields), current_user: nil)
- designs_data = graphql_data['project']['issue']['designs']['designs']
+ designs_data = graphql_data['project']['issue']['designCollection']['designs']
design_data = designs_data['nodes'].first
note_data = design_data['notes']['nodes'].first
@@ -56,7 +56,7 @@ RSpec.describe 'Getting designs related to an issue' do
'issue',
{ iid: design.issue.iid.to_s },
query_graphql_field(
- 'designs', {}, design_node
+ 'designCollection', {}, design_node
)
)
)
diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb
index 94ec83e2dce..aecbcfb5b5a 100644
--- a/spec/requests/api/lint_spec.rb
+++ b/spec/requests/api/lint_spec.rb
@@ -9,12 +9,13 @@ RSpec.describe API::Lint do
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
end
- it 'passes validation' do
+ it 'passes validation without warnings or errors' do
post api('/ci/lint'), params: { content: yaml_content }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Hash
expect(json_response['status']).to eq('valid')
+ expect(json_response['warnings']).to eq([])
expect(json_response['errors']).to eq([])
end
@@ -26,6 +27,20 @@ RSpec.describe API::Lint do
end
end
+ context 'with valid .gitlab-ci.yaml with warnings' do
+ let(:yaml_content) { { job: { script: 'ls', rules: [{ when: 'always' }] } }.to_yaml }
+
+ it 'passes validation but returns warnings' do
+ post api('/ci/lint'), params: { content: yaml_content }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['status']).to eq('valid')
+ expect(json_response['warnings']).not_to be_empty
+ expect(json_response['status']).to eq('valid')
+ expect(json_response['errors']).to eq([])
+ end
+ end
+
context 'with an invalid .gitlab_ci.yml' do
context 'with invalid syntax' do
let(:yaml_content) { 'invalid content' }
@@ -35,6 +50,7 @@ RSpec.describe API::Lint do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['status']).to eq('invalid')
+ expect(json_response['warnings']).to eq([])
expect(json_response['errors']).to eq(['Invalid configuration format'])
end
@@ -54,6 +70,7 @@ RSpec.describe API::Lint do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['status']).to eq('invalid')
+ expect(json_response['warnings']).to eq([])
expect(json_response['errors']).to eq(['jobs config should contain at least one visible job'])
end
@@ -82,7 +99,18 @@ RSpec.describe API::Lint do
let(:project) { create(:project, :repository) }
let(:dry_run) { nil }
- RSpec.shared_examples 'valid config' do
+ RSpec.shared_examples 'valid config with warnings' do
+ it 'passes validation with warnings' do
+ ci_lint
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['valid']).to eq(true)
+ expect(json_response['errors']).to eq([])
+ expect(json_response['warnings']).not_to be_empty
+ end
+ end
+
+ RSpec.shared_examples 'valid config without warnings' do
it 'passes validation' do
ci_lint
@@ -94,6 +122,7 @@ RSpec.describe API::Lint do
expect(json_response).to be_an Hash
expect(json_response['merged_yaml']).to eq(expected_yaml)
expect(json_response['valid']).to eq(true)
+ expect(json_response['warnings']).to eq([])
expect(json_response['errors']).to eq([])
end
end
@@ -105,6 +134,7 @@ RSpec.describe API::Lint do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['merged_yaml']).to eq(yaml_content)
expect(json_response['valid']).to eq(false)
+ expect(json_response['warnings']).to eq([])
expect(json_response['errors']).to eq(['jobs config should contain at least one visible job'])
end
end
@@ -157,6 +187,7 @@ RSpec.describe API::Lint do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['merged_yaml']).to eq(nil)
expect(json_response['valid']).to eq(false)
+ expect(json_response['warnings']).to eq([])
expect(json_response['errors']).to eq(['Insufficient permissions to create a new pipeline'])
end
end
@@ -186,7 +217,7 @@ RSpec.describe API::Lint do
)
end
- it_behaves_like 'valid config'
+ it_behaves_like 'valid config without warnings'
end
end
end
@@ -242,13 +273,19 @@ RSpec.describe API::Lint do
context 'when running as dry run' do
let(:dry_run) { true }
- it_behaves_like 'valid config'
+ it_behaves_like 'valid config without warnings'
end
context 'when running static validation' do
let(:dry_run) { false }
- it_behaves_like 'valid config'
+ it_behaves_like 'valid config without warnings'
+ end
+
+ context 'With warnings' do
+ let(:yaml_content) { { job: { script: 'ls', rules: [{ when: 'always' }] } }.to_yaml }
+
+ it_behaves_like 'valid config with warnings'
end
end
diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb
index a3bfa7ea33c..dc735e3714d 100644
--- a/spec/requests/git_http_spec.rb
+++ b/spec/requests/git_http_spec.rb
@@ -433,7 +433,7 @@ RSpec.describe 'Git HTTP requests' do
let(:path) { "#{redirect.path}.git" }
it 'downloads get status 200 for redirects' do
- clone_get(path, {})
+ clone_get(path)
expect(response).to have_gitlab_http_status(:ok)
end
@@ -465,7 +465,7 @@ RSpec.describe 'Git HTTP requests' do
path: "/#{path}/info/refs?service=git-upload-pack"
})
- clone_get(path, env)
+ clone_get(path, **env)
expect(response).to have_gitlab_http_status(:forbidden)
end
@@ -493,7 +493,7 @@ RSpec.describe 'Git HTTP requests' do
it "rejects pulls with 401 Unauthorized for unknown projects (no project existence information leak)" do
user.block
- download('doesnt/exist.git', env) do |response|
+ download('doesnt/exist.git', **env) do |response|
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -693,7 +693,7 @@ RSpec.describe 'Git HTTP requests' do
end
it 'downloads get status 200' do
- clone_get(path, env)
+ clone_get(path, **env)
expect(response).to have_gitlab_http_status(:ok)
end
@@ -745,7 +745,7 @@ RSpec.describe 'Git HTTP requests' do
# We know for sure it is not an information leak since pulls using
# the build token must be allowed.
it "rejects pushes with 403 Forbidden" do
- push_get(path, env)
+ push_get(path, **env)
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq(git_access_error(:auth_upload))
@@ -754,7 +754,7 @@ RSpec.describe 'Git HTTP requests' do
# We are "authenticated" as CI using a valid token here. But we are
# not authorized to see any other project, so return "not found".
it "rejects pulls for other project with 404 Not Found" do
- clone_get("#{other_project.full_path}.git", env)
+ clone_get("#{other_project.full_path}.git", **env)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to eq(git_access_error(:project_not_found))
@@ -777,7 +777,7 @@ RSpec.describe 'Git HTTP requests' do
let(:project) { create(:project) }
it 'rejects pulls with 404 Not Found' do
- clone_get path, env
+ clone_get(path, **env)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to eq(git_access_error(:no_repo))
@@ -785,7 +785,7 @@ RSpec.describe 'Git HTTP requests' do
end
it 'rejects pushes with 403 Forbidden' do
- push_get path, env
+ push_get(path, **env)
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq(git_access_error(:auth_upload))
@@ -889,7 +889,7 @@ RSpec.describe 'Git HTTP requests' do
end
it "responds with status 200" do
- clone_get(path, env) do |response|
+ clone_get(path, **env) do |response|
expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -913,7 +913,7 @@ RSpec.describe 'Git HTTP requests' do
end
it 'blocks git access when the user did not accept terms', :aggregate_failures do
- clone_get(path, env) do |response|
+ clone_get(path, **env) do |response|
expect(response).to have_gitlab_http_status(:forbidden)
end
@@ -932,7 +932,7 @@ RSpec.describe 'Git HTTP requests' do
end
it 'allows clones' do
- clone_get(path, env) do |response|
+ clone_get(path, **env) do |response|
expect(response).to have_gitlab_http_status(:ok)
end
end
diff --git a/yarn.lock b/yarn.lock
index a62939b98ad..a2e89886d6d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1148,10 +1148,10 @@
dependencies:
"@sinonjs/commons" "^1.7.0"
-"@sourcegraph/code-host-integration@0.0.50":
- version "0.0.50"
- resolved "https://registry.yarnpkg.com/@sourcegraph/code-host-integration/-/code-host-integration-0.0.50.tgz#3f91be4c1b117efbf3d49c73033a6b1880db1c70"
- integrity sha512-Hf4JeXDnqxOpW8lrkmgzKCYKklQhS6f87j4EPxK//UdjV7W7rtBhsxr6RQqdV2VdVaVCLQW2tfA/tkm0zDk8CQ==
+"@sourcegraph/code-host-integration@0.0.52":
+ version "0.0.52"
+ resolved "https://registry.yarnpkg.com/@sourcegraph/code-host-integration/-/code-host-integration-0.0.52.tgz#3668364647b9248a0c43d738f7b046c551311338"
+ integrity sha512-HYmiGuQ3XOQHJIQaRv63Wcdl6y1rgryBrCLzJd/mG5gkkhydTqBuf3wWFKgfL3PCm026OrjXu4PvOYU1fCTZJQ==
"@szmarczak/http-timer@^1.1.2":
version "1.1.2"