vagrant-openshift 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/README.asciidoc +1 -22
  4. data/lib/vagrant-openshift/action.rb +0 -34
  5. data/lib/vagrant-openshift/action/build_openshift.rb +1 -1
  6. data/lib/vagrant-openshift/action/checkout_repositories.rb +1 -5
  7. data/lib/vagrant-openshift/action/clone_upstream_repositories.rb +2 -5
  8. data/lib/vagrant-openshift/action/generate_template.rb +2 -2
  9. data/lib/vagrant-openshift/action/install_openshift.rb +3 -2
  10. data/lib/vagrant-openshift/action/install_openshift_base_dependencies.rb +15 -7
  11. data/lib/vagrant-openshift/action/local_openshift_checkout.rb +1 -5
  12. data/lib/vagrant-openshift/action/push_openshift_images.rb +48 -32
  13. data/lib/vagrant-openshift/action/run_openshift_tests.rb +2 -2
  14. data/lib/vagrant-openshift/action/sync_local_repository.rb +3 -0
  15. data/lib/vagrant-openshift/action/sync_upstream_repository.rb +1 -6
  16. data/lib/vagrant-openshift/command/openshift_init.rb +6 -1
  17. data/lib/vagrant-openshift/command/test_openshift_image.rb +7 -42
  18. data/lib/vagrant-openshift/plugin.rb +0 -10
  19. data/lib/vagrant-openshift/version.rb +1 -1
  20. metadata +3 -11
  21. data/lib/vagrant-openshift/action/bootstrap_openshift.rb +0 -34
  22. data/lib/vagrant-openshift/action/create_sample_project.rb +0 -39
  23. data/lib/vagrant-openshift/action/install_docker_registry.rb +0 -47
  24. data/lib/vagrant-openshift/action/install_openshift_router.rb +0 -54
  25. data/lib/vagrant-openshift/action/setup_sample_policy.rb +0 -42
  26. data/lib/vagrant-openshift/action/wait_for_openshift.rb +0 -61
  27. data/lib/vagrant-openshift/command/install_docker_registry.rb +0 -50
  28. data/lib/vagrant-openshift/command/install_openshift_router.rb +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acb033502a4178e709d31a39cc71226c88b50d23
4
- data.tar.gz: 4c848bdfec382e02933d75c3be1a95844b439c1b
3
+ metadata.gz: a6e6bdc21d8baa7b69733b3a3b83c60f19f2292b
4
+ data.tar.gz: e0ad051aa84b80fe52264e9cfc29bd61dfb48788
5
5
  SHA512:
6
- metadata.gz: c6d441d48d0ae6c186f77213a2842cd48b49445724352108fb2cf44bd4df7134f9425dfc2a1995c407f862f2e03d7cf2e2c42420a704bd7a94b4cd8da7f1c854
7
- data.tar.gz: de2de3908c380749c8296e5fff97007d707d18364a9cee2100e9b53a71040915ea6182722b7758baffa60ec1ee230b2eebf31e3e71d7cf63ff028a4290fbf138
6
+ metadata.gz: d79ee5377fed47bd933ef59094cddcb8542f90d8c7df59319e2534ec325b84004ed981a4021b25f05138dd1f68809bea92f53868a7984149924796ab65ae54b7
7
+ data.tar.gz: 8f1c8f3a7beebc21c1c7171a1837e613e2caa9acfed8c4c8943b1c2d797a67bea102e13e6ab92bd87f31444febbf70f7c3a50a6b7498553c9d6a32926fbc033b
data/Gemfile CHANGED
@@ -8,4 +8,5 @@ group :development do
8
8
  # gem dependency because we expect to be installed within the
9
9
  # Vagrant environment itself using `vagrant plugin`.
10
10
  gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
11
+ gem "json"
11
12
  end
@@ -39,7 +39,7 @@ Compile and install using Rake:
39
39
 
40
40
  [source, sh]
41
41
  ----
42
- $ rake vagrant:install
42
+ $ rake
43
43
  ----
44
44
 
45
45
  ===== From rubygems.org
@@ -419,27 +419,6 @@ $ vagrant build-openshift --images
419
419
  $ vagrant build-sti --binary-only
420
420
  ----
421
421
 
422
- === Creating a "bootstrap" Vagrant Box
423
-
424
- Assuming you are targeting the v0.4.4 for your vagrant box
425
-
426
- [source, sh]
427
- ----
428
- $ cd ~/tmp
429
- $ vagrant openshift-local-checkout --replace --branch v0.4.4
430
- $ pushd origin
431
- $ vagrant origin-init --stage inst --os fedora openshift-bootstrap --no-synced-folders
432
- $ vagrant up
433
- $ vagrant clone-upstream-repos --clean
434
- $ vagrant checkout-repos --branch v0.4.4
435
- $ vagrant build-openshift --images
436
- $ vagrant build-sti --binary-only
437
- $ vagrant bootstrap-openshift
438
-
439
- $ rm -f /tmp/fedora_virtualbox_bootstrap.box
440
- $ vagrant package --output /tmp/fedora_virtualbox_bootstrap.box
441
- ----
442
-
443
422
  == Notice of Export Control Law
444
423
 
445
424
  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.
@@ -40,14 +40,6 @@ module Vagrant
40
40
  end
41
41
  end
42
42
 
43
- def self.install_openshift_router(options)
44
- Vagrant::Action::Builder.new.tap do |b|
45
- b.use RunSystemctl, {:action => "start", :service => "openshift"}
46
- b.use InstallOpenshiftRouter
47
- b.use RunSystemctl, {:action => "stop", :service => "openshift"}
48
- end
49
- end
50
-
51
43
  def self.install_openshift_assets_base(options)
52
44
  Vagrant::Action::Builder.new.tap do |b|
53
45
  b.use InstallOpenshiftAssetDependencies
@@ -204,26 +196,6 @@ module Vagrant
204
196
  end
205
197
  end
206
198
 
207
- def self.install_docker_registry
208
- Vagrant::Action::Builder.new.tap do |b|
209
- b.use InstallDockerRegistry
210
- end
211
- end
212
-
213
- def self.bootstrap_openshift(options)
214
- Vagrant::Action::Builder.new.tap do |b|
215
- b.use RunSystemctl, {:action => 'restart', :service => 'docker'}
216
- b.use BootstrapOpenshift
217
- b.use RunSystemctl, {:action => 'enable', :service => 'openshift'}
218
- b.use RunSystemctl, {:action => 'start', :service => 'openshift', argv: '--force'}
219
- b.use WaitForOpenshift
220
- b.use InstallOpenshiftRouter
221
- b.use InstallDockerRegistry
222
- b.use SetupSamplePolicy
223
- b.use CreateSampleProject
224
- end
225
- end
226
-
227
199
  action_root = Pathname.new(File.expand_path("../action", __FILE__))
228
200
  autoload :Clean, action_root.join("clean")
229
201
  autoload :CloneUpstreamRepositories, action_root.join("clone_upstream_repositories")
@@ -257,13 +229,7 @@ module Vagrant
257
229
  autoload :TestExitCode, action_root.join("test_exit_code")
258
230
  autoload :CleanNetworkSetup, action_root.join("clean_network_setup")
259
231
  autoload :SetupBindHost, action_root.join("setup_bind_host")
260
- autoload :InstallOpenshiftRouter, action_root.join("install_openshift_router")
261
232
  autoload :RunSystemctl, action_root.join("run_systemctl")
262
- autoload :InstallDockerRegistry, action_root.join("install_docker_registry")
263
- autoload :WaitForOpenshift, action_root.join("wait_for_openshift")
264
- autoload :CreateSampleProject, action_root.join("create_sample_project")
265
- autoload :SetupSamplePolicy, action_root.join("setup_sample_policy")
266
- autoload :BootstrapOpenshift, action_root.join("bootstrap_openshift")
267
233
  end
268
234
  end
269
235
  end
@@ -60,7 +60,7 @@ popd
60
60
  else
61
61
  cmd = sync_bash_command('origin', cmd)
62
62
  end
63
- do_execute(env[:machine], cmd)
63
+ do_execute(env[:machine], cmd)
64
64
  @app.call(env)
65
65
  end
66
66
  end
@@ -27,14 +27,13 @@ module Vagrant
27
27
  end
28
28
 
29
29
  def call(env)
30
- git_clone_commands = ""
30
+ git_clone_commands = "set -e\n"
31
31
  Constants.repos(env).each do |repo_name, url|
32
32
  bare_repo_name = repo_name + "-bare"
33
33
  bare_repo_path = Constants.build_dir + bare_repo_name
34
34
  repo_path = Constants.build_dir + repo_name
35
35
 
36
36
  git_clone_commands += %{
37
- (
38
37
  if [ -d #{bare_repo_path} ]; then
39
38
  rm -rf #{repo_path}
40
39
  echo 'Cloning #{repo_name} ...'
@@ -48,13 +47,10 @@ git clone --quiet #{bare_repo_path} #{repo_path}
48
47
  else
49
48
  MISSING_REPO+='#{bare_repo_name}'
50
49
  fi
51
- ) &
52
- PIDS+=$!\" \";
53
50
  }
54
51
  end
55
52
 
56
53
  git_clone_commands += %{
57
- [ -n \"$PIDS\" ] && wait $PIDS
58
54
  if [ -n \"$MISSING_REPO\" ]; then
59
55
  echo 'Missing required upstream repositories:'
60
56
  echo $MISSING_REPO
@@ -35,7 +35,7 @@ module Vagrant
35
35
  UserKnownHostsFile=/dev/null
36
36
  }}
37
37
 
38
- git_clone_commands = ""
38
+ git_clone_commands = "set -e\n"
39
39
  Constants.repos(env).each do |repo_name, url|
40
40
  bare_repo_name = repo_name + "-bare"
41
41
  bare_repo_path = Constants.build_dir + bare_repo_name
@@ -46,14 +46,11 @@ module Vagrant
46
46
 
47
47
  git_clone_commands += %{
48
48
  if [ ! -d #{bare_repo_path} ]; then
49
- git clone --quiet --bare #{url} #{bare_repo_path} >/dev/null &
50
- PIDS+=$!\" \"
49
+ git clone --quiet --bare #{url} #{bare_repo_path} >/dev/null
51
50
  fi
52
51
  }
53
52
  end
54
53
 
55
- git_clone_commands += "[ -n \"$PIDS\" ] && wait $PIDS\n"
56
-
57
54
  sudo(env[:machine], "mkdir -p #{Constants.build_dir}")
58
55
  sudo(env[:machine], "mkdir -p #{Constants.build_dir + "builder"} && chown -R #{ssh_user}:#{ssh_user} #{Constants.build_dir}")
59
56
  do_execute env[:machine], git_clone_commands
@@ -62,10 +62,10 @@ module Vagrant
62
62
  'instance_name' => box_info[:instance_name],
63
63
  'os' => os,
64
64
  'dev_cluster' => false,
65
- 'insert_key' => (stage == :inst),
65
+ 'insert_key' => ((stage == :inst) || (stage == :bootstrap)) && !@options[:no_insert_key],
66
66
  'num_minions' => 2,
67
67
  'cpus' => 2,
68
- 'memory' => 1024,
68
+ 'memory' => 2048,
69
69
  'rebuild_yum_cache' => false
70
70
  }
71
71
 
@@ -41,7 +41,7 @@ ORIGIN_PATH=/data/src/github.com/openshift/origin
41
41
  cat > /etc/profile.d/openshift.sh <<DELIM
42
42
  export GOPATH=/data
43
43
  export PATH=$ORIGIN_PATH/_output/etcd/bin:$ORIGIN_PATH/_output/local/go/bin/:$GOPATH/bin:$PATH
44
- export OPENSHIFTCONFIG=/openshift.local.config/master/admin.kubeconfig
44
+ export KUBECONFIG=/openshift.local.config/master/admin.kubeconfig
45
45
  DELIM
46
46
 
47
47
  cat > /etc/sysconfig/openshift <<DELIM
@@ -84,7 +84,8 @@ Documentation=https://github.com/openshift/origin
84
84
  [Service]
85
85
  Type=simple
86
86
  EnvironmentFile=-/etc/sysconfig/openshift
87
- ExecStart=$ORIGIN_PATH/_output/local/go/bin/openshift start --public-master=https://\\${HOST}:8443
87
+ ExecStart=$ORIGIN_PATH/_output/local/go/bin/openshift start --cors-allowed-origins=.* --public-master=https://\\${HOST}:8443
88
+ LimitNOFILE=4096
88
89
 
89
90
  [Install]
90
91
  WantedBy=multi-user.target
@@ -26,17 +26,29 @@ module Vagrant
26
26
  end
27
27
 
28
28
  def call(env)
29
+ # Workaround to vagrant inability to guess interface naming sequence
30
+ # Tell system to abandon the new naming scheme and use eth* instead
31
+ is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release")
32
+ if is_fedora
33
+ sudo(env[:machine], %{
34
+ if ! [[ -L /etc/udev/rules.d/80-net-setup-link.rules ]]; then
35
+ ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
36
+ rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s3
37
+ fi
38
+ })
39
+ end
40
+
29
41
  ssh_user = env[:machine].ssh_info[:username]
30
42
  # FIXME: Move 'openshift/centos-mongodb' into openshift org and then
31
43
  # add the image into 'repositories' constants
32
44
  #
33
- sudo(env[:machine], "yum install -y git fontconfig yum-utils wget make mlocate bind augeas vim docker-io hg bzr libselinux-devel vim tig glibc-static btrfs-progs-devel device-mapper-devel sqlite-devel libnetfilter_queue-devel gcc gcc-c++ e2fsprogs tmux tmux httpie ctags hg xfsprogs rubygems openvswitch bridge-utils bzip2 ntp screen java-1.?.0-openjdk bind-utils socat", {:timeout=>60*10})
34
- sudo(env[:machine], "yum install -y facter", {fail_on_error: false, :timeout=>60*5})
45
+ sudo(env[:machine], "yum install -y git fontconfig yum-utils wget make mlocate bind augeas vim docker-io hg bzr libselinux-devel vim tig glibc-static btrfs-progs-devel device-mapper-devel sqlite-devel libnetfilter_queue-devel gcc gcc-c++ e2fsprogs tmux tmux httpie ctags hg xfsprogs rubygems openvswitch bridge-utils bzip2 ntp screen java-1.?.0-openjdk bind-utils socat", {:timeout=>60*20})
46
+ sudo(env[:machine], "yum install -y facter", {fail_on_error: false, :timeout=>60*10})
35
47
  #
36
48
  # FIXME: Need to install golang packages 'after' the 'gcc' is
37
49
  # installed. See BZ#1101508
38
50
  #
39
- sudo(env[:machine], "yum install -y golang golang-pkg-linux-amd64 golang-src", {:timeout=>60*5})
51
+ sudo(env[:machine], "yum install -y golang golang-pkg-linux-amd64 golang-src", {:timeout=>60*10})
40
52
  #
41
53
  sudo(env[:machine], %{
42
54
 
@@ -78,10 +90,6 @@ chown -R #{ssh_user}:#{ssh_user} /data
78
90
  systemctl daemon-reload
79
91
  systemctl enable docker
80
92
  systemctl start docker
81
-
82
- docker pull openshift/docker-registry
83
- docker pull openshift/origin-sti-builder
84
- docker pull openshift/origin-deployer
85
93
  }, {:timeout=>60*30})
86
94
  @app.call(env)
87
95
  end
@@ -39,13 +39,9 @@ module Vagrant
39
39
  Dir.chdir(go_path) do
40
40
  commands = "echo 'Waiting for the cloning process to finish'\n"
41
41
  Constants.openshift_repos.each do |repo, url|
42
- commands += %{
43
- ( #{repo_checkout_bash_command(repo, url)} ) &
44
- PIDS+=$!\" \";
45
- }
42
+ commands += repo_checkout_bash_command(repo, url)
46
43
  end
47
44
 
48
- commands += "[ -n \"$PIDS\" ] && wait $PIDS\n"
49
45
  system(commands)
50
46
  puts "OpenShift repositories cloned into #{Dir.pwd}"
51
47
  end
@@ -37,40 +37,46 @@ systemctl restart docker
37
37
  }
38
38
  end
39
39
 
40
- def build_image(image_name, git_ref, repo_url, registry)
40
+ def push_image(image_name, git_ref, registry)
41
41
  %{
42
42
  set -e
43
+ pushd /data/src/github/openshift/#{image_name}
44
+ git checkout #{git_ref}
45
+ git_ref=$(git rev-parse --short HEAD)
46
+ echo "Pushing image #{image_name}:$git_ref..."
47
+ docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:$git_ref
48
+ docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:latest
49
+ docker tag -f #{image_name}-centos7 docker.io/#{image_name}-centos7:latest
50
+ docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:$git_ref
51
+ docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:latest
52
+ # FIXME: Paralelize this
53
+ docker push -f #{registry}#{image_name}-centos7:$git_ref
54
+ docker push -f #{registry}#{image_name}-centos7:latest
55
+ docker push -f docker.io/#{image_name}-centos7:latest
56
+ docker push -f #{registry}#{image_name}-rhel7:$git_ref
57
+ docker push -f #{registry}#{image_name}-rhel7:latest
58
+ popd
59
+ set +e
60
+ }
61
+ end
62
+
63
+ def build_image(image_name, git_ref, repo_url, registry)
64
+ %{
43
65
  dest_dir="/data/src/github/openshift/#{image_name}"
44
66
  rm -rf ${dest_dir}; mkdir -p ${dest_dir}
45
- if git clone #{repo_url} ${dest_dir}; then
46
- pushd ${dest_dir}
47
- git checkout #{git_ref}
48
- git_ref=$(git rev-parse --short HEAD)
49
- echo "Building #{image_name}:$git_ref"
50
-
51
- if make build TARGET=centos7; then
52
- docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:$git_ref
53
- docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:latest
54
- docker tag -f #{image_name}-centos7 #{image_name}-centos7:latest
55
- docker push -f #{registry}#{image_name}-centos7:$git_ref
56
- docker push -f #{registry}#{image_name}-centos7:latest
57
- docker push -f #{image_name}-centos7:latest
58
- else
59
- echo "ERROR: Failed to build #{image_name}-centos7"
60
- exit 1
61
- fi
62
-
63
- if make build TARGET=rhel7; then
64
- docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:$git_ref
65
- docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:latest
66
- docker push -f #{registry}#{image_name}-rhel7:$git_ref
67
- docker push -f #{registry}#{image_name}-rhel7:latest
68
- else
69
- echo "ERROR: Failed to build #{image_name}-rhel7"
70
- exit 1
71
- fi
72
- popd
73
- fi
67
+ set -e
68
+ pushd ${dest_dir}
69
+ git init && git remote add -t master origin #{repo_url}
70
+ git fetch && git checkout #{git_ref}
71
+ git_ref=$(git rev-parse --short HEAD)
72
+ echo "Building and testing #{image_name}-centos7:$git_ref ..."
73
+ make test TARGET=centos7
74
+ make build TARGET=centos7
75
+ echo "Building and testing #{image_name}-rhel7:$git_ref ..."
76
+ make test TARGET=rhel7
77
+ make build TARGET=rhel7
78
+ popd
79
+ set +e
74
80
  }
75
81
  end
76
82
 
@@ -98,14 +104,20 @@ fi
98
104
  end
99
105
 
100
106
  cmd += %{
101
- set -x; set +e
102
- echo "Pre-pulling base images"
107
+ set -x
108
+ set +e
109
+ echo "Pre-pulling base images ..."
103
110
  docker pull #{@options[:registry]}openshift/base-centos7
104
111
  [[ "$?" == "0" ]] && docker tag #{@options[:registry]}openshift/base-centos7 openshift/base-centos7
105
112
  docker pull #{@options[:registry]}openshift/base-rhel7
106
113
  [[ "$?" == "0" ]] && docker tag #{@options[:registry]}openshift/base-rhel7 openshift/base-rhel7
107
114
  }
108
115
 
116
+ cmd += %{
117
+ # so we can call sti
118
+ PATH=/data/src/github.com/openshift/source-to-image/_output/go/bin:/data/src/github.com/openshift/source-to-image/_output/local/go/bin:$PATH
119
+ }
120
+
109
121
  # FIXME: We always need to make sure we have the latest base image
110
122
  # FIXME: This is because the internal registry is pruned once per month
111
123
  if !@options[:build_images].include?("openshift/base")
@@ -114,6 +126,7 @@ docker pull #{@options[:registry]}openshift/base-rhel7
114
126
 
115
127
  build_images = @options[:build_images].split(",").map { |i| i.strip }
116
128
 
129
+ push_cmd = ""
117
130
  build_images.each do |image|
118
131
  name, git_ref = image.split(':')
119
132
  repo_url = Vagrant::Openshift::Constants.openshift_images[name]
@@ -122,8 +135,11 @@ docker pull #{@options[:registry]}openshift/base-rhel7
122
135
  next
123
136
  end
124
137
  cmd += build_image(name, git_ref, repo_url, @options[:registry])
138
+ push_cmd += push_image(name, git_ref, @options[:registry])
125
139
  end
126
140
 
141
+ # Push the final images **only** when they all build successfully
142
+ cmd += push_cmd
127
143
  cmd += update_latest_image_cmd(@options[:registry])
128
144
 
129
145
  do_execute(env[:machine], cmd)
@@ -48,9 +48,9 @@ popd >/dev/null
48
48
  }
49
49
  exit_code = 0
50
50
  if as_root
51
- _,_,exit_code = sudo(env[:machine], cmd, {:timeout => 60*60, :fail_on_error => false, :verbose => false})
51
+ _,_,exit_code = sudo(env[:machine], cmd, {:timeout => 60*60*2, :fail_on_error => false, :verbose => false})
52
52
  else
53
- _,_,exit_code = do_execute(env[:machine], cmd, {:timeout => 60*60, :fail_on_error => false, :verbose => false})
53
+ _,_,exit_code = do_execute(env[:machine], cmd, {:timeout => 60*60*2, :fail_on_error => false, :verbose => false})
54
54
  end
55
55
  exit_code
56
56
  end
@@ -64,6 +64,9 @@ module Vagrant
64
64
  end
65
65
  command += "git push -q verifier:#{Constants.build_dir + repo_name }-bare #{branch}:master --tags --force"
66
66
  system(command)
67
+ if $?.exitstatus != 0
68
+ exit $?.exitstatus
69
+ end
67
70
  ensure
68
71
  reset_temp_commit
69
72
  end
@@ -27,7 +27,7 @@ module Vagrant
27
27
 
28
28
  def call(env)
29
29
  env[:machine].env.ui.info("Synchronizing upstream sources\n")
30
- command = ""
30
+ command = "set -e\n"
31
31
 
32
32
  Constants.repos(env).each do |repo_name, url|
33
33
 
@@ -40,7 +40,6 @@ module Vagrant
40
40
 
41
41
  command += "export GIT_SSH=#{Constants.git_ssh};\n" unless Constants.git_ssh.nil? or Constants.git_ssh.empty?
42
42
  command += %{
43
- (
44
43
  if [ ! -d #{bare_repo_wc_path} ]; then
45
44
  echo 'Cloning #{repo_name} ...'
46
45
  git clone -l --quiet #{bare_repo_path} #{bare_repo_wc_path}
@@ -52,13 +51,9 @@ git fetch upstream
52
51
  git checkout master
53
52
  git reset --hard upstream/#{branch}
54
53
  git push origin master -f
55
- ) &
56
- PIDS+=$!\" \";
57
54
  }
58
55
  end
59
56
 
60
- command += "[ -n \"$PIDS\" ] && wait $PIDS\n"
61
-
62
57
  do_execute(env[:machine], command)
63
58
 
64
59
  env[:machine].env.ui.info("Done")
@@ -31,7 +31,8 @@ module Vagrant
31
31
  :os => 'centos7',
32
32
  :stage => 'inst',
33
33
  :port_mappings => [],
34
- :no_synced_folders => false
34
+ :no_synced_folders => false,
35
+ :no_insert_key => false
35
36
  }
36
37
 
37
38
  valid_stage = ['os','deps','inst', 'bootstrap']
@@ -56,6 +57,10 @@ module Vagrant
56
57
  o.on('--no-synced-folders', 'Checkout source into image rather than mapping from host system') do |f|
57
58
  options[:no_synced_folders] = true
58
59
  end
60
+
61
+ o.on('--no-insert-key', 'Insert a secure ssh key on vagrant up') do |f|
62
+ options[:no_insert_key] = true
63
+ end
59
64
  end
60
65
 
61
66
  # Parse the options
@@ -30,7 +30,6 @@ module Vagrant
30
30
  options = {}
31
31
  options[:image] = nil
32
32
  options[:ref] = 'master'
33
- options[:image_version] = ""
34
33
  options[:source] = nil
35
34
  options[:base_images] = false
36
35
  options[:registry] = ""
@@ -47,10 +46,6 @@ module Vagrant
47
46
  options[:ref] = o
48
47
  end
49
48
 
50
- o.on("-m", "--image_version VERSION", String, "version of the software") do |o|
51
- options[:image_version] = o
52
- end
53
-
54
49
  o.on("-s", "--source SOURCE", String, "git repo source url") do |o|
55
50
  options[:source] = o
56
51
  end
@@ -85,7 +80,6 @@ module Vagrant
85
80
  with_target_vms(argv, :reverse => true) do |machine|
86
81
  image = options[:image]
87
82
  ref = options[:ref]
88
- image_version = options[:image_version]
89
83
  source = options[:source]
90
84
  base_images = options[:base_images]
91
85
  registry = options[:registry]
@@ -134,45 +128,16 @@ if [ "#{base_images}" == "true" -a -n "#{registry}" ]; then
134
128
  docker pull #{registry}/openshift/base-rhel7 && docker tag #{registry}/openshift/base-rhel7 openshift/base-rhel7
135
129
  fi
136
130
 
137
- if [ -n "#{image_version}" ]; then
138
- BASE_NAME="#{image}-#{image_version}"
139
- pushd #{image_version} > /dev/null
140
- else
141
- BASE_NAME="#{image}"
131
+ if ! make test TARGET=rhel7; then
132
+ echo "ERROR: #{image}-rhel7 failed testing."
133
+ exit 1
142
134
  fi
143
-
144
- IMAGE_NAME="${BASE_NAME}-centos7"
145
-
146
- # Build the CentOS7 STI image we use for testing
147
- docker build -t ${IMAGE_NAME}-candidate .
148
- status=$?
149
-
150
- # Run the STI image test framework
151
- if [ $status -eq 0 ]; then
152
- IMAGE_NAME=${IMAGE_NAME}-candidate ./test/run
153
- status=$?
135
+
136
+ if ! make test TARGET=centos7; then
137
+ echo "ERROR: #{image}-centos7 failed testing."
138
+ exit 1
154
139
  fi
155
140
 
156
- if [ $status -eq 0 -a -f Dockerfile.rhel7 ]; then
157
- mv Dockerfile Dockerfile.centos7
158
- mv Dockerfile.rhel7 Dockerfile
159
-
160
- IMAGE_NAME="${BASE_NAME}-rhel7"
161
-
162
- # Build the RHEL7 based STI image we use for testing
163
- docker build -t ${IMAGE_NAME}-candidate .
164
- status=$?
165
-
166
- # Run the STI image test framework
167
- if [ $status -eq 0 ]; then
168
- IMAGE_NAME=${IMAGE_NAME}-candidate ./test/run
169
- status=$?
170
- fi
171
- fi
172
-
173
- # If software version is set, go back to the repository root
174
- [ -n "#{image_version}" ] && popd > /dev/null
175
-
176
141
  # clean up
177
142
  cd /
178
143
  rm -rf $temp_dir
@@ -137,16 +137,6 @@ module Vagrant
137
137
  Commands::TestOpenshiftImage
138
138
  end
139
139
 
140
- command "install-openshift-router" do
141
- require_relative "command/install_openshift_router"
142
- Commands::InstallOpenshiftRouter
143
- end
144
-
145
- command "install-docker-registry" do
146
- require_relative 'command/install_docker_registry'
147
- Commands::InstallDockerRegistry
148
- end
149
-
150
140
  command "bootstrap-openshift" do
151
141
  require_relative 'command/bootstrap_openshift'
152
142
  Commands::BootstrapOpenshift
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Vagrant
18
18
  module Openshift
19
- VERSION = "2.0.1"
19
+ VERSION = "2.0.2"
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-openshift
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Red Hat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-06 00:00:00.000000000 Z
11
+ date: 2015-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -122,7 +122,6 @@ files:
122
122
  - Rakefile
123
123
  - lib/vagrant-openshift.rb
124
124
  - lib/vagrant-openshift/action.rb
125
- - lib/vagrant-openshift/action/bootstrap_openshift.rb
126
125
  - lib/vagrant-openshift/action/build_openshift.rb
127
126
  - lib/vagrant-openshift/action/build_openshift_base_images.rb
128
127
  - lib/vagrant-openshift/action/build_sti.rb
@@ -132,18 +131,15 @@ files:
132
131
  - lib/vagrant-openshift/action/clone_upstream_repositories.rb
133
132
  - lib/vagrant-openshift/action/create_ami.rb
134
133
  - lib/vagrant-openshift/action/create_bare_repo_placeholders.rb
135
- - lib/vagrant-openshift/action/create_sample_project.rb
136
134
  - lib/vagrant-openshift/action/create_yum_repositories.rb
137
135
  - lib/vagrant-openshift/action/download_artifacts_openshift.rb
138
136
  - lib/vagrant-openshift/action/download_artifacts_sti.rb
139
137
  - lib/vagrant-openshift/action/generate_template.rb
140
- - lib/vagrant-openshift/action/install_docker_registry.rb
141
138
  - lib/vagrant-openshift/action/install_openshift.rb
142
139
  - lib/vagrant-openshift/action/install_openshift_asset_dependencies.rb
143
140
  - lib/vagrant-openshift/action/install_openshift_base_dependencies.rb
144
141
  - lib/vagrant-openshift/action/install_openshift_images.rb
145
142
  - lib/vagrant-openshift/action/install_openshift_rhel7.rb
146
- - lib/vagrant-openshift/action/install_openshift_router.rb
147
143
  - lib/vagrant-openshift/action/local_openshift_checkout.rb
148
144
  - lib/vagrant-openshift/action/modify_ami.rb
149
145
  - lib/vagrant-openshift/action/modify_instance.rb
@@ -156,11 +152,9 @@ files:
156
152
  - lib/vagrant-openshift/action/set_host_name.rb
157
153
  - lib/vagrant-openshift/action/setup_bind_dns_key.rb
158
154
  - lib/vagrant-openshift/action/setup_bind_host.rb
159
- - lib/vagrant-openshift/action/setup_sample_policy.rb
160
155
  - lib/vagrant-openshift/action/sync_local_repository.rb
161
156
  - lib/vagrant-openshift/action/sync_upstream_repository.rb
162
157
  - lib/vagrant-openshift/action/test_exit_code.rb
163
- - lib/vagrant-openshift/action/wait_for_openshift.rb
164
158
  - lib/vagrant-openshift/action/yum_update.rb
165
159
  - lib/vagrant-openshift/command/bootstrap_openshift.rb
166
160
  - lib/vagrant-openshift/command/build_openshift.rb
@@ -170,10 +164,8 @@ files:
170
164
  - lib/vagrant-openshift/command/checkout_repositories.rb
171
165
  - lib/vagrant-openshift/command/clone_upstream_repositories.rb
172
166
  - lib/vagrant-openshift/command/create_ami.rb
173
- - lib/vagrant-openshift/command/install_docker_registry.rb
174
167
  - lib/vagrant-openshift/command/install_openshift.rb
175
168
  - lib/vagrant-openshift/command/install_openshift_assets_base.rb
176
- - lib/vagrant-openshift/command/install_openshift_router.rb
177
169
  - lib/vagrant-openshift/command/local_openshift_setup.rb
178
170
  - lib/vagrant-openshift/command/modify_ami.rb
179
171
  - lib/vagrant-openshift/command/modify_instance.rb
@@ -215,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
207
  version: '0'
216
208
  requirements: []
217
209
  rubyforge_project:
218
- rubygems_version: 2.2.2
210
+ rubygems_version: 2.4.5
219
211
  signing_key:
220
212
  specification_version: 4
221
213
  summary: Vagrant plugin to manage OpenShift Origin environments
@@ -1,34 +0,0 @@
1
- #--
2
- # Copyright 2015 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 BootstrapOpenshift
21
- include CommandHelper
22
- def initialize(app, env)
23
- @app = app
24
- @env = env
25
- end
26
-
27
- def call(env)
28
- do_execute(env[:machine], %q[echo "Bootstrap OpenShift Environment"])
29
- @app.call(env)
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,39 +0,0 @@
1
- #--
2
- # Copyright 2015 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 CreateSampleProject
21
- include CommandHelper
22
-
23
- def initialize(app, env)
24
- @app = app
25
- end
26
-
27
- def call(env)
28
- puts %q[Creating sample OpenShift project 'Turbo']
29
-
30
- sudo(env[:machine], %q[
31
- openshift admin new-project turbo --admin=admin --description='Turbo Sample' --display-name='Turbo Sample'
32
- ])
33
-
34
- @app.call(env)
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,47 +0,0 @@
1
- #--
2
- # Copyright 2015 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 InstallDockerRegistry
21
- include CommandHelper
22
-
23
- def initialize(app, env)
24
- @app = app
25
- @env = env
26
- end
27
-
28
- def call(env)
29
- puts 'Installing docker registry'
30
- sudo(env[:machine], %q[
31
- #set -x
32
- source /etc/profile.d/openshift.sh
33
-
34
- CMD="openshift admin registry --create --credentials=${OPENSHIFTCONFIG}"
35
- OS_RUNNING=$(systemctl status openshift | /bin/grep "(running)")
36
- if [[ $OS_RUNNING ]]; then
37
- ${CMD}
38
- else
39
- echo "The OpenShift process is not running. To install a docker registry please start OpenShift and run ${CMD}"
40
- fi
41
- ])
42
- @app.call(env)
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,54 +0,0 @@
1
- #--
2
- # Copyright 2014 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 InstallOpenshiftRouter
21
- include CommandHelper
22
-
23
- def initialize(app, env)
24
- @app = app
25
- @env = env
26
- end
27
-
28
- def call(env)
29
- puts 'Installing router'
30
- sudo(env[:machine], '
31
- OS_RUNNING=$(systemctl status openshift | grep "(running)")
32
- CMD="openshift ex router --create --credentials=${OPENSHIFTCONFIG}"
33
-
34
- if [[ $OS_RUNNING ]]; then
35
- ROUTER_EXISTS=$(openshift ex router --credentials=${OPENSHIFTCONFIG} 2>&1 | grep "service exists")
36
- if [[ -z $ROUTER_EXISTS ]]; then
37
- echo "Installing OpenShift router"
38
- ${CMD}
39
- else
40
- echo "Router already exists, skipping"
41
- fi
42
- else
43
- echo "The OpenShift process is not running. To install a router please start OpenShift and run ${CMD}"
44
- fi
45
-
46
-
47
- ')
48
-
49
- @app.call(env)
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,42 +0,0 @@
1
- #--
2
- # Copyright 2015 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 SetupSamplePolicy
21
- include CommandHelper
22
-
23
- def initialize(app, env)
24
- @app = app
25
- end
26
-
27
- def call(env)
28
- puts 'Creating cluster-admin policy'
29
-
30
- sudo(env[:machine], %q[
31
- #set -x
32
-
33
- source /etc/profile.d/openshift.sh
34
- openshift admin policy add-role-to-group cluster-admin system:authenticated --config=${OPENSHIFTCONFIG} --namespace=master
35
- ])
36
-
37
- @app.call(env)
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,61 +0,0 @@
1
- #--
2
- # Copyright 2015 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
- require 'open-uri'
17
- require 'openssl'
18
- require 'uri'
19
-
20
- module Vagrant
21
- module Openshift
22
- module Action
23
- class WaitForOpenshift
24
- include CommandHelper
25
-
26
- def initialize(app, env)
27
- @app = app
28
- @env = env
29
- end
30
-
31
- def call(env)
32
- puts 'Waiting on openshift...'
33
-
34
- uri = URI.parse('https://localhost:8443/api')
35
- status = nil
36
- begin
37
- until '200' == status
38
- uri.open(ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, read_timeout: 10) do |response|
39
- status = response.status[0]
40
- if '200' == status
41
- puts "...#{response.status[1]}"
42
- else
43
- puts "...#{response.status[1]}:#{status}"
44
- sleep 1
45
- end
46
- end
47
- end
48
- rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, OpenURI::HTTPError
49
- sleep 1
50
- retry
51
- rescue => e
52
- puts "#{e.class}: #{e.message}"
53
- raise
54
- end
55
-
56
- @app.call(env)
57
- end
58
- end
59
- end
60
- end
61
- end
@@ -1,50 +0,0 @@
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
- require_relative "../action"
17
-
18
- module Vagrant
19
- module Openshift
20
- module Commands
21
- class InstallDockerRegistry < Vagrant.plugin(2, :command)
22
- include CommandHelper
23
-
24
- def self.synopsis
25
- "installs docker registry as container"
26
- end
27
-
28
- def execute
29
- options = {}
30
- options[:clean] = false
31
-
32
- opts = OptionParser.new do |o|
33
- o.banner = "Usage: vagrant install-docker-registry [vm-name]"
34
- o.separator ""
35
- end
36
-
37
- # Parse the options
38
- argv = parse_options(opts)
39
- return if !argv
40
-
41
- with_target_vms(argv, :reverse => true) do |machine|
42
- actions = Vagrant::Openshift::Action.install_docker_registry(options)
43
- @env.action_runner.run actions, {:machine => machine}
44
- 0
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,50 +0,0 @@
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
- require_relative "../action"
17
-
18
- module Vagrant
19
- module Openshift
20
- module Commands
21
- class InstallOpenshiftRouter < Vagrant.plugin(2, :command)
22
- include CommandHelper
23
-
24
- def self.synopsis
25
- "installs openshift router"
26
- end
27
-
28
- def execute
29
- options = {}
30
- options[:clean] = false
31
-
32
- opts = OptionParser.new do |o|
33
- o.banner = "Usage: vagrant install-openshift-router [vm-name]"
34
- o.separator ""
35
- end
36
-
37
- # Parse the options
38
- argv = parse_options(opts)
39
- return if !argv
40
-
41
- with_target_vms(argv, :reverse => true) do |machine|
42
- actions = Vagrant::Openshift::Action.install_openshift_router(options)
43
- @env.action_runner.run actions, {:machine => machine}
44
- 0
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end