summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/dev.rake
blob: 930b4bc13e2848472b9a36596414f51e69113320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
namespace :gitlab do
  namespace :dev do
    desc 'Checks if the branch would apply cleanly to EE'
    task :ee_compat_check, [:branch] => :environment do |_, args|
      opts =
        if ENV['CI']
          {
            # We don't use CI_REPOSITORY_URL since it includes `gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@`
            # which is confusing in the steps suggested in the job's output.
            ce_repo: "#{ENV['CI_PROJECT_URL']}.git",
            branch: ENV['CI_COMMIT_REF_NAME']
          }
        else
          unless args[:branch]
            puts "Must specify a branch as an argument".color(:red)
            exit 1
          end
          args
        end

      if File.basename(Rails.root) == 'gitlab-ee'
        puts "Skipping EE projects"
        exit 0
      elsif Gitlab::EeCompatCheck.new(opts || {}).check
        exit 0
      else
        exit 1
      end
    end
  end
end