From 4c68d2387e51632e9808ed3a0db9f6dc14e25b31 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 7 Jul 2014 14:12:06 +0200 Subject: Add sanitize option to gitlab check rake task. --- lib/tasks/gitlab/check.rake | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 34116568e99..84f0cf8ef21 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -216,7 +216,12 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - print "#{project.name_with_namespace.yellow} ... " + message = if sanitize + "#{project.namespace_id.to_s.yellow}/#{project.id.to_s.yellow} ... " + else + "#{project.name_with_namespace.yellow} ... " + end + print message if project.satellite.exists? puts "yes".green @@ -525,7 +530,12 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - print "#{project.name_with_namespace.yellow} ... " + message = if sanitize + "#{project.id.to_s.yellow} ... " + else + "#{project.name_with_namespace.yellow} ... " + end + print message if project.empty_repo? puts "repository is empty".magenta @@ -588,7 +598,12 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - print "#{project.name_with_namespace.yellow} ... " + message = if sanitize + "#{project.namespace_id.to_s.yellow}/#{project.id.to_s.yellow} ... " + else + "#{project.name_with_namespace.yellow} ... " + end + print message if project.namespace puts "yes".green @@ -837,4 +852,12 @@ namespace :gitlab do def omnibus_gitlab? Dir.pwd == '/opt/gitlab/embedded/service/gitlab-rails' end + + def sanitize + if ENV['SANITIZE'] == "true" + true + else + false + end + end end -- cgit v1.2.1 From 553f3aba48e7b124b02b0a7eecd85eacec7453e3 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 7 Jul 2014 14:19:32 +0200 Subject: Remove duplicated calls. --- lib/tasks/gitlab/check.rake | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 84f0cf8ef21..28fc56591cb 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -216,12 +216,7 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - message = if sanitize - "#{project.namespace_id.to_s.yellow}/#{project.id.to_s.yellow} ... " - else - "#{project.name_with_namespace.yellow} ... " - end - print message + print sanitized_message(project) if project.satellite.exists? puts "yes".green @@ -530,12 +525,7 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - message = if sanitize - "#{project.id.to_s.yellow} ... " - else - "#{project.name_with_namespace.yellow} ... " - end - print message + print sanitized_message(project) if project.empty_repo? puts "repository is empty".magenta @@ -598,12 +588,7 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - message = if sanitize - "#{project.namespace_id.to_s.yellow}/#{project.id.to_s.yellow} ... " - else - "#{project.name_with_namespace.yellow} ... " - end - print message + print sanitized_message(project) if project.namespace puts "yes".green @@ -853,6 +838,14 @@ namespace :gitlab do Dir.pwd == '/opt/gitlab/embedded/service/gitlab-rails' end + def sanitized_message(project) + if sanitize + "#{project.namespace_id.to_s.yellow}/#{project.id.to_s.yellow} ... " + else + "#{project.name_with_namespace.yellow} ... " + end + end + def sanitize if ENV['SANITIZE'] == "true" true -- cgit v1.2.1 From cb4d8eff4cb158fbef4d59bf64e04e776e29eaed Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 7 Jul 2014 14:41:02 +0200 Subject: Add sanitize option to documentation. --- CONTRIBUTING.md | 2 +- doc/install/installation.md | 2 ++ doc/raketasks/maintenance.md | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a08ffa449d8..e7e4cbf39ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,7 @@ Please send a merge request with a tested solution or a merge request with a fai 1. **Observed behavior** 1. **Relevant logs and/or screenshots:** Please use code blocks (\`\`\`) to format console output, logs, and code as it's very hard to read otherwise. 1. **Output of checks** - * Results of GitLab [Application Check](doc/install/installation.md#check-application-status) (`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production`); we will only investigate if the tests are passing + * Results of GitLab [Application Check](doc/install/installation.md#check-application-status) (`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`); we will only investigate if the tests are passing * Version of GitLab you are running; we will only investigate issues in the latest stable and development releases as per the [maintenance policy](MAINTENANCE.md) * Add the last commit sha1 of the GitLab version you used to replicate the issue (obtainable from the help page) * Describe your setup (use relevant parts from `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`) diff --git a/doc/install/installation.md b/doc/install/installation.md index 37f9377256c..b5ebb2694b9 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -331,6 +331,8 @@ To make sure you didn't miss anything run a more thorough check with: If all items are green, then congratulations on successfully installing GitLab! +NOTE: Supply `SANITIZE=true` environment variable to `gitlab:check` to omit project names from the output of the check command. + ### Initial Login Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has created an admin account for you. You can use it to log in: diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index 3339dfb03ac..9f5d21527c3 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -63,6 +63,8 @@ sudo gitlab-rake gitlab:check bundle exec rake gitlab:check RAILS_ENV=production ``` +NOTE: Use SANITIZE=true for gitlab:check if you want to omit project names from the output. + Example output: ``` -- cgit v1.2.1