vagrant-proxyconf 2.0.3 → 2.0.8
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 +141 -1
- 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 -21
- 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 +23 -21
- 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
- metadata +49 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d721ed3ca409df6422674ace6fe21eb4d061f2803ab1e3d3297f2a6443ca06b
|
4
|
+
data.tar.gz: ba5327b55dbda01b797803002c990b96a9905897ec9fa933f38dac8c9fd00341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4be0de47b43ad064279e9820e22de28a3ac55436635eb655dea3e407df08c71900569a565df930d090e4ebe8a887542feeeb4f1018881aae6e0166179882bb1
|
7
|
+
data.tar.gz: e259b6a96d86aca4fdebca70a029c918c574801569aee4acee0299908d7f2f34633627561e4b35d13f5b4af16e3d45c34025683523808dedcc09988bd827d881
|
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,4 +1,144 @@
|
|
1
|
-
# 2.0.
|
1
|
+
# 2.0.9 / not yet released
|
2
|
+
|
3
|
+
# 2.0.8 / 2020-06-10
|
4
|
+
|
5
|
+
This is a bug fix release for windows users which fixes a bug with the
|
6
|
+
tempfile creation when uploading and downloading files from the vagrant
|
7
|
+
machine.
|
8
|
+
|
9
|
+
#### Closed Issues
|
10
|
+
|
11
|
+
- [tempfile implementation on windows doesn't always seem to work
|
12
|
+
#220](https://github.com/tmatilai/vagrant-proxyconf/issues/220)
|
13
|
+
|
14
|
+
#### Credits
|
15
|
+
|
16
|
+
Big thanks to @chucknelson for debugging and troubleshooting and getting
|
17
|
+
to the bottom of this for windows users. Thank you!
|
18
|
+
|
19
|
+
- @chucknelson
|
20
|
+
|
21
|
+
# 2.0.7 / 2019-11-14
|
22
|
+
|
23
|
+
This is a bug fix release.
|
24
|
+
|
25
|
+
- Addresses issues with docker proxy configuration and permissions.
|
26
|
+
|
27
|
+
#### Closed Issues
|
28
|
+
|
29
|
+
- https://github.com/tmatilai/vagrant-proxyconf/milestone/3
|
30
|
+
|
31
|
+
|
32
|
+
#### Credits
|
33
|
+
|
34
|
+
Thank you to these folks how identified the bugs and provided
|
35
|
+
workarounds.
|
36
|
+
|
37
|
+
- @antoinetran
|
38
|
+
- @tkang007
|
39
|
+
|
40
|
+
|
41
|
+
# 2.0.6 / 2019-08-09
|
42
|
+
|
43
|
+
This is a bug fix release addressing a permissions problem with the docker proxy client config.
|
44
|
+
The fixes the permissions problem setting /etc/docker/config.json from 0600 to 0644 permissions.
|
45
|
+
|
46
|
+
#### Credits
|
47
|
+
|
48
|
+
- Credit to this release goes to @takuto-h.
|
49
|
+
|
50
|
+
# 2.0.5 / 2019-07-27
|
51
|
+
|
52
|
+
#### Deprecations:
|
53
|
+
|
54
|
+
- Dropped support for vagrant 1.9.8 due to our tests failinging and it's more than 2 years old.
|
55
|
+
|
56
|
+
#### Credits
|
57
|
+
|
58
|
+
- Credit to this release goes to @greut. Thank you for your detailed information and for reporting a solution.
|
59
|
+
|
60
|
+
This is a feature enhancement for the APT proxy configuration when using
|
61
|
+
a proxy that is terminating SSL. By default, these settings are left
|
62
|
+
as-is and only enabled when a user wants to configure these settings.
|
63
|
+
This feature supports enabling/disabling the follwoing settings
|
64
|
+
|
65
|
+
#### file `/etc/apt/apt.conf.d/01proxy`
|
66
|
+
|
67
|
+
```
|
68
|
+
Acquire::https::Verify-Host
|
69
|
+
Acquire::https::Verify-Peer
|
70
|
+
```
|
71
|
+
|
72
|
+
#### Configuration settings for `Acquire::https::Verify-Host` and `Acquire::https::Verify-Peer`
|
73
|
+
|
74
|
+
* The value for these settings must be a string.
|
75
|
+
* When `"true"` enable the setting
|
76
|
+
* When `"false"` disable the setting
|
77
|
+
* When `""` this setting is removed.
|
78
|
+
|
79
|
+
#### Example Inside the Vagrantfile
|
80
|
+
|
81
|
+
```
|
82
|
+
Vagrant.configure("2") do |config|
|
83
|
+
|
84
|
+
config.vm.define 'apt_host' do |c|
|
85
|
+
c.vm.box = "bento/ubuntu-18.04"
|
86
|
+
|
87
|
+
if Vagrant.has_plugin?('vagrant-proxyconf')
|
88
|
+
c.proxy.http = ENV['HTTP_PROXY']
|
89
|
+
c.proxy.https = ENV['HTTPS_PROXY']
|
90
|
+
c.proxy.no_proxy = ENV['NO_PROXY']
|
91
|
+
c.apt_proxy.verify_host = "false"
|
92
|
+
c.apt_proxy.verify_peer = "false"
|
93
|
+
|
94
|
+
c.proxy.enabled = {
|
95
|
+
:apt => {
|
96
|
+
:enabled => true,
|
97
|
+
:skip => false,
|
98
|
+
},
|
99
|
+
:env => {
|
100
|
+
:enabled => true,
|
101
|
+
:skip => false,
|
102
|
+
},
|
103
|
+
:git => {
|
104
|
+
:enabled => true,
|
105
|
+
:skip => false,
|
106
|
+
}
|
107
|
+
}
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
114
|
+
#### Example setting the environment variables
|
115
|
+
|
116
|
+
```
|
117
|
+
export VAGRANT_APT_VERIFY_HOST="false"
|
118
|
+
export VAGRANT_APT_VERIFY_PEER="false"
|
119
|
+
vagrant up
|
120
|
+
vagrant provision
|
121
|
+
```
|
122
|
+
|
123
|
+
**NOTE** If you change a setting in your `Vagrantfile` and the box is
|
124
|
+
running, you can run `vagrant provision` or `vagrant reload` to adjust
|
125
|
+
the settings.
|
126
|
+
|
127
|
+
Supporting Issues:
|
128
|
+
- https://github.com/tmatilai/vagrant-proxyconf/issues/199
|
129
|
+
|
130
|
+
Supporting Integration Tests:
|
131
|
+
- Look at the examples in directory [199](test/issues/199/)
|
132
|
+
|
133
|
+
|
134
|
+
# 2.0.4 / 2019-07-24
|
135
|
+
|
136
|
+
This is a bug fix release to address a logic issue for supporting docker
|
137
|
+
versions when attempting to configure a docker proxy.
|
138
|
+
|
139
|
+
|
140
|
+
Bug Fixes:
|
141
|
+
- https://github.com/tmatilai/vagrant-proxyconf/issues/197
|
2
142
|
|
3
143
|
# 2.0.3 / 2019-07-23
|
4
144
|
|
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
|