diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 12:09:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 12:09:42 +0000 |
commit | 729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch) | |
tree | f326420fc64999c6bcc28816ed54f0972fb46459 /lib | |
parent | 6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff) | |
download | gitlab-ce-729e3765d5feb762df1ccfbc228a8dd4662aa3f9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities/event.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/group.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/release.rb | 2 | ||||
-rw-r--r-- | lib/api/entities/releases/evidence.rb | 15 | ||||
-rw-r--r-- | lib/api/helpers/presentable.rb | 3 | ||||
-rw-r--r-- | lib/event_filter.rb | 19 | ||||
-rw-r--r-- | lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml | 4 | ||||
-rw-r--r-- | lib/gitlab/experimentation.rb | 6 |
8 files changed, 47 insertions, 4 deletions
diff --git a/lib/api/entities/event.rb b/lib/api/entities/event.rb index 9c2d766b7f1..8fd0bac13f4 100644 --- a/lib/api/entities/event.rb +++ b/lib/api/entities/event.rb @@ -9,6 +9,7 @@ module API expose :created_at expose :note, using: Entities::Note, if: ->(event, options) { event.note? } expose :author, using: Entities::UserBasic, if: ->(event, options) { event.author } + expose :wiki_page, using: Entities::WikiPageBasic, if: ->(event, _options) { event.wiki_page? } expose :push_event_payload, as: :push_data, diff --git a/lib/api/entities/group.rb b/lib/api/entities/group.rb index 10e10e52d9f..8a6a5b7057c 100644 --- a/lib/api/entities/group.rb +++ b/lib/api/entities/group.rb @@ -19,6 +19,7 @@ module API end expose :request_access_enabled expose :full_name, :full_path + expose :created_at expose :parent_id expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes diff --git a/lib/api/entities/release.rb b/lib/api/entities/release.rb index c70982a9ece..edcd9bc6505 100644 --- a/lib/api/entities/release.rb +++ b/lib/api/entities/release.rb @@ -22,6 +22,7 @@ module API expose :commit_path, expose_nil: false expose :tag_path, expose_nil: false expose :evidence_sha, expose_nil: false, if: ->(_, _) { can_download_code? } + expose :assets do expose :assets_count, as: :count do |release, _| assets_to_exclude = can_download_code? ? [] : [:sources] @@ -33,6 +34,7 @@ module API end expose :evidence_file_path, expose_nil: false, if: ->(_, _) { can_download_code? } end + expose :evidences, using: Entities::Releases::Evidence, expose_nil: false, if: ->(_, _) { can_download_code? } expose :_links do expose :self_url, as: :self, expose_nil: false expose :merge_requests_url, expose_nil: false diff --git a/lib/api/entities/releases/evidence.rb b/lib/api/entities/releases/evidence.rb new file mode 100644 index 00000000000..25b2bf6bf6f --- /dev/null +++ b/lib/api/entities/releases/evidence.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module API + module Entities + module Releases + class Evidence < Grape::Entity + include ::API::Helpers::Presentable + + expose :summary_sha, as: :sha + expose :filepath + expose :collected_at + end + end + end +end diff --git a/lib/api/helpers/presentable.rb b/lib/api/helpers/presentable.rb index 973c2132efe..a5186cc56ea 100644 --- a/lib/api/helpers/presentable.rb +++ b/lib/api/helpers/presentable.rb @@ -4,7 +4,7 @@ module API module Helpers ## # This module makes it possible to use `app/presenters` with - # Grape Entities. It instantiates model presenter and passes + # Grape Entities. It instantiates the model presenter and passes # options defined in the API endpoint to the presenter itself. # # present object, with: Entities::Something, @@ -22,6 +22,7 @@ module API extend ActiveSupport::Concern def initialize(object, options = {}) + options = options.opts_hash if options.is_a?(Grape::Entity::Options) super(object.present(options), options) end end diff --git a/lib/event_filter.rb b/lib/event_filter.rb index e062e3ddb1c..8cb0b1441df 100644 --- a/lib/event_filter.rb +++ b/lib/event_filter.rb @@ -9,6 +9,7 @@ class EventFilter ISSUE = 'issue' COMMENTS = 'comments' TEAM = 'team' + WIKI = 'wiki' def initialize(filter) # Split using comma to maintain backward compatibility Ex/ "filter1,filter2" @@ -22,6 +23,8 @@ class EventFilter # rubocop: disable CodeReuse/ActiveRecord def apply_filter(events) + events = apply_feature_flags(events) + case filter when PUSH events.where(action: Event::PUSHED) @@ -33,6 +36,8 @@ class EventFilter events.where(action: [Event::JOINED, Event::LEFT, Event::EXPIRED]) when ISSUE events.where(action: [Event::CREATED, Event::UPDATED, Event::CLOSED, Event::REOPENED], target_type: 'Issue') + when WIKI + wiki_events(events) else events end @@ -41,8 +46,20 @@ class EventFilter private + def apply_feature_flags(events) + return events.not_wiki_page unless Feature.enabled?(:wiki_events) + + events + end + + def wiki_events(events) + return events unless Feature.enabled?(:wiki_events) + + events.for_wiki_page + end + def filters - [ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM] + [ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM, WIKI] end end diff --git a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml index 9f9975f9e1c..262c52b2484 100644 --- a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml @@ -36,9 +36,9 @@ sast: export DOCKER_HOST='tcp://localhost:2375' fi fi - - ENVS=`printenv | grep -vE '^(DOCKER_|CI|GITLAB_|FF_|HOME|PWD|OLDPWD|PATH|SHLVL|HOSTNAME)' | sed -n '/^[^\t]/s/=.*//p' | sed '/^$/d' | sed 's/^/-e /g' | tr '\n' ' '` - | - docker run $ENVS \ + docker run \ + $(awk 'BEGIN{for(v in ENVIRON) print v}' | grep -v -E '^(DOCKER_|CI|GITLAB_|FF_|HOME|PWD|OLDPWD|PATH|SHLVL|HOSTNAME)' | awk '{printf " -e %s", $0}') \ --volume "$PWD:/code" \ --volume /var/run/docker.sock:/var/run/docker.sock \ "registry.gitlab.com/gitlab-org/security-products/sast:$SAST_VERSION" /app/bin/run /code diff --git a/lib/gitlab/experimentation.rb b/lib/gitlab/experimentation.rb index 30c8eaf605a..f1b952760b5 100644 --- a/lib/gitlab/experimentation.rb +++ b/lib/gitlab/experimentation.rb @@ -28,6 +28,12 @@ module Gitlab environment: ::Gitlab.dev_env_or_com?, enabled_ratio: 0.1, tracking_category: 'Growth::Expansion::Experiment::SuggestPipeline' + }, + ci_notification_dot: { + feature_toggle: :ci_notification_dot, + environment: ::Gitlab.dev_env_or_com?, + enabled_ratio: 0.1, + tracking_category: 'Growth::Expansion::Experiment::CiNotificationDot' } }.freeze |