summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-24 09:06:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-24 09:06:18 +0000
commitdc0622dbe3cd552abca4107557c6c09edb23625c (patch)
tree224dc625a2fe70a37ea7af11b1ad539b9bee2212
parent12287a65b735d784cda3555d1b261e50b461b29e (diff)
downloadgitlab-ce-dc0622dbe3cd552abca4107557c6c09edb23625c.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab/ci/review.gitlab-ci.yml14
-rw-r--r--app/views/projects/protected_branches/shared/_branches_list.html.haml3
-rw-r--r--changelogs/unreleased/34684-job-log.yml5
-rw-r--r--changelogs/unreleased/ph-fixProtectedBranchesFlash.yml5
-rw-r--r--changelogs/unreleased/visual-review-api.yml5
-rw-r--r--doc/api/api_resources.md5
-rw-r--r--doc/api/visual_review_discussions.md40
-rw-r--r--doc/user/application_security/index.md38
-rw-r--r--lib/gitlab/ci/ansi2html.rb4
-rw-r--r--locale/gitlab.pot2
-rwxr-xr-xscripts/review_apps/automated_cleanup.rb8
-rw-r--r--spec/javascripts/jobs/components/job_log_spec.js2
-rw-r--r--spec/javascripts/jobs/mock_data.js15
-rw-r--r--spec/lib/gitlab/ci/ansi2html_spec.rb6
14 files changed, 113 insertions, 39 deletions
diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml
index fd26711cfcf..2ab492c16b2 100644
--- a/.gitlab/ci/review.gitlab-ci.yml
+++ b/.gitlab/ci/review.gitlab-ci.yml
@@ -35,14 +35,12 @@ build-qa-image:
- echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
- time docker push ${QA_IMAGE}
-schedule:review-cleanup:
+.base-review-cleanup:
extends:
- .default-tags
- .default-retry
- .default-only
- .only-code-qa-changes
- - .only-review-schedules
- - .except-deploys
stage: prepare
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base
allow_failure: true
@@ -55,6 +53,16 @@ schedule:review-cleanup:
script:
- ruby -rrubygems scripts/review_apps/automated_cleanup.rb
+schedule:review-cleanup:
+ extends:
+ - .base-review-cleanup
+ - .only-review-schedules
+
+manual:review-cleanup:
+ extends:
+ - .base-review-cleanup
+ when: manual
+
.review-build-cng-base:
extends:
- .default-only
diff --git a/app/views/projects/protected_branches/shared/_branches_list.html.haml b/app/views/projects/protected_branches/shared/_branches_list.html.haml
index 9dff251101b..f07de81d7fd 100644
--- a/app/views/projects/protected_branches/shared/_branches_list.html.haml
+++ b/app/views/projects/protected_branches/shared/_branches_list.html.haml
@@ -5,6 +5,7 @@
%p.settings-message.text-center
= s_("ProtectedBranch|There are currently no protected branches, protect a branch with the form above.")
- else
+ .flash-container
%table.table.table-bordered
%colgroup
%col{ width: "20%" }
@@ -27,8 +28,6 @@
- if can_admin_project
%th
%tbody
- %tr
- %td.flash-container{ colspan: 5 }
= yield
= paginate @protected_branches, theme: 'gitlab'
diff --git a/changelogs/unreleased/34684-job-log.yml b/changelogs/unreleased/34684-job-log.yml
new file mode 100644
index 00000000000..5d7172fefd0
--- /dev/null
+++ b/changelogs/unreleased/34684-job-log.yml
@@ -0,0 +1,5 @@
+---
+title: Removes arrow icons for old collapsible sections
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/ph-fixProtectedBranchesFlash.yml b/changelogs/unreleased/ph-fixProtectedBranchesFlash.yml
new file mode 100644
index 00000000000..0307570ec24
--- /dev/null
+++ b/changelogs/unreleased/ph-fixProtectedBranchesFlash.yml
@@ -0,0 +1,5 @@
+---
+title: Fixed protected branches flash styling
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/visual-review-api.yml b/changelogs/unreleased/visual-review-api.yml
new file mode 100644
index 00000000000..667ec553fb2
--- /dev/null
+++ b/changelogs/unreleased/visual-review-api.yml
@@ -0,0 +1,5 @@
+---
+title: New API endpoint for creating anonymous merge request discussions from Visual Review Tools
+merge_request: 18710
+author:
+type: added
diff --git a/doc/api/api_resources.md b/doc/api/api_resources.md
index 232a9825691..eeb4bf6c5f2 100644
--- a/doc/api/api_resources.md
+++ b/doc/api/api_resources.md
@@ -24,7 +24,7 @@ The following API resources are available in the project context:
| [Commits](commits.md) | `/projects/:id/repository/commits`, `/projects/:id/statuses` |
| [Container Registry](container_registry.md) | `/projects/:id/registry/repositories` |
| [Custom attributes](custom_attributes.md) | `/projects/:id/custom_attributes` (also available for groups and users) |
-| [Dependencies](dependencies.md) **(ULTIMATE)** | `/projects/:id/dependencies`
+| [Dependencies](dependencies.md) **(ULTIMATE)** | `/projects/:id/dependencies` |
| [Deploy keys](deploy_keys.md) | `/projects/:id/deploy_keys` (also available standalone) |
| [Deployments](deployments.md) | `/projects/:id/deployments` |
| [Discussions](discussions.md) (threaded comments) | `/projects/:id/issues/.../discussions`, `/projects/:id/snippets/.../discussions`, `/projects/:id/merge_requests/.../discussions`, `/projects/:id/commits/.../discussions` (also available for groups) |
@@ -67,7 +67,8 @@ The following API resources are available in the project context:
| [Search](search.md) | `/projects/:id/search` (also available for groups and standalone) |
| [Services](services.md) | `/projects/:id/services` |
| [Tags](tags.md) | `/projects/:id/repository/tags` |
-| [Vulnerabilities](vulnerabilities.md) **(ULTIMATE)** | `/projects/:id/vulnerabilities`
+| [Vulnerabilities](vulnerabilities.md) **(ULTIMATE)** | `/projects/:id/vulnerabilities` |
+| [Visual Review discussions](visual_review_discussions.md) **(STARTER**) | `/projects/:id/merge_requests/:merge_request_id/visual_review_discussions` |
| [Wikis](wikis.md) | `/projects/:id/wikis` |
## Group resources
diff --git a/doc/api/visual_review_discussions.md b/doc/api/visual_review_discussions.md
new file mode 100644
index 00000000000..59dbd6cb006
--- /dev/null
+++ b/doc/api/visual_review_discussions.md
@@ -0,0 +1,40 @@
+# Visual Review discussions API **(STARTER**)
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/merge_requests/18710) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.5.
+
+Visual Review discussions are notes on Merge Requests sent as
+feedback from [Visual Reviews](../ci/review_apps/index.md#visual-reviews-starter).
+
+## Create new merge request thread
+
+Creates a new thread to a single project merge request. This is similar to creating
+a note but other comments (replies) can be added to it later.
+
+```
+POST /projects/:id/merge_requests/:merge_request_iid/visual_review_discussions
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+| ------------------------- | -------------- | -------- | ----------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
+| `merge_request_iid` | integer | yes | The IID of a merge request |
+| `body` | string | yes | The content of the thread |
+| `position` | hash | no | Position when creating a diff note |
+| `position[base_sha]` | string | yes | Base commit SHA in the source branch |
+| `position[start_sha]` | string | yes | SHA referencing commit in target branch |
+| `position[head_sha]` | string | yes | SHA referencing HEAD of this merge request |
+| `position[position_type]` | string | yes | Type of the position reference. Either `text` or `image`. |
+| `position[new_path]` | string | no | File path after change |
+| `position[new_line]` | integer | no | Line number after change (Only stored for `text` diff notes) |
+| `position[old_path]` | string | no | File path before change |
+| `position[old_line]` | integer | no | Line number before change (Only stored for `text` diff notes) |
+| `position[width]` | integer | no | Width of the image (Only stored for `image` diff notes) |
+| `position[height]` | integer | no | Height of the image (Only stored for `image` diff notes) |
+| `position[x]` | integer | no | X coordinate (Only stored for `image` diff notes) |
+| `position[y]` | integer | no | Y coordinate (Only stored for `image` diff notes) |
+
+```bash
+curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/merge_requests/11/visual_review_discussions?body=comment
+```
diff --git a/doc/user/application_security/index.md b/doc/user/application_security/index.md
index e9f5898950e..dbbcb606ac7 100644
--- a/doc/user/application_security/index.md
+++ b/doc/user/application_security/index.md
@@ -203,14 +203,34 @@ An approval will be optional when a license report:
- Contains no software license violations.
- Contains only new licenses that are `approved` or unknown.
-<!-- ## Troubleshooting
+## Troubleshooting
-Include any troubleshooting steps that you can foresee. If you know beforehand what issues
-one might have when setting this up, or when something is changed, or on upgrading, it's
-important to describe those, too. Think of things that may go wrong and include them here.
-This is important to minimize requests for support, and to avoid doc comments with
-questions that you know someone might ask.
+### Getting error message `sast job: stage parameter should be [some stage name here]`
-Each scenario can be a third-level heading, e.g. `### Getting error message X`.
-If you have none to add when creating a doc, leave this section in place
-but commented out to help encourage others to add to it in the future. -->
+When including a security job template like [`SAST`](sast/index.md#configuration),
+the following error can be raised, depending on your GitLab CI/CD configuration:
+
+```
+Found errors in your .gitlab-ci.yml:
+
+* sast job: stage parameter should be unit-tests
+```
+
+This error appears when the stage (nammed `test`) of the included job isn't declared
+in `.gitlab-ci.yml`.
+To fix this issue, you can either:
+
+- Add a `test` stage in your `.gitlab-ci.yml`.
+- Change the default stage of the included security jobs. For example, with `SAST`:
+
+ ```yaml
+ include:
+ template: SAST.gitlab-ci.yml
+
+ sast:
+ stage: unit-tests
+ ```
+
+[Learn more on overriding the SAST template](sast/index.md#overriding-the-sast-template).
+All the security scanning tools define their stage, so this error can occur with
+all of them.
diff --git a/lib/gitlab/ci/ansi2html.rb b/lib/gitlab/ci/ansi2html.rb
index eb5d78ebcd4..a737d5543ad 100644
--- a/lib/gitlab/ci/ansi2html.rb
+++ b/lib/gitlab/ci/ansi2html.rb
@@ -220,7 +220,7 @@ module Gitlab
return if @sections.include?(section)
@sections << section
- write_raw %{<div class="js-section-start section-start fa fa-caret-down pr-2 cursor-pointer" data-timestamp="#{timestamp}" data-section="#{data_section_names}" role="button"></div>}
+ write_raw %{<div class="section-start" data-timestamp="#{timestamp}" data-section="#{data_section_names}" role="button"></div>}
@lineno_in_section = 0
end
@@ -308,7 +308,7 @@ module Gitlab
css_classes << "section"
css_classes << if @lineno_in_section == 0
- "js-section-header section-header cursor-pointer"
+ "section-header"
else
"line"
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 136cd00ce6c..1c8669deef3 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -16671,7 +16671,7 @@ msgstr ""
msgid "There was an error fetching configuration for charts"
msgstr ""
-msgid "There was an error fetching data for the form"
+msgid "There was an error fetching label data for the selected group"
msgstr ""
msgid "There was an error gathering the chart data"
diff --git a/scripts/review_apps/automated_cleanup.rb b/scripts/review_apps/automated_cleanup.rb
index da6652d603b..2b4f1b9fe0b 100755
--- a/scripts/review_apps/automated_cleanup.rb
+++ b/scripts/review_apps/automated_cleanup.rb
@@ -58,8 +58,11 @@ class AutomatedCleanup
checked_environments = []
delete_threshold = threshold_time(days: days_for_delete)
stop_threshold = threshold_time(days: days_for_stop)
+ deployments_look_back_threshold = threshold_time(days: days_for_delete * 5)
+
+ gitlab.deployments(project_path, per_page: DEPLOYMENTS_PER_PAGE, sort: 'desc').auto_paginate do |deployment|
+ break if Time.parse(deployment.created_at) < deployments_look_back_threshold
- gitlab.deployments(project_path, per_page: DEPLOYMENTS_PER_PAGE).auto_paginate do |deployment|
environment = deployment.environment
next unless environment
@@ -89,6 +92,9 @@ class AutomatedCleanup
threshold_day = threshold_time(days: days)
helm_releases.each do |release|
+ # Prevents deleting `dns-gitlab-review-app` releases or other unrelated releases
+ next unless release.name.start_with?('review-')
+
if release.status == 'FAILED' || release.last_update < threshold_day
delete_helm_release(release)
else
diff --git a/spec/javascripts/jobs/components/job_log_spec.js b/spec/javascripts/jobs/components/job_log_spec.js
index dd58f234394..4d782e5bd0e 100644
--- a/spec/javascripts/jobs/components/job_log_spec.js
+++ b/spec/javascripts/jobs/components/job_log_spec.js
@@ -10,7 +10,7 @@ describe('Job Log', () => {
let vm;
const trace =
- '<span>Running with gitlab-runner 12.1.0 (de7731dd)<br/></span><span> on docker-auto-scale-com d5ae8d25<br/></span><div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer" data-timestamp="1565502765" data-section="prepare-executor" role="button"></div><span class="section js-section-header section-header js-s-prepare-executor">Using Docker executor with image ruby:2.6 ...<br/></span>';
+ '<span>Running with gitlab-runner 12.1.0 (de7731dd)<br/></span><span> on docker-auto-scale-com d5ae8d25<br/></span><div class="append-right-8" data-timestamp="1565502765" data-section="prepare-executor" role="button"></div><span class="section section-header js-s-prepare-executor">Using Docker executor with image ruby:2.6 ...<br/></span>';
beforeEach(() => {
store = createStore();
diff --git a/spec/javascripts/jobs/mock_data.js b/spec/javascripts/jobs/mock_data.js
index c5022d3e93d..3d40e94d219 100644
--- a/spec/javascripts/jobs/mock_data.js
+++ b/spec/javascripts/jobs/mock_data.js
@@ -1189,18 +1189,3 @@ export const jobsInStage = {
path: '/gitlab-org/gitlab-shell/pipelines/27#build',
dropdown_path: '/gitlab-org/gitlab-shell/pipelines/27/stage.json?stage=build',
};
-
-export const logWithCollapsibleSections = {
- append: false,
- complete: true,
- html:
- '<div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer" data-timestamp="1559571405" data-section="after-script" role="button"></div><span class="term-fg-l-green term-bold section js-section-header js-s-after-script">Running after script...</span><span class="section js-section-header js-s-after-script"><br /></span><span class="section s_after-script line"></span><span class="section js-s-after-script"></span><span class="term-fg-l-green term-bold section js-s-after-script">$ date</span><span class="section js-s-after-script"><br /></span><span class="section s_after-script line"></span><span class="section js-s-after-script">Mon Jun 3 14:16:46 UTC 2019<br /></span><span class="section s_after-script line"></span><span class="section js-s-after-script"></span><div class="section-end" data-section="after-script"></div><div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer"data-timestamp="1559571408" data-section="archive-cache" role="button" ></div><span class="term-fg-l-green term-bold section js-section-header js-s-archive-cache">Not uploading cache debian-stretch-ruby-2.6.3-node-10.x-3 due to policy</span><span class="section js-section-header js-s-archive-cache"><br /></span><span class="section s_archive-cache line"></span><span class="section js-s-archive-cache"></span><div class="section-end" data-section="archive-cache"></div><div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer" data-timestamp="1559571409" data-section="upload-artifacts-on-success" role="button"></div><span class="term-fg-l-green term-bold section js-section-header js-s-upload-artifacts-on-success">Uploading artifacts...</span><span class="section js-section-header js-s-upload-artifacts-on-success"><br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success">coverage/: found 5 matching files </span><span class="section js-s-upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success">knapsack/: found 4 matching files </span><span class="section js-s-upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success">rspec_flaky/: found 4 matching files </span><span class="section js-s-upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success">rspec_profiling/: found 1 matching files </span><span class="section js-s-upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success"></span><span class="term-fg-yellow section js-s-upload-artifacts-on-success">WARNING: tmp/capybara/: no matching files </span><span class="section js-s-upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success">Uploading artifacts to coordinator... ok </span><span class="section js-s-upload-artifacts-on-success"> id</span><span class="section js-s-upload-artifacts-on-success">=224162288 responseStatus</span><span class="section js-s-upload-artifacts-on-success">=201 Created token</span><span class="section js-s-upload-artifacts-on-success">=bBmyXJNW<br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success"></span><span class="term-fg-l-green term-bold section js-s-upload-artifacts-on-success">Uploading artifacts...</span><span class="section js-s-upload-artifacts-on-success"><br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success">junit_rspec.xml: found 1 matching files </span><span class="section js-s-upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success">Uploading artifacts to coordinator... ok </span><span class="section js-s-upload-artifacts-on-success"> id</span><span class="section js-s-upload-artifacts-on-success">=224162288 responseStatus</span><span class="section js-s-upload-artifacts-on-success">=201 Created token</span><span class="section js-s-upload-artifacts-on-success">=bBmyXJNW<br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s-upload-artifacts-on-success"></span><div class="section-end" data-section="upload-artifacts-on-success"></div><span class="term-fg-l-green term-bold">Job succeeded<br /><span class="term-fg-l-green term-bold"></span></span>',
- id: 1385,
- offset: 0,
- size: 78815,
- state:
- 'eyJvZmZzZXQiOjc4ODE1LCJuX29wZW5fdGFncyI6MCwiZmdfY29sb3IiOm51bGwsImJnX2NvbG9yIjpudWxsLCJzdHlsZV9tYXNrIjowLCJzZWN0aW9ucyI6W10sImxpbmVub19pbl9zZWN0aW9uIjoxMX0=',
- status: 'success',
- total: 78815,
- truncated: false,
-};
diff --git a/spec/lib/gitlab/ci/ansi2html_spec.rb b/spec/lib/gitlab/ci/ansi2html_spec.rb
index c8afcbd053d..ee789995bc2 100644
--- a/spec/lib/gitlab/ci/ansi2html_spec.rb
+++ b/spec/lib/gitlab/ci/ansi2html_spec.rb
@@ -209,7 +209,7 @@ describe Gitlab::Ci::Ansi2html do
let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K"}
let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K"}
let(:section_start_html) do
- '<div class="js-section-start section-start fa fa-caret-down pr-2 cursor-pointer"' \
+ '<div class="section-start"' \
" data-timestamp=\"#{section_start_time.to_i}\" data-section=\"#{class_name(section_name)}\"" \
' role="button"></div>'
end
@@ -233,8 +233,8 @@ describe Gitlab::Ci::Ansi2html do
it 'prints light red' do
text = "#{section_start}\e[91mHello\e[0m\nLine 1\nLine 2\nLine 3\n#{section_end}"
- header = %{<span class="term-fg-l-red section js-section-header section-header cursor-pointer js-s-#{class_name(section_name)}">Hello</span>}
- line_break = %{<span class="section js-section-header section-header cursor-pointer js-s-#{class_name(section_name)}"><br/></span>}
+ header = %{<span class="term-fg-l-red section section-header js-s-#{class_name(section_name)}">Hello</span>}
+ line_break = %{<span class="section section-header js-s-#{class_name(section_name)}"><br/></span>}
output_line = %{<span class="section line js-s-#{class_name(section_name)}">Line 1<br/>Line 2<br/>Line 3<br/></span>}
html = "#{section_start_html}#{header}#{line_break}#{output_line}#{section_end_html}"