This guide will demonstrate how to mirror an SVN into a Git repo. You're the target audience if you're an SVN user, just getting started with Git and need to coax your project team over to Git.
The branching scenario has been simplified for clarity.
| bash <<'EOF' || echo "Chef bootstrap failed!" | |
| # This is a mixture of the Ironfan and @fnichol bootstraps. | |
| # It keeps the chef ruby away from our other rubies. | |
| # | |
| # * installs a chef ruby using ruby_build. | |
| # * upgrades rubygems rather than installing from source | |
| # * pushes the node identity into the first-boot.json | |
| # * installs the chef-client service and kicks off the first run of chef |
| #!/usr/bin/env ruby | |
| # A lil' snip to submodule cookbooks in bulk. | |
| require 'rubygems' | |
| require 'octokit' | |
| github_org = 'guidance-cookbooks' | |
| Octokit.repositories(github_org).each do |repo| | |
| unless File.exists?(File.join(File.dirname(__FILE__), "cookbooks", repo.name)) |
| -----BEGIN PGP PUBLIC KEY BLOCK----- | |
| Version: GnuPG v1.4.11 (GNU/Linux) | |
| mQMuBE6groMRCADgZsZHKVwPzl4JRhWYLbukOPS65Xn+BiMCSt0b4faFy1ieBICG | |
| T+87F+wH0pQ69Gkq6XhO41u69uu3uHry9DSDNgkkDU9mIJtDjFgYD2rnWch5iSQo | |
| p8/9the41uTVxKUBes9yMXa84EYrrPkn3i7bKQggJo99wA2M2sl7Ya4LtQvU5vLv | |
| yQPsrkhpxqGu82DpyuxnJDW9aZzkoxhXhDTNIZPskNKMd1jbbBCgt/a4fIWXKQum | |
| PRRPOzqM5nLsixR5Dx8a35cLze8o0myQdPK8iKszhLe5CTga7m47NjG91qd5XO+R | |
| o03C64tjRIj+fS5X/LPUgRwDpqVQukWC2Qi3AQDC0gQCq251YU7s7e2Xsnv/KF2c | |
| nPvOdHFRAzD1Vh/fuQf/XuyIe/l4ivWH9FYz/AUFZDiRUOs+GRSKKlYCusiLwqWw |
| bash -c ' | |
| <%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> | |
| if [ ! -f /usr/bin/chef-client ]; then | |
| apt-get update | |
| apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras | |
| cd /tmp | |
| wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz | |
| tar zxf rubygems-1.3.7.tgz | |
| cd rubygems-1.3.7 |
| # Source accepts the protocol region:// with the host as the bucket | |
| # access_key_id and secret_access_key are just that | |
| # for the eu-west-1 region: | |
| s3_file "/var/bulk/the_file.tar.gz" do | |
| source "s3-eu-west-1://your.bucket/the_file.tar.gz" | |
| access_key_id your_key | |
| secret_access_key your_secret | |
| owner "root" | |
| group "root" |
| # -*- ruby -*- | |
| # Needs following parameters configured in rake.rb: | |
| # DNS_DOMAIN: domain for which to set entries, including trailing dot | |
| # (e.g. "example.com.") | |
| # DNS_ATTRIBUTE: attribute containing hostname to CNAME to, defaults | |
| # to 'fqdn'; for EC2, use "ec2.public_hostname" | |
| # DNS_ENTRIES: hash mapping hostname to node search query, | |
| # e.g. {'buildbot' => 'recipes:buildbot', 'monitoring' => | |
| # 'roles:monitoring'} |
| # @see https://github.com/infochimps/cluster_chef/blob/version_3/site-cookbooks/hadoop_cluster/libraries/munge_one_line.rb | |
| module MungeOneLine | |
| # | |
| # @param [String] name - name for the resource invocation | |
| # @param [String] filename - the file to modify (in-place) | |
| # @param [String] old_line - the string to replace | |
| # @param [String] new_line - the string to insert in its place | |
| # @param [String] shibboleth - a simple foolproof string that should be | |
| # present after this works |
| namespace :ec2 do | |
| # setup chef config | |
| # assumes this file is sibling to .chef dir, ex: CHEF_REPO/tasks | |
| config = File.join(File.dirname(__FILE__), '..', '.chef', 'knife.rb') | |
| Chef::Config.from_file(config) | |
| require 'active_support' | |
| require 'aws' | |
| desc 'Delete any ec2-based chef nodes that no longer exist' |