vagrant-openshift 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +1 -0
  3. data/.gitignore +24 -0
  4. data/Gemfile +11 -0
  5. data/LICENSE.txt +13 -0
  6. data/README.asciidoc +379 -0
  7. data/Rakefile +53 -0
  8. data/lib/vagrant-openshift/action/build_geard.rb +41 -0
  9. data/lib/vagrant-openshift/action/build_geard_broker.rb +59 -0
  10. data/lib/vagrant-openshift/action/build_geard_console.rb +55 -0
  11. data/lib/vagrant-openshift/action/build_geard_images.rb +54 -0
  12. data/lib/vagrant-openshift/action/build_sources.rb +39 -0
  13. data/lib/vagrant-openshift/action/checkout_repositories.rb +72 -0
  14. data/lib/vagrant-openshift/action/checkout_tests.rb +57 -0
  15. data/lib/vagrant-openshift/action/clean.rb +51 -0
  16. data/lib/vagrant-openshift/action/clean_network_setup.rb +52 -0
  17. data/lib/vagrant-openshift/action/clone_upstream_repositories.rb +65 -0
  18. data/lib/vagrant-openshift/action/create_ami.rb +54 -0
  19. data/lib/vagrant-openshift/action/create_bare_repo_placeholders.rb +53 -0
  20. data/lib/vagrant-openshift/action/create_puppet_file.rb +84 -0
  21. data/lib/vagrant-openshift/action/create_test_users.rb +36 -0
  22. data/lib/vagrant-openshift/action/create_yum_repositories.rb +121 -0
  23. data/lib/vagrant-openshift/action/download_artifacts.rb +70 -0
  24. data/lib/vagrant-openshift/action/generate_template.rb +89 -0
  25. data/lib/vagrant-openshift/action/idle_all_gears.rb +36 -0
  26. data/lib/vagrant-openshift/action/install_build_dependencies.rb +48 -0
  27. data/lib/vagrant-openshift/action/install_geard.rb +76 -0
  28. data/lib/vagrant-openshift/action/install_geard_base_dependencies.rb +72 -0
  29. data/lib/vagrant-openshift/action/install_geard_broker.rb +39 -0
  30. data/lib/vagrant-openshift/action/install_geard_images.rb +51 -0
  31. data/lib/vagrant-openshift/action/install_open_shift_dependencies.rb +50 -0
  32. data/lib/vagrant-openshift/action/install_rhc.rb +42 -0
  33. data/lib/vagrant-openshift/action/local_geard_checkout.rb +58 -0
  34. data/lib/vagrant-openshift/action/local_repo_checkout.rb +47 -0
  35. data/lib/vagrant-openshift/action/modify_ami.rb +54 -0
  36. data/lib/vagrant-openshift/action/modify_instance.rb +71 -0
  37. data/lib/vagrant-openshift/action/prepare_ssh_config.rb +89 -0
  38. data/lib/vagrant-openshift/action/preserve_mcollective_logs.rb +48 -0
  39. data/lib/vagrant-openshift/action/restart_geard.rb +39 -0
  40. data/lib/vagrant-openshift/action/restart_geard_broker.rb +43 -0
  41. data/lib/vagrant-openshift/action/restart_geard_console.rb +43 -0
  42. data/lib/vagrant-openshift/action/run_geard_tests.rb +57 -0
  43. data/lib/vagrant-openshift/action/run_tests.rb +47 -0
  44. data/lib/vagrant-openshift/action/set_host_name.rb +43 -0
  45. data/lib/vagrant-openshift/action/setup_bind_dns_key.rb +38 -0
  46. data/lib/vagrant-openshift/action/setup_bind_host.rb +141 -0
  47. data/lib/vagrant-openshift/action/setup_builder_files.rb +57 -0
  48. data/lib/vagrant-openshift/action/setup_geard_broker.rb +71 -0
  49. data/lib/vagrant-openshift/action/sync_local_repository.rb +115 -0
  50. data/lib/vagrant-openshift/action/sync_upstream_repository.rb +71 -0
  51. data/lib/vagrant-openshift/action/test_exit_code.rb +36 -0
  52. data/lib/vagrant-openshift/action/uninstall_openshift_rpms.rb +37 -0
  53. data/lib/vagrant-openshift/action/yum_update.rb +67 -0
  54. data/lib/vagrant-openshift/action.rb +308 -0
  55. data/lib/vagrant-openshift/command/build_geard.rb +51 -0
  56. data/lib/vagrant-openshift/command/build_geard_base.rb +51 -0
  57. data/lib/vagrant-openshift/command/build_geard_broker.rb +59 -0
  58. data/lib/vagrant-openshift/command/build_geard_console.rb +59 -0
  59. data/lib/vagrant-openshift/command/build_geard_images.rb +68 -0
  60. data/lib/vagrant-openshift/command/build_origin_base.rb +51 -0
  61. data/lib/vagrant-openshift/command/checkout_repositories.rb +55 -0
  62. data/lib/vagrant-openshift/command/clone_upstream_repositories.rb +54 -0
  63. data/lib/vagrant-openshift/command/create_ami.rb +49 -0
  64. data/lib/vagrant-openshift/command/install_geard.rb +51 -0
  65. data/lib/vagrant-openshift/command/install_geard_broker.rb +51 -0
  66. data/lib/vagrant-openshift/command/install_rhc.rb +49 -0
  67. data/lib/vagrant-openshift/command/local_geard_setup.rb +62 -0
  68. data/lib/vagrant-openshift/command/local_repo_setup.rb +62 -0
  69. data/lib/vagrant-openshift/command/modify_ami.rb +54 -0
  70. data/lib/vagrant-openshift/command/modify_instance.rb +63 -0
  71. data/lib/vagrant-openshift/command/openshift_init.rb +83 -0
  72. data/lib/vagrant-openshift/command/repo_sync.rb +73 -0
  73. data/lib/vagrant-openshift/command/repo_sync_geard.rb +78 -0
  74. data/lib/vagrant-openshift/command/restart_geard.rb +51 -0
  75. data/lib/vagrant-openshift/command/restart_geard_broker.rb +51 -0
  76. data/lib/vagrant-openshift/command/restart_geard_console.rb +51 -0
  77. data/lib/vagrant-openshift/command/setup_geard_broker.rb +49 -0
  78. data/lib/vagrant-openshift/command/test.rb +108 -0
  79. data/lib/vagrant-openshift/command/test_geard.rb +59 -0
  80. data/lib/vagrant-openshift/command/test_geard_image.rb +147 -0
  81. data/lib/vagrant-openshift/config.rb +56 -0
  82. data/lib/vagrant-openshift/constants.rb +111 -0
  83. data/lib/vagrant-openshift/helper/command_helper.rb +213 -0
  84. data/lib/vagrant-openshift/plugin.rb +171 -0
  85. data/lib/vagrant-openshift/provisioner.rb +82 -0
  86. data/lib/vagrant-openshift/templates/builder/Rakefile +231 -0
  87. data/lib/vagrant-openshift/templates/builder/lib/.gitkeep +0 -0
  88. data/lib/vagrant-openshift/templates/builder/lib/rpm.rb +248 -0
  89. data/lib/vagrant-openshift/templates/builder/lib/test.rb +432 -0
  90. data/lib/vagrant-openshift/templates/builder/yum-listbuilddep +124 -0
  91. data/lib/vagrant-openshift/templates/command/init-openshift/Vagrantfile.erb +175 -0
  92. data/lib/vagrant-openshift/templates/command/init-openshift/box_info.yaml +152 -0
  93. data/lib/vagrant-openshift/version.rb +21 -0
  94. data/lib/vagrant-openshift.rb +34 -0
  95. data/vagrant-openshift.gemspec +43 -0
  96. metadata +234 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 37cbead9fef9d999bd787d5c5235398207ecf3fb
4
+ data.tar.gz: d55a4db0100f1aca956fbaaff81828cb922f8110
5
+ SHA512:
6
+ metadata.gz: 4a9234f05f04cba7415dd7ef94457ae166609c0b747a571875f938e4ff3a984b3eb8cb28176fbc2d1d2accaa153432e419b2fa780c7526469b7e9c1faa511679
7
+ data.tar.gz: 7e514acfc0c3d39cdebfcbc0a76ac6632820ed643415bc82ce65958d1379d276e07eeb52dbf4eac606523472338245f5dba0c585945bea6976d6a56f86ad6ddc
data/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * autocrlf=input eol=lf
data/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ *.rbc
3
+ *.swp
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ .project
8
+ .idea/*
9
+ Gemfile.lock
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ test/tmp
19
+ test/version_tmp
20
+ test/Vagrantfile
21
+ test/origin-server
22
+ test/puppet-openshift_origin
23
+ test/rhc
24
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-openshift.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ # We depend on Vagrant for development, but we don't add it as a
8
+ # gem dependency because we expect to be installed within the
9
+ # Vagrant environment itself using `vagrant plugin`.
10
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
11
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2013 Red Hat, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.asciidoc ADDED
@@ -0,0 +1,379 @@
1
+ == OpenShift Origin Build Tools
2
+
3
+ This is a link:http://www.vagrantup.com[Vagrant] 1.2+ plugin that adds command and provisioner to
4
+ build and test link:http://openshift.github.io[OpenShift Origin].
5
+
6
+ NOTE: This plugin requires Vagrant 1.2+
7
+
8
+ === Features
9
+
10
+ * Compatible with VMs run via link:https://www.virtualbox.org[VirtualBox], link:https://github.com/mitchellh/vagrant-aws[AWS]
11
+ or link:https://github.com/tknerr/vagrant-managed-servers[managed] providers.
12
+ * Provides commands to install build dependencies, sync repositories, and run tests
13
+
14
+ === Installing
15
+
16
+ To work on the *vagrant-openshift* plugin, clone this repository out, and use
17
+ link:http://gembundler.com[Bundler] to get the dependencies:
18
+
19
+ [source, sh]
20
+ ----
21
+ $ bundle
22
+ ----
23
+
24
+ Install prereq plugins to Vagrant
25
+ ----
26
+ $ vagrant plugin install vagrant-aws
27
+ ----
28
+
29
+ Compile an install the plugin using Rake
30
+
31
+ [source, sh]
32
+ ----
33
+ $ rake vagrant:install
34
+ ----
35
+
36
+ === Getting started
37
+
38
+ ==== Clone the OpenShift Origin repositories
39
+
40
+ ===== OpenShift 3
41
+
42
+ [source, sh]
43
+ ----
44
+ $ echo "export GOPATH=~/code" >> ~/.bash_profile # ~/code can be any dir
45
+ $ source ~/.bash_profile
46
+ $ cd $GOPATH
47
+ $ vagrant geard-local-checkout -u <github username>
48
+ ----
49
+
50
+ ===== OpenShift 2.x
51
+
52
+ [source, sh]
53
+ ----
54
+ $ vagrant origin-local-checkout -u <github username>
55
+ ----
56
+
57
+ This will clone several repositories from link:http://www.github.com[GitHub] and link them against the upstream repositories.
58
+
59
+ NOTE: Skip this step if building upstream code
60
+
61
+ ==== Initialize the Vagrantfile
62
+
63
+ Create a Vagrantfile and customize it to match your requirements:
64
+
65
+ [source, sh]
66
+ ----
67
+ $ vagrant origin-init <instance name>
68
+ ----
69
+
70
+ .Command options:
71
+
72
+ * Specify which OS to build with:
73
+ ** --os fedora - Launch a Fedora 20 image (used for OpenShift 3 development)
74
+ ** --os rhel6 - Launch a RHEL 6 image (where available)
75
+ ** --os centos6 - Launch a CentOS 6 image (where available, used for OpenShift 2.x development)
76
+
77
+ * Specify the stage of image to launch:
78
+ ** --stage os - Launch the base operating system with no OpenShift dependencies
79
+ ** --stage deps - Launch the image with OpenShift dependencies already installed
80
+ ** --stage inst - Launch the image with OpenShift fully installed
81
+
82
+ .So to launch the latest OpenShift instance:
83
+
84
+ [source, sh]
85
+ ----
86
+ $ vagrant origin-init --stage inst --os fedora <instance name>
87
+ ----
88
+
89
+ ==== Start the machine
90
+
91
+ ===== VirtualBox
92
+
93
+ Running with the default VirtualBox provider
94
+
95
+ [source, sh]
96
+ ----
97
+ vagrant up
98
+ ----
99
+
100
+ Note: See Other Environments below for launching against other options.
101
+
102
+
103
+ ==== Making Subsequent Changes
104
+
105
+ * Syncing and building code from local repository clones
106
+
107
+ ===== OpenShift 3
108
+
109
+ [source, sh]
110
+ ----
111
+ $ vagrant sync-geard
112
+ ----
113
+
114
+
115
+ ===== OpenShift 2.x
116
+
117
+ [source, sh]
118
+ ----
119
+ $ vagrant sync
120
+ ----
121
+
122
+
123
+ ==== Running OpenShift Origin Tests
124
+
125
+ ===== OpenShift 3
126
+
127
+ [source, sh]
128
+ ----
129
+ $ vagrant test-geard --all
130
+ ----
131
+
132
+
133
+ ===== OpenShift 2.x
134
+
135
+ [source, sh]
136
+ ----
137
+ $ vagrant test --all
138
+ ----
139
+
140
+ == Other Notes
141
+
142
+ ==== Install OpenShift and its Dependencies
143
+
144
+ If starting from --stage os, install the build and package dependencies.
145
+
146
+ ===== OpenShift 3
147
+
148
+ [source, sh]
149
+ ----
150
+ $ vagrant build-geard-base
151
+ $ vagrant install-geard
152
+ $ vagrant build-geard-broker
153
+ $ vagrant install-geard-broker
154
+ ----
155
+
156
+ ===== OpenShift 2.x
157
+
158
+ [source, sh]
159
+ ----
160
+ $ vagrant origin-build-base
161
+ $ vagrant sync --clean
162
+ ----
163
+
164
+ ==== Other Environments
165
+
166
+ ===== AWS/EC2
167
+
168
+ * Install the latest vagrant-aws plugin. Follow the link:https://github.com/mitchellh/vagrant-aws/blob/master/README.md#development[build steps].
169
+
170
+ * Edit the Vagrantfile and update your EC2 credentials.
171
+
172
+ ----
173
+ aws.access_key_id = "<API KEY>"
174
+ aws.secret_access_key = "<API SECRET>"
175
+ aws.keypair_name = "<SSH KEY NAME>"
176
+ override.ssh.private_key_path = "<PRIVATE KEY FILE>"
177
+ ----
178
+
179
+ * Start the AWS machine
180
+
181
+ [source, sh]
182
+ ----
183
+ vagrant up --provider=aws
184
+ ----
185
+
186
+ NOTE: Requires latest link:https://github.com/mitchellh/vagrant-aws[AWS] provider.
187
+
188
+ NOTE: You can use the link:https://github.com/mikery/vagrant-ami[Vagrant-AMI] plugin to create an AMI from a running AWS machine.
189
+
190
+
191
+ ===== OpenStack
192
+
193
+ * Install the latest vagrant-openstack-plugin. See: https://github.com/cloudbau/vagrant-openstack-plugin.
194
+
195
+ * Edit the Vagrantfile and update your OpenStack credentials, endpoint and tenant (They can be read automatically from ~/.openstackcred).
196
+
197
+ ----
198
+ os.endpoint = "<OPENSTACK ENDPOINT URL>"
199
+ os.tenant = "<OPENSTACK TENANT>"
200
+ os.username = "<OPENSTACK USERNAME>"
201
+ os.api_key = "<OPENSTACK PASSWORD>"
202
+ os.keypair_name = "<OPENSTACK KEYPAIR NAME>"
203
+ override.ssh.private_key_path = "<PRIVATE KEY FILE>"
204
+ ----
205
+
206
+ * Start the OpenStack machine
207
+
208
+ [source, sh]
209
+ ----
210
+ vagrant up --provider=openstack
211
+ ----
212
+
213
+ NOTE: Requires latest link:https://github.com/cloudbau/vagrant-openstack-plugin[OpenStack] provider.
214
+
215
+
216
+ ===== LibVirt
217
+
218
+ * Install the vagrant-libvirt plugin dependencies
219
+
220
+ [source, sh]
221
+ ----
222
+ yum install libxslt-devel libxml2-devel libvirt-devel
223
+ ----
224
+
225
+ * Install the vagrant-libvirt plugin
226
+
227
+ [source, sh]
228
+ ----
229
+ vagrant plugin install vagrant-libvirt
230
+ ----
231
+
232
+ * Configure LibVirt to allow remote TLS connections
233
+ ** Create TLS certificates and key pairs. Follow the guide at http://libvirt.org/remote.html#Remote_certificates
234
+ Example commands for creating a self signed certificate are provided below.
235
+
236
+ .Example self-signed certificates
237
+ [source, sh]
238
+ ----
239
+ mkdir -p /etc/pki/libvirt/private
240
+
241
+ #CA Cert
242
+ certtool --generate-privkey > cakey.pem
243
+
244
+ cat <<EOF> ca.info
245
+ cn = MyOrg
246
+ ca
247
+ cert_signing_key
248
+ EOF
249
+
250
+ certtool --generate-self-signed --load-privkey cakey.pem --template ca.info --outfile cacert.pem
251
+ /bin/cp -f cacert.pem /etc/pki/CA/cacert.pem
252
+
253
+ #Server cert
254
+ certtool --generate-privkey > serverkey.pem
255
+
256
+ cat <<EOF> server.info
257
+ organization = MyOrg
258
+ cn = oirase
259
+ tls_www_server
260
+ encryption_key
261
+ signing_key
262
+ EOF
263
+
264
+ certtool --generate-certificate --load-privkey serverkey.pem \
265
+ --load-ca-certificate cacert.pem --load-ca-privkey cakey.pem \
266
+ --template server.info --outfile servercert.pem
267
+ /bin/cp -f serverkey.pem /etc/pki/libvirt/private/serverkey.pem
268
+ /bin/cp -f servercert.pem /etc/pki/libvirt/servercert.pem
269
+
270
+ #Client cert
271
+ certtool --generate-privkey > clientkey.pem
272
+
273
+ cat <<EOF> client.info
274
+ country = US
275
+ state = California
276
+ locality = Mountain View
277
+ organization = MyOrg
278
+ cn = client1
279
+ tls_www_client
280
+ encryption_key
281
+ signing_key
282
+ EOF
283
+
284
+ certtool --generate-certificate --load-privkey clientkey.pem \
285
+ --load-ca-certificate cacert.pem --load-ca-privkey cakey.pem \
286
+ --template client.info --outfile clientcert.pem
287
+
288
+ /bin/cp -f clientkey.pem /etc/pki/libvirt/private/clientkey.pem
289
+ /bin/cp -f clientcert.pem /etc/pki/libvirt/clientcert.pem
290
+ ----
291
+
292
+ ** Modify /etc/sysconfig/libvirtd and enable listening to connections
293
+
294
+ ----
295
+ LIBVIRTD_ARGS="--listen"
296
+ ----
297
+
298
+ ** Restart libvirtd
299
+
300
+ * Start the LibVirt machine
301
+
302
+ [source, sh]
303
+ ----
304
+ vagrant up --provider=libvirt
305
+ ----
306
+
307
+ NOTE: Requires latest link:https://github.com/pradels/vagrant-libvirt[LibVirt] provider
308
+
309
+ ===== Managed
310
+
311
+ Running on other environments which are not managed by Vagrant directly.
312
+
313
+ * Install the vagrant-managed-servers plugin
314
+
315
+ [source, sh]
316
+ ----
317
+ vagrant plugin install vagrant-managed-servers
318
+ ----
319
+
320
+ * Edit the Vagrantfile and update the managed section to update the IP address, User name and SSH key.
321
+
322
+ ----
323
+ managed.server = "HOST or IP of machine"
324
+ override.ssh.username = "root"
325
+ override.ssh.private_key_path = "~/.ssh/id_rsa"
326
+ ----
327
+
328
+ * Connect to the manually managed machine
329
+
330
+ [source, sh]
331
+ ----
332
+ vagrant up --provider=managed
333
+ ----
334
+
335
+ NOTE: Requires latest link:https://github.com/tknerr/vagrant-managed-servers[Managed] provider
336
+
337
+ === Developer environment
338
+
339
+ To enable easy customization of the build environment, any files placed under '\~/.openshiftdev/home.d' will be copied to
340
+ the vagrant user home directory. For example: '~/.openshiftdev/home.d/.bash_profile' will be copied to '.bash_profile'
341
+ on the vagrant VM.
342
+
343
+ === AWS Credentials
344
+
345
+ Rather than have to add AWS credentials every time the Vagrantfile is created using origin-init command, you can
346
+ specify your credentials in the '~/.awscreds' file and it will be automatically added to the Vagrantfile.
347
+
348
+ Example:
349
+
350
+ .'~/.awscreds'
351
+ ----
352
+ AWSAccessKeyId=<AWS API Key>
353
+ AWSSecretKey=<AWS API Secret>
354
+ AWSKeyPairName=<Keypair name>
355
+ AWSPrivateKeyPath=<SSH Private key>
356
+ ----
357
+
358
+
359
+ === OpenStack Credentials
360
+
361
+ Rather than have to add OpenStack credentials every time the Vagrantfile is created using origin-init command, you can
362
+ specify your credentials in the '~/.openstackcred' file and it will be automatically added to the Vagrantfile.
363
+
364
+ Example:
365
+
366
+ .'~/.openstackcred'
367
+ ----
368
+ OSEndpoint=<OpenStack Endpoint URL>
369
+ OSUsername=<OpenStack Username>
370
+ OSAPIKey=<OpenStack Password>
371
+ OSKeyPairName=<Keypair name >
372
+ OSPrivateKeyPath=<SSH Private key path>
373
+ OSTenant=<OpenStack Tenant Name>
374
+ ----
375
+
376
+
377
+ == Notice of Export Control Law
378
+
379
+ This software distribution includes cryptographic software that is subject to the U.S. Export Administration Regulations (the "*EAR*") and other U.S. and foreign laws and may not be exported, re-exported or transferred (a) to any country listed in Country Group E:1 in Supplement No. 1 to part 740 of the EAR (currently, Cuba, Iran, North Korea, Sudan & Syria); (b) to any prohibited destination or to any end user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government; or (c) for use in connection with the design, development or production of nuclear, chemical or biological weapons, or rocket systems, space launch vehicles, or sounding rockets, or unmanned air vehicle systems.You may not download this software or technical information if you are located in one of these countries or otherwise subject to these restrictions. You may not provide this software or technical information to individuals or entities located in one of these countries or otherwise subject to these restrictions. You are also responsible for compliance with foreign law requirements applicable to the import, export and use of this software and technical information.
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ #--
2
+ # Copyright 2013 Red Hat, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #++
16
+
17
+ require 'rubygems'
18
+ require 'bundler/setup'
19
+ require 'pry'
20
+ $stdout.sync = true
21
+ $stderr.sync = true
22
+
23
+ namespace :vagrant do
24
+
25
+ desc "Install plugin into Vagrant"
26
+ task :install do
27
+ # We want to install our plugin on the system vagrant. Pull gem paths out of
28
+ # $PATH so that we get the correct vagrant binary.
29
+ dirty_path = `echo $PATH`
30
+ clean_path = dirty_path.split(':').select{ |p| not p.include?('gem') }.join(':')
31
+ sys_cmd = `PATH=#{clean_path} which vagrant`.chomp
32
+ if not $?.exitstatus == 0
33
+ sys_cmd = `which vagrant`.chomp
34
+ if not $?.exitstatus == 0
35
+ puts "ERROR: Could not find a Vagrant binary in your PATH.\nEnsure that Vagrant has been installed on this system."
36
+ exit
37
+ else
38
+ puts "WARNING: Could not find a Vagrant binary outside of your gem environments.\nEnsure that the Vagrant package has been installed from the official Vagrant packages and not a gem."
39
+ end
40
+ end
41
+
42
+ system("rm -rf pkg")
43
+
44
+ Rake::Task['build'].invoke
45
+ name = Bundler::GemHelper.instance.send(:name)
46
+ version = Bundler::GemHelper.instance.send(:version).to_s
47
+
48
+ system "#{sys_cmd} plugin uninstall vagrant-openshift; #{sys_cmd} plugin install pkg/#{name}-#{version}.gem"
49
+ end
50
+ end
51
+
52
+ Bundler::GemHelper.install_tasks
53
+ task :default => "vagrant:install"
@@ -0,0 +1,41 @@
1
+ #--
2
+ # Copyright 2013 Red Hat, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #++
16
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class BuildGeard
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ do_execute(env[:machine], sync_bash_command('geard', %{
30
+ echo "Performing geard build..."
31
+ set -e
32
+ contrib/build -s
33
+ }))
34
+
35
+ @app.call(env)
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,59 @@
1
+ #--
2
+ # Copyright 2013 Red Hat, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #++
16
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class BuildGeardBroker
21
+ include CommandHelper
22
+
23
+ def initialize(app, env, options = {})
24
+ @app = app
25
+ @env = env
26
+ @options = options
27
+ end
28
+
29
+ def call(env)
30
+ docker_file_path = "broker/docker/origin-broker-builder"
31
+ build_builder_cmd = %{
32
+ echo "Performing origin-broker-builder build..."
33
+ set -e
34
+ pushd #{Constants.build_dir}origin-server/#{docker_file_path}
35
+ docker build --rm #{@options[:force] ? "--no-cache" : ""} -t origin-broker-builder .
36
+ popd
37
+ }
38
+ build_broker_cmd = %{
39
+ echo "Copy generated plugin configuration to broker source for use in build"
40
+ PLUGINS_CONF="#{Vagrant::Openshift::Constants.plugins_conf_dir}"
41
+ cp -f --parents $(find $PLUGINS_CONF \\( -name "*.conf" \\)) /data/src/github.com/openshift/origin-server
42
+ echo "Performing broker build..."
43
+ set -e
44
+ gear build #{Constants.build_dir}origin-server/ origin-broker-builder origin-broker --verbose
45
+ }
46
+
47
+ if @options[:force]
48
+ sudo(env[:machine], build_builder_cmd + build_broker_cmd, {:timeout => 60*40})
49
+ else
50
+ sudo(env[:machine], sync_bash_command_on_dockerfile('origin-server', docker_file_path, build_builder_cmd), {:timeout => 60*20})
51
+
52
+ sudo(env[:machine], sync_bash_command('origin-server', build_broker_cmd), {:timeout => 60*20})
53
+ @app.call(env)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,55 @@
1
+ #--
2
+ # Copyright 2013 Red Hat, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #++
16
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class BuildGeardConsole
21
+ include CommandHelper
22
+
23
+ def initialize(app, env, options = {})
24
+ @app = app
25
+ @env = env
26
+ @options = options
27
+ end
28
+
29
+ def call(env)
30
+ docker_file_path = "console/docker/origin-console-builder"
31
+ build_builder_cmd = %{
32
+ echo "Performing origin-console-builder build..."
33
+ set -e
34
+ pushd #{Constants.build_dir}origin-server/#{docker_file_path}
35
+ docker build --rm #{@options[:force] ? "--no-cache" : ""} -t origin-console-builder .
36
+ popd
37
+ }
38
+ build_console_cmd = %{
39
+ echo "Performing console build..."
40
+ set -e
41
+ gear build #{Constants.build_dir}origin-server/ origin-console-builder origin-console --verbose
42
+ }
43
+ if @options[:force]
44
+ sudo(env[:machine], build_builder_cmd + build_console_cmd, {:timeout => 60*40})
45
+ else
46
+ sudo(env[:machine], sync_bash_command_on_dockerfile('origin-server', docker_file_path, build_builder_cmd), {:timeout => 60*20})
47
+
48
+ sudo(env[:machine], sync_bash_command('origin-server', build_console_cmd), {:timeout => 60*20})
49
+ @app.call(env)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end