vagrant-proxyconf 2.0.4 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +12 -7
- data/CHANGELOG.md +155 -0
- data/Gemfile +1 -18
- data/Jenkinsfile +60 -0
- data/Makefile +33 -0
- data/README.md +22 -0
- data/deps/patches/lib/vagrant/bundler.rb.patch +14 -0
- data/jenkins/helper_functions +206 -0
- data/lib/vagrant-proxyconf/action/base.rb +20 -9
- data/lib/vagrant-proxyconf/action/configure_docker_proxy.rb +21 -23
- data/lib/vagrant-proxyconf/config/apt_proxy.rb +21 -2
- data/lib/vagrant-proxyconf/version.rb +1 -1
- data/spec/unit/support/shared/apt_proxy_config.rb +12 -0
- data/spec/unit/vagrant-proxyconf/action/configure_docker_proxy_spec.rb +44 -37
- data/spec/unit/vagrant-proxyconf/action/configure_svn_proxy_spec.rb +1 -0
- data/test/issues/172/README.md +2 -2
- data/test/issues/172/spec/docker_host/redhat_spec.rb +2 -2
- data/test/issues/180/spec/docker_host/redhat_spec.rb +2 -2
- data/test/issues/192/.rspec +2 -0
- data/test/issues/192/Dockerfile +47 -0
- data/test/issues/192/Dockerfile.bionic +40 -0
- data/test/issues/192/README.md +29 -0
- data/test/issues/192/Rakefile +27 -0
- data/test/issues/192/Vagrantfile +64 -0
- data/test/issues/192/entrypoint.sh +50 -0
- data/test/issues/192/spec/default/redhat_spec.rb +15 -0
- data/test/issues/192/spec/docker_host/ubuntu_spec.rb +3 -0
- data/test/issues/192/spec/spec_helper.rb +52 -0
- data/test/issues/192/tinyproxy.conf +333 -0
- data/test/issues/199/.rspec +2 -0
- data/test/issues/199/Dockerfile +47 -0
- data/test/issues/199/README.md +31 -0
- data/test/issues/199/Rakefile +27 -0
- data/test/issues/199/Vagrantfile +74 -0
- data/test/issues/199/entrypoint.sh +50 -0
- data/test/issues/199/spec/apt_host/ubuntu_spec.rb +135 -0
- data/test/issues/199/spec/default/redhat_spec.rb +15 -0
- data/test/issues/199/spec/spec_helper.rb +52 -0
- data/test/issues/199/tinyproxy.conf +333 -0
- data/test/issues/218/.rspec +2 -0
- data/test/issues/218/Dockerfile +47 -0
- data/test/issues/218/README.md +35 -0
- data/test/issues/218/Rakefile +27 -0
- data/test/issues/218/Vagrantfile +62 -0
- data/test/issues/218/entrypoint.sh +50 -0
- data/test/issues/218/force-all-outbound-traffic-through-proxy.iptables +18 -0
- data/test/issues/218/spec/default/redhat_spec.rb +16 -0
- data/test/issues/218/spec/docker_host/redhat_spec.rb +171 -0
- data/test/issues/218/spec/spec_helper.rb +43 -0
- data/test/issues/218/tinyproxy.conf +333 -0
- metadata +71 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6d2ed9c11cdc9cd9649a6dab1f4916430deffd34d7beef9f60ec1d997d8248ba
|
4
|
+
data.tar.gz: 44b631d6aee2ad96dcb2acceb25ac5eb11ec948830d8003f24be2182f047ea83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76a5f3c7cd26ea510166d5757f3aa30f09befda31820fd0f1af02ff339964148314fcd8d686bf11cb8ee99b7ab4a49b2b7f7e1adde062766b9006e655f0130f0
|
7
|
+
data.tar.gz: c9e333a2a6f9306e71d0e7d2f5e2ef196cb4d8adde2864cb4d5bc8da54df348fddc21899291d176a7e28bb184094453da6759f4252e672b412dd9c7eac659a21
|
data/.travis.yml
CHANGED
@@ -1,24 +1,29 @@
|
|
1
|
+
---
|
2
|
+
|
1
3
|
language: ruby
|
2
4
|
cache: bundler
|
3
5
|
sudo: false
|
4
6
|
|
5
7
|
before_install: ./travis/before_install
|
8
|
+
install: make
|
9
|
+
script: bundle exec rspec
|
6
10
|
bundler_args: --without=development
|
7
11
|
|
8
12
|
env:
|
9
13
|
global:
|
10
14
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
11
15
|
|
12
|
-
rvm:
|
16
|
+
rvm:
|
17
|
+
- 2.6.6
|
18
|
+
|
13
19
|
matrix:
|
14
20
|
include:
|
21
|
+
- env: VAGRANT_VERSION=v2.2.9
|
22
|
+
- env: VAGRANT_VERSION=v2.2.8
|
23
|
+
- env: VAGRANT_VERSION=v2.2.7
|
24
|
+
- env: VAGRANT_VERSION=v2.2.6
|
25
|
+
- env: VAGRANT_VERSION=v2.2.5
|
15
26
|
- env: VAGRANT_VERSION=v2.2.4
|
16
|
-
- env: VAGRANT_VERSION=v2.2.3
|
17
|
-
- env: VAGRANT_VERSION=v2.2.2
|
18
|
-
- env: VAGRANT_VERSION=v2.1.5
|
19
|
-
- env: VAGRANT_VERSION=v2.0.4
|
20
|
-
- env: VAGRANT_VERSION=v1.9.8
|
21
|
-
rvm: 2.3.4
|
22
27
|
- env: VAGRANT_VERSION=master
|
23
28
|
allow_failures:
|
24
29
|
- env: VAGRANT_VERSION=master
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,158 @@
|
|
1
|
+
# 2.0.10 / 2020-07-03
|
2
|
+
|
3
|
+
This is a bug fix release when provisioning docker hosts inside of
|
4
|
+
vagrant. This version removes the hard coded DOCKER_CONFIG environment
|
5
|
+
variable in /etc/environment and hard codes the client config to
|
6
|
+
/home/vagrant/.docker/config.json. This is a temporary work around until
|
7
|
+
the this can be refactored.
|
8
|
+
|
9
|
+
Existing values in /home/vagrant/.docker/config.json should be preserved
|
10
|
+
and merged when the vagrant-proxy conf is being provisioned.
|
11
|
+
|
12
|
+
#### Closed Issues
|
13
|
+
|
14
|
+
- [Respect Existing Docker Config Location #218](https://github.com/tmatilai/vagrant-proxyconf/issues/218)
|
15
|
+
|
16
|
+
|
17
|
+
# 2.0.9 / Not released
|
18
|
+
|
19
|
+
A release tagging error caused this release to become a draft release
|
20
|
+
and this will be re-released as 2.0.10.
|
21
|
+
|
22
|
+
|
23
|
+
# 2.0.8 / 2020-06-10
|
24
|
+
|
25
|
+
This is a bug fix release for windows users which fixes a bug with the
|
26
|
+
tempfile creation when uploading and downloading files from the vagrant
|
27
|
+
machine.
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
#### Closed Issues
|
32
|
+
|
33
|
+
- [tempfile implementation on windows doesn't always seem to work
|
34
|
+
#220](https://github.com/tmatilai/vagrant-proxyconf/issues/220)
|
35
|
+
|
36
|
+
#### Credits
|
37
|
+
|
38
|
+
Big thanks to @chucknelson for debugging and troubleshooting and getting
|
39
|
+
to the bottom of this for windows users. Thank you!
|
40
|
+
|
41
|
+
- @chucknelson
|
42
|
+
|
43
|
+
# 2.0.7 / 2019-11-14
|
44
|
+
|
45
|
+
This is a bug fix release.
|
46
|
+
|
47
|
+
- Addresses issues with docker proxy configuration and permissions.
|
48
|
+
|
49
|
+
#### Closed Issues
|
50
|
+
|
51
|
+
- https://github.com/tmatilai/vagrant-proxyconf/milestone/3
|
52
|
+
|
53
|
+
|
54
|
+
#### Credits
|
55
|
+
|
56
|
+
Thank you to these folks how identified the bugs and provided
|
57
|
+
workarounds.
|
58
|
+
|
59
|
+
- @antoinetran
|
60
|
+
- @tkang007
|
61
|
+
|
62
|
+
|
63
|
+
# 2.0.6 / 2019-08-09
|
64
|
+
|
65
|
+
This is a bug fix release addressing a permissions problem with the docker proxy client config.
|
66
|
+
The fixes the permissions problem setting /etc/docker/config.json from 0600 to 0644 permissions.
|
67
|
+
|
68
|
+
#### Credits
|
69
|
+
|
70
|
+
- Credit to this release goes to @takuto-h.
|
71
|
+
|
72
|
+
# 2.0.5 / 2019-07-27
|
73
|
+
|
74
|
+
#### Deprecations:
|
75
|
+
|
76
|
+
- Dropped support for vagrant 1.9.8 due to our tests failinging and it's more than 2 years old.
|
77
|
+
|
78
|
+
#### Credits
|
79
|
+
|
80
|
+
- Credit to this release goes to @greut. Thank you for your detailed information and for reporting a solution.
|
81
|
+
|
82
|
+
This is a feature enhancement for the APT proxy configuration when using
|
83
|
+
a proxy that is terminating SSL. By default, these settings are left
|
84
|
+
as-is and only enabled when a user wants to configure these settings.
|
85
|
+
This feature supports enabling/disabling the follwoing settings
|
86
|
+
|
87
|
+
#### file `/etc/apt/apt.conf.d/01proxy`
|
88
|
+
|
89
|
+
```
|
90
|
+
Acquire::https::Verify-Host
|
91
|
+
Acquire::https::Verify-Peer
|
92
|
+
```
|
93
|
+
|
94
|
+
#### Configuration settings for `Acquire::https::Verify-Host` and `Acquire::https::Verify-Peer`
|
95
|
+
|
96
|
+
* The value for these settings must be a string.
|
97
|
+
* When `"true"` enable the setting
|
98
|
+
* When `"false"` disable the setting
|
99
|
+
* When `""` this setting is removed.
|
100
|
+
|
101
|
+
#### Example Inside the Vagrantfile
|
102
|
+
|
103
|
+
```
|
104
|
+
Vagrant.configure("2") do |config|
|
105
|
+
|
106
|
+
config.vm.define 'apt_host' do |c|
|
107
|
+
c.vm.box = "bento/ubuntu-18.04"
|
108
|
+
|
109
|
+
if Vagrant.has_plugin?('vagrant-proxyconf')
|
110
|
+
c.proxy.http = ENV['HTTP_PROXY']
|
111
|
+
c.proxy.https = ENV['HTTPS_PROXY']
|
112
|
+
c.proxy.no_proxy = ENV['NO_PROXY']
|
113
|
+
c.apt_proxy.verify_host = "false"
|
114
|
+
c.apt_proxy.verify_peer = "false"
|
115
|
+
|
116
|
+
c.proxy.enabled = {
|
117
|
+
:apt => {
|
118
|
+
:enabled => true,
|
119
|
+
:skip => false,
|
120
|
+
},
|
121
|
+
:env => {
|
122
|
+
:enabled => true,
|
123
|
+
:skip => false,
|
124
|
+
},
|
125
|
+
:git => {
|
126
|
+
:enabled => true,
|
127
|
+
:skip => false,
|
128
|
+
}
|
129
|
+
}
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
```
|
135
|
+
|
136
|
+
#### Example setting the environment variables
|
137
|
+
|
138
|
+
```
|
139
|
+
export VAGRANT_APT_VERIFY_HOST="false"
|
140
|
+
export VAGRANT_APT_VERIFY_PEER="false"
|
141
|
+
vagrant up
|
142
|
+
vagrant provision
|
143
|
+
```
|
144
|
+
|
145
|
+
**NOTE** If you change a setting in your `Vagrantfile` and the box is
|
146
|
+
running, you can run `vagrant provision` or `vagrant reload` to adjust
|
147
|
+
the settings.
|
148
|
+
|
149
|
+
Supporting Issues:
|
150
|
+
- https://github.com/tmatilai/vagrant-proxyconf/issues/199
|
151
|
+
|
152
|
+
Supporting Integration Tests:
|
153
|
+
- Look at the examples in directory [199](test/issues/199/)
|
154
|
+
|
155
|
+
|
1
156
|
# 2.0.4 / 2019-07-24
|
2
157
|
|
3
158
|
This is a bug fix release to address a logic issue for supporting docker
|
data/Gemfile
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
#### Added due to https://groups.google.com/forum/#!topic/vagrant-up/J8J6LmhzBqM/discussion
|
4
|
-
embedded_locations = %w(/Applications/Vagrant/embedded /opt/vagrant/embedded)
|
5
|
-
|
6
|
-
embedded_locations.each do |p|
|
7
|
-
ENV['VAGRANT_INSTALLER_EMBEDDED_DIR'] = p if File.directory?(p)
|
8
|
-
end
|
9
|
-
|
10
|
-
unless ENV.key?('VAGRANT_INSTALLER_EMBEDDED_DIR')
|
11
|
-
$stderr.puts "Couldn't find a packaged install of vagrant, and we need this"
|
12
|
-
$stderr.puts 'in order to make use of the RubyEncoder libraries.'
|
13
|
-
$stderr.puts 'I looked in:'
|
14
|
-
embedded_locations.each do |p|
|
15
|
-
$stderr.puts " #{p}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
#### End Added due to https://groups.google.com/forum/#!topic/vagrant-up/J8J6LmhzBqM/discussion
|
19
|
-
|
20
3
|
gem 'vagrant',
|
21
4
|
git: 'https://github.com/hashicorp/vagrant.git',
|
22
|
-
|
5
|
+
tag: ENV.fetch('VAGRANT_VERSION', 'v2.2.9')
|
23
6
|
|
24
7
|
gem 'rake'
|
25
8
|
gem 'rspec', '~> 3.1'
|
data/Jenkinsfile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
pipeline {
|
2
|
+
|
3
|
+
agent { label 'virtualbox' }
|
4
|
+
|
5
|
+
options {
|
6
|
+
disableConcurrentBuilds()
|
7
|
+
}
|
8
|
+
|
9
|
+
parameters {
|
10
|
+
|
11
|
+
string(
|
12
|
+
name: 'VAGRANT_TEST_ISSUE',
|
13
|
+
defaultValue: '180',
|
14
|
+
description: 'The test/issues/# where "#" refers to the test environment to invoke'
|
15
|
+
)
|
16
|
+
|
17
|
+
string(
|
18
|
+
name: 'DEFAULT_RVM_RUBY',
|
19
|
+
defaultValue: '2.4.4',
|
20
|
+
description: 'The default ruby to use for RVM'
|
21
|
+
)
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
stages {
|
26
|
+
|
27
|
+
stage('test') {
|
28
|
+
|
29
|
+
environment {
|
30
|
+
VAGRANT_TEST_ISSUE = "${params.VAGRANT_TEST_ISSUE}"
|
31
|
+
DEFAULT_RVM_RUBY = "${params.DEFAULT_RVM_RUBY}"
|
32
|
+
}
|
33
|
+
|
34
|
+
steps {
|
35
|
+
timestamps {
|
36
|
+
ansiColor('xterm') {
|
37
|
+
|
38
|
+
dir("${WORKSPACE}") {
|
39
|
+
|
40
|
+
sh '''#!/usr/bin/env bash -l
|
41
|
+
|
42
|
+
set +x
|
43
|
+
tty
|
44
|
+
. jenkins/helper_functions
|
45
|
+
|
46
|
+
setup_test_env
|
47
|
+
|
48
|
+
set -e
|
49
|
+
run_all_tests
|
50
|
+
|
51
|
+
'''
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
} // stages
|
59
|
+
|
60
|
+
}
|
data/Makefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
.PHONY: clean
|
2
|
+
.PHONY: help
|
3
|
+
.PHONY: init
|
4
|
+
.PHONY: patch_bundler
|
5
|
+
|
6
|
+
|
7
|
+
all: clean init patch_bundler
|
8
|
+
|
9
|
+
|
10
|
+
clean:
|
11
|
+
rm -f Gemfile.lock
|
12
|
+
rm -rf .bundle/
|
13
|
+
|
14
|
+
|
15
|
+
help:
|
16
|
+
@echo "[Commands]"
|
17
|
+
@echo ""
|
18
|
+
@echo " all -> The default which runs all tasks"
|
19
|
+
@echo " clean -> Deletes Gemfile.lock and .bundle/"
|
20
|
+
@echo " init -> Creates the bundle for developing the next release"
|
21
|
+
@echo " patch_bundler -> Attemps to patch vagrant bundler with known issues"
|
22
|
+
@echo ""
|
23
|
+
|
24
|
+
init: clean
|
25
|
+
bundle config set path '.bundle/gems'
|
26
|
+
bundle install
|
27
|
+
|
28
|
+
|
29
|
+
patch_bundler:
|
30
|
+
[ "$(VAGRANT_VERSION)" == "v2.2.5" ] && (patch -p0 --batch --backup -d "`bundle info --path vagrant`" < deps/patches/lib/vagrant/bundler.rb.patch) || true
|
31
|
+
[ "$(VAGRANT_VERSION)" == "v2.2.6" ] && (patch -p0 --batch --backup -d "`bundle info --path vagrant`" < deps/patches/lib/vagrant/bundler.rb.patch) || true
|
32
|
+
[ "$(VAGRANT_VERSION)" == "v2.2.7" ] && (patch -p0 --batch --backup -d "`bundle info --path vagrant`" < deps/patches/lib/vagrant/bundler.rb.patch) || true
|
33
|
+
[ "$(VAGRANT_VERSION)" == "v2.2.8" ] && (egrep -q 'cap/redhat' `bundle info --path vagrant`/plugins/provisioners/docker/plugin.rb && sed -i.bak -e 's/redhat/centos/g' `bundle info --path vagrant`/plugins/provisioners/docker/plugin.rb) || true
|
data/README.md
CHANGED
@@ -237,6 +237,8 @@ VAGRANT_APT_HTTP_PROXY="http://proxy.example.com:8080" vagrant up
|
|
237
237
|
| apt | `VAGRANT_APT_HTTP_PROXY` | Configures APT http proxy | Highest |
|
238
238
|
| | `VAGRANT_APT_HTTPS_PROXY` | Configures APT https proxy | Highest |
|
239
239
|
| | `VAGRANT_APT_FTP_PROXY` | Configures APT ftp proxy | Highest |
|
240
|
+
| | `VAGRANT_APT_VERIFY_PEER` | Configures APT Verify-Peer | Highest |
|
241
|
+
| | `VAGRANT_APT_VERIFY_HOST` | Configures APT Verify-Host | Highest |
|
240
242
|
| chef | `VAGRANT_CHEF_HTTP_PROXY` | Configures CHEF http proxy | Highest |
|
241
243
|
| | `VAGRANT_CHEF_HTTPS_PROXY` | Configures CHEF https proxy | Highest |
|
242
244
|
| | `VAGRANT_CHEF_NO_PROXY` | Configures CHEF no proxy | Highest |
|
@@ -330,3 +332,23 @@ unless ENV.key?('VAGRANT_INSTALLER_EMBEDDED_DIR')
|
|
330
332
|
end
|
331
333
|
end
|
332
334
|
```
|
335
|
+
|
336
|
+
# Contributors
|
337
|
+
|
338
|
+
* @tmatilai
|
339
|
+
* @otahi
|
340
|
+
* @jperville
|
341
|
+
* @johnbellone
|
342
|
+
* @SaschaGuenther
|
343
|
+
* @mrsheepuk
|
344
|
+
* @vboerchers
|
345
|
+
* @rlaveycal
|
346
|
+
* @pomeh
|
347
|
+
* @mynamewastaken
|
348
|
+
* @lawsonj2019
|
349
|
+
* @jonekdahl
|
350
|
+
* @hexmode
|
351
|
+
* @craigmunro
|
352
|
+
* @greut
|
353
|
+
* @chucknelson
|
354
|
+
* @codylane
|
@@ -0,0 +1,14 @@
|
|
1
|
+
--- lib/vagrant/bundler.rb 2020-04-27 14:19:39.000000000 -0600
|
2
|
+
+++ lib/vagrant/bundler.rb 2020-04-27 14:20:01.000000000 -0600
|
3
|
+
@@ -421,8 +421,9 @@
|
4
|
+
def vagrant_internal_specs
|
5
|
+
# activate any dependencies up front so we can always
|
6
|
+
# pin them when resolving
|
7
|
+
- Gem::Specification.find { |s| s.name == "vagrant" && s.activated? }.
|
8
|
+
- runtime_dependencies.each { |d| gem d.name, *d.requirement.as_list }
|
9
|
+
+ if (vs = Gem::Specification.find { |s| s.name == "vagrant" && s.activated? })
|
10
|
+
+ vs.runtime_dependencies.each { |d| gem d.name, *d.requirement.as_list }
|
11
|
+
+ end
|
12
|
+
# discover all the gems we have available
|
13
|
+
list = {}
|
14
|
+
directories = [Gem::Specification.default_specifications_dir]
|
@@ -0,0 +1,206 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
DEFAULT_RVM_RUBY="${DEFAULT_RVM_RUBY:-2.4.4}"
|
4
|
+
|
5
|
+
RVM_HOME_DIR="${RVM_HOME_DIR:-${HOME}/.rvm/scripts/rvm}"
|
6
|
+
|
7
|
+
VAGRANT_TEST_ISSUE="${VAGRANT_TEST_ISSUE:-180}"
|
8
|
+
|
9
|
+
err() {
|
10
|
+
|
11
|
+
echo "ERR: $* exiting" >&2
|
12
|
+
|
13
|
+
reset_docker_perms || true
|
14
|
+
|
15
|
+
exit 1
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
bundle_exec() {
|
21
|
+
|
22
|
+
local run_dir="test/issues/${VAGRANT_TEST_ISSUE}"
|
23
|
+
|
24
|
+
pushd "${run_dir}" || err "The directory: '${run_dir}' does not exist" && true
|
25
|
+
|
26
|
+
bundle exec $@
|
27
|
+
|
28
|
+
popd >>/dev/null 2>&1
|
29
|
+
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
enable_rvm_ruby() {
|
34
|
+
|
35
|
+
local ruby_version="${1:-${DEFAULT_RVM_RUBY}}"
|
36
|
+
|
37
|
+
shift
|
38
|
+
local persist="${1:-persist}"
|
39
|
+
|
40
|
+
|
41
|
+
[ -f "${RVM_HOME_DIR}" ] && . "${RVM_HOME_DIR}" >> /dev/null || true
|
42
|
+
|
43
|
+
rvm use "ruby-${ruby_version}" || err "Unable to switch to ruby ${ruby_version}"
|
44
|
+
|
45
|
+
[ -z "${persist}" ] || echo "${DEFAULT_RVM_RUBY}" > .ruby-version
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
enable_rbenv_ruby() {
|
51
|
+
|
52
|
+
local ruby_version="${1:-${DEFAULT_RVM_RUBY}}"
|
53
|
+
|
54
|
+
shift
|
55
|
+
local persist="${1:-persist}"
|
56
|
+
|
57
|
+
eval "$(rbenv init -)"
|
58
|
+
|
59
|
+
rbenv_install "${DEFAULT_RVM_RUBY}"
|
60
|
+
|
61
|
+
if [ -n "${persist}" ]; then
|
62
|
+
|
63
|
+
echo "${DEFAULT_RVM_RUBY}" > .ruby-version
|
64
|
+
|
65
|
+
rbenv shell "${DEFAULT_RVM_RUBY}"
|
66
|
+
|
67
|
+
fi
|
68
|
+
|
69
|
+
rbenv versions
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
rbenv_install() {
|
74
|
+
|
75
|
+
rbenv versions | grep -q "${1}" || rbenv install "${1}"
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
vagrant_cmd() {
|
80
|
+
|
81
|
+
bundle_exec vagrant $@
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
install_gems() {
|
87
|
+
|
88
|
+
command -v bundle >>/dev/null 2>&1 || gem install bundler --no-doc
|
89
|
+
command -v rake >>/dev/null 2>&1 || gem install rake --no-doc
|
90
|
+
|
91
|
+
gem update --system --no-doc || err "Updating system gems"
|
92
|
+
|
93
|
+
rm -f Gemfile.lock
|
94
|
+
bundle install --path .bundle/gems
|
95
|
+
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
install_from_gemfile() {
|
100
|
+
|
101
|
+
[ -d ".bundle/gems" ] || install_gems
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
run_all_tests() {
|
107
|
+
|
108
|
+
set -e
|
109
|
+
|
110
|
+
vagrant_cmd status
|
111
|
+
bundle_exec rake spec
|
112
|
+
|
113
|
+
set +e
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
setup_test_env() {
|
119
|
+
|
120
|
+
set -e
|
121
|
+
|
122
|
+
whoami
|
123
|
+
env
|
124
|
+
|
125
|
+
ruby -v
|
126
|
+
gem list
|
127
|
+
|
128
|
+
install_from_gemfile
|
129
|
+
|
130
|
+
bundle show
|
131
|
+
|
132
|
+
update_docker_perms
|
133
|
+
|
134
|
+
vagrant_cmd plugin repair || true
|
135
|
+
vagrant_cmd status
|
136
|
+
vagrant_cmd up || err "Starting the virtual machine"
|
137
|
+
vagrant_cmd provision || err "Attempting to provision the virtual machine"
|
138
|
+
|
139
|
+
reset_docker_perms
|
140
|
+
|
141
|
+
set +e
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
reset_docker_perms() {
|
147
|
+
|
148
|
+
[ -L /var/run/docker.sock ] && sudo chmod 0770 "$(readlink /var/run/docker.sock)" || true
|
149
|
+
|
150
|
+
}
|
151
|
+
|
152
|
+
update_docker_perms() {
|
153
|
+
|
154
|
+
[ -L /var/run/docker.sock ] && sudo chmod 6770 "$(readlink /var/run/docker.sock)" || true
|
155
|
+
|
156
|
+
}
|
157
|
+
|
158
|
+
|
159
|
+
is_container_running() {
|
160
|
+
|
161
|
+
CONTAINER_ID=$(docker ps -a | grep ':8888' | awk '{print $1}')
|
162
|
+
|
163
|
+
[ -z "${CONTAINER_ID}" ] && return 0
|
164
|
+
|
165
|
+
echo "${CONTAINER_ID}"
|
166
|
+
return 1
|
167
|
+
|
168
|
+
}
|
169
|
+
|
170
|
+
|
171
|
+
initialize() {
|
172
|
+
reset_docker_perms
|
173
|
+
|
174
|
+
OS_TYPE="$(uname -s 2>>/dev/null)"
|
175
|
+
|
176
|
+
case "${OS_TYPE}" in
|
177
|
+
|
178
|
+
Darwin)
|
179
|
+
HOME_DIR_PREFIX="/Users"
|
180
|
+
;;
|
181
|
+
|
182
|
+
*)
|
183
|
+
HOME_DIR_PREFIX="/home"
|
184
|
+
;;
|
185
|
+
|
186
|
+
esac
|
187
|
+
|
188
|
+
[ -f ${HOME_DIR_PREFIX}/jenkins/.bash_profile ] && . ${HOME_DIR_PREFIX}/jenkins/.bash_profile || true
|
189
|
+
[ -f ${HOME_DIR_PREFIX}/jenkins/.bashrc ] && . ${HOME_DIR_PREFIX}/jenkins/.bashrc || true
|
190
|
+
|
191
|
+
command -v rvm >>/dev/null 2>&1 && enable_rvm_ruby "${DEFAULT_RVM_RUBY}" "persist" || true
|
192
|
+
command -v rbenv >>/dev/null 2>&1 && enable_rbenv_ruby "${DEFAULT_RVM_RUBY}" "persist" || true
|
193
|
+
|
194
|
+
command -v docker || err "Docker must be installed on this host."
|
195
|
+
command -v bsdtar || err "Please install bsdtar"
|
196
|
+
|
197
|
+
id
|
198
|
+
groups
|
199
|
+
|
200
|
+
CONTAINER_ID=$(is_container_running)
|
201
|
+
[ $? -ne 0 ] && docker rm -vf "${CONTAINER_ID}"
|
202
|
+
|
203
|
+
reset_docker_perms
|
204
|
+
}
|
205
|
+
|
206
|
+
initialize
|