This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###########jenkins script################################# | |
#!/bin/bash -l | |
# Use the correct ruby | |
echo "rvm use 'ruby@gemset'" | |
rvm use "ruby@gemset" | |
# Set "fail on error" in bash | |
echo "set -e" | |
set -e | |
echo $PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -l | |
source "$HOME/.rvm/scripts/rvm" | |
#Add path for ruby gems | |
PATH=/var/lib/jenkins/.rvm/gems/ruby-2.4.3@gemset/bin:$PATH | |
rvm use "ruby@gemset" | |
# Set "fail on error" in bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'concurrent' | |
require_relative 'common' | |
require_relative 'mirror_database' | |
class RsyncSupervisor | |
def initialize() | |
@beanstalk = Beaneater.new(Beaneater.configuration.beanstalkd_url) | |
@tube = @beanstalk.tubes["mirror"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'concurrent' | |
require_relative 'common' | |
require_relative 'mirror_database' | |
class RsyncSupervisor | |
def initialize | |
@beanstalk = Beaneater.new(Beaneater.configuration.beanstalkd_url) | |
@tube = @beanstalk.tubes['mirror'] | |
@pool = Concurrent::FixedThreadPool.new(10) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'concurrent' | |
require_relative 'common' | |
require_relative 'mirror_database' | |
class RsyncSupervisor | |
def initialize | |
@beanstalk = Beaneater.new(Beaneater.configuration.beanstalkd_url) | |
@tube = @beanstalk.tubes['mirror'] | |
@pool = Concurrent::FixedThreadPool.new(10) | |
@db = MirrorDatabase.new() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
require './lib/mirror_database' | |
require './lib/common.rb' | |
describe MirrorDatabase do | |
TEST_DB_FILE = File.join(File.dirname(__FILE__), '../test_data/mirror.db') | |
MIRROR_DB_OBJECT = begin | |
MirrorDatabase.new(db_file: TEST_DB_FILE) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sqlite3' | |
require_relative 'common' | |
class MirrorDatabase | |
include MirrorFileUtils | |
SYNC_STATUS_SYNCING = 'Syncing'.freeze | |
SYNC_STATUS_SUCCESSFUL = 'Successful'.freeze | |
SYNC_STATUS_FAILED = 'Failed'.freeze | |
SYNC_STATUS_STOP = 'Stop'.freeze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
require './lib/mirror_database' | |
require './lib/common.rb' | |
describe MirrorDatabase do | |
TEST_DB_FILE = File.join(File.dirname(__FILE__), '../test_data/mirror.db') | |
MIRROR_DB_OBJECT = begin | |
MirrorDatabase.new(db_file: TEST_DB_FILE) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run options: --seed 6399 | |
# Running: | |
.....2017-12-30 21:40:14 +0800 [1907] Database Exception occurred: near "05": syntax error | |
2017-12-30 21:40:14 +0800 [1907] near "05": syntax error | |
/home/marz/.rvm/gems/ruby-2.4.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize' | |
/home/marz/.rvm/gems/ruby-2.4.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new' | |
/home/marz/.rvm/gems/ruby-2.4.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare' | |
/home/marz/.rvm/gems/ruby-2.4.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Running: | |
...2018-01-01 12:20:52 +0800 [31673] Database Exception occurred: near "?": syntax error | |
2018-01-01 12:20:52 +0800 [31673] near "?": syntax error | |
/home/marz/.rvm/gems/ruby-2.4.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize' | |
/home/marz/.rvm/gems/ruby-2.4.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new' | |
/home/marz/.rvm/gems/ruby-2.4.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare' | |
/home/marz/rise/chef-repo/cookbooks/rise-mirror-script/lib/mirror_database.rb:81:in `block in update_sync_result_status' | |
/home/marz/rise/chef-repo/cookbooks/rise-mirror-script/lib/mirror_database.rb:172:in `execute' | |
/home/marz/rise/chef-repo/cookbooks/rise-mirror-script/lib/mirror_database.rb:68:in `update_sync_result_status' |