summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-10-14 11:31:10 +0000
committerLin Jen-Shin <godfat@godfat.org>2016-10-14 11:31:10 +0000
commitdc1d269f67f63eab5f358306ce394b5831377bf7 (patch)
tree2fb75d51a54d6b19e783c11cf12942d7a67cf8db /lib/tasks
parentb5f9d4c4bc48b252d3175432a3bb6fb1ca394af9 (diff)
parentca3bef554b14ddd2a0d844cd64874885e3f4e90e (diff)
downloadgitlab-ce-dc1d269f67f63eab5f358306ce394b5831377bf7.tar.gz
Merge remote-tracking branch 'upstream/master' into pipeline-emails
* upstream/master: (237 commits) Grapify boards API Add test, fix merge error Use local assigns to get the dropdown title Updated issuable dropdown titles Added safety check for formatted values Minor style improvement Fixed conflict and corrected teaspoon test Rename method in test Moved ci_status environments logic to new action ci_envrionments_status and set up frontend polling Refactor ci_status on MergeRequestController Fix indenting error in HAML Show what time ago a MR was deployed Fixed missing links Fixed missing links Refactor merge requests revisions Add link to update docs for source installations Grapify todos API Link to review apps example from docs fix grafana_configuration.md move link Do not run before_script, artifacts, cache in trigger_docs job ...
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/ce_to_ee_merge_check.rake4
-rw-r--r--lib/tasks/gitlab/check.rake6
-rw-r--r--lib/tasks/gitlab/dev.rake107
-rw-r--r--lib/tasks/gitlab/users.rake11
4 files changed, 125 insertions, 3 deletions
diff --git a/lib/tasks/ce_to_ee_merge_check.rake b/lib/tasks/ce_to_ee_merge_check.rake
new file mode 100644
index 00000000000..424e7883060
--- /dev/null
+++ b/lib/tasks/ce_to_ee_merge_check.rake
@@ -0,0 +1,4 @@
+desc 'Checks if the branch would apply cleanly to EE'
+task ce_to_ee_merge_check: :environment do
+ Rake::Task['gitlab:dev:ce_to_ee_merge_check'].invoke
+end
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 5f4a6bbfa35..2ae48a970ce 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -671,7 +671,7 @@ namespace :gitlab do
"Enable mail_room in the init.d configuration."
)
for_more_information(
- "doc/incoming_email/README.md"
+ "doc/administration/reply_by_email.md"
)
fix_and_rerun
end
@@ -690,7 +690,7 @@ namespace :gitlab do
"Enable mail_room in your Procfile."
)
for_more_information(
- "doc/incoming_email/README.md"
+ "doc/administration/reply_by_email.md"
)
fix_and_rerun
end
@@ -747,7 +747,7 @@ namespace :gitlab do
"Check that the information in config/gitlab.yml is correct"
)
for_more_information(
- "doc/incoming_email/README.md"
+ "doc/administration/reply_by_email.md"
)
fix_and_rerun
end
diff --git a/lib/tasks/gitlab/dev.rake b/lib/tasks/gitlab/dev.rake
new file mode 100644
index 00000000000..47bdb2d32d2
--- /dev/null
+++ b/lib/tasks/gitlab/dev.rake
@@ -0,0 +1,107 @@
+namespace :gitlab do
+ namespace :dev do
+ desc 'Checks if the branch would apply cleanly to EE'
+ task ce_to_ee_merge_check: :environment do
+ return if defined?(Gitlab::License)
+ return unless ENV['CI']
+
+ ce_repo = ENV['CI_BUILD_REPO']
+ ce_branch = ENV['CI_BUILD_REF_NAME']
+
+ ee_repo = 'https://gitlab.com/gitlab-org/gitlab-ee.git'
+ ee_branch = "#{ce_branch}-ee"
+ ee_dir = 'gitlab-ee-merge-check'
+
+ puts "\n=> Cloning #{ee_repo} into #{ee_dir}\n"
+ `git clone #{ee_repo} #{ee_dir} --depth 1`
+ Dir.chdir(ee_dir) do
+ puts "\n => Fetching #{ce_repo}/#{ce_branch}\n"
+ `git fetch #{ce_repo} #{ce_branch} --depth 1`
+
+ # Try to merge the current tested branch to EE/master...
+ puts "\n => Merging #{ce_repo}/#{ce_branch} into #{ee_repo}/master\n"
+ `git merge FETCH_HEAD`
+
+ exit 0 if $?.success?
+
+ # Check if the <branch>-ee branch exists...
+ puts "\n => Check if #{ee_repo}/#{ee_branch} exists\n"
+ `git rev-parse --verify #{ee_branch}`
+
+ # The <branch>-ee doesn't exist
+ unless $?.success?
+ puts
+ puts <<-MSG.strip_heredoc
+ =================================================================
+ The #{ce_branch} branch cannot be merged without conflicts to the
+ current EE/master, and no #{ee_branch} branch was detected in
+ the EE repository.
+
+ Please create a #{ee_branch} branch that includes changes from
+ #{ce_branch} but also specific changes than can be applied cleanly
+ to EE/master.
+
+ You can create this branch as follows:
+
+ 1. In the EE repo:
+ $ git fetch origin
+ $ git fetch #{ce_repo} #{ce_branch}
+ $ git checkout -b #{ee_branch} FETCH_HEAD
+ $ git rebase origin/master
+ 2. At this point you will likely have conflicts, solve them, and
+ continue/finish the rebase. Note: You can squash the CE commits
+ before rebasing.
+ 3. You can squash all the original #{ce_branch} commits into a
+ single "Port of #{ce_branch} to EE".
+ 4. Push your branch to #{ee_repo}:
+ $ git push origin #{ee_branch}
+ =================================================================\n
+ MSG
+
+ exit 1
+ end
+
+ # Try to merge the <branch>-ee branch to EE/master...
+ puts "\n => Merging #{ee_repo}/#{ee_branch} into #{ee_repo}/master\n"
+ `git merge #{ee_branch} master`
+
+ # The <branch>-ee cannot be merged cleanly to EE/master...
+ unless $?.success?
+ puts
+ puts <<-MSG.strip_heredoc
+ =================================================================
+ The #{ce_branch} branch cannot be merged without conflicts to
+ EE/master, and even though the #{ee_branch} branch exists in the EE
+ repository, it cannot be merged without conflicts to EE/master.
+
+ Please update the #{ee_branch}, push it again to #{ee_repo}, and
+ retry this job.
+ =================================================================\n
+ MSG
+
+ exit 2
+ end
+
+ puts "\n => Merging #{ce_repo}/#{ce_branch} into #{ee_repo}/master\n"
+ `git merge FETCH_HEAD`
+ exit 0 if $?.success?
+
+ # The <branch>-ee can be merged cleanly to EE/master, but <branch> still
+ # cannot be merged cleanly to EE/master...
+ puts
+ puts <<-MSG.strip_heredoc
+ =================================================================
+ The #{ce_branch} branch cannot be merged without conflicts to EE, and
+ even though the #{ee_branch} branch exists in the EE repository and
+ applies cleanly to EE/master, it doesn't prevent conflicts when
+ merging #{ce_branch} into EE.
+
+ We may be in a complex situation here.
+ =================================================================\n
+ MSG
+
+ exit 3
+ end
+ end
+ end
+end
diff --git a/lib/tasks/gitlab/users.rake b/lib/tasks/gitlab/users.rake
new file mode 100644
index 00000000000..3a16ace60bd
--- /dev/null
+++ b/lib/tasks/gitlab/users.rake
@@ -0,0 +1,11 @@
+namespace :gitlab do
+ namespace :users do
+ desc "GitLab | Clear the authentication token for all users"
+ task clear_all_authentication_tokens: :environment do |t, args|
+ # Do small batched updates because these updates will be slow and locking
+ User.select(:id).find_in_batches(batch_size: 100) do |batch|
+ User.where(id: batch.map(&:id)).update_all(authentication_token: nil)
+ end
+ end
+ end
+end