beaker-docker 0.8.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1f70940dc7c4b43db06838e143fc4e4a498247be0ed67ae0926ae84527f5786
4
- data.tar.gz: b12830fb23b10ccf1718be061c3e6ffe3e81c0b47b3aff58e3882e2e0a843c7d
3
+ metadata.gz: 2de8c341eaa907ce915686f4af31417659a391ace3e844cd10de5b6b3a6f963a
4
+ data.tar.gz: 533955311e2c5a195bbc884a15dd71ae0a54603097baaf0afc41ca7226fef083
5
5
  SHA512:
6
- metadata.gz: d182e05ba8dea02f896571bb5cf100f3a313349e1178f3eb9daf5e62f7ec93572114e4e1cf6e10a34aa18e8280d7be0ff7ed8a1482984cbd07ae3a530a7a0be9
7
- data.tar.gz: 478ac68e7088d66a8f5a4732f59a1337b355293b5a5f8d38551e5d54b81e6e7634528139b4c5717462b3d0b4a8558de05afc83b2f2c51705f0e8d16b7fb885a8
6
+ metadata.gz: a0ae7bb38381077821e427d7f46ff135649ef686b381c4438a6dd046ffec455f32169226f5e7799a52bd7360cca8fd118e06c3db507b55776647a6273736b5c7
7
+ data.tar.gz: 8250ec4f91378d821e0bbf3cf92a5038971df55f224ac03142148fe2dd8ee8137c6e86f11c94c597d1555e163c664b299076807cf6026eb1b2d6c0beaaadd08c
@@ -1,24 +1,32 @@
1
1
  name: Release
2
2
 
3
3
  on:
4
- create:
5
- ref_type: tag
4
+ push:
5
+ tags:
6
+ - '*'
6
7
 
7
8
  jobs:
8
9
  release:
9
10
  runs-on: ubuntu-latest
10
- if: github.repository == 'voxpupuli/beaker-docker'
11
- env:
12
- BUNDLE_WITHOUT: release
11
+ if: github.repository_owner == 'voxpupuli'
13
12
  steps:
14
13
  - uses: actions/checkout@v2
15
- - name: Install Ruby 2.7
14
+ - name: Install Ruby 3.0
16
15
  uses: ruby/setup-ruby@v1
17
16
  with:
18
- ruby-version: '2.7'
17
+ ruby-version: '3.0'
18
+ env:
19
+ BUNDLE_WITHOUT: release
19
20
  - name: Build gem
20
21
  run: gem build *.gemspec
21
- - name: Publish gem
22
+ - name: Publish gem to rubygems.org
22
23
  run: gem push *.gem
23
24
  env:
24
25
  GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
26
+ - name: Setup GitHub packages access
27
+ run: |
28
+ mkdir -p ~/.gem
29
+ echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
30
+ chmod 0600 ~/.gem/credentials
31
+ - name: Publish gem to GitHub packages
32
+ run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem
@@ -1,13 +1,11 @@
1
1
  name: Test
2
2
 
3
3
  on:
4
- push:
5
- branches:
6
- - test_me_github
7
- pull_request:
8
- branches:
9
- - main
10
- - master
4
+ - pull_request
5
+ - push
6
+
7
+ env:
8
+ BUNDLE_WITHOUT: release
11
9
 
12
10
  jobs:
13
11
  rspec:
@@ -15,13 +13,15 @@ jobs:
15
13
  strategy:
16
14
  fail-fast: true
17
15
  matrix:
18
- ruby:
19
- - "2.4"
20
- - "2.5"
21
- - "2.6"
22
- - "2.7"
16
+ include:
17
+ - ruby: "2.4"
18
+ - ruby: "2.5"
19
+ - ruby: "2.6"
20
+ - ruby: "2.7"
21
+ - ruby: "3.0"
22
+ coverage: "yes"
23
23
  env:
24
- BUNDLE_WITHOUT: release
24
+ COVERAGE: ${{ matrix.coverage }}
25
25
  name: RSpec - Ruby ${{ matrix.ruby }}
26
26
  steps:
27
27
  - uses: actions/checkout@v2
@@ -30,12 +30,10 @@ jobs:
30
30
  with:
31
31
  ruby-version: ${{ matrix.ruby }}
32
32
  bundler-cache: true
33
- - name: install bundler
34
- run: |
35
- gem install bundler -v '~> 1.17.3'
36
- bundle update
37
33
  - name: spec tests
38
34
  run: bundle exec rake test:spec
35
+ - name: Build gem
36
+ run: gem build *.gemspec
39
37
 
40
38
  docker:
41
39
  runs-on: ubuntu-latest
@@ -44,8 +42,6 @@ jobs:
44
42
  matrix:
45
43
  ruby:
46
44
  - "2.6"
47
- env:
48
- BUNDLE_WITHOUT: release
49
45
  name: Docker - Ruby ${{ matrix.ruby }}
50
46
  steps:
51
47
  - uses: actions/checkout@v2
@@ -78,8 +74,6 @@ jobs:
78
74
  matrix:
79
75
  ruby:
80
76
  - "2.6"
81
- env:
82
- BUNDLE_WITHOUT: release
83
77
  name: Podman - Ruby ${{ matrix.ruby }}
84
78
  steps:
85
79
  - uses: actions/checkout@v2
data/CHANGELOG.md ADDED
@@ -0,0 +1,197 @@
1
+ # Changelog
2
+
3
+ ## [1.0.0](https://github.com/voxpupuli/beaker-docker/tree/1.0.0) (2021-08-06)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.8.4...1.0.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Implement codecov reporting [\#49](https://github.com/voxpupuli/beaker-docker/pull/49) ([bastelfreak](https://github.com/bastelfreak))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Treat Fedora 22+ and EL8 the same [\#48](https://github.com/voxpupuli/beaker-docker/pull/48) ([ekohl](https://github.com/ekohl))
14
+ - Be more aggressive about picking a connection [\#47](https://github.com/voxpupuli/beaker-docker/pull/47) ([trevor-vaughan](https://github.com/trevor-vaughan))
15
+
16
+ ## [0.8.4](https://github.com/voxpupuli/beaker-docker/tree/0.8.4) (2021-03-15)
17
+
18
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.8.3...0.8.4)
19
+
20
+ **Fixed bugs:**
21
+
22
+ - Force Container Removal [\#45](https://github.com/voxpupuli/beaker-docker/pull/45) ([trevor-vaughan](https://github.com/trevor-vaughan))
23
+
24
+ **Closed issues:**
25
+
26
+ - Wrong SSH port getting used [\#43](https://github.com/voxpupuli/beaker-docker/issues/43)
27
+ - Beaker complains about host unreachable - Ubuntu 18 and 20 [\#39](https://github.com/voxpupuli/beaker-docker/issues/39)
28
+
29
+ **Merged pull requests:**
30
+
31
+ - Fix docker usage to use correct port and IP address on local docker [\#44](https://github.com/voxpupuli/beaker-docker/pull/44) ([treydock](https://github.com/treydock))
32
+ - Update to Check Rootless [\#41](https://github.com/voxpupuli/beaker-docker/pull/41) ([trevor-vaughan](https://github.com/trevor-vaughan))
33
+ - Change from my personal fork to docker-api 2.1+ [\#40](https://github.com/voxpupuli/beaker-docker/pull/40) ([trevor-vaughan](https://github.com/trevor-vaughan))
34
+
35
+ ## [0.8.3](https://github.com/voxpupuli/beaker-docker/tree/0.8.3) (2021-02-28)
36
+
37
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.8.2...0.8.3)
38
+
39
+ **Merged pull requests:**
40
+
41
+ - Cleanup docs and gemspec [\#37](https://github.com/voxpupuli/beaker-docker/pull/37) ([genebean](https://github.com/genebean))
42
+
43
+ ## [0.8.2](https://github.com/voxpupuli/beaker-docker/tree/0.8.2) (2021-02-28)
44
+
45
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.8.1...0.8.2)
46
+
47
+ **Merged pull requests:**
48
+
49
+ - Deconflict Privileged and CAPs [\#34](https://github.com/voxpupuli/beaker-docker/pull/34) ([trevor-vaughan](https://github.com/trevor-vaughan))
50
+
51
+ ## [0.8.1](https://github.com/voxpupuli/beaker-docker/tree/0.8.1) (2021-02-28)
52
+
53
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.8.0...0.8.1)
54
+
55
+ **Merged pull requests:**
56
+
57
+ - Fix docker support and update github actions [\#32](https://github.com/voxpupuli/beaker-docker/pull/32) ([trevor-vaughan](https://github.com/trevor-vaughan))
58
+ - Add GH Action for releases [\#31](https://github.com/voxpupuli/beaker-docker/pull/31) ([genebean](https://github.com/genebean))
59
+
60
+ ## [0.8.0](https://github.com/voxpupuli/beaker-docker/tree/0.8.0) (2021-02-26)
61
+
62
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.7.1...0.8.0)
63
+
64
+ **Merged pull requests:**
65
+
66
+ - Move testing to GH Actions [\#30](https://github.com/voxpupuli/beaker-docker/pull/30) ([genebean](https://github.com/genebean))
67
+ - Add Podman Support [\#29](https://github.com/voxpupuli/beaker-docker/pull/29) ([trevor-vaughan](https://github.com/trevor-vaughan))
68
+
69
+ ## [0.7.1](https://github.com/voxpupuli/beaker-docker/tree/0.7.1) (2020-09-11)
70
+
71
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.7.0...0.7.1)
72
+
73
+ **Merged pull requests:**
74
+
75
+ - Fix: docker-api gem dependency [\#26](https://github.com/voxpupuli/beaker-docker/pull/26) ([msalway](https://github.com/msalway))
76
+ - Add Dependabot to keep thins up to date [\#23](https://github.com/voxpupuli/beaker-docker/pull/23) ([genebean](https://github.com/genebean))
77
+
78
+ ## [0.7.0](https://github.com/voxpupuli/beaker-docker/tree/0.7.0) (2020-01-23)
79
+
80
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.6.0...0.7.0)
81
+
82
+ **Merged pull requests:**
83
+
84
+ - Fix: Too many authentication failures [\#21](https://github.com/voxpupuli/beaker-docker/pull/21) ([b4ldr](https://github.com/b4ldr))
85
+ - \(MAINT\) add release section to README [\#20](https://github.com/voxpupuli/beaker-docker/pull/20) ([kevpl](https://github.com/kevpl))
86
+
87
+ ## [0.6.0](https://github.com/voxpupuli/beaker-docker/tree/0.6.0) (2019-11-12)
88
+
89
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.5.4...0.6.0)
90
+
91
+ **Merged pull requests:**
92
+
93
+ - \(BKR-1613\) add CentOS8 support [\#19](https://github.com/voxpupuli/beaker-docker/pull/19) ([ciprianbadescu](https://github.com/ciprianbadescu))
94
+
95
+ ## [0.5.4](https://github.com/voxpupuli/beaker-docker/tree/0.5.4) (2019-07-15)
96
+
97
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.5.3...0.5.4)
98
+
99
+ **Merged pull requests:**
100
+
101
+ - \(maint\) A number of fixes for rerunning tests on docker containers [\#18](https://github.com/voxpupuli/beaker-docker/pull/18) ([underscorgan](https://github.com/underscorgan))
102
+
103
+ ## [0.5.3](https://github.com/voxpupuli/beaker-docker/tree/0.5.3) (2019-05-06)
104
+
105
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.5.2...0.5.3)
106
+
107
+ **Merged pull requests:**
108
+
109
+ - BKR-1586 - allow an 'as-is' container to be used rather than rebuilding every time [\#17](https://github.com/voxpupuli/beaker-docker/pull/17) ([oldNoakes](https://github.com/oldNoakes))
110
+
111
+ ## [0.5.2](https://github.com/voxpupuli/beaker-docker/tree/0.5.2) (2019-02-11)
112
+
113
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.5.1...0.5.2)
114
+
115
+ **Merged pull requests:**
116
+
117
+ - Allow users with large keyrings to run test [\#16](https://github.com/voxpupuli/beaker-docker/pull/16) ([trevor-vaughan](https://github.com/trevor-vaughan))
118
+
119
+ ## [0.5.1](https://github.com/voxpupuli/beaker-docker/tree/0.5.1) (2018-11-29)
120
+
121
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.5.0...0.5.1)
122
+
123
+ **Merged pull requests:**
124
+
125
+ - \(SERVER-2380\) add image tagging ability [\#14](https://github.com/voxpupuli/beaker-docker/pull/14) ([tvpartytonight](https://github.com/tvpartytonight))
126
+
127
+ ## [0.5.0](https://github.com/voxpupuli/beaker-docker/tree/0.5.0) (2018-11-19)
128
+
129
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.4.0...0.5.0)
130
+
131
+ **Merged pull requests:**
132
+
133
+ - \(BKR-1551\) Updates for Beaker 4 [\#13](https://github.com/voxpupuli/beaker-docker/pull/13) ([caseywilliams](https://github.com/caseywilliams))
134
+
135
+ ## [0.4.0](https://github.com/voxpupuli/beaker-docker/tree/0.4.0) (2018-10-26)
136
+
137
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.3.3...0.4.0)
138
+
139
+ **Merged pull requests:**
140
+
141
+ - \(PUP-9212\) Allow for building containers with context [\#12](https://github.com/voxpupuli/beaker-docker/pull/12) ([tvpartytonight](https://github.com/tvpartytonight))
142
+ - \(PUP-9212\) Allow for image entry point CMDs [\#11](https://github.com/voxpupuli/beaker-docker/pull/11) ([tvpartytonight](https://github.com/tvpartytonight))
143
+ - \(BKR-1509\) Hypervisor usage instructions for Beaker 4..0 [\#9](https://github.com/voxpupuli/beaker-docker/pull/9) ([Dakta](https://github.com/Dakta))
144
+
145
+ ## [0.3.3](https://github.com/voxpupuli/beaker-docker/tree/0.3.3) (2018-04-16)
146
+
147
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.3.2...0.3.3)
148
+
149
+ **Merged pull requests:**
150
+
151
+ - \(BKR-305\) Support custom docker options [\#8](https://github.com/voxpupuli/beaker-docker/pull/8) ([double16](https://github.com/double16))
152
+
153
+ ## [0.3.2](https://github.com/voxpupuli/beaker-docker/tree/0.3.2) (2018-04-09)
154
+
155
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.3.1...0.3.2)
156
+
157
+ **Merged pull requests:**
158
+
159
+ - \(MAINT\) fix paths when using DOCKER\_TOOLBOX on windows [\#7](https://github.com/voxpupuli/beaker-docker/pull/7) ([tabakhase](https://github.com/tabakhase))
160
+
161
+ ## [0.3.1](https://github.com/voxpupuli/beaker-docker/tree/0.3.1) (2018-02-22)
162
+
163
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.3.0...0.3.1)
164
+
165
+ **Merged pull requests:**
166
+
167
+ - Fix Archlinux support [\#6](https://github.com/voxpupuli/beaker-docker/pull/6) ([bastelfreak](https://github.com/bastelfreak))
168
+
169
+ ## [0.3.0](https://github.com/voxpupuli/beaker-docker/tree/0.3.0) (2018-01-29)
170
+
171
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.2.0...0.3.0)
172
+
173
+ **Merged pull requests:**
174
+
175
+ - \[BKR-1021\] Archlinux support [\#5](https://github.com/voxpupuli/beaker-docker/pull/5) ([jantman](https://github.com/jantman))
176
+ - Don't set container name to node hostname [\#4](https://github.com/voxpupuli/beaker-docker/pull/4) ([jovrum](https://github.com/jovrum))
177
+
178
+ ## [0.2.0](https://github.com/voxpupuli/beaker-docker/tree/0.2.0) (2017-08-11)
179
+
180
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/0.1.0...0.2.0)
181
+
182
+ **Merged pull requests:**
183
+
184
+ - \(BKR-1189\) Fix port mapping [\#3](https://github.com/voxpupuli/beaker-docker/pull/3) ([rishijavia](https://github.com/rishijavia))
185
+ - Make beaker-docker work in a docker container [\#2](https://github.com/voxpupuli/beaker-docker/pull/2) ([hedinasr](https://github.com/hedinasr))
186
+
187
+ ## [0.1.0](https://github.com/voxpupuli/beaker-docker/tree/0.1.0) (2017-08-01)
188
+
189
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/7f6a78541f30385016478e810ecb0c14f3936e20...0.1.0)
190
+
191
+ **Merged pull requests:**
192
+
193
+ - \(MAINT\) Add docker-api dependency as its removed from beaker [\#1](https://github.com/voxpupuli/beaker-docker/pull/1) ([rishijavia](https://github.com/rishijavia))
194
+
195
+
196
+
197
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source ENV['GEM_SOURCE'] || "https://rubygems.org"
1
+ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
@@ -16,10 +16,19 @@ end
16
16
  # We don't put beaker in as a test dependency because we
17
17
  # don't want to create a transitive dependency
18
18
  group :acceptance_testing do
19
- gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0')
19
+ gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 4.30')
20
20
  end
21
21
 
22
22
 
23
23
  if File.exists? "#{__FILE__}.local"
24
24
  eval(File.read("#{__FILE__}.local"), binding)
25
25
  end
26
+
27
+ group :coverage, optional: ENV['COVERAGE']!='yes' do
28
+ gem 'simplecov-console', :require => false
29
+ gem 'codecov', :require => false
30
+ end
31
+
32
+ group :release do
33
+ gem 'github_changelog_generator', require: false
34
+ end
data/Gemfile.local CHANGED
@@ -1,5 +1,3 @@
1
1
  group :acceptance_testing do
2
- # Needed for podman testing
3
- gem "docker-api", :git => 'https://github.com/trevor-vaughan/docker-api', :branch => 'podman-compat'
4
2
  gem "beaker-rspec"
5
3
  end
data/README.md CHANGED
@@ -1,10 +1,18 @@
1
1
  # beaker-docker
2
2
 
3
+ [![License](https://img.shields.io/github/license/voxpupuli/beaker-docker.svg)](https://github.com/voxpupuli/beaker-docker/blob/master/LICENSE)
4
+ [![Test](https://github.com/voxpupuli/beaker-docker/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/beaker-docker/actions/workflows/test.yml)
5
+ [![codecov](https://codecov.io/gh/voxpupuli/beaker-docker/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/voxpupuli/beaker-docker)
6
+ [![Release](https://github.com/voxpupuli/beaker-docker/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/beaker-docker/actions/workflows/release.yml)
7
+ [![RubyGem Version](https://img.shields.io/gem/v/beaker-docker.svg)](https://rubygems.org/gems/beaker-docker)
8
+ [![RubyGem Downloads](https://img.shields.io/gem/dt/beaker-docker.svg)](https://rubygems.org/gems/beaker-docker)
9
+ [![Donated by Puppet Inc](https://img.shields.io/badge/donated%20by-Puppet%20Inc-fb7047.svg)](#transfer-notice)
10
+
3
11
  Beaker library to use docker hypervisor
4
12
 
5
- # How to use this wizardry
13
+ ## How to use this wizardry
6
14
 
7
- This gem that allows you to use hosts with [docker](docker.md) hypervisor with [beaker](https://github.com/puppetlabs/beaker).
15
+ This gem that allows you to use hosts with [docker](docker.md) hypervisor with [beaker](https://github.com/voxpupuli/beaker).
8
16
 
9
17
  Beaker will automatically load the appropriate hypervisors for any given hosts
10
18
  file, so as long as your project dependencies are satisfied there's nothing else
@@ -14,20 +22,20 @@ In order to use a specific hypervisor or DSL extension library in your project,
14
22
  you will need to include them alongside Beaker in your Gemfile or
15
23
  project.gemspec. E.g.
16
24
 
17
- ~~~ruby
25
+ ```ruby
18
26
  # Gemfile
19
27
  gem 'beaker', '~> 4.0'
20
28
  gem 'beaker-docker'
21
29
  # project.gemspec
22
30
  s.add_runtime_dependency 'beaker', '~> 4.0'
23
31
  s.add_runtime_dependency 'beaker-docker'
24
- ~~~
32
+ ```
25
33
 
26
- ## Nodeset Options
34
+ ### Nodeset Options
27
35
 
28
36
  The following is a sample nodeset:
29
37
 
30
- ~~~yaml
38
+ ```yaml
31
39
  HOSTS:
32
40
  el8:
33
41
  platform: el-8-x86_64
@@ -51,21 +59,21 @@ HOSTS:
51
59
  CONFIG:
52
60
  docker_cap_add:
53
61
  - AUDIT_WRITE
54
- ~~~
62
+ ```
55
63
 
56
- ## Privileged containers
64
+ ### Privileged containers
57
65
 
58
- Containers are **not** run in privileged mode by default for safety.
66
+ Containers are run in privileged mode by default unless capabilities are set.
59
67
 
60
- If you wish to enable privileged mode, simply set the following in your node:
68
+ If you wish to disable privileged mode, simply set the following in your node:
61
69
 
62
- ~~~yaml
70
+ ```yaml
63
71
  dockeropts:
64
72
  HostConfig:
65
- Privileged: true
66
- ~~~
73
+ Privileged: false
74
+ ```
67
75
 
68
- ## Cleaning up after tests
76
+ ### Cleaning up after tests
69
77
 
70
78
  Containers created by this plugin may not be destroyed unless the tests complete
71
79
  successfully. Each container created is prefixed by `beaker-` to make filtering
@@ -73,11 +81,11 @@ for clean up easier.
73
81
 
74
82
  A quick way to clean up all nodes is as follows:
75
83
 
76
- ~~~sh
84
+ ```sh
77
85
  podman rm -f $( podman ps -q -f name="beaker-*" )
78
- ~~~
86
+ ```
79
87
 
80
- # Working with `podman`
88
+ ## Working with `podman`
81
89
 
82
90
  If you're using a version of `podman` that has API socket support then you
83
91
  should be able to simply set `DOCKER_HOST` to your socket and connect as usual.
@@ -94,14 +102,15 @@ See the
94
102
  [HostConfig](https://any-api.com/docker_com/engine/docs/Definitions/HostConfig)
95
103
  portion of the docker API for more information.
96
104
 
97
- # Spec tests
105
+ ## Spec tests
98
106
 
99
107
  Spec test live under the `spec` folder. There are the default rake task and therefore can run with a simple command:
108
+
100
109
  ```bash
101
110
  bundle exec rake test:spec
102
111
  ```
103
112
 
104
- # Acceptance tests
113
+ ## Acceptance tests
105
114
 
106
115
  There is a simple rake task to invoke acceptance test for the library:
107
116
 
@@ -109,17 +118,24 @@ There is a simple rake task to invoke acceptance test for the library:
109
118
  bundle exec rake test:acceptance
110
119
  ```
111
120
 
112
- # Contributing
121
+ ## Transfer Notice
122
+
123
+ This plugin was originally authored by [Puppet Inc](http://puppet.com).
124
+ The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
125
+ Existing pull requests and issues were transferred over, please fork and continue to contribute here.
126
+
127
+ Previously: https://github.com/puppetlabs/beaker
113
128
 
114
- Please refer to puppetlabs/beaker's [contributing](https://github.com/puppetlabs/beaker/blob/master/CONTRIBUTING.md) guide.
129
+ ## License
115
130
 
116
- # Releasing
131
+ This gem is licensed under the Apache-2 license.
117
132
 
118
- To release new versions of beaker-docker, please use this [jenkins job](https://cinext-jenkinsmaster-sre-prod-1.delivery.puppetlabs.net/view/all/job/qe_beaker-docker_init-multijob_master/). This job
119
- lives on Puppet-internal infrastructure, so you'll need to be a part of the Puppet org to do this.
133
+ ## Release information
120
134
 
121
- To run the job, click on `Build with Parameters` in the menu on the left. Make
122
- sure you check the box next to `PUBLIC` and enter the appropriate version. The
123
- version should adhere to [semantic version standards](https://semver.org).
124
- When in doubt, consult the [maintainers of Beaker](https://github.com/puppetlabs/beaker/blob/master/CODEOWNERS)
125
- for guidance.
135
+ To make a new release, please do:
136
+ * update the version in `lib/beaker-docker/version.rb`
137
+ * Install gems with `bundle install --with release --path .vendor`
138
+ * generate the changelog with `bundle exec rake changelog`
139
+ * Check if the new version matches the closed issues/PRs in the changelog
140
+ * Create a PR with it
141
+ * After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages
data/Rakefile CHANGED
@@ -163,3 +163,17 @@ namespace :docs do
163
163
  end
164
164
  end
165
165
  end
166
+
167
+ begin
168
+ require 'rubygems'
169
+ require 'github_changelog_generator/task'
170
+ rescue LoadError
171
+ else
172
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
173
+ config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog}
174
+ config.user = 'voxpupuli'
175
+ config.project = 'beaker-docker'
176
+ gem_version = Gem::Specification.load("#{config.project}.gemspec").version
177
+ config.future_release = gem_version
178
+ end
179
+ end
@@ -5,12 +5,17 @@ require 'beaker-docker/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "beaker-docker"
7
7
  s.version = BeakerDocker::VERSION
8
- s.authors = ["Rishi Javia, Kevin Imber, Tony Vu"]
9
- s.email = ["rishi.javia@puppet.com, kevin.imber@puppet.com, tony.vu@puppet.com"]
10
- s.homepage = "https://github.com/puppetlabs/beaker-docker"
8
+ s.authors = [
9
+ "Vox Pupuli",
10
+ "Rishi Javia",
11
+ "Kevin Imber",
12
+ "Tony Vu"
13
+ ]
14
+ s.email = ["voxpupuli@groups.io"]
15
+ s.homepage = "https://github.com/voxpupuli/beaker-docker"
11
16
  s.summary = %q{Beaker DSL Extension Helpers!}
12
17
  s.description = %q{For use for the Beaker acceptance testing tool}
13
- s.license = 'Apache2'
18
+ s.license = 'Apache-2.0'
14
19
 
15
20
  s.files = `git ls-files`.split("\n")
16
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -19,15 +24,13 @@ Gem::Specification.new do |s|
19
24
 
20
25
  # Testing dependencies
21
26
  s.add_development_dependency 'rspec', '~> 3.0'
22
- s.add_development_dependency 'rspec-its'
27
+ s.add_development_dependency 'rspec-its', '~> 1.3'
23
28
  s.add_development_dependency 'fakefs', '~> 1.3'
24
29
  s.add_development_dependency 'rake', '~> 13.0'
25
- s.add_development_dependency 'simplecov'
26
- s.add_development_dependency 'pry', '~> 0.10'
27
30
 
28
31
  # Run time dependencies
29
32
  s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
30
- s.add_runtime_dependency 'docker-api', '< 3.0.0'
33
+ s.add_runtime_dependency 'docker-api', '~> 2.1'
31
34
 
32
35
  end
33
36
 
@@ -1,3 +1,3 @@
1
1
  module BeakerDocker
2
- VERSION = '0.8.1'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -44,6 +44,8 @@ module Beaker
44
44
  else
45
45
  @registry = ENV['DOCKER_REGISTRY']
46
46
  end
47
+ elsif ::Docker.respond_to?(:podman?) && ::Docker.podman?
48
+ @docker_type = 'podman'
47
49
  else
48
50
  @docker_type = 'docker'
49
51
  end
@@ -150,13 +152,46 @@ module Beaker
150
152
  gw = network_settings['Gateway']
151
153
  ip = gw unless (gw.nil? || gw.empty?)
152
154
  else
153
- port22 = network_settings.dig('Ports','22/tcp')
154
- ip = port22[0]["HostIp"] if port22
155
+ # The many faces of container networking
156
+
157
+ # Host to Container
158
+ port22 = network_settings.dig('PortBindings','22/tcp')
159
+ ip = port22[0]['HostIp'] if port22
160
+ port = port22[0]['HostPort'] if port22
161
+
162
+ # Container to container
163
+ unless ip && port
164
+ ip = nil
165
+ port = nil
166
+
167
+ ip = network_settings['IPAddress']
168
+ port = 22 if ip && !ip.empty?
169
+ end
170
+
171
+ # Container through gateway
172
+ unless ip && port
173
+ ip = nil
174
+ port = nil
175
+
176
+ ip = network_settings['Gateway']
177
+
178
+ if ip && !ip.empty?
179
+ port22 = network_settings.dig('PortBindings','22/tcp')
180
+ port = port22[0]['HostPort'] if port22
181
+ end
182
+ end
183
+
184
+ # Legacy fallback
185
+ unless ip && port
186
+ port22 = network_settings.dig('Ports','22/tcp')
187
+ ip = port22[0]["HostIp"] if port22
188
+ port = port22[0]['HostPort'] if port22
189
+ end
155
190
  end
156
191
  end
157
192
 
158
193
  if host_config['NetworkMode'] != 'slirp4netns' && network_settings['IPAddress'] && !network_settings['IPAddress'].empty?
159
- ip = network_settings['IPAddress']
194
+ ip = network_settings['IPAddress'] if ip.nil?
160
195
  else
161
196
  port22 = network_settings.dig('Ports','22/tcp')
162
197
  port = port22[0]['HostPort'] if port22
@@ -192,6 +227,8 @@ module Beaker
192
227
  image_name = image.id
193
228
  end
194
229
 
230
+ ### BEGIN CONTAINER OPTIONS MANGLING ###
231
+
195
232
  container_opts = get_container_opts(host, image_name)
196
233
  if host['dockeropts'] || @options[:dockeropts]
197
234
  dockeropts = host['dockeropts'] ? host['dockeropts'] : @options[:dockeropts]
@@ -228,8 +265,17 @@ module Beaker
228
265
  container_opts['Env'] = host['docker_env']
229
266
  end
230
267
 
268
+ # Fixup privileges
269
+ #
270
+ # If the user has specified CAPs, then we cannot be privileged
271
+ #
272
+ # If the user has not specified CAPs, we will default to privileged for
273
+ # compatibility with worst practice
231
274
  if host['docker_cap_add']
232
275
  container_opts['HostConfig']['CapAdd'] = host['docker_cap_add']
276
+ container_opts['HostConfig'].delete('Privileged')
277
+ else
278
+ container_opts['HostConfig']['Privileged'] = container_opts['HostConfig']['Privileged'].nil? ? true : container_opts['HostConfig']['Privileged']
233
279
  end
234
280
 
235
281
  if host['docker_container_name']
@@ -238,6 +284,8 @@ module Beaker
238
284
  container_opts['name'] = ['beaker', host.name, SecureRandom.uuid.split('-').last].join('-')
239
285
  end
240
286
 
287
+ ### END CONTAINER OPTIONS MANGLING ###
288
+
241
289
  @logger.debug("Creating container from image #{image_name}")
242
290
 
243
291
  ok=false
@@ -246,10 +294,11 @@ module Beaker
246
294
  container = ::Docker::Container.create(container_opts)
247
295
 
248
296
  ssh_info = get_ssh_connection_info(container)
249
- if ssh_info[:ip] == '127.0.0.1' && (ssh_info[:port].to_i < 1024) && (Process.uid != 0)
250
- @logger.debug("#{host} was given a port less than 1024 but you are not running as root, retrying")
297
+ if ::Docker.rootless? && ssh_info[:ip] == '127.0.0.1' && (ssh_info[:port].to_i < 1024)
298
+ @logger.debug("#{host} was given a port less than 1024 but you are connecting to a rootless instance, retrying")
251
299
 
252
- container.delete
300
+ container.delete(force: true)
301
+ container = nil
253
302
 
254
303
  retries+=1
255
304
  next
@@ -274,7 +323,7 @@ module Beaker
274
323
  begin
275
324
  container.stats
276
325
  rescue StandardError => e
277
- container.delete
326
+ container.delete(force: true)
278
327
  raise "Container '#{container.id}' in a bad state: #{e}"
279
328
  end
280
329
 
@@ -333,7 +382,7 @@ module Beaker
333
382
  container.exec(%w(apt-get update))
334
383
  container.exec(%w(apt-get install -y openssh-server openssh-client))
335
384
  container.exec(%w(sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/*))
336
- when /fedora-(2[2-9])/
385
+ when /el-8/, /fedora-(2[2-9]|3[0-9])/
337
386
  container.exec(%w(dnf clean all))
338
387
  container.exec(%w(dnf install -y sudo openssh-server openssh-clients))
339
388
  container.exec(%w(ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key))
@@ -389,7 +438,7 @@ module Beaker
389
438
  end
390
439
  @logger.debug("delete container #{container.id}")
391
440
  begin
392
- container.delete
441
+ container.delete(force: true)
393
442
  rescue Excon::Errors::ClientError => e
394
443
  @logger.warn("deletion of container #{container.id} failed: #{e.response.body}")
395
444
  end
@@ -470,15 +519,7 @@ module Beaker
470
519
  RUN apt-get update
471
520
  RUN apt-get install -y openssh-server openssh-client #{Beaker::HostPrebuiltSteps::CUMULUS_PACKAGES.join(' ')}
472
521
  EOF
473
- when /fedora-(2[2-9])/
474
- dockerfile += <<~EOF
475
- RUN dnf clean all
476
- RUN dnf install -y sudo openssh-server openssh-clients #{Beaker::HostPrebuiltSteps::UNIX_PACKAGES.join(' ')}
477
- RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
478
- RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
479
- RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/*
480
- EOF
481
- when /el-8/
522
+ when /el-8/, /fedora-(2[2-9]|3)/
482
523
  dockerfile += <<~EOF
483
524
  RUN dnf clean all
484
525
  RUN dnf install -y sudo openssh-server openssh-clients #{Beaker::HostPrebuiltSteps::RHEL8_PACKAGES.join(' ')}
@@ -105,6 +105,10 @@ module Beaker
105
105
 
106
106
  let (:version) { {"ApiVersion"=>"1.18", "Arch"=>"amd64", "GitCommit"=>"4749651", "GoVersion"=>"go1.4.2", "KernelVersion"=>"3.16.0-37-generic", "Os"=>"linux", "Version"=>"1.6.0"} }
107
107
 
108
+ before :each do
109
+ allow(::Docker).to receive(:rootless?).and_return(true)
110
+ end
111
+
108
112
  context 'with connection failure' do
109
113
  describe '#initialize' do
110
114
  before :each do
@@ -130,6 +134,7 @@ module Beaker
130
134
  allow( ::Docker ).to receive(:options).and_return(docker_options)
131
135
  allow( ::Docker ).to receive(:options=)
132
136
  allow( ::Docker ).to receive(:logger=)
137
+ allow( ::Docker ).to receive(:podman?).and_return(false)
133
138
  allow( ::Docker ).to receive(:version).and_return(version)
134
139
  allow( ::Docker::Image ).to receive(:build).and_return(image)
135
140
  allow( ::Docker::Image ).to receive(:create).and_return(image)
@@ -303,6 +308,7 @@ module Beaker
303
308
  'PortBindings' => {
304
309
  '22/tcp' => [{ 'HostPort' => /\b\d{4}\b/, 'HostIp' => '0.0.0.0'}]
305
310
  },
311
+ 'Privileged' => true,
306
312
  'PublishAllPorts' => true,
307
313
  'RestartPolicy' => {
308
314
  'Name' => 'always'
@@ -337,6 +343,7 @@ module Beaker
337
343
  '22/tcp' => [{ 'HostPort' => /\b\d{4}\b/, 'HostIp' => '0.0.0.0'}]
338
344
  },
339
345
  'PublishAllPorts' => true,
346
+ 'Privileged' => true,
340
347
  'RestartPolicy' => {
341
348
  'Name' => 'always'
342
349
  }
@@ -367,6 +374,7 @@ module Beaker
367
374
  '22/tcp' => [{ 'HostPort' => /\b\d{4}\b/, 'HostIp' => '0.0.0.0'}]
368
375
  },
369
376
  'PublishAllPorts' => true,
377
+ 'Privileged' => true,
370
378
  'RestartPolicy' => {
371
379
  'Name' => 'always'
372
380
  }
@@ -424,6 +432,7 @@ module Beaker
424
432
  '22/tcp' => [{ 'HostPort' => /\b\d{4}\b/, 'HostIp' => '0.0.0.0'}]
425
433
  },
426
434
  'PublishAllPorts' => true,
435
+ 'Privileged' => true,
427
436
  'RestartPolicy' => {
428
437
  'Name' => 'always'
429
438
  }
@@ -482,7 +491,7 @@ module Beaker
482
491
  ENV['DOCKER_HOST'] = nil
483
492
  docker.provision
484
493
 
485
- expect( hosts[0]['ip'] ).to be === '127.0.1.1'
494
+ expect( hosts[0]['ip'] ).to be === '192.0.2.1'
486
495
  expect( hosts[0]['port'] ).to be === 8022
487
496
  end
488
497
 
@@ -498,7 +507,7 @@ module Beaker
498
507
  ENV['DOCKER_HOST'] = nil
499
508
  docker.provision
500
509
 
501
- expect( hosts[0]['ip'] ).to be === '127.0.1.1'
510
+ expect( hosts[0]['ip'] ).to be === '192.0.2.1'
502
511
  expect( hosts[0]['port'] ).to be === 8022
503
512
  expect( hosts[0]['ssh'][:password] ).to be === 'root'
504
513
  expect( hosts[0]['ssh'][:port] ).to be === 8022
@@ -529,7 +538,7 @@ module Beaker
529
538
  docker.provision
530
539
 
531
540
  expect( hosts[0]['ip'] ).to be === '192.0.2.1'
532
- expect( hosts[0]['port'] ).to be === '22'
541
+ expect( hosts[0]['port'] ).to be === 22
533
542
  end
534
543
  end
535
544
 
@@ -689,7 +698,7 @@ module Beaker
689
698
  expect( dockerfile ).to be =~ /RUN zypper -n in openssh/
690
699
  end
691
700
 
692
- (22..29).to_a.each do | fedora_release |
701
+ (22..39).to_a.each do | fedora_release |
693
702
  it "should use dnf on fedora #{fedora_release}" do
694
703
  FakeFS.deactivate!
695
704
  dockerfile = docker.send(:dockerfile_for, {
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,30 @@
1
- require 'simplecov'
2
1
  require 'rspec/its'
3
2
  require 'beaker'
4
3
 
4
+ begin
5
+ require 'simplecov'
6
+ require 'simplecov-console'
7
+ require 'codecov'
8
+ rescue LoadError
9
+ else
10
+ SimpleCov.start do
11
+ track_files 'lib/**/*.rb'
12
+
13
+ add_filter '/spec'
14
+
15
+ enable_coverage :branch
16
+
17
+ # do not track vendored files
18
+ add_filter '/vendor'
19
+ add_filter '/.vendor'
20
+ end
21
+
22
+ SimpleCov.formatters = [
23
+ SimpleCov::Formatter::Console,
24
+ SimpleCov::Formatter::Codecov,
25
+ ]
26
+ end
27
+
5
28
  Dir.glob(Dir.pwd + '/lib/beaker/hypervisor/*.rb') {|file| require file}
6
29
 
7
30
  # setup & require beaker's spec_helper.rb
metadata CHANGED
@@ -1,14 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Rishi Javia, Kevin Imber, Tony Vu
7
+ - Vox Pupuli
8
+ - Rishi Javia
9
+ - Kevin Imber
10
+ - Tony Vu
8
11
  autorequire:
9
12
  bindir: bin
10
13
  cert_chain: []
11
- date: 2021-02-28 00:00:00.000000000 Z
14
+ date: 2021-08-06 00:00:00.000000000 Z
12
15
  dependencies:
13
16
  - !ruby/object:Gem::Dependency
14
17
  name: rspec
@@ -28,16 +31,16 @@ dependencies:
28
31
  name: rspec-its
29
32
  requirement: !ruby/object:Gem::Requirement
30
33
  requirements:
31
- - - ">="
34
+ - - "~>"
32
35
  - !ruby/object:Gem::Version
33
- version: '0'
36
+ version: '1.3'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - ">="
41
+ - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '0'
43
+ version: '1.3'
41
44
  - !ruby/object:Gem::Dependency
42
45
  name: fakefs
43
46
  requirement: !ruby/object:Gem::Requirement
@@ -66,34 +69,6 @@ dependencies:
66
69
  - - "~>"
67
70
  - !ruby/object:Gem::Version
68
71
  version: '13.0'
69
- - !ruby/object:Gem::Dependency
70
- name: simplecov
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: pry
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0.10'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '0.10'
97
72
  - !ruby/object:Gem::Dependency
98
73
  name: stringify-hash
99
74
  requirement: !ruby/object:Gem::Requirement
@@ -112,19 +87,19 @@ dependencies:
112
87
  name: docker-api
113
88
  requirement: !ruby/object:Gem::Requirement
114
89
  requirements:
115
- - - "<"
90
+ - - "~>"
116
91
  - !ruby/object:Gem::Version
117
- version: 3.0.0
92
+ version: '2.1'
118
93
  type: :runtime
119
94
  prerelease: false
120
95
  version_requirements: !ruby/object:Gem::Requirement
121
96
  requirements:
122
- - - "<"
97
+ - - "~>"
123
98
  - !ruby/object:Gem::Version
124
- version: 3.0.0
99
+ version: '2.1'
125
100
  description: For use for the Beaker acceptance testing tool
126
101
  email:
127
- - rishi.javia@puppet.com, kevin.imber@puppet.com, tony.vu@puppet.com
102
+ - voxpupuli@groups.io
128
103
  executables:
129
104
  - beaker-docker
130
105
  extensions: []
@@ -135,6 +110,7 @@ files:
135
110
  - ".github/workflows/test.yml"
136
111
  - ".gitignore"
137
112
  - ".simplecov"
113
+ - CHANGELOG.md
138
114
  - Gemfile
139
115
  - Gemfile.local
140
116
  - LICENSE
@@ -149,9 +125,9 @@ files:
149
125
  - lib/beaker/hypervisor/docker.rb
150
126
  - spec/beaker/hypervisor/docker_spec.rb
151
127
  - spec/spec_helper.rb
152
- homepage: https://github.com/puppetlabs/beaker-docker
128
+ homepage: https://github.com/voxpupuli/beaker-docker
153
129
  licenses:
154
- - Apache2
130
+ - Apache-2.0
155
131
  metadata: {}
156
132
  post_install_message:
157
133
  rdoc_options: []
@@ -168,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
144
  - !ruby/object:Gem::Version
169
145
  version: '0'
170
146
  requirements: []
171
- rubygems_version: 3.1.4
147
+ rubygems_version: 3.2.22
172
148
  signing_key:
173
149
  specification_version: 4
174
150
  summary: Beaker DSL Extension Helpers!