vagrant-openshift 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.asciidoc +5 -3
  4. data/lib/vagrant-openshift/action/build_openshift3.rb +30 -5
  5. data/lib/vagrant-openshift/action/{install_rhc.rb → build_openshift3_base_images.rb} +13 -11
  6. data/lib/vagrant-openshift/action/{run_openshift2_tests.rb → build_sti.rb} +28 -11
  7. data/lib/vagrant-openshift/action/clean.rb +1 -4
  8. data/lib/vagrant-openshift/action/clean_network_setup.rb +1 -1
  9. data/lib/vagrant-openshift/action/download_artifacts_openshift3.rb +4 -1
  10. data/lib/vagrant-openshift/action/{download_artifacts_openshift2.rb → download_artifacts_sti.rb} +3 -11
  11. data/lib/vagrant-openshift/action/generate_template.rb +38 -40
  12. data/lib/vagrant-openshift/action/install_openshift3.rb +5 -16
  13. data/lib/vagrant-openshift/action/{build_openshift2.rb → install_openshift3_asset_dependencies.rb} +17 -5
  14. data/lib/vagrant-openshift/action/install_openshift3_base_dependencies.rb +20 -5
  15. data/lib/vagrant-openshift/action/{local_openshift2_checkout.rb → push_openshift3_release.rb} +14 -14
  16. data/lib/vagrant-openshift/action/run_openshift3_tests.rb +38 -14
  17. data/lib/vagrant-openshift/action/run_sti_tests.rb +64 -0
  18. data/lib/vagrant-openshift/action.rb +44 -83
  19. data/lib/vagrant-openshift/command/build_openshift3.rb +9 -0
  20. data/lib/vagrant-openshift/command/{build_openshift2_base.rb → build_openshift3_base_images.rb} +5 -5
  21. data/lib/vagrant-openshift/command/{build_openshift3_infrastructure_images.rb → build_sti.rb} +10 -12
  22. data/lib/vagrant-openshift/command/checkout_repositories.rb +1 -1
  23. data/lib/vagrant-openshift/command/{install_rhc.rb → install_openshift3_assets_base.rb} +5 -5
  24. data/lib/vagrant-openshift/command/local_openshift3_setup.rb +1 -1
  25. data/lib/vagrant-openshift/command/openshift_init.rb +4 -4
  26. data/lib/vagrant-openshift/command/push_openshift3_release.rb +57 -0
  27. data/lib/vagrant-openshift/command/repo_sync_openshift3.rb +1 -13
  28. data/lib/vagrant-openshift/command/{repo_sync_openshift2.rb → repo_sync_sti.rb} +11 -19
  29. data/lib/vagrant-openshift/command/test_openshift3.rb +8 -0
  30. data/lib/vagrant-openshift/command/test_openshift3_image.rb +8 -17
  31. data/lib/vagrant-openshift/command/test_sti.rb +59 -0
  32. data/lib/vagrant-openshift/config.rb +2 -14
  33. data/lib/vagrant-openshift/constants.rb +3 -67
  34. data/lib/vagrant-openshift/helper/command_helper.rb +0 -3
  35. data/lib/vagrant-openshift/plugin.rb +24 -29
  36. data/lib/vagrant-openshift/provisioner.rb +5 -37
  37. data/lib/vagrant-openshift/templates/builder/Rakefile +0 -205
  38. data/lib/vagrant-openshift/templates/command/init-openshift/box_info.yaml +34 -49
  39. data/lib/vagrant-openshift/version.rb +1 -1
  40. metadata +33 -48
  41. data/lib/vagrant-openshift/action/build_openshift3_images.rb +0 -54
  42. data/lib/vagrant-openshift/action/build_openshift3_infrastructure_images.rb +0 -50
  43. data/lib/vagrant-openshift/action/checkout_openshift2_tests.rb +0 -57
  44. data/lib/vagrant-openshift/action/create_openshift2_puppet_file.rb +0 -84
  45. data/lib/vagrant-openshift/action/create_openshift2_test_users.rb +0 -36
  46. data/lib/vagrant-openshift/action/idle_all_gears_openshift2.rb +0 -36
  47. data/lib/vagrant-openshift/action/install_openshift2_base_dependencies.rb +0 -50
  48. data/lib/vagrant-openshift/action/install_openshift2_build_dependencies.rb +0 -48
  49. data/lib/vagrant-openshift/action/preserve_mcollective_logs.rb +0 -48
  50. data/lib/vagrant-openshift/action/setup_builder_files.rb +0 -57
  51. data/lib/vagrant-openshift/action/uninstall_openshift2_rpms.rb +0 -37
  52. data/lib/vagrant-openshift/command/build_openshift3_images.rb +0 -68
  53. data/lib/vagrant-openshift/command/local_openshift2_setup.rb +0 -62
  54. data/lib/vagrant-openshift/command/test_openshift2.rb +0 -108
  55. data/lib/vagrant-openshift/templates/builder/lib/rpm.rb +0 -248
  56. data/lib/vagrant-openshift/templates/builder/lib/test.rb +0 -432
  57. data/lib/vagrant-openshift/templates/builder/yum-listbuilddep +0 -124
  58. data/lib/vagrant-openshift/templates/command/init-openshift/Vagrantfile.erb +0 -171
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e99424d02a9d9cf48ecfe8b86623f866c41f67ae
4
- data.tar.gz: a9394c7c854bd35e0a2b0b75486fa842469cdbff
3
+ metadata.gz: b3de362d4afaa7efa6b650d3afe95d5dc8fc1677
4
+ data.tar.gz: 7670a84d828f1971c5f5bef2f3cd26cf2d90a892
5
5
  SHA512:
6
- metadata.gz: 586312d43c42cb95f7464e97ba75d9eb56638784038cbb8d7810fb837a145186e3119218e518977e2c3e31ab0b9f8caf13b489935c31c58e65c52587052f6b48
7
- data.tar.gz: d5b882400527319a834c92ab70f9231e2fa643e198898dd6e5744758b2a14dbecf8e5e05c92b8178d89329d33d43de97321c9bb8e3de218bf095eee2200966d8
6
+ metadata.gz: 470481770849a482baeda76f06ce3a7d9910e63d2d0030193e8b66a9467c93e468f1f60f7cbd0c71f80690321852b9223f891f93521229666b0e908e59911370
7
+ data.tar.gz: 9b31993e2257e17083ca08ca8c56ebb19bc7227e7b4ed5022379b2431a1703e81a26db9b53087a35984dbc03ffc87b67603a49821a9f0c5015652d83e3de2365
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ test/origin-server
22
22
  test/puppet-openshift_origin
23
23
  test/rhc
24
24
  tmp
25
+ vendor
data/README.asciidoc CHANGED
@@ -43,7 +43,7 @@ $ echo "export GOPATH=~/code" >> ~/.bash_profile # ~/code can be any dir
43
43
  $ source ~/.bash_profile
44
44
  $ cd $GOPATH
45
45
  $ vagrant openshift3-local-checkout -u <github username>
46
- $ cd github.com/src/openshift/origin
46
+ $ cd src/github.com/openshift/origin
47
47
  ----
48
48
 
49
49
 
@@ -91,6 +91,8 @@ $ vagrant test-openshift3 --all
91
91
 
92
92
  === Getting started with Openshift v2
93
93
 
94
+ Note: v2 (aka M4) is not longer supported on the master branch or in the published rubygems.org version of this plugin. You must checkout the v2 branch of this repository in order to use the plugin with v2.
95
+
94
96
  ==== Clone the OpenShift Origin repositories
95
97
 
96
98
  [source, sh]
@@ -327,11 +329,11 @@ on the vagrant VM.
327
329
  === AWS Credentials
328
330
 
329
331
  Rather than have to add AWS credentials every time the Vagrantfile is created using origin-init command, you can
330
- specify your credentials in the '~/.awscreds' file and it will be automatically added to the Vagrantfile.
332
+ specify your credentials in the '~/.awscred' file and it will be automatically added to the Vagrantfile.
331
333
 
332
334
  Example:
333
335
 
334
- .'~/.awscreds'
336
+ .'~/.awscred'
335
337
  ----
336
338
  AWSAccessKeyId=<AWS API Key>
337
339
  AWSSecretKey=<AWS API Secret>
@@ -20,25 +20,50 @@ module Vagrant
20
20
  class BuildOpenshift3
21
21
  include CommandHelper
22
22
 
23
- def initialize(app, env)
23
+ def initialize(app, env, options)
24
24
  @app = app
25
25
  @env = env
26
+ @options = options
26
27
  end
27
28
 
28
29
  def call(env)
29
- do_execute(env[:machine], sync_bash_command('origin', %{
30
+ if @options[:images]
31
+ cmd = %{
32
+ echo "Performing openshift release build..."
33
+ set -e
34
+ hack/verify-gofmt.sh
35
+ hack/build-release.sh
36
+ hack/build-images.sh
37
+ if [ ! -d _output/etcd ]
38
+ then
39
+ hack/install-etcd.sh
40
+ fi
41
+ }
42
+ else
43
+ cmd = %{
30
44
  echo "Performing openshift build..."
31
45
  set -e
46
+ hack/verify-gofmt.sh
32
47
  hack/build-go.sh
33
48
  if [ ! -d _output/etcd ]
34
49
  then
35
50
  hack/install-etcd.sh
36
51
  fi
37
- }))
38
-
52
+ }
53
+ end
54
+ if @options[:force]
55
+ build_cmd = cmd
56
+ cmd = %{
57
+ pushd /data/src/github.com/openshift/origin
58
+ #{build_cmd}
59
+ popd
60
+ }
61
+ else
62
+ cmd = sync_bash_command('origin', cmd)
63
+ end
64
+ do_execute(env[:machine], cmd)
39
65
  @app.call(env)
40
66
  end
41
-
42
67
  end
43
68
  end
44
69
  end
@@ -17,26 +17,28 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class InstallRhc
20
+ class BuildOpenshift3BaseImages
21
21
  include CommandHelper
22
22
 
23
- def initialize(app, env)
23
+ def initialize(app, env, options)
24
24
  @app = app
25
25
  @env = env
26
+ @options = options
26
27
  end
27
28
 
28
29
  def call(env)
29
- do_execute(env[:machine], sync_bash_command('rhc', %{
30
- echo "Build and install rhc from local source"
31
- gem uninstall rhc -x -q
32
- rm -f rhc-*.gem
33
- gem build rhc.gemspec
34
- gem install $(find ./ -name 'rhc-*.gem')
35
- rm -f rhc-*.gem
36
- }))
30
+ do_execute(env[:machine], %{
31
+ echo "Building base images..."
32
+ set -e
33
+ pushd /data/src/github.com/openshift/origin
34
+ hack/build-base-images.sh
35
+ popd
36
+ },
37
+ { :timeout => 60*20, :verbose => false })
37
38
  @app.call(env)
38
39
  end
40
+
39
41
  end
40
42
  end
41
43
  end
42
- end
44
+ end
@@ -17,28 +17,45 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class RunOpenshift2Tests
20
+ class BuildSti
21
21
  include CommandHelper
22
22
 
23
- @@SSH_TIMEOUT = 4800
24
-
25
23
  def initialize(app, env, options)
26
24
  @app = app
27
25
  @env = env
28
- @options = options.clone
26
+ @options = options
29
27
  end
30
28
 
31
29
  def call(env)
32
- is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release")
33
- @options.delete :logs
30
+ if @options[:binary_only]
31
+
32
+ cmd = %{
33
+ echo "Performing source-to-image build..."
34
+ set -e
35
+ hack/build-go.sh
36
+ }
37
+ else
34
38
 
35
- cmd_opts = ''
36
- @options.each do |k,v|
37
- cmd_opts += "#{k}=#{v} "
39
+ cmd = %{
40
+ echo "Performing source-to-image build..."
41
+ set -e
42
+ hack/verify-gofmt.sh
43
+ hack/build-go.sh
44
+ hack/build-test-images.sh
45
+ }
38
46
  end
39
- cmd = "cd #{Constants.build_dir + 'builder'}; #{scl_wrapper(is_fedora,'rake run_tests ' + cmd_opts)} "
40
- _,_,env[:test_exit_code] = sudo(env[:machine], cmd, {timeout: 0, fail_on_error: false})
41
47
 
48
+ if @options[:force]
49
+ build_cmd = cmd
50
+ cmd = %{
51
+ pushd /data/src/github.com/openshift/source-to-image
52
+ #{build_cmd}
53
+ popd
54
+ }
55
+ else
56
+ cmd = sync_bash_command('source-to-image', cmd)
57
+ end
58
+ do_execute(env[:machine], cmd)
42
59
  @app.call(env)
43
60
  end
44
61
  end
@@ -38,12 +38,9 @@ module Vagrant
38
38
  end
39
39
  do_execute env[:machine], git_clone_commands
40
40
 
41
- sudo env[:machine], "rm -rf /etc/yum.repos.d/openshift-origin.repo"
42
- sudo env[:machine], "rm -rf /var/cache/yum/x86_64/19/openshift-origin" #clear OpenShift package cache
43
- sudo env[:machine], "rm -f /etc/openshift/.mongo-setup-complete"
44
41
  @app.call(env)
45
42
  end
46
43
  end
47
44
  end
48
45
  end
49
- end
46
+ end
@@ -28,7 +28,7 @@ module Vagrant
28
28
  def call(env)
29
29
  is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release")
30
30
 
31
- if !is_fedora
31
+ unless is_fedora
32
32
  if env[:machine].communicate.test("test -e /etc/udev/rules.d/70-persistent-net.rules")
33
33
  remote_write(env[:machine], "/etc/udev/rules.d/70-persistent-net.rules") do
34
34
  %{# This file was automatically generated by the /lib/udev/write_net_rules
@@ -36,7 +36,10 @@ module Vagrant
36
36
  download_map = {
37
37
  "/var/log/yum.log" => artifacts_dir + "yum.log",
38
38
  "/var/log/secure" => artifacts_dir + "secure",
39
- "/var/log/audit/audit.log" => artifacts_dir + "audit.log"
39
+ "/var/log/audit/audit.log" => artifacts_dir + "audit.log",
40
+ "/tmp/origin/e2e/" => artifacts_dir + "e2e/",
41
+
42
+ "/data/src/github.com/openshift/origin/_output/local/releases/" => artifacts_dir + "release/",
40
43
  }
41
44
 
42
45
  download_map.each do |source,target|
@@ -18,7 +18,7 @@ require 'pathname'
18
18
  module Vagrant
19
19
  module Openshift
20
20
  module Action
21
- class DownloadArtifactsOpenshift2
21
+ class DownloadArtifactsSti
22
22
  include CommandHelper
23
23
 
24
24
  def initialize(app, env)
@@ -28,23 +28,15 @@ module Vagrant
28
28
 
29
29
  def call(env)
30
30
  machine = @env[:machine]
31
- machine.ui.info "Downloading logs and rpms"
31
+ machine.ui.info "Downloading logs"
32
32
  ssh_info = machine.ssh_info
33
33
  private_key_path = ssh_info[:private_key_path].kind_of?(Array) ? ssh_info[:private_key_path][0] : ssh_info[:private_key_path]
34
34
 
35
35
  artifacts_dir = Pathname.new(File.expand_path(machine.env.root_path + "artifacts"))
36
36
  download_map = {
37
- "/tmp/rhc/" => artifacts_dir + "test_runs/",
38
- "/var/log/openshift/" => artifacts_dir + "openshift_logs/",
39
- "/var/log/httpd/" => artifacts_dir + "node_httpd_logs/",
40
37
  "/var/log/yum.log" => artifacts_dir + "yum.log",
41
- "/var/log/messages" => artifacts_dir + "messages",
42
38
  "/var/log/secure" => artifacts_dir + "secure",
43
- "/var/log/audit/audit.log" => artifacts_dir + "audit.log",
44
- #"/tmp/rhc/*_coverage" => artifacts_dir + "coverage/",
45
- "/var/log/mcollective.*" => artifacts_dir + "mcollective/",
46
- "#{Constants.build_dir}/origin-rpms/" => artifacts_dir + "rpms/",
47
- "#{Constants.build_dir}/origin-srpms/" => artifacts_dir + "srpms/"
39
+ "/var/log/audit/audit.log" => artifacts_dir + "audit.log"
48
40
  }
49
41
 
50
42
  download_map.each do |source,target|
@@ -33,14 +33,13 @@ module Vagrant
33
33
  stage = @options[:stage].to_sym
34
34
  inst_ts = Time.now.getutc.strftime('%Y%m%d_%H%M')
35
35
 
36
- template_path = Pathname.new(File.expand_path("#{__FILE__}/../../templates/command/init-openshift/Vagrantfile.erb"))
37
36
  box_info_path = Pathname.new(File.expand_path("#{__FILE__}/../../templates/command/init-openshift/box_info.yaml"))
38
37
 
39
38
  box_info_data = YAML.load(File.new(box_info_path))
40
39
  box_info = box_info_data[os][stage]
41
40
  box_info[:instance_name] = @options[:name].nil? ? 'openshift_origin_' + inst_ts : @options[:name]
42
41
  box_info[:os] = os
43
- box_info[:vagrant_guest] = [:centos6, :rhel6].include?(os) ? :redhat : os
42
+ box_info[:vagrant_guest] = [:centos7, :rhel7].include?(os) ? :redhat : os
44
43
  box_info[:port_mappings] = @options[:port_mappings]
45
44
 
46
45
  @openstack_creds_file = ENV['OPENSTACK_CREDS'].nil? || ENV['OPENSTACK_CREDS'] == '' ? "~/.openstackcred" : ENV['OPENSTACK_CREDS']
@@ -52,46 +51,44 @@ module Vagrant
52
51
  box_info[:aws_creds_file] = @aws_creds_file
53
52
  find_ami_from_tag(box_info)
54
53
 
55
- if os == :fedora
56
-
57
- gopath = nil
58
- if ENV['GOPATH'] && !ENV['GOPATH'].empty?
59
- gopath = File.expand_path(ENV['GOPATH'].split(/:/).last)
60
- else
61
- gopath = '.'
62
- end
54
+ gopath = nil
55
+ if ENV['GOPATH'] && !ENV['GOPATH'].empty?
56
+ gopath = File.expand_path(ENV['GOPATH'].split(/:/).last)
57
+ else
58
+ gopath = '.'
59
+ end
63
60
 
64
- vagrant_openshift_config = {
65
- 'instance_name' => box_info[:instance_name],
66
- 'os' => os,
67
- 'dev_cluster' => false,
68
- 'num_minions' => 2,
69
- 'rebuild_yum_cache' => false,
70
- 'sync_to' => '/data/src',
71
- 'sync_from' => "#{gopath}/src",
72
- 'virtualbox' => {
73
- 'box_name' => box_info[:virtualbox][:box_name],
74
- 'box_url' => box_info[:virtualbox][:box_url]
75
- },
76
- 'vmware' => {
77
- 'box_name' => box_info[:vmware][:box_name],
78
- 'box_url' => box_info[:vmware][:box_url]
79
- },
80
- 'aws' => {
81
- 'ami' => box_info[:aws][:ami],
82
- 'ami_region' => box_info[:aws][:ami_region],
83
- 'ssh_user' => box_info[:aws][:ssh_user]
84
- }
61
+ vagrant_openshift_config = {
62
+ 'instance_name' => box_info[:instance_name],
63
+ 'os' => os,
64
+ 'dev_cluster' => false,
65
+ 'num_minions' => 2,
66
+ 'cpus' => 2,
67
+ 'memory' => 1024,
68
+ 'rebuild_yum_cache' => false,
69
+ 'sync_to' => '/data/src',
70
+ 'sync_from' => "#{gopath}/src",
71
+ 'virtualbox' => {
72
+ 'box_name' => box_info[:virtualbox][:box_name],
73
+ 'box_url' => box_info[:virtualbox][:box_url]
74
+ },
75
+ 'vmware' => {
76
+ 'box_name' => box_info[:vmware][:box_name],
77
+ 'box_url' => box_info[:vmware][:box_url]
78
+ },
79
+ 'libvirt' => {
80
+ 'box_name' => box_info[:libvirt][:box_name],
81
+ 'box_url' => box_info[:libvirt][:box_url]
82
+ },
83
+ 'aws' => {
84
+ 'ami' => box_info[:aws][:ami],
85
+ 'ami_region' => box_info[:aws][:ami_region],
86
+ 'ssh_user' => box_info[:aws][:ssh_user]
85
87
  }
88
+ }
86
89
 
87
- File.open(".vagrant-openshift.json","w") do |f|
88
- f.write(JSON.pretty_generate(vagrant_openshift_config))
89
- end
90
- else
91
- contents = Vagrant::Util::TemplateRenderer.render(template_path.to_s[0..-5], box_info: box_info)
92
- File.open("Vagrantfile", "w+") do |f|
93
- f.write(contents)
94
- end
90
+ File.open(".vagrant-openshift.json","w") do |f|
91
+ f.write(JSON.pretty_generate(vagrant_openshift_config))
95
92
  end
96
93
 
97
94
  @app.call(env)
@@ -103,7 +100,8 @@ module Vagrant
103
100
  return if box_info[:aws][:ami_tag_prefix].nil?
104
101
  @env[:ui].info("Reading AWS credentials from #{@aws_creds_file.to_s}")
105
102
  if @aws_creds_file.exist?
106
- aws_creds = @aws_creds_file.exist? ? Hash[*(File.open(@aws_creds_file.to_s).readlines.map{ |l| l.split('=') }.flatten.map{ |i| i.strip })] : {}
103
+ aws_creds = @aws_creds_file.exist? ? Hash[*(File.open(@aws_creds_file.to_s).readlines.map{ |l| l.strip!
104
+ l.split('=') }.flatten)] : {}
107
105
 
108
106
  fog_config = {
109
107
  :provider => :aws,
@@ -28,33 +28,20 @@ module Vagrant
28
28
  ssh_user = env[:machine].ssh_info[:username]
29
29
  sudo(env[:machine], %{
30
30
  set -x
31
- # TODO Remove me ASAP
32
- sed -i 's,^SELINUX=.*,SELINUX=permissive,' /etc/selinux/config
33
- setenforce 0
34
- usermod -a -G docker #{ssh_user}
35
31
 
36
32
  ORIGIN_PATH=/data/src/github.com/openshift/origin
37
-
38
33
  cat > /etc/profile.d/openshift.sh <<DELIM
39
34
  export GOPATH=/data
40
- export PATH=$GOPATH/bin:$ORIGIN_PATH/_output/etcd/bin:$ORIGIN_PATH/_output/go/bin:$PATH
41
- # Force using local images instead of always reaching docker hub when doing builds
42
- export USE_LOCAL_IMAGES=true
35
+ export PATH=$ORIGIN_PATH/_output/etcd/bin:$ORIGIN_PATH/_output/local/go/bin/:$GOPATH/bin:$PATH
36
+ export KUBERNETES_MASTER=http://localhost:8080
43
37
  DELIM
44
38
 
45
39
  source /etc/profile.d/openshift.sh
46
40
 
47
- go get code.google.com/p/go.tools/cmd/cover
48
-
49
41
  pushd $ORIGIN_PATH
50
42
  hack/install-etcd.sh
51
43
  popd
52
44
 
53
- # Force socket reuse
54
- echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
55
-
56
- chown -R #{ssh_user}:#{ssh_user} /data
57
-
58
45
  cat > /usr/lib/systemd/system/openshift.service <<DELIM
59
46
  [Unit]
60
47
  Description=OpenShift
@@ -65,13 +52,15 @@ Documentation=https://github.com/openshift/origin
65
52
  [Service]
66
53
  Type=simple
67
54
  EnvironmentFile=-/etc/profile.d/openshift.sh
68
- ExecStart=$ORIGIN_PATH/_output/go/bin/openshift start
55
+ ExecStart=$ORIGIN_PATH/_output/local/go/bin/openshift start --listen=http://0.0.0.0:8080
69
56
 
70
57
  [Install]
71
58
  WantedBy=multi-user.target
72
59
  DELIM
73
60
 
74
61
  #systemctl enable openshift.service
62
+
63
+ chown -R #{ssh_user}:#{ssh_user} /data
75
64
  })
76
65
 
77
66
  @app.call(env)
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class BuildOpenshift2
20
+ class InstallOpenshift3AssetDependencies
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -26,11 +26,23 @@ module Vagrant
26
26
  end
27
27
 
28
28
  def call(env)
29
- is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release")
30
- hostname = env[:machine].config.vm.hostname
31
- sudo(env[:machine],"echo #{hostname} > /proc/sys/kernel/hostname")
32
- sudo(env[:machine], "cd #{Constants.build_dir + "builder"}; #{scl_wrapper(is_fedora,'rake update_packages')}", {timeout: 60*30})
29
+ ssh_user = env[:machine].ssh_info[:username]
30
+ do_execute(env[:machine], %{
33
31
 
32
+ ORIGIN_PATH=/data/src/github.com/openshift/origin
33
+
34
+ if ! which bundler > /dev/null 2>&1 ; then
35
+ gem install bundler
36
+ fi
37
+
38
+ if ! which npm > /dev/null 2>&1 ; then
39
+ sudo yum -y install npm
40
+ fi
41
+
42
+ pushd $ORIGIN_PATH
43
+ hack/install-assets.sh
44
+ popd
45
+ }, {:timeout=>60*20})
34
46
  @app.call(env)
35
47
  end
36
48
  end
@@ -26,6 +26,7 @@ module Vagrant
26
26
  end
27
27
 
28
28
  def call(env)
29
+ ssh_user = env[:machine].ssh_info[:username]
29
30
  # FIXME: Move 'openshift/centos-mongodb' into openshift org and then
30
31
  # add the image into 'repositories' constants
31
32
  #
@@ -34,18 +35,32 @@ module Vagrant
34
35
  # FIXME: Need to install golang packages 'after' the 'gcc' is
35
36
  # installed. See BZ#1101508
36
37
  #
37
- sudo(env[:machine], "yum install -y golang golang-pkg* golang-src")
38
+ sudo(env[:machine], "yum install -y golang golang-pkg-linux-amd64 golang-src")
38
39
  #
39
40
  sudo(env[:machine], %{
41
+
42
+ set -x
43
+ # TODO Remove me ASAP
44
+ sed -i 's,^SELINUX=.*,SELINUX=permissive,' /etc/selinux/config
45
+ setenforce 0
46
+
47
+ usermod -a -G docker #{ssh_user}
48
+
49
+ sed -i "s,^OPTIONS='\\(.*\\)',OPTIONS='--insecure-registry=172.30.17.0/24 \\1'," /etc/sysconfig/docker
50
+ cat /etc/sysconfig/docker
51
+
52
+ # Force socket reuse
53
+ echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
54
+
55
+ mkdir /data
56
+ GOPATH=/data go get code.google.com/p/go.tools/cmd/cover
57
+ chown -R #{ssh_user}:#{ssh_user} /data
58
+
40
59
  systemctl daemon-reload
41
60
  systemctl enable docker
42
61
  systemctl start docker
43
62
 
44
63
  docker pull openshift/docker-registry
45
- docker pull openshift/docker-builder
46
- docker pull openshift/sti-builder
47
-
48
- touch #{Vagrant::Openshift::Constants.deps_marker}
49
64
  }, {:timeout=>60*20})
50
65
  @app.call(env)
51
66
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright 2013 Red Hat, Inc.
2
+ # Copyright 2014 Red Hat, Inc.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class LocalOpenshift2Checkout
20
+ class PushOpenshift3Release
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env, options)
@@ -27,20 +27,20 @@ module Vagrant
27
27
  end
28
28
 
29
29
  def call(env)
30
- commands = "echo 'Waiting for the cloning process to finish'\n"
31
- Constants.openshift2_repos.each do |repo, url|
32
- commands += %{
33
- ( #{repo_checkout_bash_command(repo, url)} ) &
34
- PIDS+=$!\" \";
35
- }
36
- end
37
-
38
- commands += "[ -n \"$PIDS\" ] && wait $PIDS\n"
39
-
40
- system(commands)
41
-
30
+ registry_name = @options[:registry_name]
31
+ push_base = !!@options[:push_base_images]
32
+ env[:machine].config.ssh.pty = true
33
+ do_execute(env[:machine], %{
34
+ echo "Pushing release images"
35
+ set -e
36
+ pushd /data/src/github.com/openshift/origin
37
+ OS_PUSH_BASE_IMAGES="#{push_base ? 'true' : ''}" OS_PUSH_BASE_REGISTRY="#{registry_name}" hack/push-release.sh
38
+ popd
39
+ },
40
+ { :timeout => 60*20, :verbose => false })
42
41
  @app.call(env)
43
42
  end
43
+
44
44
  end
45
45
  end
46
46
  end
@@ -28,17 +28,7 @@ module Vagrant
28
28
  @options = options.clone
29
29
  end
30
30
 
31
- def call(env)
32
- @options.delete :logs
33
-
34
- cmds = ['hack/test-go.sh']
35
-
36
- if @options[:all]
37
- cmds << 'hack/test-cmd.sh'
38
- cmds << 'hack/test-integration.sh'
39
- cmds << 'hack/test-end-to-end.sh'
40
- end
41
-
31
+ def run_tests(env, cmds, as_root=true)
42
32
  tests = ''
43
33
  cmds.each do |cmd|
44
34
  tests += "
@@ -49,14 +39,48 @@ echo 'Finished #{cmd}'
49
39
  echo '***************************************************'
50
40
  "
51
41
  end
52
-
53
- _,_,env[:test_exit_code] = sudo(env[:machine], %{
42
+ cmd = %{
54
43
  set -e
55
44
  pushd #{Constants.build_dir}/origin >/dev/null
56
45
  export PATH=$GOPATH/bin:$PATH
57
46
  #{tests}
58
47
  popd >/dev/null
59
- }, {:timeout => 60*60, :fail_on_error => false, :verbose => false})
48
+ }
49
+ exit_code = 0
50
+ if as_root
51
+ _,_,exit_code = sudo(env[:machine], cmd, {:timeout => 60*60, :fail_on_error => false, :verbose => false})
52
+ else
53
+ _,_,exit_code = do_execute(env[:machine], cmd, {:timeout => 60*60, :fail_on_error => false, :verbose => false})
54
+ end
55
+ exit_code
56
+ end
57
+
58
+ def call(env)
59
+ @options.delete :logs
60
+
61
+ if @options[:report_coverage]
62
+ cmds = ['OUTPUT_COVERAGE=/tmp/origin/e2e/artifacts/coverage hack/test-go.sh']
63
+ else
64
+ cmds = ['hack/test-go.sh']
65
+ end
66
+
67
+ if @options[:all]
68
+ cmds << 'hack/test-integration.sh'
69
+ cmds << 'hack/test-cmd.sh'
70
+ if @options[:skip_image_cleanup]
71
+ cmds << 'SKIP_IMAGE_CLEANUP=1 ARTIFACT_DIR=/tmp/origin/e2e/artifacts LOG_DIR=/tmp/origin/e2e/logs hack/test-end-to-end.sh'
72
+ else
73
+ cmds << 'ARTIFACT_DIR=/tmp/origin/e2e/artifacts LOG_DIR=/tmp/origin/e2e/logs hack/test-end-to-end.sh'
74
+ end
75
+ end
76
+
77
+ env[:test_exit_code] = run_tests(env, cmds, true)
78
+
79
+ # any other tests that should not be run as sudo
80
+ if env[:test_exit_code] == 0 && @options[:all]
81
+ cmds = ['hack/test-assets.sh']
82
+ env[:test_exit_code] = run_tests(env, cmds, false)
83
+ end
60
84
 
61
85
  @app.call(env)
62
86
  end