Use the tests-passed branch when upgrading Discourse for stability.
This commit is contained in:
parent
f09ad64b91
commit
e025c32fde
|
@ -15,7 +15,7 @@ module DockerManager
|
||||||
repos << DockerManager::GitRepo.new(File.dirname(p.path), p.name)
|
repos << DockerManager::GitRepo.new(File.dirname(p.path), p.name)
|
||||||
end
|
end
|
||||||
repos.map! do |r|
|
repos.map! do |r|
|
||||||
result = {name: r.name, path: r.path }
|
result = {name: r.name, path: r.path, branch: r.branch }
|
||||||
if r.valid?
|
if r.valid?
|
||||||
result[:id] = r.name.downcase.gsub(/[^a-z]/, '_').gsub(/_+/, '_').sub(/_$/, '')
|
result[:id] = r.name.downcase.gsub(/[^a-z]/, '_').gsub(/_+/, '_').sub(/_$/, '')
|
||||||
result[:version] = r.latest_local_commit
|
result[:version] = r.latest_local_commit
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
# like Grit just very very minimal
|
# like Grit just very very minimal
|
||||||
class DockerManager::GitRepo
|
class DockerManager::GitRepo
|
||||||
attr_reader :path, :name
|
attr_reader :path, :name, :branch
|
||||||
|
|
||||||
def initialize(path, name=nil)
|
def initialize(path, name=nil)
|
||||||
@path = path
|
@path = path
|
||||||
@name = name
|
@name = name
|
||||||
@memoize = {}
|
@memoize = {}
|
||||||
|
|
||||||
|
# For discourse proper, defauilt to the `tests-passed` branch
|
||||||
|
@branch = (path == Rails.root.to_s) ? 'tests-passed' : 'master'
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_upgrading
|
def start_upgrading
|
||||||
|
@ -74,7 +77,10 @@ class DockerManager::GitRepo
|
||||||
end
|
end
|
||||||
|
|
||||||
def tracking_branch
|
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
|
end
|
||||||
|
|
||||||
def run(cmd)
|
def run(cmd)
|
||||||
|
|
|
@ -20,7 +20,7 @@ class DockerManager::Upgrader
|
||||||
|
|
||||||
# HEAD@{upstream} is just a fancy way how to say origin/master (in normal case)
|
# HEAD@{upstream} is just a fancy way how to say origin/master (in normal case)
|
||||||
# see http://stackoverflow.com/a/12699604/84283
|
# 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("********************************************************")
|
||||||
log("*** Please be patient, next steps might take a while ***")
|
log("*** Please be patient, next steps might take a while ***")
|
||||||
log("********************************************************")
|
log("********************************************************")
|
||||||
|
|
Loading…
Reference in New Issue