Use the tests-passed branch when upgrading Discourse for stability.

This commit is contained in:
Robin Ward 2014-06-10 17:16:05 -04:00
parent f09ad64b91
commit e025c32fde
3 changed files with 10 additions and 4 deletions

View File

@ -15,7 +15,7 @@ module DockerManager
repos << DockerManager::GitRepo.new(File.dirname(p.path), p.name)
end
repos.map! do |r|
result = {name: r.name, path: r.path }
result = {name: r.name, path: r.path, branch: r.branch }
if r.valid?
result[:id] = r.name.downcase.gsub(/[^a-z]/, '_').gsub(/_+/, '_').sub(/_$/, '')
result[:version] = r.latest_local_commit

View File

@ -1,11 +1,14 @@
# like Grit just very very minimal
class DockerManager::GitRepo
attr_reader :path, :name
attr_reader :path, :name, :branch
def initialize(path, name=nil)
@path = path
@name = name
@memoize = {}
# For discourse proper, defauilt to the `tests-passed` branch
@branch = (path == Rails.root.to_s) ? 'tests-passed' : 'master'
end
def start_upgrading
@ -74,7 +77,10 @@ class DockerManager::GitRepo
end
def tracking_branch
run "for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)"
return @tracking_branch if @tracking_branch
@tracking_branch = run("for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)")
@tracking_branch.gsub!('master', branch)
@tracking_branch
end
def run(cmd)

View File

@ -20,7 +20,7 @@ class DockerManager::Upgrader
# HEAD@{upstream} is just a fancy way how to say origin/master (in normal case)
# see http://stackoverflow.com/a/12699604/84283
run("cd #{@repo.path} && git fetch && git reset --hard HEAD@{upstream}")
run("cd #{@repo.path} && git fetch && git checkout #{@repo.branch} && git reset --hard HEAD@{upstream}")
log("********************************************************")
log("*** Please be patient, next steps might take a while ***")
log("********************************************************")