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']
          {
            branch: ENV['CI_BUILD_REF_NAME'],
            ce_repo: ENV['CI_BUILD_REPO']
          }
        else
          unless args[:branch]
            puts "Must specify a branch as an argument".color(:red)
            exit 1
          end
          args
        end

      if Gitlab::EeCompatCheck.new(opts || {}).check
        exit 0
      else
        exit 1
      end
    end
  end
end

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']
          { branch: ENV['CI_BUILD_REF_NAME'] }
        else
          unless args[:branch]
            puts "Must specify a branch as an argument".color(:red)
            exit 1
          end
          args
        end

      if Gitlab::EeCompatCheck.new(opts || {}).check
        exit 0
      else
        exit 1
      end
    end
  end
end

Use the public CE repo URL instead of the one used in the runner
Use the public CE repo URL instead of the one used in the runner

This will prevent the task to advertise using
https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.com/gitlab-org/gitlab-ce.git
when https://gitlab.com/gitlab-org/gitlab-ce.git is enough

Signed-off-by: Rémy Coutable <4ea0184b9df19e0786dd00b28e6daa4d26baeb3e@rymai.me>
