-
Notifications
You must be signed in to change notification settings - Fork 4
/
Vagrantfile_RPM_Test
84 lines (71 loc) · 2.83 KB
/
Vagrantfile_RPM_Test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- mode: ruby -*-
# # vi: set ft=ruby :
# Require Vagrant 2.0+.
Vagrant.require_version '>= 2.0.0'
Vagrant.configure("2") do |config|
tomcatPort = ENV['TOMCAT_PORT']
if tomcatPort.nil?
tomcatPort = '8888'
end
transPort = ENV['NODEJS_PORT']
if transPort.nil?
transPort = '8094'
end
mergePort = ENV['P2P_PORT']
if mergePort.nil?
mergePort = '8096'
end
disableForwarding = ENV['DISABLE_VAGRANT_FORWARDING']
if disableForwarding.nil?
config.vm.network "forwarded_port", guest: 8080, host: tomcatPort
config.vm.network "forwarded_port", guest: 8094, host: transPort
config.vm.network "forwarded_port", guest: 8096, host: mergePort
end
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = 20480
vb.cpus = 4
end
def aws_provider(config, os)
config.vm.provider :aws do |aws, override|
override.nfs.functional = false
aws.subnet_id = ENV['AWS_SUBNET_ID']
aws.instance_type = ENV.fetch('AWS_INSTANCE_TYPE', 't2.2xlarge')
aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1',
'Ebs.VolumeSize' => 24,
'Ebs.DeleteOnTermination' => true }]
if ENV.key?('AWS_KEYPAIR_NAME')
aws.keypair_name = ENV['AWS_KEYPAIR_NAME']
end
if ENV.key?('AWS_SECURITY_GROUP')
aws.security_groups = ENV['AWS_SECURITY_GROUP']
end
aws.tags = {
'Name' => ENV.fetch('AWS_INSTANCE_NAME_TAG',
"jenkins-hootenanny-rpms-#{os.downcase}"),
'URL' => ENV.fetch('AWS_INSTANCE_URL_TAG',
"https://github.com/ngageoint/hootenanny-rpms"),
'env' => ENV.fetch('HOOT_RPM_AWS_ENV_TAG', 'testing'),
'use' => ENV.fetch('HOOT_RPM_AWS_USE_TAG', 'Jenkins'),
'group' => ENV.fetch('HOOT_RPM_AWS_GROUP_TAG', 'devops')
}
if ENV.key?('JOB_NAME')
aws.tags['JobName'] = ENV['JOB_NAME']
end
if ENV.key?('BUILD_NUMBER')
aws.tags['BuildNumber'] = ENV['BUILD_NUMBER']
end
end
end
# set VM operating system to CentOS7
config.vm.define "default", primary: true do |hoot_centos7|
config.vm.box = "hoot/centos7-minimal"
config.vm.hostname = "hoot-rpms-test"
# sync `pwd` with VM at /home/vagrant/hoot-rpms
config.vm.synced_folder ".", "/home/vagrant/hoot-rpms"
# execute the shell script yum-configure.sh on the VM
config.vm.provision :shell, path:
"tests/yum-configure.sh"
aws_provider(hoot_centos7, 'CentOS7')
end
end