vagrant-proxyconf 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -1
- data/CHANGELOG.md +19 -1
- data/Gemfile +1 -1
- data/Jenkinsfile +60 -0
- data/jenkins/helper_functions +206 -0
- data/lib/vagrant-proxyconf/action/configure_docker_proxy.rb +4 -3
- data/lib/vagrant-proxyconf/version.rb +1 -1
- data/spec/unit/vagrant-proxyconf/action/configure_docker_proxy_spec.rb +4 -3
- data/test/issues/180/spec/docker_host/redhat_spec.rb +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09ccd0a2a51d1de18dc63c8355c6f6d4217faf1d31b470a0de6348c514a5c621'
|
4
|
+
data.tar.gz: 6384262695d6fffd759de258efb6c70ddd52a434fb1ead968ea0f0f8aa225ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df0979eae22816e8a23ebddaf8e0874d0e6b5b8a9ae79e66499cb4bc418e47c300483dd1dc889e6324c7169636d4c4b2cffcfbc67c17e21170b3b178654211ce
|
7
|
+
data.tar.gz: ad5f86225dd89c3ce59c2fb50f72b10375e53f1b630de6e28ae53b3f4677507f26114ee991e467408b3c0cc612297cd87284400b2e7cdf50fdcc6007baf21658
|
data/.travis.yml
CHANGED
@@ -1,15 +1,21 @@
|
|
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: bundle install --path .bundle/gems
|
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.4.4
|
18
|
+
|
13
19
|
matrix:
|
14
20
|
include:
|
15
21
|
- env: VAGRANT_VERSION=v2.2.4
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,22 @@
|
|
1
|
-
# 2.0.7 /
|
1
|
+
# 2.0.7 / 2019-11-14
|
2
|
+
|
3
|
+
This is a bug fix release.
|
4
|
+
|
5
|
+
- Addresses issues with docker proxy configuration and permissions.
|
6
|
+
|
7
|
+
#### Closed Issues
|
8
|
+
|
9
|
+
- https://github.com/tmatilai/vagrant-proxyconf/milestone/3
|
10
|
+
|
11
|
+
|
12
|
+
#### Credits
|
13
|
+
|
14
|
+
Thank you to these folks how identified the bugs and provided
|
15
|
+
workarounds.
|
16
|
+
|
17
|
+
- @antoinetran
|
18
|
+
- @tkang007
|
19
|
+
|
2
20
|
|
3
21
|
# 2.0.6 / 2019-08-09
|
4
22
|
|
data/Gemfile
CHANGED
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
|
+
}
|
@@ -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
|
@@ -97,9 +97,9 @@ module VagrantPlugins
|
|
97
97
|
@machine.communicate.tap do |comm|
|
98
98
|
comm.upload(@docker_client_config_path.path, "/tmp/vagrant-proxyconf-docker-config.json")
|
99
99
|
comm.sudo("mkdir -p /etc/docker")
|
100
|
-
comm.sudo("chown root:
|
100
|
+
comm.sudo("chown root:docker /etc/docker")
|
101
101
|
comm.sudo("mv /tmp/vagrant-proxyconf-docker-config.json /etc/docker/config.json")
|
102
|
-
comm.sudo("chown root:
|
102
|
+
comm.sudo("chown root:docker /etc/docker/config.json")
|
103
103
|
comm.sudo("chmod 0644 /etc/docker/config.json")
|
104
104
|
comm.sudo("rm -f /tmp/vagrant-proxyconf-docker-config.json")
|
105
105
|
|
@@ -155,6 +155,7 @@ module VagrantPlugins
|
|
155
155
|
end
|
156
156
|
|
157
157
|
comm.sudo('chown -R 0:0 /etc/systemd/system/docker.service.d/')
|
158
|
+
comm.sudo('touch /etc/systemd/system/docker.service.d/http-proxy.conf')
|
158
159
|
comm.sudo('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
|
159
160
|
|
160
161
|
if changed
|
@@ -236,7 +237,7 @@ module VagrantPlugins
|
|
236
237
|
|
237
238
|
# update config and restart docker when config changed
|
238
239
|
comm.sudo("chmod 0644 #{path}.new")
|
239
|
-
comm.sudo("chown root:
|
240
|
+
comm.sudo("chown root:docker #{path}.new")
|
240
241
|
comm.sudo("mv -f #{path}.new #{path}")
|
241
242
|
comm.sudo(service_restart_command)
|
242
243
|
end
|
@@ -10,7 +10,7 @@ def mock_write_docker_config(machine)
|
|
10
10
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("cat /tmp/vagrant-proxyconf >> /etc/default/docker.new")
|
11
11
|
allow(machine).to receive_message_chain(:communicate, :test).with("diff /etc/default/docker.new /etc/default/docker")
|
12
12
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /etc/default/docker.new")
|
13
|
-
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:
|
13
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/default/docker.new")
|
14
14
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mv -f /etc/default/docker.new /etc/default/docker")
|
15
15
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("kill -HUP `pgrep -f 'docker'` || systemctl restart docker || service docker restart || /etc/init.d/docker restart")
|
16
16
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf /etc/default/docker.new")
|
@@ -19,13 +19,13 @@ end
|
|
19
19
|
def mock_update_docker_client_config(machine)
|
20
20
|
allow(machine).to receive_message_chain(:communicate, :upload)
|
21
21
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mv /tmp/vagrant-proxyconf-docker-config.json /etc/docker/config.json")
|
22
|
-
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:
|
22
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker/config.json")
|
23
23
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /etc/docker/config.json")
|
24
24
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf-docker-config.json")
|
25
25
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("sed -i.bak -e '/^DOCKER_CONFIG/d' /etc/environment")
|
26
26
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("echo DOCKER_CONFIG=/etc/docker >> /etc/environment")
|
27
27
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/docker")
|
28
|
-
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:
|
28
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker")
|
29
29
|
end
|
30
30
|
|
31
31
|
def mock_update_docker_systemd_config(machine)
|
@@ -164,6 +164,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
164
164
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/systemd/system/docker.service.d")
|
165
165
|
allow(machine).to receive_message_chain(:communicate, :upload).with(@docker_proxy.instance_variable_get(:@docker_systemd_config), "/tmp")
|
166
166
|
allow(machine).to receive_message_chain(:communicate, :sudo).with('chown -R 0:0 /etc/systemd/system/docker.service.d/')
|
167
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with('touch /etc/systemd/system/docker.service.d/http-proxy.conf')
|
167
168
|
allow(machine).to receive_message_chain(:communicate, :sudo).with('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
|
168
169
|
allow(machine).to receive_message_chain(:communicate, :test).with('command -v systemctl').and_return(false)
|
169
170
|
allow(machine).to receive_message_chain(:communicate, :test).with('diff -Naur /etc/systemd/system/docker.service.d/http-proxy.conf /tmp/vagrant-proxyconf-docker-systemd-config').and_return(false)
|
@@ -10,9 +10,9 @@ end
|
|
10
10
|
describe file('/etc/docker/config.json') do
|
11
11
|
it { should be_file }
|
12
12
|
it { should exist }
|
13
|
-
it { should be_mode
|
13
|
+
it { should be_mode 644 }
|
14
14
|
it { should be_owned_by "root" }
|
15
|
-
it { should be_grouped_into "
|
15
|
+
it { should be_grouped_into "docker" }
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'when proxy is enabled' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-proxyconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Teemu Matilainen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Vagrant plugin that configures the virtual machine to use proxy servers
|
14
14
|
email:
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- CHANGELOG.md
|
24
24
|
- Gemfile
|
25
25
|
- Guardfile
|
26
|
+
- Jenkinsfile
|
26
27
|
- LICENSE.txt
|
27
28
|
- README.md
|
28
29
|
- Rakefile
|
@@ -33,6 +34,7 @@ files:
|
|
33
34
|
- development/install-c7.sh
|
34
35
|
- development/install-debian.sh
|
35
36
|
- development/tinyproxy.conf
|
37
|
+
- jenkins/helper_functions
|
36
38
|
- lib/vagrant-proxyconf.rb
|
37
39
|
- lib/vagrant-proxyconf/action.rb
|
38
40
|
- lib/vagrant-proxyconf/action/base.rb
|
@@ -200,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
202
|
- !ruby/object:Gem::Version
|
201
203
|
version: '0'
|
202
204
|
requirements: []
|
203
|
-
rubygems_version: 3.0.
|
205
|
+
rubygems_version: 3.0.6
|
204
206
|
signing_key:
|
205
207
|
specification_version: 4
|
206
208
|
summary: A Vagrant plugin that configures the virtual machine to use proxy servers
|