vagrant-openshift 2.0.9 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.asciidoc +8 -4
- data/lib/vagrant-openshift/action.rb +3 -3
- data/lib/vagrant-openshift/action/install_openshift.rb +1 -1
- data/lib/vagrant-openshift/action/install_openshift_asset_dependencies.rb +30 -7
- data/lib/vagrant-openshift/action/install_openshift_base_dependencies.rb +12 -5
- data/lib/vagrant-openshift/action/push_openshift_images.rb +36 -43
- data/lib/vagrant-openshift/command/push_openshift_images.rb +4 -1
- data/lib/vagrant-openshift/constants.rb +0 -24
- data/lib/vagrant-openshift/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae6afb23aff38bb9c5e56876934f390f424b6120
|
4
|
+
data.tar.gz: 9d63ba4a151d314534c8a4eb9025fba51be2e281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be084f3f1c4dd7a4fb8af5419212e997efd55def06b483ba00fa8195d6ccf97fa392b82c9acd7a95869f2e9d8987b9232373f9b50a8858ab54465ed28b660472
|
7
|
+
data.tar.gz: 24752536ba60a84328c38554ff1c87d60d5f7eb100e8b2fcea4662f66db66f3a58b8ae34d4d6ad61e5d2b04d6e445c3d062dbbd6526328b2f4a1f5db4bcd06e5
|
data/README.asciidoc
CHANGED
@@ -215,16 +215,20 @@ Install plugin from rubygems:
|
|
215
215
|
$ vagrant plugin install vagrant-openstack-plugin
|
216
216
|
----
|
217
217
|
|
218
|
+
NOTE: On some systems (e.g. mac) doing `export NOKOGIRI_USE_SYSTEM_LIBRARIES=1` can help make the above command work.
|
219
|
+
|
218
220
|
* Edit `~/.openstackcred` and update your OpenStack credentials, endpoint and tenant name.
|
219
221
|
|
220
222
|
.'~/.openstackcred'
|
221
223
|
----
|
222
|
-
OSEndpoint=<OpenStack Endpoint URL>
|
224
|
+
OSEndpoint=<OpenStack Endpoint URL, e.g. http://openshift.example.com:5000/v2.0/tokens>
|
223
225
|
OSUsername=<OpenStack Username>
|
224
226
|
OSAPIKey=<OpenStack Password>
|
225
|
-
OSKeyPairName=<Keypair name>
|
226
|
-
OSPrivateKeyPath=<SSH Private key
|
227
|
-
OSTenant=<OpenStack Tenant Name>
|
227
|
+
OSKeyPairName=<Keypair name as registered in OpenStack>
|
228
|
+
OSPrivateKeyPath=<path to that SSH Private key>
|
229
|
+
OSTenant=<OpenStack Tenant/Project Name, see it at the top in OpenStack web UI>
|
230
|
+
OSFloatingIP=<specific floating ip or ':auto' if floating ip is desired>
|
231
|
+
OSFloatingIPPool=<specific pool or 'false' (to use first found) if floating ip is desired>
|
228
232
|
----
|
229
233
|
|
230
234
|
* Edit `.vagrant-openshift.json` and update the openstack provider
|
@@ -42,13 +42,13 @@ module Vagrant
|
|
42
42
|
b.use SetHostName
|
43
43
|
b.use InstallOpenshift
|
44
44
|
b.use InstallOpenshiftRhel7
|
45
|
-
b.use InstallOpenshiftAssetDependencies
|
45
|
+
b.use InstallOpenshiftAssetDependencies, :restore_assets => true
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
def self.install_openshift_assets_base(options)
|
50
50
|
Vagrant::Action::Builder.new.tap do |b|
|
51
|
-
b.use InstallOpenshiftAssetDependencies
|
51
|
+
b.use InstallOpenshiftAssetDependencies, :backup_assets => true
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -92,7 +92,7 @@ module Vagrant
|
|
92
92
|
end
|
93
93
|
b.use SyncLocalRepository
|
94
94
|
b.use CheckoutRepositories
|
95
|
-
b.use InstallOpenshiftAssetDependencies
|
95
|
+
b.use InstallOpenshiftAssetDependencies, :restore_assets => true
|
96
96
|
end
|
97
97
|
if options[:build]
|
98
98
|
b.use(BuildOpenshiftBaseImages, options) if options[:images]
|
@@ -84,7 +84,7 @@ 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/
|
87
|
+
ExecStart=$ORIGIN_PATH/_output/local/bin/linux/amd64/openshift start --cors-allowed-origins=.* --public-master=https://\\${HOST}:8443
|
88
88
|
LimitNOFILE=4096
|
89
89
|
|
90
90
|
[Install]
|
@@ -20,29 +20,52 @@ module Vagrant
|
|
20
20
|
class InstallOpenshiftAssetDependencies
|
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.clone
|
26
27
|
end
|
27
28
|
|
28
29
|
def call(env)
|
29
30
|
ssh_user = env[:machine].ssh_info[:username]
|
30
|
-
|
31
|
+
cmd = %{
|
31
32
|
|
32
33
|
ORIGIN_PATH=/data/src/github.com/openshift/origin
|
33
|
-
|
34
|
-
if ! which bundler > /dev/null 2>&1 ; then
|
35
|
-
gem install bundler
|
36
|
-
fi
|
34
|
+
ASSET_BACKUP_DIR=/data/asset_dependencies
|
37
35
|
|
38
36
|
if ! which npm > /dev/null 2>&1 ; then
|
39
37
|
sudo yum -y install npm
|
40
38
|
fi
|
41
39
|
|
40
|
+
}
|
41
|
+
if @options[:restore_assets]
|
42
|
+
cmd += %{
|
43
|
+
# make sure the dirs always exist
|
44
|
+
mkdir -p /data/asset_dependencies/node_modules
|
45
|
+
mkdir -p /data/asset_dependencies/bower_components
|
46
|
+
# copy them to the assets dir
|
47
|
+
cp -rf $ASSET_BACKUP_DIR/node_modules $ORIGIN_PATH/assets/node_modules
|
48
|
+
cp -rf $ASSET_BACKUP_DIR/bower_components $ORIGIN_PATH/assets/bower_components
|
49
|
+
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
cmd += %{
|
42
54
|
pushd $ORIGIN_PATH
|
43
55
|
hack/install-assets.sh
|
44
56
|
popd
|
45
|
-
|
57
|
+
|
58
|
+
}
|
59
|
+
|
60
|
+
if @options[:backup_assets]
|
61
|
+
cmd += %{
|
62
|
+
mkdir -p $ASSET_BACKUP_DIR
|
63
|
+
cp -rf $ORIGIN_PATH/assets/node_modules $ASSET_BACKUP_DIR/node_modules
|
64
|
+
cp -rf $ORIGIN_PATH/assets/bower_components $ASSET_BACKUP_DIR/bower_components
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
do_execute(env[:machine], cmd, {:timeout=>60*20})
|
46
69
|
@app.call(env)
|
47
70
|
end
|
48
71
|
end
|
@@ -42,7 +42,7 @@ fi
|
|
42
42
|
# FIXME: Move 'openshift/centos-mongodb' into openshift org and then
|
43
43
|
# add the image into 'repositories' constants
|
44
44
|
#
|
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 unzip Xvfb", {:timeout=>60*20})
|
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 unzip Xvfb ethtool", {:timeout=>60*20})
|
46
46
|
sudo(env[:machine], "yum install -y facter", {fail_on_error: false, :timeout=>60*10})
|
47
47
|
|
48
48
|
# Install Chrome and chromedriver for headless UI testing
|
@@ -102,13 +102,20 @@ mkdir -p /data/bin
|
|
102
102
|
GO_VERSION=($(go version))
|
103
103
|
echo "Detected go version: $(go version)"
|
104
104
|
|
105
|
+
# TODO: Remove for go1.5, go vet and go cover will be internal
|
105
106
|
if [[ ${GO_VERSION[2]} == "go1.4"* ]]; then
|
106
107
|
GOPATH=/data go get golang.org/x/tools/cmd/cover
|
107
|
-
else
|
108
|
-
GOPATH=/data go get code.google.com/p/go.tools/cmd/cover
|
109
|
-
fi
|
110
108
|
|
111
|
-
GOPATH=/data go get golang.org/x/tools/cmd/vet
|
109
|
+
GOPATH=/data go get golang.org/x/tools/cmd/vet
|
110
|
+
|
111
|
+
# Check out a stable commit for go vet in order to version lock it to something we can work with
|
112
|
+
pushd /data/src/golang.org/x/tools >/dev/null 2>&1
|
113
|
+
git checkout c262de870b618eed648983aa994b03bc04641c72
|
114
|
+
popd >/dev/null 2>&1
|
115
|
+
|
116
|
+
# Re-install using this version of the tool
|
117
|
+
GOPATH=/data go install golang.org/x/tools/cmd/vet
|
118
|
+
fi
|
112
119
|
|
113
120
|
chown -R #{ssh_user}:#{ssh_user} /data
|
114
121
|
|
@@ -38,35 +38,29 @@ sudo systemctl restart docker
|
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
-
def push_image(image_name, git_ref, registry)
|
41
|
+
def push_image(centos_namespace,rhel_namespace,image_name, git_ref, registry)
|
42
|
+
|
42
43
|
%{
|
43
44
|
set -e
|
44
45
|
pushd /tmp/images/#{image_name}
|
45
46
|
git checkout #{git_ref}
|
46
47
|
git_ref=$(git rev-parse --short HEAD)
|
47
|
-
echo "Pushing image #{image_name}
|
48
|
-
|
49
|
-
docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:$git_ref
|
50
|
-
docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:latest
|
51
|
-
docker tag -f #{image_name}-centos7 docker.io/#{image_name}-centos7:latest
|
52
|
-
docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:$git_ref
|
53
|
-
docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:latest
|
48
|
+
echo "Pushing image #{image_name}:#{git_ref}..."
|
54
49
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
docker tag -f #{centos_namespace}/#{image_name}-centos7 #{registry}#{centos_namespace}/#{image_name}-centos7:#{git_ref}
|
51
|
+
docker tag -f #{centos_namespace}/#{image_name}-centos7 #{registry}#{centos_namespace}/#{image_name}-centos7:latest
|
52
|
+
docker tag -f #{centos_namespace}/#{image_name}-centos7 docker.io/#{centos_namespace}/#{image_name}-centos7:latest
|
53
|
+
docker tag -f #{rhel_namespace}/#{image_name}-rhel7 #{registry}#{rhel_namespace}/#{image_name}-rhel7:#{git_ref}
|
54
|
+
docker tag -f #{rhel_namespace}/#{image_name}-rhel7 #{registry}#{rhel_namespace}/#{image_name}-rhel7:latest
|
60
55
|
|
61
56
|
# We can't fully parallelize this because docker fails when you push to the same repo at the
|
62
57
|
# same time (using different tags), so we do two groups of push operations.
|
63
|
-
|
64
58
|
# this one is failing in parallel for unknown reasons
|
65
|
-
docker push -f #{registry}#{image_name}-rhel7
|
59
|
+
docker push -f #{registry}#{rhel_namespace}/#{image_name}-rhel7:#{git_ref}
|
66
60
|
|
67
|
-
procs[0]="docker push -f #{registry}#{image_name}-centos7
|
68
|
-
procs[1]="docker push -f docker.io/#{image_name}-centos7:latest"
|
69
|
-
#procs[2]="docker push -f #{registry}#{image_name}-rhel7
|
61
|
+
procs[0]="docker push -f #{registry}#{centos_namespace}/#{image_name}-centos7:#{git_ref}"
|
62
|
+
procs[1]="docker push -f docker.io/#{centos_namespace}/#{image_name}-centos7:latest"
|
63
|
+
#procs[2]="docker push -f #{registry}#{rhel_namespace}/#{image_name}-rhel7:#{git_ref}"
|
70
64
|
|
71
65
|
# Run pushes in parallel
|
72
66
|
for i in {0..1}; do
|
@@ -82,8 +76,8 @@ for pid in ${pids[*]}; do
|
|
82
76
|
wait $pid
|
83
77
|
done
|
84
78
|
|
85
|
-
procs[0]="docker push -f #{registry}#{image_name}-centos7:latest"
|
86
|
-
procs[1]="docker push -f #{registry}#{image_name}-rhel7:latest"
|
79
|
+
procs[0]="docker push -f #{registry}#{centos_namespace}/#{image_name}-centos7:latest"
|
80
|
+
procs[1]="docker push -f #{registry}#{rhel_namespace}/#{image_name}-rhel7:latest"
|
87
81
|
|
88
82
|
# Run pushes in parallel
|
89
83
|
for i in {0..1}; do
|
@@ -125,20 +119,14 @@ set +e
|
|
125
119
|
}
|
126
120
|
end
|
127
121
|
|
128
|
-
def
|
122
|
+
def check_latest_image_cmd(registry,namespace,name,git_url)
|
129
123
|
cmd = %{
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
git_ref=$(git ls-remote #{git_url} -h refs/heads/master | cut -c1-7)
|
136
|
-
curl -s http://#{registry}v1/repositories/#{name}-rhel7/tags/${git_ref} | grep -q "error"
|
137
|
-
if [[ "$?" != "0" ]]; then
|
138
|
-
echo "#{name};$git_ref" >> ~/latest_images
|
139
|
-
fi
|
124
|
+
git_ref=$(git ls-remote #{git_url} -h refs/heads/master | cut -c1-7)
|
125
|
+
curl -s http://#{registry}v1/repositories/#{namespace}/#{name}-rhel7/tags/${git_ref} | grep -q "error"
|
126
|
+
if [[ "$?" != "0" ]]; then
|
127
|
+
echo "#{name};$git_ref" >> ~/latest_images
|
128
|
+
fi
|
140
129
|
}
|
141
|
-
end
|
142
130
|
return cmd
|
143
131
|
end
|
144
132
|
|
@@ -159,33 +147,38 @@ docker pull #{@options[:registry]}openshift/base-rhel7
|
|
159
147
|
}
|
160
148
|
|
161
149
|
cmd += %{
|
162
|
-
# so we can call
|
150
|
+
# so we can call s2i
|
163
151
|
export 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
|
164
152
|
}
|
165
153
|
|
166
154
|
# FIXME: We always need to make sure we have the latest base image
|
167
155
|
# FIXME: This is because the internal registry is pruned once per month
|
168
|
-
if !@options[:build_images].include?("
|
169
|
-
@options[:build_images] = "openshift/base
|
156
|
+
if !@options[:build_images].include?("base")
|
157
|
+
@options[:build_images] = "openshift;openshift;base;1;https://github.com/openshift/sti-base;master,#{@options[:build_images]}"
|
170
158
|
end
|
171
159
|
|
172
160
|
build_images = @options[:build_images].split(",").map { |i| i.strip }
|
173
161
|
|
174
162
|
push_cmd = ""
|
163
|
+
update_cmd=""
|
175
164
|
build_images.each do |image|
|
176
|
-
name, version, git_ref = image.split('
|
177
|
-
repo_url = Vagrant::Openshift::Constants.openshift_images[name]
|
178
|
-
if repo_url == nil
|
179
|
-
puts "Unregistered image: #{name}, skipping"
|
180
|
-
next
|
181
|
-
end
|
165
|
+
centos_namespace,rhel_namespace,name, version, repo_url, git_ref = image.split(';')
|
182
166
|
cmd += build_image(name, version, git_ref, repo_url)
|
183
|
-
push_cmd += push_image(name, git_ref, @options[:registry])
|
167
|
+
push_cmd += push_image(centos_namespace,rhel_namespace,name, git_ref, @options[:registry])
|
184
168
|
end
|
185
169
|
|
186
170
|
# Push the final images **only** when they all build successfully
|
187
171
|
cmd += push_cmd
|
188
|
-
|
172
|
+
|
173
|
+
cmd += %{
|
174
|
+
set +e
|
175
|
+
rm -rf ~/latest_images ; touch ~/latest_images
|
176
|
+
}
|
177
|
+
check_images = @options[:check_images].split(",").map { |i| i.strip }
|
178
|
+
check_images.each do |image|
|
179
|
+
centos_namespace,rhel_namespace,name, version, repo_url, git_ref = image.split(';')
|
180
|
+
cmd+= check_latest_image_cmd(@options[:registry],rhel_namespace,name,repo_url)
|
181
|
+
end
|
189
182
|
|
190
183
|
do_execute(env[:machine], cmd)
|
191
184
|
|
@@ -35,9 +35,12 @@ module Vagrant
|
|
35
35
|
o.on("--registry [url]", String, "Docker Registry to push images to.") do |c|
|
36
36
|
options[:registry] = c
|
37
37
|
end
|
38
|
-
o.on("--build_images [list]", String, "List of IMAGE
|
38
|
+
o.on("--build_images [list]", String, "List of CENTOS_NAMESPACE;RHEL_NAMESPACE;IMAGE;VERSION;GIT_REPO;REF pairs, delimited by ','") do |i|
|
39
39
|
options[:build_images] = i
|
40
40
|
end
|
41
|
+
o.on("--check_images [list]", String, "List of CENTOS_NAMESPACE;RHEL_NAMESPACE;IMAGE;VERSION;GIT_REPO;REF pairs, delimited by ','") do |ci|
|
42
|
+
options[:check_images] = ci
|
43
|
+
end
|
41
44
|
o.separator ""
|
42
45
|
end
|
43
46
|
|
@@ -30,30 +30,6 @@ module Vagrant
|
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.openshift_images
|
34
|
-
{
|
35
|
-
'openshift/base' => 'https://github.com/openshift/sti-base.git',
|
36
|
-
'openshift/jenkins-1' => 'https://github.com/openshift/jenkins.git',
|
37
|
-
'openshift/nodejs-010' => 'https://github.com/openshift/sti-nodejs.git',
|
38
|
-
'openshift/openldap-2441' => 'https://github.com/openshift/openldap.git',
|
39
|
-
'openshift/perl-516' => 'https://github.com/openshift/sti-perl.git',
|
40
|
-
'openshift/perl-520' => 'https://github.com/openshift/sti-perl.git',
|
41
|
-
'openshift/php-55' => 'https://github.com/openshift/sti-php.git',
|
42
|
-
'openshift/php-56' => 'https://github.com/openshift/sti-php.git',
|
43
|
-
'openshift/python-27' => 'https://github.com/openshift/sti-python.git',
|
44
|
-
'openshift/python-33' => 'https://github.com/openshift/sti-python.git',
|
45
|
-
'openshift/python-34' => 'https://github.com/openshift/sti-python.git',
|
46
|
-
'openshift/ruby-20' => 'https://github.com/openshift/sti-ruby.git',
|
47
|
-
'openshift/ruby-22' => 'https://github.com/openshift/sti-ruby.git',
|
48
|
-
'openshift/mysql-55' => 'https://github.com/openshift/mysql.git',
|
49
|
-
'openshift/mysql-56' => 'https://github.com/openshift/mysql.git',
|
50
|
-
'openshift/mongodb-24' => 'https://github.com/openshift/mongodb.git',
|
51
|
-
'rhscl/mongodb-26' => 'https://github.com/openshift/mongodb.git',
|
52
|
-
'openshift/postgresql-92' => 'https://github.com/openshift/postgresql.git',
|
53
|
-
'openshift/wildfly-81' => 'https://github.com/openshift/sti-wildfly.git'
|
54
|
-
}
|
55
|
-
end
|
56
|
-
|
57
33
|
def self.git_branch_current
|
58
34
|
"$(git rev-parse --abbrev-ref HEAD)"
|
59
35
|
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.
|
4
|
+
version: 2.0.10
|
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-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|