vagrant-openshift 1.0.17 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.asciidoc +4 -2
- data/lib/vagrant-openshift/action/download_artifacts_openshift3.rb +1 -0
- data/lib/vagrant-openshift/action/download_artifacts_sti.rb +2 -1
- data/lib/vagrant-openshift/action/install_openshift3.rb +5 -1
- data/lib/vagrant-openshift/action/install_openshift3_base_dependencies.rb +2 -1
- data/lib/vagrant-openshift/action/install_openshift3_router.rb +54 -0
- data/lib/vagrant-openshift/action/push_openshift3_images.rb +132 -0
- data/lib/vagrant-openshift/action/run_openshift3_tests.rb +27 -11
- data/lib/vagrant-openshift/action/run_sti_tests.rb +1 -1
- data/lib/vagrant-openshift/action/{try_restart_openshift3.rb → run_systemctl.rb} +7 -6
- data/lib/vagrant-openshift/action.rb +19 -3
- data/lib/vagrant-openshift/command/install_openshift3_router.rb +51 -0
- data/lib/vagrant-openshift/command/push_openshift3_images.rb +67 -0
- data/lib/vagrant-openshift/command/test_openshift3.rb +1 -1
- data/lib/vagrant-openshift/command/test_openshift3_image.rb +71 -16
- data/lib/vagrant-openshift/constants.rb +5 -9
- data/lib/vagrant-openshift/plugin.rb +10 -0
- data/lib/vagrant-openshift/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6f50f81d496445d7c7ff530ebbb98b6d1734a8f
|
4
|
+
data.tar.gz: d0601c6912e1dea1acadb9959c3ca2e0e93dad1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8f6c74bd4528eebfc10e70c6ab4f1c99a0e052fd8b21075ed2330a404cfa2d7c1303afa86ebb1ef40f7da1e8b77a45ead66e0d774f949e4b6156cc917d2b2da
|
7
|
+
data.tar.gz: a87ed5e5469411c4026f5bb8cd4bdad123069b550fc234545d6a778f1a2c1fa50866dc6aa5c328bc84a7f6de180ab0f2d32c3ca5d72024673d547f826028579e
|
data/README.asciidoc
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
== OpenShift Origin Build Tools
|
2
2
|
|
3
|
-
This is a link:http://www.vagrantup.com[Vagrant] 1.2+ plugin that adds vagrant commands and provisioners to
|
3
|
+
This is a link:http://www.vagrantup.com[Vagrant] 1.7.2+ plugin that adds vagrant commands and provisioners to
|
4
4
|
build and test link:http://openshift.github.io[OpenShift Origin].
|
5
5
|
|
6
|
-
NOTE: This plugin requires link:https://www.vagrantup.com/downloads.html[Vagrant 1.2+]
|
6
|
+
NOTE: This plugin requires link:https://www.vagrantup.com/downloads.html[Vagrant 1.7.2+]
|
7
7
|
|
8
8
|
NOTE: Instructions below generally assume a Linux-like command line and may require modifications for other environments.
|
9
9
|
|
@@ -199,6 +199,8 @@ a base AMI in your repository's `.vagrant-openshift.json` file under the
|
|
199
199
|
vagrant up --provider=aws
|
200
200
|
----
|
201
201
|
|
202
|
+
TIP: Be sure to rerun origin-init for each subsequent run of `vagrant up --provider=aws` to pick up the last built ami.
|
203
|
+
|
202
204
|
NOTE: Requires latest link:https://github.com/mitchellh/vagrant-aws[AWS] provider.
|
203
205
|
|
204
206
|
NOTE: You can use the link:https://github.com/mikery/vagrant-ami[Vagrant-AMI] plugin to create an AMI from a running AWS machine.
|
@@ -40,6 +40,7 @@ module Vagrant
|
|
40
40
|
"/tmp/origin/e2e/" => artifacts_dir + "e2e/",
|
41
41
|
|
42
42
|
"/data/src/github.com/openshift/origin/_output/local/releases/" => artifacts_dir + "release/",
|
43
|
+
"/data/src/github.com/openshift/origin/assets/test/tmp/screenshots/" => artifacts_dir + "screenshots/",
|
43
44
|
}
|
44
45
|
|
45
46
|
download_map.each do |source,target|
|
@@ -36,7 +36,8 @@ 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/sti/" => artifacts_dir + "sti/"
|
40
41
|
}
|
41
42
|
|
42
43
|
download_map.each do |source,target|
|
@@ -45,6 +45,10 @@ export PATH=$ORIGIN_PATH/_output/etcd/bin:$ORIGIN_PATH/_output/local/go/bin/:$GO
|
|
45
45
|
export KUBECONFIG=/openshift.local.certificates/admin/.kubeconfig
|
46
46
|
DELIM
|
47
47
|
|
48
|
+
cat > /etc/sysconfig/openshift <<DELIM
|
49
|
+
GOPATH=/data
|
50
|
+
DELIM
|
51
|
+
|
48
52
|
source /etc/profile.d/openshift.sh
|
49
53
|
|
50
54
|
pushd $ORIGIN_PATH
|
@@ -74,7 +78,7 @@ Documentation=https://github.com/openshift/origin
|
|
74
78
|
|
75
79
|
[Service]
|
76
80
|
Type=simple
|
77
|
-
EnvironmentFile=-/etc/
|
81
|
+
EnvironmentFile=-/etc/sysconfig/openshift
|
78
82
|
ExecStart=$ORIGIN_PATH/_output/local/go/bin/openshift start --public-master=https://\\${HOST}:8443
|
79
83
|
ExecStartPost=/bin/sleep 8
|
80
84
|
ExecStartPost=/bin/chmod a+r -R /openshift.local.certificates/admin
|
@@ -30,7 +30,7 @@ module Vagrant
|
|
30
30
|
# FIXME: Move 'openshift/centos-mongodb' into openshift org and then
|
31
31
|
# add the image into 'repositories' constants
|
32
32
|
#
|
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 screen")
|
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 screen java-1.?.0-openjdk")
|
34
34
|
sudo(env[:machine], "yum install -y facter", {fail_on_error: false})
|
35
35
|
#
|
36
36
|
# FIXME: Need to install golang packages 'after' the 'gcc' is
|
@@ -67,6 +67,7 @@ systemctl enable docker
|
|
67
67
|
systemctl start docker
|
68
68
|
|
69
69
|
docker pull openshift/docker-registry
|
70
|
+
docker pull openshift/origin-docker-registry
|
70
71
|
}, {:timeout=>60*20})
|
71
72
|
@app.call(env)
|
72
73
|
end
|
@@ -0,0 +1,54 @@
|
|
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 InstallOpenshift3Router
|
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
|
+
ROUTER_EXISTS=$(openshift ex router 2>&1 | grep "does not exist")
|
32
|
+
OS_RUNNING=$(systemctl status openshift | grep "(running)")
|
33
|
+
CMD="openshift ex router --create --credentials=${KUBECONFIG}"
|
34
|
+
|
35
|
+
if [[ $OS_RUNNING ]]; then
|
36
|
+
if [[ -n $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
|
@@ -0,0 +1,132 @@
|
|
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 PushOpenshift3Images
|
21
|
+
include CommandHelper
|
22
|
+
|
23
|
+
def initialize(app, env, options)
|
24
|
+
@app = app
|
25
|
+
@env = env
|
26
|
+
@options = options
|
27
|
+
end
|
28
|
+
|
29
|
+
# FIXME: This is a temporary fix as the RHEL7 AMI should have this
|
30
|
+
# registry here already.
|
31
|
+
def fix_insecure_registry_cmd(registry_url)
|
32
|
+
%{
|
33
|
+
cat <<EOF > /etc/sysconfig/docker
|
34
|
+
OPTIONS='--insecure-registry #{registry_url} --selinux-enabled -H fd://'
|
35
|
+
EOF
|
36
|
+
systemctl restart docker
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def build_image(image_name, git_ref, repo_url, registry)
|
41
|
+
%{
|
42
|
+
dest_dir="/data/src/github/openshift/#{image_name}"
|
43
|
+
rm -rf ${dest_dir}; mkdir -p ${dest_dir}
|
44
|
+
if git clone #{repo_url} ${dest_dir}; then
|
45
|
+
pushd ${dest_dir}
|
46
|
+
git checkout #{git_ref}
|
47
|
+
git_ref=$(git rev-parse --short HEAD)
|
48
|
+
echo "Building #{image_name}:$git_ref"
|
49
|
+
|
50
|
+
if make build TARGET=centos7; then
|
51
|
+
docker tag #{image_name}-centos7 #{registry}#{image_name}-centos7:$git_ref
|
52
|
+
docker tag #{image_name}-centos7 #{registry}#{image_name}-centos7:latest
|
53
|
+
docker tag #{image_name}-centos7 #{image_name}-centos7:latest
|
54
|
+
docker push #{registry}#{image_name}-centos7:$git_ref
|
55
|
+
docker push #{registry}#{image_name}-centos7:latest
|
56
|
+
docker push #{image_name}-centos7:latest
|
57
|
+
else
|
58
|
+
echo "ERROR: Failed to build #{image_name}-centos7"
|
59
|
+
fi
|
60
|
+
|
61
|
+
if make build TARGET=rhel7; then
|
62
|
+
docker tag #{image_name}-rhel7 #{registry}#{image_name}-rhel7:$git_ref
|
63
|
+
docker tag #{image_name}-rhel7 #{registry}#{image_name}-rhel7:latest
|
64
|
+
docker push #{registry}#{image_name}-rhel7:$git_ref
|
65
|
+
docker push #{registry}#{image_name}-rhel7:latest
|
66
|
+
else
|
67
|
+
echo "ERROR: Failed to build #{image_name}-rhel7"
|
68
|
+
fi
|
69
|
+
popd
|
70
|
+
fi
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
def update_latest_image_cmd(registry)
|
75
|
+
cmd = %{
|
76
|
+
rm -rf ~/latest_images ; touch ~/latest_images
|
77
|
+
}
|
78
|
+
Vagrant::Openshift::Constants.openshift3_images.each do |name, git_url|
|
79
|
+
cmd += %{
|
80
|
+
git_ref=$(git ls-remote #{git_url} -h refs/heads/master | cut -c1-7)
|
81
|
+
curl -s http://#{registry}v1/repositories/#{name}-rhel7/tags/${git_ref} | grep -q "error"
|
82
|
+
if [[ "$?" != "0" ]]; then
|
83
|
+
echo "#{name};$git_ref" >> ~/latest_images
|
84
|
+
fi
|
85
|
+
}
|
86
|
+
end
|
87
|
+
return cmd
|
88
|
+
end
|
89
|
+
|
90
|
+
def call(env)
|
91
|
+
cmd = fix_insecure_registry_cmd(@options[:registry])
|
92
|
+
if !@options[:registry].end_with?('/')
|
93
|
+
@options[:registry] += "/"
|
94
|
+
end
|
95
|
+
|
96
|
+
cmd += %{
|
97
|
+
set -x; set +e
|
98
|
+
echo "Pre-pulling base images"
|
99
|
+
docker pull #{@options[:registry]}openshift/base-centos7
|
100
|
+
[[ "$?" == "0" ]] && docker tag #{@options[:registry]}openshift/base-centos7 openshift/base-centos7
|
101
|
+
docker pull #{@options[:registry]}openshift/base-rhel7
|
102
|
+
[[ "$?" == "0" ]] && docker tag #{@options[:registry]}openshift/base-rhel7 openshift/base-rhel7
|
103
|
+
}
|
104
|
+
|
105
|
+
# FIXME: We always need to make sure we have the latest base image
|
106
|
+
# FIXME: This is because the internal registry is pruned once per month
|
107
|
+
if !@options[:build_images].include?("openshift/base")
|
108
|
+
@options[:build_images] = "openshift/base:master,#{@options[:build_images]}"
|
109
|
+
end
|
110
|
+
|
111
|
+
build_images = @options[:build_images].split(",").map { |i| i.strip }
|
112
|
+
|
113
|
+
build_images.each do |image|
|
114
|
+
name, git_ref = image.split(':')
|
115
|
+
repo_url = Vagrant::Openshift::Constants.openshift3_images[name]
|
116
|
+
if repo_url == nil
|
117
|
+
puts "Unregistred image: #{name}, skipping"
|
118
|
+
next
|
119
|
+
end
|
120
|
+
cmd += build_image(name, git_ref, repo_url, @options[:registry])
|
121
|
+
end
|
122
|
+
|
123
|
+
cmd += update_latest_image_cmd(@options[:registry])
|
124
|
+
|
125
|
+
do_execute(env[:machine], cmd)
|
126
|
+
|
127
|
+
@app.call(env)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -55,26 +55,42 @@ popd >/dev/null
|
|
55
55
|
exit_code
|
56
56
|
end
|
57
57
|
|
58
|
+
#
|
59
|
+
# Build and run the make commands
|
60
|
+
# for testing all run make test
|
61
|
+
# for testing unit tests only run make build check
|
62
|
+
# for testing assets run hack/test-assets.sh
|
63
|
+
#
|
64
|
+
# All env vars will be added to the beginning of the command like VAR=1 make test
|
65
|
+
#
|
58
66
|
def call(env)
|
59
67
|
@options.delete :logs
|
60
68
|
|
61
|
-
|
62
|
-
|
63
|
-
else
|
64
|
-
cmds = ['hack/test-go.sh']
|
65
|
-
end
|
69
|
+
cmd_env = []
|
70
|
+
build_targets = ["make"]
|
66
71
|
|
67
72
|
if @options[:all]
|
68
|
-
|
69
|
-
|
73
|
+
cmd_env << 'ARTIFACT_DIR=/tmp/origin/e2e/artifacts'
|
74
|
+
cmd_env << 'LOG_DIR=/tmp/origin/e2e/logs'
|
75
|
+
cmd_env << 'TEST_ASSETS=true'
|
76
|
+
build_targets << 'test'
|
77
|
+
# we want to test the output of build-release, this flag tells the makefile to skip the build dependency
|
78
|
+
# so the command comes out to <cmd_env settings> make test SKIP_BUILD=true
|
79
|
+
build_targets << "SKIP_BUILD=true"
|
80
|
+
|
70
81
|
if @options[:skip_image_cleanup]
|
71
|
-
|
72
|
-
else
|
73
|
-
cmds << 'ARTIFACT_DIR=/tmp/origin/e2e/artifacts LOG_DIR=/tmp/origin/e2e/logs hack/test-end-to-end.sh'
|
82
|
+
cmd_env << 'SKIP_IMAGE_CLEANUP=1'
|
74
83
|
end
|
84
|
+
else
|
85
|
+
build_targets << "check"
|
86
|
+
end
|
87
|
+
|
88
|
+
if @options[:report_coverage]
|
89
|
+
cmd_env << 'OUTPUT_COVERAGE=/tmp/origin/e2e/artifacts/coverage'
|
75
90
|
end
|
76
91
|
|
77
|
-
|
92
|
+
cmd = cmd_env.join(' ') + ' ' + build_targets.join(' ')
|
93
|
+
env[:test_exit_code] = run_tests(env, [cmd], true)
|
78
94
|
|
79
95
|
# any other tests that should not be run as sudo
|
80
96
|
if env[:test_exit_code] == 0 && @options[:all]
|
@@ -17,20 +17,21 @@
|
|
17
17
|
module Vagrant
|
18
18
|
module Openshift
|
19
19
|
module Action
|
20
|
-
class
|
20
|
+
class RunSystemctl
|
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
|
-
|
30
|
-
|
31
|
-
|
30
|
+
unless @options[:action].nil? || @options[:service].nil?
|
31
|
+
sudo(env[:machine], "systemctl #{@options[:action]} #{@options[:service]}")
|
32
|
+
@app.call(env)
|
33
|
+
end
|
32
34
|
end
|
33
|
-
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
@@ -40,6 +40,14 @@ module Vagrant
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def self.install_openshift3_router(options)
|
44
|
+
Vagrant::Action::Builder.new.tap do |b|
|
45
|
+
b.use RunSystemctl, {:action => "start", :service => "openshift"}
|
46
|
+
b.use InstallOpenshift3Router
|
47
|
+
b.use RunSystemctl, {:action => "stop", :service => "openshift"}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
43
51
|
def self.install_openshift3_assets_base(options)
|
44
52
|
Vagrant::Action::Builder.new.tap do |b|
|
45
53
|
b.use InstallOpenshift3AssetDependencies
|
@@ -52,6 +60,12 @@ module Vagrant
|
|
52
60
|
end
|
53
61
|
end
|
54
62
|
|
63
|
+
def self.push_openshift3_images(options)
|
64
|
+
Vagrant::Action::Builder.new.tap do |b|
|
65
|
+
b.use PushOpenshift3Images, options
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
55
69
|
def self.build_sti(options)
|
56
70
|
Vagrant::Action::Builder.new.tap do |b|
|
57
71
|
b.use BuildSti, options
|
@@ -60,7 +74,7 @@ module Vagrant
|
|
60
74
|
|
61
75
|
def self.try_restart_openshift3(options)
|
62
76
|
Vagrant::Action::Builder.new.tap do |b|
|
63
|
-
b.use
|
77
|
+
b.use RunSystemctl, {:action => "try-restart", :service => "openshift"}
|
64
78
|
end
|
65
79
|
end
|
66
80
|
|
@@ -85,7 +99,7 @@ module Vagrant
|
|
85
99
|
if options[:build]
|
86
100
|
b.use(BuildOpenshift3BaseImages, options) if options[:images]
|
87
101
|
b.use(BuildOpenshift3, options)
|
88
|
-
b.use
|
102
|
+
b.use RunSystemctl, {:action => "try-restart", :service => "openshift"}
|
89
103
|
end
|
90
104
|
end
|
91
105
|
end
|
@@ -201,12 +215,12 @@ module Vagrant
|
|
201
215
|
autoload :InstallOpenshift3BaseDependencies, action_root.join("install_openshift3_base_dependencies")
|
202
216
|
autoload :InstallOpenshift3AssetDependencies, action_root.join("install_openshift3_asset_dependencies")
|
203
217
|
autoload :BuildOpenshift3BaseImages, action_root.join("build_openshift3_base_images")
|
218
|
+
autoload :PushOpenshift3Images, action_root.join("push_openshift3_images")
|
204
219
|
autoload :PushOpenshift3Release, action_root.join("push_openshift3_release")
|
205
220
|
autoload :InstallOpenshift3, action_root.join("install_openshift3")
|
206
221
|
autoload :InstallOpenshift3Rhel7, action_root.join("install_openshift3_rhel7")
|
207
222
|
autoload :BuildOpenshift3, action_root.join("build_openshift3")
|
208
223
|
autoload :BuildSti, action_root.join("build_sti")
|
209
|
-
autoload :TryRestartOpenshift3, action_root.join("try_restart_openshift3")
|
210
224
|
autoload :PrepareSshConfig, action_root.join("prepare_ssh_config")
|
211
225
|
autoload :SyncLocalRepository, action_root.join("sync_local_repository")
|
212
226
|
autoload :SyncUpstreamRepository, action_root.join("sync_upstream_repository")
|
@@ -223,6 +237,8 @@ module Vagrant
|
|
223
237
|
autoload :TestExitCode, action_root.join("test_exit_code")
|
224
238
|
autoload :CleanNetworkSetup, action_root.join("clean_network_setup")
|
225
239
|
autoload :SetupBindHost, action_root.join("setup_bind_host")
|
240
|
+
autoload :InstallOpenshift3Router, action_root.join("install_openshift3_router")
|
241
|
+
autoload :RunSystemctl, action_root.join("run_systemctl")
|
226
242
|
end
|
227
243
|
end
|
228
244
|
end
|
@@ -0,0 +1,51 @@
|
|
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 InstallOpenshift3Router < Vagrant.plugin(2, :command)
|
22
|
+
include CommandHelper
|
23
|
+
|
24
|
+
def self.synopsis
|
25
|
+
"installs openshift3 router"
|
26
|
+
end
|
27
|
+
|
28
|
+
def execute
|
29
|
+
options = {}
|
30
|
+
options[:clean] = false
|
31
|
+
options[:local_source] = false
|
32
|
+
|
33
|
+
opts = OptionParser.new do |o|
|
34
|
+
o.banner = "Usage: vagrant install-openshift3-router [vm-name]"
|
35
|
+
o.separator ""
|
36
|
+
end
|
37
|
+
|
38
|
+
# Parse the options
|
39
|
+
argv = parse_options(opts)
|
40
|
+
return if !argv
|
41
|
+
|
42
|
+
with_target_vms(argv, :reverse => true) do |machine|
|
43
|
+
actions = Vagrant::Openshift::Action.install_openshift3_router(options)
|
44
|
+
@env.action_runner.run actions, {:machine => machine}
|
45
|
+
0
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,67 @@
|
|
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
|
+
|
22
|
+
class PushOpenshift3Images < Vagrant.plugin(2, :command)
|
23
|
+
include CommandHelper
|
24
|
+
|
25
|
+
def self.synopsis
|
26
|
+
"build and push openshift v3 images"
|
27
|
+
end
|
28
|
+
|
29
|
+
def execute
|
30
|
+
options = {}
|
31
|
+
options[:registry] = nil
|
32
|
+
|
33
|
+
opts = OptionParser.new do |o|
|
34
|
+
o.banner = "Usage: vagrant push-openshift3-images --registry DOCKER_REGISTRY [vm-name]"
|
35
|
+
o.on("--registry [url]", String, "Docker Registry to push images to.") do |c|
|
36
|
+
options[:registry] = c
|
37
|
+
end
|
38
|
+
o.on("--build_images [list]", String, "List of IMAGE:REF pairs, delimited by ','") do |i|
|
39
|
+
options[:build_images] = i
|
40
|
+
end
|
41
|
+
o.separator ""
|
42
|
+
end
|
43
|
+
|
44
|
+
# Parse the options
|
45
|
+
argv = parse_options(opts)
|
46
|
+
return if !argv
|
47
|
+
|
48
|
+
if options[:registry].nil?
|
49
|
+
@env.ui.warn "You must specify target Docker registry"
|
50
|
+
exit
|
51
|
+
end
|
52
|
+
|
53
|
+
if options[:build_images].nil?
|
54
|
+
@env.ui.warn "You must specify list of images to build"
|
55
|
+
exit
|
56
|
+
end
|
57
|
+
|
58
|
+
with_target_vms(argv, :reverse => true) do |machine|
|
59
|
+
actions = Vagrant::Openshift::Action.push_openshift3_images(options)
|
60
|
+
@env.action_runner.run actions, {:machine => machine}
|
61
|
+
0
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -46,7 +46,7 @@ module Vagrant
|
|
46
46
|
options[:skip_image_cleanup] = true
|
47
47
|
end
|
48
48
|
|
49
|
-
o.on("-c","--report-coverage", String, "Generate code coverage report
|
49
|
+
o.on("-c","--report-coverage", String, "Generate code coverage report") do |f|
|
50
50
|
options[:report_coverage] = true
|
51
51
|
end
|
52
52
|
end
|
@@ -30,7 +30,10 @@ module Vagrant
|
|
30
30
|
options = {}
|
31
31
|
options[:image] = nil
|
32
32
|
options[:ref] = 'master'
|
33
|
+
options[:image_version] = ""
|
33
34
|
options[:source] = nil
|
35
|
+
options[:base_images] = false
|
36
|
+
options[:registry] = ""
|
34
37
|
|
35
38
|
opts = OptionParser.new do |o|
|
36
39
|
o.banner = "Usage: vagrant test-openshift3-image --image IMAGE [vm-name]"
|
@@ -44,9 +47,23 @@ module Vagrant
|
|
44
47
|
options[:ref] = o
|
45
48
|
end
|
46
49
|
|
50
|
+
o.on("-m", "--image_version VERSION", String, "version of the software") do |o|
|
51
|
+
options[:image_version] = o
|
52
|
+
end
|
53
|
+
|
47
54
|
o.on("-s", "--source SOURCE", String, "git repo source url") do |o|
|
48
55
|
options[:source] = o
|
49
56
|
end
|
57
|
+
|
58
|
+
o.on("-b", "--base_images", "flag whether the base images have to be pre-pulled") do
|
59
|
+
options[:base_images] = true
|
60
|
+
end
|
61
|
+
|
62
|
+
# FIXME: This is a temporary fix as the RHEL7 AMI should have this
|
63
|
+
# registry here already.
|
64
|
+
o.on("--registry [url]", String, "Docker Registry to push images to.") do |o|
|
65
|
+
options[:registry] = o
|
66
|
+
end
|
50
67
|
end
|
51
68
|
|
52
69
|
# Parse the options
|
@@ -59,23 +76,37 @@ module Vagrant
|
|
59
76
|
end
|
60
77
|
|
61
78
|
if options[:source].nil?
|
62
|
-
|
79
|
+
@env.ui.warn "You must specify git repo source url"
|
80
|
+
exit
|
63
81
|
end
|
64
82
|
|
83
|
+
options[:source] = "https://github.com/#{options[:source]}"
|
84
|
+
|
65
85
|
with_target_vms(argv, :reverse => true) do |machine|
|
66
86
|
image = options[:image]
|
67
87
|
ref = options[:ref]
|
88
|
+
image_version = options[:image_version]
|
68
89
|
source = options[:source]
|
90
|
+
base_images = options[:base_images]
|
91
|
+
registry = options[:registry]
|
69
92
|
|
70
|
-
# image could be centos or openshift/ruby-20-
|
71
|
-
# just grab the end (centos or ruby-20-
|
72
|
-
source_dir = File.basename(
|
93
|
+
# image could be centos or openshift/ruby-20-centos7
|
94
|
+
# just grab the end (centos or ruby-20-centos7)
|
95
|
+
source_dir = File.basename(source)
|
73
96
|
app_name = "test-#{source_dir}"
|
74
97
|
rc=1
|
75
98
|
begin
|
76
99
|
out, err, rc = do_execute(machine, %{
|
77
100
|
set -x
|
78
101
|
|
102
|
+
# NOTE: This is only for rhel7
|
103
|
+
if [ -n "#{registry}" -a -f /etc/sysconfig/docker ]; then
|
104
|
+
cat <<EOF > /etc/sysconfig/docker
|
105
|
+
OPTIONS='--insecure-registry #{registry} --selinux-enabled -H fd://'
|
106
|
+
EOF
|
107
|
+
systemctl restart docker
|
108
|
+
fi
|
109
|
+
|
79
110
|
# so we can call sti
|
80
111
|
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
|
81
112
|
|
@@ -91,33 +122,57 @@ cd $temp_dir
|
|
91
122
|
git clone #{source}
|
92
123
|
cd #{source_dir}
|
93
124
|
|
125
|
+
# Fetch refs from Github pull requests
|
126
|
+
git fetch --quiet --tags --progress #{source} +refs/pull/*:refs/remotes/origin/pr/*
|
127
|
+
|
94
128
|
# switch to the desired ref
|
95
129
|
git checkout #{ref}
|
96
130
|
|
97
|
-
#
|
98
|
-
|
131
|
+
if [ "#{base_images}" == "true" -a -n "#{registry}" ]; then
|
132
|
+
# Pull base images
|
133
|
+
docker pull #{registry}/openshift/base-centos7 && docker tag #{registry}/openshift/base-centos7 openshift/base-centos7
|
134
|
+
docker pull #{registry}/openshift/base-rhel7 && docker tag #{registry}/openshift/base-rhel7 openshift/base-rhel7
|
135
|
+
fi
|
136
|
+
|
137
|
+
if [ -n "#{image_version}" ]; then
|
138
|
+
BASE_NAME="#{image}-#{image_version}"
|
139
|
+
pushd #{image_version} > /dev/null
|
140
|
+
else
|
141
|
+
BASE_NAME="#{image}"
|
142
|
+
fi
|
143
|
+
|
144
|
+
IMAGE_NAME="${BASE_NAME}-centos7"
|
99
145
|
|
100
|
-
# Build the STI image we use for testing
|
101
|
-
docker build -t
|
146
|
+
# Build the CentOS7 STI image we use for testing
|
147
|
+
docker build -t ${IMAGE_NAME}-candidate .
|
102
148
|
status=$?
|
103
149
|
|
104
150
|
# Run the STI image test framework
|
105
151
|
if [ $status -eq 0 ]; then
|
106
|
-
IMAGE_NAME
|
152
|
+
IMAGE_NAME=${IMAGE_NAME}-candidate ./test/run
|
107
153
|
status=$?
|
108
154
|
fi
|
109
155
|
|
110
|
-
if [ $status -eq 0 ]; then
|
111
|
-
|
112
|
-
|
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"
|
113
161
|
|
114
|
-
#
|
115
|
-
docker
|
162
|
+
# Build the RHEL7 based STI image we use for testing
|
163
|
+
docker build -t ${IMAGE_NAME}-candidate .
|
164
|
+
status=$?
|
116
165
|
|
117
|
-
#
|
118
|
-
|
166
|
+
# Run the STI image test framework
|
167
|
+
if [ $status -eq 0 -a -f Dockerfile.rhel7 ]; then
|
168
|
+
IMAGE_NAME=${IMAGE_NAME}-candidate ./test/run
|
169
|
+
status=$?
|
170
|
+
fi
|
119
171
|
fi
|
120
172
|
|
173
|
+
# If software version is set, go back to the repository root
|
174
|
+
[ -n "#{image_version}" ] && popd > /dev/null
|
175
|
+
|
121
176
|
# clean up
|
122
177
|
cd /
|
123
178
|
rm -rf $temp_dir
|
@@ -27,22 +27,18 @@ module Vagrant
|
|
27
27
|
{
|
28
28
|
'origin' => 'https://github.com/openshift/origin.git',
|
29
29
|
'source-to-image' => 'https://github.com/openshift/source-to-image.git'
|
30
|
-
}
|
30
|
+
}
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.openshift3_images
|
34
34
|
{
|
35
|
-
'
|
36
|
-
'ruby-20
|
35
|
+
'openshift/base' => 'https://github.com/openshift/sti-base.git',
|
36
|
+
'openshift/ruby-20' => 'https://github.com/openshift/sti-ruby.git',
|
37
|
+
'openshift/nodejs-010' => 'https://github.com/openshift/sti-nodejs.git',
|
38
|
+
'openshift/mysql-55' => 'https://github.com/openshift/mysql.git',
|
37
39
|
}
|
38
40
|
end
|
39
41
|
|
40
|
-
def self.images
|
41
|
-
[
|
42
|
-
'centos'
|
43
|
-
] + openshift3_images.map { |c, _| "openshift/#{c}" }
|
44
|
-
end
|
45
|
-
|
46
42
|
def self.git_branch_current
|
47
43
|
"$(git rev-parse --abbrev-ref HEAD)"
|
48
44
|
end
|
@@ -77,6 +77,11 @@ module Vagrant
|
|
77
77
|
Commands::BuildOpenshift3BaseImages
|
78
78
|
end
|
79
79
|
|
80
|
+
command "push-openshift3-images" do
|
81
|
+
require_relative "command/push_openshift3_images"
|
82
|
+
Commands::PushOpenshift3Images
|
83
|
+
end
|
84
|
+
|
80
85
|
command "origin-init" do
|
81
86
|
require_relative "command/openshift_init"
|
82
87
|
Commands::OpenshiftInit
|
@@ -132,6 +137,11 @@ module Vagrant
|
|
132
137
|
Commands::TestOpenshift3Image
|
133
138
|
end
|
134
139
|
|
140
|
+
command "install-openshift3-router" do
|
141
|
+
require_relative "command/install_openshift3_router"
|
142
|
+
Commands::InstallOpenshift3Router
|
143
|
+
end
|
144
|
+
|
135
145
|
provisioner(:openshift) do
|
136
146
|
require_relative "provisioner"
|
137
147
|
Provisioner
|
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: 1.0.
|
4
|
+
version: 1.0.18
|
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-
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -140,20 +140,22 @@ files:
|
|
140
140
|
- lib/vagrant-openshift/action/install_openshift3_base_dependencies.rb
|
141
141
|
- lib/vagrant-openshift/action/install_openshift3_images.rb
|
142
142
|
- lib/vagrant-openshift/action/install_openshift3_rhel7.rb
|
143
|
+
- lib/vagrant-openshift/action/install_openshift3_router.rb
|
143
144
|
- lib/vagrant-openshift/action/local_openshift3_checkout.rb
|
144
145
|
- lib/vagrant-openshift/action/modify_ami.rb
|
145
146
|
- lib/vagrant-openshift/action/modify_instance.rb
|
146
147
|
- lib/vagrant-openshift/action/prepare_ssh_config.rb
|
148
|
+
- lib/vagrant-openshift/action/push_openshift3_images.rb
|
147
149
|
- lib/vagrant-openshift/action/push_openshift3_release.rb
|
148
150
|
- lib/vagrant-openshift/action/run_openshift3_tests.rb
|
149
151
|
- lib/vagrant-openshift/action/run_sti_tests.rb
|
152
|
+
- lib/vagrant-openshift/action/run_systemctl.rb
|
150
153
|
- lib/vagrant-openshift/action/set_host_name.rb
|
151
154
|
- lib/vagrant-openshift/action/setup_bind_dns_key.rb
|
152
155
|
- lib/vagrant-openshift/action/setup_bind_host.rb
|
153
156
|
- lib/vagrant-openshift/action/sync_local_repository.rb
|
154
157
|
- lib/vagrant-openshift/action/sync_upstream_repository.rb
|
155
158
|
- lib/vagrant-openshift/action/test_exit_code.rb
|
156
|
-
- lib/vagrant-openshift/action/try_restart_openshift3.rb
|
157
159
|
- lib/vagrant-openshift/action/yum_update.rb
|
158
160
|
- lib/vagrant-openshift/command/build_openshift3.rb
|
159
161
|
- lib/vagrant-openshift/command/build_openshift3_base.rb
|
@@ -164,10 +166,12 @@ files:
|
|
164
166
|
- lib/vagrant-openshift/command/create_ami.rb
|
165
167
|
- lib/vagrant-openshift/command/install_openshift3.rb
|
166
168
|
- lib/vagrant-openshift/command/install_openshift3_assets_base.rb
|
169
|
+
- lib/vagrant-openshift/command/install_openshift3_router.rb
|
167
170
|
- lib/vagrant-openshift/command/local_openshift3_setup.rb
|
168
171
|
- lib/vagrant-openshift/command/modify_ami.rb
|
169
172
|
- lib/vagrant-openshift/command/modify_instance.rb
|
170
173
|
- lib/vagrant-openshift/command/openshift_init.rb
|
174
|
+
- lib/vagrant-openshift/command/push_openshift3_images.rb
|
171
175
|
- lib/vagrant-openshift/command/push_openshift3_release.rb
|
172
176
|
- lib/vagrant-openshift/command/repo_sync_openshift3.rb
|
173
177
|
- lib/vagrant-openshift/command/repo_sync_sti.rb
|