Vagrantfile #1

  • //
  • guest/
  • perforce_software/
  • helix-installer/
  • dev/
  • test/
  • Vagrantfile
  • View
  • Commits
  • Open Download .zip Download (2 KB)
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

our_domain = "p4demo.com"
helix_installer_config = (JSON.parse(File.read("helix_installer_test.json")))

class SDPError < Vagrant::Errors::VagrantError
  error_key "SDP Configuration error"
end
if !helix_installer_config.has_key?("oses")
  raise SDPError.new("Please define boxes in JSON file")
end

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  if Vagrant.has_plugin?("vagrant-hostmanager")
    config.hostmanager.enabled = true
    config.hostmanager.manage_host = true
    config.hostmanager.ignore_private_ip = false
    config.hostmanager.include_offline = true
  end

  helix_installer_config['oses'].each do |os|
    osname = os['osname']
    os['nodes'].each do |node|
      hostname = "#{osname}-#{node[':nodename']}"
      os_bootstrap = "bootstrap-linux.sh"
      config.vm.define hostname.to_sym do |machine|
        if Vagrant.has_plugin?("vagrant-cachier")
          machine.cache.scope = :box
        end
        if Vagrant.has_plugin?("vagrant-vbguest")
          config.vbguest.auto_update = false
        end
        machine.vm.box = os['box']
        machine.vm.box_url =  os['box_url']
        # Set the root password to 'vagrant'
        machine.vm.provision "shell", inline: "echo 'root:vagrant' | sudo chpasswd"

        # OS specific and common bootstrap/provisioning
        machine.vm.provision :shell, :path => os_bootstrap
        machine.vm.network :private_network, ip: node[':ip']
        if node.has_key?(":forwarded_port")
            ports = node[':forwarded_port']
	        machine.vm.network :forwarded_port, guest: ports['guest'], host: ports['host']
	    end
        machine.vm.hostname = hostname + "." + our_domain
        if Vagrant.has_plugin?("vagrant-hostmanager")
            machine.hostmanager.aliases = ["#{hostname}.localdomain", "#{hostname}"]
        end
      end
    end
  end

end
# Change User Description Committed
#9 27288 C. Thomas Tyler Removed old Vagrant Test suite.
#8 26795 C. Thomas Tyler Fixed test suite issues:
* Shell environment for test suite regression fixed.
* Vagrantfile referred to SDP rather than Helix Installer (old
Copy/Paste issue, harmless but wrong).
* Updated baseline Vagrant image for CentOS6 box.
* Fixed issue with setting hostname on CentOS6 by making hostname   
a paramter to the bootstrap script, and adjusting the bootstrap
script.

Along with this change, added missing hostmanager plugin on test
machine.
#7 26784 C. Thomas Tyler reset_sdp.sh v3.17.0:

Made /hx* mount points configurable in settings.cfg, and
updated documentation accordingly.

Added support for configuring /hxmetadata1 and /hxmetadata2
with different values.

Added test coverage for changing /hxdepots from the default.

Enhanced test suite.

TEST FAIL NOTE: As of this change, tests are succeeding on all
platforms except CentOS 6. Failures are in the test suite
infrastructure, not related to this change.
#6 26021 C. Thomas Tyler Test suite enhancements to better test Configured mode with
settings.cfg.
#5 25990 C. Thomas Tyler Refined test mechanism so local workspace dirs aren't
modified by test operations.

Changed logfile name to make it easier to find with
prefix rather than suffix.
#4 25987 C. Thomas Tyler Enhanced test suite to mount the local dir with checked out
files into the test VMs, rather than using 'curl' from a
URL which can only get submitted revisions of reset_sdp.sh.
#3 25164 C. Thomas Tyler Added Helix Installer path.
#2 24870 C. Thomas Tyler Various test environment tweaks:
* Adjusted host name to bos-helix-01 to be a simplified variant
  of the Battle School Lab.
* Changed defalt SDP branch to pull to auto-detected, using
         SDP 'dev' branch if in the Helix Installer dev branch, and
  SDP 'main' branch if in the Helix Installer main branch.
* Added host aliases in /etc/hosts.
* Added niceties in ~perforce/.bashrc file.
#1 24860 C. Thomas Tyler Added basic Vagrant test suite for Helix Installer for testing
on CentOS 6.10.