summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-20 16:35:02 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-20 16:35:02 +0200
commitae9531910a4e677b86fef682e542f998b5e77ee8 (patch)
tree4afb53286c5d79044d992072fc3773a150910a61 /lib
parentb234e027f37c0869ca6fca634a1e4b2cba3079fd (diff)
downloadgitlab-ci-ae9531910a4e677b86fef682e542f998b5e77ee8.tar.gz
Use rake task with whenever instead of runner
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/scheduler.rb1
-rw-r--r--lib/tasks/cleanup.rake2
-rw-r--r--lib/tasks/schedule_builds.rake5
-rw-r--r--lib/tasks/sidekiq.rake4
4 files changed, 9 insertions, 3 deletions
diff --git a/lib/scheduler.rb b/lib/scheduler.rb
index 5dc9c11..0fa7638 100644
--- a/lib/scheduler.rb
+++ b/lib/scheduler.rb
@@ -8,6 +8,7 @@ class Scheduler
interval = project.polling_interval
if (last_build.created_at + interval.hours) < Time.now
Build.create_from(last_build)
+ puts "."
end
end
end
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
index b001ec6..5bcb5c4 100644
--- a/lib/tasks/cleanup.rake
+++ b/lib/tasks/cleanup.rake
@@ -1,5 +1,5 @@
namespace :cleanup do
- desc "GITLAB | Clean running builds"
+ desc "GitLab CI | Clean running builds"
task builds: :environment do
Build.running.update_all(status: 'canceled')
end
diff --git a/lib/tasks/schedule_builds.rake b/lib/tasks/schedule_builds.rake
new file mode 100644
index 0000000..02d6bb0
--- /dev/null
+++ b/lib/tasks/schedule_builds.rake
@@ -0,0 +1,5 @@
+desc "GitLab CI | Clean running builds"
+task schedule_builds: :environment do
+ Scheduler.new.perform
+ puts "Done"
+end
diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake
index 8fe4e0f..44105a8 100644
--- a/lib/tasks/sidekiq.rake
+++ b/lib/tasks/sidekiq.rake
@@ -1,10 +1,10 @@
namespace :sidekiq do
- desc "GITLAB | Stop sidekiq"
+ desc "GitLab CI | Stop sidekiq"
task :stop do
system "bundle exec sidekiqctl stop #{pidfile}"
end
- desc "GITLAB | Start sidekiq"
+ desc "GitLab CI | Start sidekiq"
task :start do
system "nohup bundle exec sidekiq -q runner,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
end