Sha256: 055a8a22f472d9fe95979183c46a64426d391f287e53119c8295f123d5b4c9d0

Contents?: true

Size: 1.52 KB

Versions: 6

Compression:

Stored size: 1.52 KB

Contents

# Copyright (c) 2012-2013 Stark & Wayne, LLC

module Bosh; module CloudFoundry; end; end

# There are two concepts of "latest".
# * for upload: "latest" is the highest release in cf-release
# * for manifest creation: "latest" is the highest release already uploaded to the BOSH
module Bosh::CloudFoundry::GerritPatchesHelper

  def extract_refs_change(gerrit_change)
    if gerrit_change =~ %r{(\d+)/(\d+)/(\d+)$}
      "#{$1}/#{$2}/#{$3}"
    else
      nil
    end
  end

  def add_gerrit_refs_change(refs_change)
    system_config.gerrit_changes ||= []
    unless system_config.gerrit_changes.include?(refs_change)
      system_config.gerrit_changes << refs_change
      system_config.save
    end
  end
  
  def apply_gerrit_patches
    # is the gerrit setup necessary; or can use anonymous HTTP?
    # confirm_gerrit_username # http://reviews.cloudfoundry.org/#/settings/
    # confirm_user_added_vcap_ssh_keys_to_gerrit # http://reviews.cloudfoundry.org/#/settings/ssh-keys
    # confirm_ssh_access # ssh -p 29418 drnic@reviews.cloudfoundry.org 2>&1 | grep "Permission denied"
    create_and_change_into_patches_branch
    ssh_uri = "http://reviews.cloudfoundry.org/cf-release"
    chdir(cf_release_dir) do
      system_config.gerrit_changes.each do |refs_change|
        sh "git pull #{ssh_uri} refs/changes/#{refs_change}"
      end
    end
  end

  def create_and_change_into_patches_branch
    chdir(cf_release_dir) do
      sh "git checkout master"
      sh "git branch -f patches" # force create
      sh "git checkout patches"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bosh-cloudfoundry-0.5.0 lib/bosh-cloudfoundry/gerrit_patches_helper.rb
bosh-cloudfoundry-0.4.1 lib/bosh-cloudfoundry/gerrit_patches_helper.rb
bosh-cloudfoundry-0.4.0 lib/bosh-cloudfoundry/gerrit_patches_helper.rb
bosh-cloudfoundry-0.3.0 lib/bosh-cloudfoundry/gerrit_patches_helper.rb
bosh-cloudfoundry-0.2.1 lib/bosh-cloudfoundry/gerrit_patches_helper.rb
bosh-cloudfoundry-0.2.0 lib/bosh-cloudfoundry/gerrit_patches_helper.rb