Welcome to mirror list, hosted at ThFree Co, Russian Federation.

build_policy.rb « ci « policies « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 71ecb5bca8d67a78bf35768c9617e4fba89e2465 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Ci
  class BuildPolicy < CommitStatusPolicy
    condition(:protected_action) do
      next false unless @subject.action?

      access = ::Gitlab::UserAccess.new(@user, project: @subject.project)

      !access.can_merge_to_branch?(@subject.ref) ||
        !access.can_create_tag?(@subject.ref)
    end

    rule { protected_action }.prevent :update_build
  end
end