vagrant-proxyconf 2.0.2 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -3
  3. data/CHANGELOG.md +137 -1
  4. data/Gemfile +1 -1
  5. data/Jenkinsfile +60 -0
  6. data/README.md +21 -0
  7. data/jenkins/helper_functions +206 -0
  8. data/lib/vagrant-proxyconf/action.rb +5 -8
  9. data/lib/vagrant-proxyconf/action/base.rb +9 -5
  10. data/lib/vagrant-proxyconf/action/configure_docker_proxy.rb +9 -6
  11. data/lib/vagrant-proxyconf/config/apt_proxy.rb +21 -2
  12. data/lib/vagrant-proxyconf/version.rb +1 -1
  13. data/spec/unit/support/shared/apt_proxy_config.rb +12 -0
  14. data/spec/unit/vagrant-proxyconf/action/configure_docker_proxy_spec.rb +5 -3
  15. data/spec/unit/vagrant-proxyconf/action/configure_svn_proxy_spec.rb +1 -0
  16. data/test/issues/172/README.md +2 -2
  17. data/test/issues/172/Vagrantfile +3 -2
  18. data/test/issues/180/spec/docker_host/redhat_spec.rb +2 -2
  19. data/test/issues/192/.rspec +2 -0
  20. data/test/issues/192/Dockerfile +47 -0
  21. data/test/issues/192/Dockerfile.bionic +40 -0
  22. data/test/issues/192/README.md +29 -0
  23. data/test/issues/192/Rakefile +27 -0
  24. data/test/issues/192/Vagrantfile +64 -0
  25. data/test/issues/192/entrypoint.sh +50 -0
  26. data/test/issues/192/spec/default/redhat_spec.rb +15 -0
  27. data/test/issues/192/spec/docker_host/ubuntu_spec.rb +3 -0
  28. data/test/issues/192/spec/spec_helper.rb +52 -0
  29. data/test/issues/192/tinyproxy.conf +333 -0
  30. data/test/issues/199/.rspec +2 -0
  31. data/test/issues/199/Dockerfile +47 -0
  32. data/test/issues/199/README.md +31 -0
  33. data/test/issues/199/Rakefile +27 -0
  34. data/test/issues/199/Vagrantfile +74 -0
  35. data/test/issues/199/entrypoint.sh +50 -0
  36. data/test/issues/199/spec/apt_host/ubuntu_spec.rb +135 -0
  37. data/test/issues/199/spec/default/redhat_spec.rb +15 -0
  38. data/test/issues/199/spec/spec_helper.rb +52 -0
  39. data/test/issues/199/tinyproxy.conf +333 -0
  40. metadata +47 -4
@@ -33,14 +33,11 @@ module VagrantPlugins
33
33
  b.use Builtin::Call, IsEnabled do |env, b2|
34
34
  # next if !env[:result]
35
35
 
36
- # TODO: Do we really need to configure only specific proxies after the provisioner runs?
37
- # Shouldn't they already be configured by this point?
38
- # Cody Lane - Dec 2018
39
- # b2.use ConfigureDockerProxy
40
- # b2.use ConfigureGitProxy
41
- # b2.use ConfigureNpmProxy
42
- # b2.use ConfigurePearProxy
43
- # b2.use ConfigureSvnProxy
36
+ b2.use ConfigureDockerProxy
37
+ b2.use ConfigureGitProxy
38
+ b2.use ConfigureNpmProxy
39
+ b2.use ConfigurePearProxy
40
+ b2.use ConfigureSvnProxy
44
41
  end
45
42
  end
46
43
  end
@@ -87,13 +87,17 @@ module VagrantPlugins
87
87
  local_tmp = tempfile(config)
88
88
 
89
89
  logger.debug "Configuration (#{path}):\n#{config}"
90
+
90
91
  @machine.communicate.tap do |comm|
91
- comm.sudo("rm -f #{tmp}", error_check: false)
92
92
  comm.upload(local_tmp.path, tmp)
93
- comm.sudo("chmod #{opts[:mode] || '0644'} #{tmp}")
94
- comm.sudo("chown #{opts[:owner] || 'root:root'} #{tmp}")
95
- comm.sudo("mkdir -p #{File.dirname(path)}")
96
- comm.sudo("mv -f #{tmp} #{path}")
93
+ if comm.test("command -v sudo")
94
+ comm.sudo("chmod #{opts[:mode] || '0644'} #{tmp}")
95
+ comm.sudo("chown #{opts[:owner] || 'root:root'} #{tmp}")
96
+ comm.sudo("mkdir -p #{File.dirname(path)}")
97
+ comm.sudo("mv -f #{tmp} #{path}")
98
+ else
99
+ raise Vagrant::Errors::CommandUnavailable.new(file: "sudo")
100
+ end
97
101
  end
98
102
  end
99
103
 
@@ -97,9 +97,10 @@ 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:root /etc/docker")
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:root /etc/docker/config.json")
102
+ comm.sudo("chown root:docker /etc/docker/config.json")
103
+ comm.sudo("chmod 0644 /etc/docker/config.json")
103
104
  comm.sudo("rm -f /tmp/vagrant-proxyconf-docker-config.json")
104
105
 
105
106
  comm.sudo("sed -i.bak -e '/^DOCKER_CONFIG/d' /etc/environment")
@@ -154,6 +155,7 @@ module VagrantPlugins
154
155
  end
155
156
 
156
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')
157
159
  comm.sudo('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
158
160
 
159
161
  if changed
@@ -197,10 +199,11 @@ module VagrantPlugins
197
199
 
198
200
  # https://docs.docker.com/network/proxy/#configure-the-docker-client
199
201
  # if docker version >= 17.07 it supports config.json
200
- return true if major >= 17 && minor >= 7
201
-
202
202
  # docker version < 17.07 so it does not support config.json
203
- return false
203
+ return false if major <= 17 && minor < 7
204
+
205
+ # docker version must be >= 17.07 so we return true
206
+ return true
204
207
  end
205
208
 
206
209
  def supports_systemd?
@@ -234,7 +237,7 @@ module VagrantPlugins
234
237
 
235
238
  # update config and restart docker when config changed
236
239
  comm.sudo("chmod 0644 #{path}.new")
237
- comm.sudo("chown root:root #{path}.new")
240
+ comm.sudo("chown root:docker #{path}.new")
238
241
  comm.sudo("mv -f #{path}.new #{path}")
239
242
  comm.sudo(service_restart_command)
240
243
  end
@@ -20,6 +20,12 @@ module VagrantPlugins
20
20
  # @return [String] the FTP proxy
21
21
  key :ftp, env_var: 'VAGRANT_APT_FTP_PROXY'
22
22
 
23
+ # @return [String] whether APT should verify peer certificate
24
+ key :verify_peer, env_var: 'VAGRANT_APT_VERIFY_PEER'
25
+
26
+ # @return [String] whether APT should verify that certificate name matches server name
27
+ key :verify_host, env_var: 'VAGRANT_APT_VERIFY_HOST'
28
+
23
29
  def finalize!
24
30
  super
25
31
 
@@ -33,7 +39,15 @@ module VagrantPlugins
33
39
 
34
40
  # (see KeyMixin#config_for)
35
41
  def config_for(key, value)
36
- %Q{Acquire::#{key.name}::Proxy #{value.inspect};\n} if value
42
+ if value
43
+ if key.name == :verify_host
44
+ %Q{Acquire::https::Verify-Host #{value.inspect};\n}
45
+ elsif key.name == :verify_peer
46
+ %Q{Acquire::https::Verify-Peer #{value.inspect};\n}
47
+ else
48
+ %Q{Acquire::#{key.name}::Proxy #{value.inspect};\n}
49
+ end
50
+ end
37
51
  end
38
52
 
39
53
  def finalize_uri(key, value)
@@ -55,7 +69,8 @@ module VagrantPlugins
55
69
  end
56
70
 
57
71
  def to_s
58
- direct || "#{prefix}#{value}#{suffix}"
72
+ # direct || "#{prefix}#{value}#{suffix}"
73
+ direct || verify || "#{prefix}#{value}#{suffix}"
59
74
  end
60
75
 
61
76
  private
@@ -64,6 +79,10 @@ module VagrantPlugins
64
79
  'DIRECT' if value.upcase == 'DIRECT'
65
80
  end
66
81
 
82
+ def verify
83
+ value if ["true", "false"].to_set.include? value
84
+ end
85
+
67
86
  # Hash of deprecation warning sentinels
68
87
  @@warned = {}
69
88
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ProxyConf
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.7'
4
4
  end
5
5
  end
@@ -8,6 +8,10 @@ end
8
8
  def conf_line(proto, name, port = 3142)
9
9
  if name == :direct
10
10
  %Q{Acquire::#{proto}::Proxy "DIRECT";\n}
11
+ elsif proto == :verify_peer
12
+ %Q{Acquire::https::Verify-Peer "#{name}";\n}
13
+ elsif proto == :verify_host
14
+ %Q{Acquire::https::Verify-Host "#{name}";\n}
11
15
  else
12
16
  port = ":#{port}" if port
13
17
  %Q{Acquire::#{proto}::Proxy "#{proto}://#{name}#{port}";\n}
@@ -65,6 +69,14 @@ shared_examples "apt proxy config" do |proto|
65
69
  end
66
70
  end
67
71
 
72
+ [:verify_peer, :verify_host].each do |verify|
73
+ context "with #{verify.inspect}" do
74
+ subject { config_with(verify => "false") }
75
+ its(:enabled?) { should be_truthy }
76
+ its(:to_s) { should eq conf_line(verify, "false") }
77
+ end
78
+ end
79
+
68
80
  [false, ""].each do |unset|
69
81
  context "with #{unset.inspect}" do
70
82
  subject { config_with(proto => unset) }
@@ -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:root /etc/default/docker.new")
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,12 +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:root /etc/docker/config.json")
22
+ allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker/config.json")
23
+ allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /etc/docker/config.json")
23
24
  allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf-docker-config.json")
24
25
  allow(machine).to receive_message_chain(:communicate, :sudo).with("sed -i.bak -e '/^DOCKER_CONFIG/d' /etc/environment")
25
26
  allow(machine).to receive_message_chain(:communicate, :sudo).with("echo DOCKER_CONFIG=/etc/docker >> /etc/environment")
26
27
  allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/docker")
27
- allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:root /etc/docker")
28
+ allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker")
28
29
  end
29
30
 
30
31
  def mock_update_docker_systemd_config(machine)
@@ -163,6 +164,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
163
164
  allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/systemd/system/docker.service.d")
164
165
  allow(machine).to receive_message_chain(:communicate, :upload).with(@docker_proxy.instance_variable_get(:@docker_systemd_config), "/tmp")
165
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')
166
168
  allow(machine).to receive_message_chain(:communicate, :sudo).with('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
167
169
  allow(machine).to receive_message_chain(:communicate, :test).with('command -v systemctl').and_return(false)
168
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)
@@ -4,6 +4,7 @@ require 'vagrant-proxyconf/action/configure_svn_proxy'
4
4
  def mock_write_config(machine)
5
5
  allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf", error_check: false)
6
6
  allow(machine).to receive_message_chain(:communicate, :upload)
7
+ allow(machine).to receive_message_chain(:communicate, :test).with('command -v sudo').and_return(true)
7
8
  allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /tmp/vagrant-proxyconf")
8
9
  allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:root /tmp/vagrant-proxyconf")
9
10
  allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/subversion")
@@ -10,7 +10,7 @@ bundle exec vagrant up default
10
10
  ## Expect
11
11
 
12
12
 
13
- ### Box `default``
13
+ ### Box `default`
14
14
 
15
15
  - The box `default` is a docker container that will be a reverse
16
16
  proxy. It should provision itself and work without errors.
@@ -21,7 +21,7 @@ bundle exec vagrant up default
21
21
  - **NOTE**: You'll need to use `docker exec <hash> -it bash` to get into the container
22
22
 
23
23
 
24
- ### Box `docker-host`
24
+ ### Box `docker_host`
25
25
 
26
26
  - Vagrant should automatically instally docker-ce.
27
27
  - The box should come up and provision itself with the proxy settings
@@ -27,9 +27,10 @@ Vagrant.configure("2") do |config|
27
27
 
28
28
  c.vm.provider "docker" do |d|
29
29
  d.build_dir = "."
30
- d.expose = ["#{$PROXY_PORT}"]
31
30
  d.has_ssh = true
32
- d.ports = ["#{$PROXY_PORT}", "#{$PROXY_PORT}"].join(':')
31
+ d.ports = [
32
+ "#{$PROXY_PORT}:#{$PROXY_PORT}",
33
+ ]
33
34
  end
34
35
  end
35
36
 
@@ -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 600 }
13
+ it { should be_mode 644 }
14
14
  it { should be_owned_by "root" }
15
- it { should be_grouped_into "root" }
15
+ it { should be_grouped_into "docker" }
16
16
  end
17
17
 
18
18
  context 'when proxy is enabled' do
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,47 @@
1
+ FROM centos:7
2
+
3
+ ENV CI_USERNAME vagrant
4
+ ENV CI_PASSWORD vagrant
5
+ ENV CI_HOMEDIR /home/vagrant
6
+ ENV CI_SHELL /bin/bash
7
+
8
+ EXPOSE 8888
9
+
10
+ RUN yum clean all && \
11
+ yum makecache fast && \
12
+ yum -y install epel-release && \
13
+ yum clean expire-cache && \
14
+ yum -y install \
15
+ curl \
16
+ initscripts \
17
+ openssh-clients \
18
+ openssh-server \
19
+ sudo \
20
+ tinyproxy
21
+
22
+ RUN /usr/sbin/sshd-keygen && \
23
+ mkdir -p /var/run/sshd && \
24
+ rm -f /usr/lib/tmpfiles.d/systemd-nologin.conf
25
+
26
+ RUN if ! getent passwd $CI_USERNAME; then \
27
+ useradd -m -d ${CI_HOMEDIR} -s ${CI_SHELL} $CI_USERNAME; \
28
+ fi && \
29
+ echo "${CI_USERNAME}:${CI_PASSWORD}" | chpasswd && \
30
+ echo "${CI_USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
31
+ mkdir -p /etc/sudoers.d && \
32
+ echo "${CI_USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/${CI_USERNAME} && \
33
+ chmod 0440 /etc/sudoers.d/${CI_USERNAME} && \
34
+ mkdir -p ${CI_HOMEDIR}/.ssh && \
35
+ chown -R ${CI_USERNAME}:${CI_USERNAME} ${CI_HOMEDIR}/.ssh && \
36
+ chmod 0700 ${CI_HOMEDIR}/.ssh && \
37
+ curl -L https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub > ${CI_HOMEDIR}/.ssh/vagrant.pub && \
38
+ touch ${CI_HOMEDIR}/.ssh/authorized_keys && \
39
+ grep -q "$(cat ${CI_HOMEDIR}/.ssh/vagrant.pub | awk '{print $2}')" ${CI_HOMEDIR}/.ssh/authorized_keys || cat ${CI_HOMEDIR}/.ssh/vagrant.pub >> ${CI_HOMEDIR}/.ssh/authorized_keys && \
40
+ chown ${CI_USERNAME}:${CI_USERNAME} ${CI_HOMEDIR}/.ssh/authorized_keys && \
41
+ chmod 0600 ${CI_HOMEDIR}/.ssh/authorized_keys
42
+
43
+ COPY tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
44
+ COPY entrypoint.sh /entrypoint.sh
45
+
46
+ ENTRYPOINT ["/entrypoint.sh"]
47
+ CMD [ "start" ]
@@ -0,0 +1,40 @@
1
+ FROM ubuntu:bionic
2
+
3
+ ENV CI_USERNAME vagrant
4
+ ENV CI_PASSWORD vagrant
5
+ ENV CI_HOMEDIR /home/vagrant
6
+ ENV CI_SHELL /bin/bash
7
+
8
+ RUN apt-get -y update && \
9
+ mkdir -p /run/sshd && \
10
+ apt-get -y install \
11
+ apt-transport-https \
12
+ ca-certificates \
13
+ curl \
14
+ gnupg-agent \
15
+ openssh-client \
16
+ openssh-server \
17
+ software-properties-common \
18
+ sudo
19
+
20
+ RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
21
+ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
22
+ rm -f /usr/lib/tmpfiles.d/systemd-nologin.conf && \
23
+ if ! getent passwd $CI_USERNAME; then \
24
+ useradd -m -d ${CI_HOMEDIR} -s ${CI_SHELL} $CI_USERNAME; \
25
+ fi && \
26
+ echo "${CI_USERNAME}:${CI_PASSWORD}" | chpasswd && \
27
+ echo "${CI_USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
28
+ mkdir -p /etc/sudoers.d && \
29
+ echo "${CI_USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/${CI_USERNAME} && \
30
+ chmod 0440 /etc/sudoers.d/${CI_USERNAME} && \
31
+ mkdir -p ${CI_HOMEDIR}/.ssh && \
32
+ chown -R ${CI_USERNAME}:${CI_USERNAME} ${CI_HOMEDIR}/.ssh && \
33
+ chmod 0700 ${CI_HOMEDIR}/.ssh && \
34
+ curl -L https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub > ${CI_HOMEDIR}/.ssh/vagrant.pub && \
35
+ touch ${CI_HOMEDIR}/.ssh/authorized_keys && \
36
+ grep -q "$(cat ${CI_HOMEDIR}/.ssh/vagrant.pub | awk '{print $2}')" ${CI_HOMEDIR}/.ssh/authorized_keys || cat ${CI_HOMEDIR}/.ssh/vagrant.pub >> ${CI_HOMEDIR}/.ssh/authorized_keys && \
37
+ chown ${CI_USERNAME}:${CI_USERNAME} ${CI_HOMEDIR}/.ssh/authorized_keys && \
38
+ chmod 0600 ${CI_HOMEDIR}/.ssh/authorized_keys
39
+
40
+ CMD [ "/usr/sbin/sshd", "-D" ]
@@ -0,0 +1,29 @@
1
+ Tests
2
+ -----
3
+
4
+ If you are testing the current release of this plugin via bundler
5
+
6
+ ```
7
+ bundle exec vagrant up default
8
+ ```
9
+
10
+ ## Expect
11
+
12
+
13
+ ### Box `default`
14
+
15
+ - The box `default` is a docker container that will be a reverse
16
+ proxy. It should provision itself and work without errors.
17
+
18
+ - You can check that the proxy is working by
19
+ `tail -f /var/log/tinyproxy/tinyproxy.log` inside the container
20
+
21
+ - **NOTE**: You'll need to use `docker exec <hash> -it bash` to get into the container
22
+
23
+
24
+ ### Box `docker-host`
25
+
26
+ - Vagrant should automatically instally docker-ce.
27
+ - The box should come up and provision itself with the proxy settings
28
+ configured in your Vagrantfile.
29
+ - **NOTE**: You can use `ssh` to connect to this container.
@@ -0,0 +1,27 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :spec => 'spec:all'
5
+ task :default => :spec
6
+
7
+ namespace :spec do
8
+ targets = []
9
+ Dir.glob('./spec/*').each do |dir|
10
+ next unless File.directory?(dir)
11
+ target = File.basename(dir)
12
+ target = "_#{target}" if target == "default"
13
+ targets << target
14
+ end
15
+
16
+ task :all => targets
17
+ task :default => :all
18
+
19
+ targets.each do |target|
20
+ original_target = target == "_default" ? target[1..-1] : target
21
+ desc "Run serverspec tests to #{original_target}"
22
+ RSpec::Core::RakeTask.new(target.to_sym) do |t|
23
+ ENV['TARGET_HOST'] = original_target
24
+ t.pattern = "spec/#{original_target}/*_spec.rb"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,64 @@
1
+ # this should be the IP address of the :default box
2
+ $PROXY_HOST ="172.17.0.1"
3
+ $PROXY_PORT="8888"
4
+ $PROXY_NO_PROXY=[
5
+ 'localhost',
6
+ ]
7
+
8
+ ENV['HTTP_PROXY'] = ENV.fetch('HTTP_PROXY', "http://#{$PROXY_HOST}:#{$PROXY_PORT}")
9
+ ENV['HTTPS_PROXY'] = ENV.fetch('HTTPS_PROXY', "http://#{$PROXY_HOST}:#{$PROXY_PORT}")
10
+ ENV['NO_PROXY'] = ENV.fetch('NO_PROXY', $PROXY_NO_PROXY.join(","))
11
+
12
+ puts "HTTP_PROXY = '#{ENV["HTTP_PROXY"]}'"
13
+ puts "HTTPS_PROXY = '#{ENV["HTTPS_PROXY"]}'"
14
+ puts "NO_PROXY = '#{ENV["NO_PROXY"]}'"
15
+
16
+ puts "vagrant-proxyconf is installed? #{Vagrant.has_plugin?('vagrant-proxyconf')}"
17
+
18
+
19
+ Vagrant.configure("2") do |config|
20
+
21
+ config.vm.define 'default' do |c|
22
+ c.vm.box = nil
23
+
24
+ if Vagrant.has_plugin?('vagrant-proxyconf')
25
+ c.proxy.enabled = false
26
+ end
27
+
28
+ c.vm.provider "docker" do |d|
29
+ d.build_dir = "."
30
+ d.has_ssh = true
31
+ d.ports = [
32
+ "#{$PROXY_PORT}:#{$PROXY_PORT}",
33
+ ]
34
+ end
35
+ end
36
+
37
+ config.vm.define 'docker_host' do |c|
38
+ c.vm.box = nil
39
+
40
+ if Vagrant.has_plugin?('vagrant-proxyconf')
41
+ c.proxy.http = ENV['HTTP_PROXY']
42
+ c.proxy.https = ENV['HTTPS_PROXY']
43
+ c.proxy.no_proxy = ENV['NO_PROXY']
44
+ c.proxy.enabled = {
45
+ :apt => {
46
+ :enabled => true,
47
+ :skip => false,
48
+ },
49
+ :env => {
50
+ :enabled => false,
51
+ :skip => false,
52
+ }
53
+ }
54
+ end
55
+
56
+ c.vm.provider "docker" do |d|
57
+ d.build_dir = "."
58
+ d.dockerfile = "Dockerfile.bionic"
59
+ d.has_ssh = true
60
+ end
61
+
62
+ end
63
+
64
+ end