beaker-docker 3.1.2 → 3.2.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 +4 -4
- data/.github/workflows/release.yml +9 -9
- data/.github/workflows/test.yml +91 -30
- data/CHANGELOG.md +23 -0
- data/Gemfile +1 -1
- data/acceptance/config/nodes/hosts.yaml +7 -0
- data/beaker-docker.gemspec +1 -1
- data/docker.md +14 -1
- data/lib/beaker/hypervisor/docker.rb +15 -6
- data/lib/beaker-docker/version.rb +1 -1
- data/spec/beaker/hypervisor/docker_spec.rb +64 -7
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3558d672e0a02e7a5847184d70b3003b173e501ff8b1023a9f606bb46c6a4852
|
|
4
|
+
data.tar.gz: '09fea7467dc98209892cecefc0be6abf7d23929cc19f6625228c333b0f1187ee'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8afa62bf82f407c4c815503230b5b1eb5411abe98fc47c733bd597dee29cff12ab4519e33a694f5e55e65bf763c2278d1782b4e4c55f4cb8f048ef0a8a4662b
|
|
7
|
+
data.tar.gz: 369b61ead22fc95defd7a538d3f1e1bdba857d6db823107f68fe00cc6072b2b7023d2038924d55353987d6cffa9687f9493808c09c33d5d73557dcc91d0a88d3
|
|
@@ -15,16 +15,16 @@ jobs:
|
|
|
15
15
|
name: Build the gem
|
|
16
16
|
runs-on: ubuntu-24.04
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
19
19
|
- name: Install Ruby
|
|
20
|
-
uses: ruby/setup-ruby@v1
|
|
20
|
+
uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
21
21
|
with:
|
|
22
22
|
ruby-version: 'ruby'
|
|
23
23
|
- name: Build gem
|
|
24
24
|
shell: bash
|
|
25
25
|
run: gem build --verbose *.gemspec
|
|
26
26
|
- name: Upload gem to GitHub cache
|
|
27
|
-
uses: actions/upload-artifact@v7
|
|
27
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
28
28
|
with:
|
|
29
29
|
name: gem-artifact
|
|
30
30
|
path: '*.gem'
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
contents: write # clone repo and create release
|
|
40
40
|
steps:
|
|
41
41
|
- name: Download gem from GitHub cache
|
|
42
|
-
uses: actions/download-artifact@v8
|
|
42
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
43
43
|
with:
|
|
44
44
|
name: gem-artifact
|
|
45
45
|
- name: Create Release
|
|
@@ -56,7 +56,7 @@ jobs:
|
|
|
56
56
|
packages: write # publish to rubygems.pkg.github.com
|
|
57
57
|
steps:
|
|
58
58
|
- name: Download gem from GitHub cache
|
|
59
|
-
uses: actions/download-artifact@v8
|
|
59
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
60
60
|
with:
|
|
61
61
|
name: gem-artifact
|
|
62
62
|
- name: Publish gem to GitHub packages
|
|
@@ -73,10 +73,10 @@ jobs:
|
|
|
73
73
|
id-token: write # rubygems.org authentication
|
|
74
74
|
steps:
|
|
75
75
|
- name: Download gem from GitHub cache
|
|
76
|
-
uses: actions/download-artifact@v8
|
|
76
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
77
77
|
with:
|
|
78
78
|
name: gem-artifact
|
|
79
|
-
- uses: rubygems/configure-rubygems-credentials@
|
|
79
|
+
- uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
|
|
80
80
|
- name: Publish gem to rubygems.org
|
|
81
81
|
shell: bash
|
|
82
82
|
run: gem push *.gem
|
|
@@ -92,11 +92,11 @@ jobs:
|
|
|
92
92
|
- release-to-rubygems
|
|
93
93
|
steps:
|
|
94
94
|
- name: Download gem from GitHub cache
|
|
95
|
-
uses: actions/download-artifact@v8
|
|
95
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
96
96
|
with:
|
|
97
97
|
name: gem-artifact
|
|
98
98
|
- name: Install Ruby
|
|
99
|
-
uses: ruby/setup-ruby@v1
|
|
99
|
+
uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
100
100
|
with:
|
|
101
101
|
ruby-version: 'ruby'
|
|
102
102
|
- name: Wait for release to propagate
|
data/.github/workflows/test.yml
CHANGED
|
@@ -15,17 +15,21 @@ jobs:
|
|
|
15
15
|
runs-on: ubuntu-24.04
|
|
16
16
|
outputs:
|
|
17
17
|
ruby: ${{ steps.ruby.outputs.versions }}
|
|
18
|
+
latest_ruby: ${{ steps.latest_ruby.outputs.version }}
|
|
18
19
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
20
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
20
21
|
- name: Install Ruby 4.0
|
|
21
|
-
uses: ruby/setup-ruby@v1
|
|
22
|
+
uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
22
23
|
with:
|
|
23
24
|
ruby-version: '4.0'
|
|
24
25
|
bundler-cache: true
|
|
25
26
|
- name: Run Rubocop
|
|
26
27
|
run: bundle exec rake rubocop
|
|
27
28
|
- id: ruby
|
|
28
|
-
uses: voxpupuli/ruby-version@
|
|
29
|
+
uses: voxpupuli/ruby-version@be0467ce7366d206b2e87f5b7a032a030120b7cb # 2.0.0
|
|
30
|
+
- id: latest_ruby
|
|
31
|
+
name: Determine newest supported Ruby
|
|
32
|
+
run: echo "version=$(echo '${{ steps.ruby.outputs.versions }}' | jq -r 'max_by(split(".") | map(tonumber))')" >> "$GITHUB_OUTPUT"
|
|
29
33
|
|
|
30
34
|
rspec:
|
|
31
35
|
runs-on: ubuntu-24.04
|
|
@@ -36,9 +40,9 @@ jobs:
|
|
|
36
40
|
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
|
|
37
41
|
name: RSpec - Ruby ${{ matrix.ruby }}
|
|
38
42
|
steps:
|
|
39
|
-
- uses: actions/checkout@
|
|
43
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
40
44
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
41
|
-
uses: ruby/setup-ruby@v1
|
|
45
|
+
uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
42
46
|
with:
|
|
43
47
|
ruby-version: ${{ matrix.ruby }}
|
|
44
48
|
bundler-cache: true
|
|
@@ -56,34 +60,86 @@ jobs:
|
|
|
56
60
|
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
|
|
57
61
|
name: Docker on Ruby ${{ matrix.ruby }}
|
|
58
62
|
steps:
|
|
59
|
-
- uses: actions/checkout@
|
|
63
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
60
64
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
61
|
-
uses: ruby/setup-ruby@v1
|
|
65
|
+
uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
62
66
|
with:
|
|
63
67
|
ruby-version: ${{ matrix.ruby }}
|
|
64
68
|
bundler-cache: true
|
|
65
69
|
- name: Run acceptance tests
|
|
66
70
|
run: bundle exec rake test:acceptance
|
|
67
71
|
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
# Run Beaker itself inside a container talking to the host daemon, so the
|
|
73
|
+
# test containers are siblings. Covers both connection routing modes:
|
|
74
|
+
# gateway - in_container? detects /.dockerenv and connects via the bridge
|
|
75
|
+
# gateway and published ssh port
|
|
76
|
+
# dind - DOCKER_IN_DOCKER=true forces a direct connection to the test
|
|
77
|
+
# container's network IP
|
|
78
|
+
beaker_in_container:
|
|
79
|
+
runs-on: ubuntu-24.04
|
|
80
|
+
needs: rubocop_and_matrix
|
|
81
|
+
strategy:
|
|
82
|
+
fail-fast: false
|
|
83
|
+
matrix:
|
|
84
|
+
mode: [gateway, dind]
|
|
85
|
+
name: Docker - Beaker in container connection test (${{ matrix.mode }})
|
|
86
|
+
timeout-minutes: 15
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
89
|
+
- name: Run Beaker in docker container
|
|
90
|
+
run: |
|
|
91
|
+
docker run --rm \
|
|
92
|
+
-v "$PWD:/work" -w /work \
|
|
93
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
94
|
+
${{ matrix.mode == 'dind' && '-e DOCKER_IN_DOCKER=true' || '' }} \
|
|
95
|
+
ruby:${{ needs.rubocop_and_matrix.outputs.latest_ruby }} \
|
|
96
|
+
bash -c 'bundle install && bundle exec rake test:acceptance'
|
|
97
|
+
|
|
98
|
+
# Same as beaker_in_container, but with podman. The gateway mode exercises
|
|
99
|
+
# the /run/.containerenv detection in in_container?.
|
|
100
|
+
# Rootless podman publishes ports only in the host network namespace, so
|
|
101
|
+
# they are not reachable at the bridge gateway from a sibling container and
|
|
102
|
+
# gateway mode has to use rootful podman. dind mode connects to sibling IPs
|
|
103
|
+
# directly, which rootless podman supports once the Beaker container joins
|
|
104
|
+
# the default bridge network instead of the slirp4netns one a plain run gets.
|
|
105
|
+
# This needs netavark >= 1.6.0: older versions turn the 0.0.0.0 host ip of a
|
|
106
|
+
# port binding into a DNAT rule that never matches, so the gateway connection
|
|
107
|
+
# lands on conmon's port reservation socket and hangs. ubuntu-24.04 ships
|
|
108
|
+
# netavark 1.4.0, ubuntu-26.04 ships podman 5.7.
|
|
109
|
+
beaker_in_podman:
|
|
110
|
+
runs-on: ubuntu-26.04
|
|
111
|
+
needs: rubocop_and_matrix
|
|
112
|
+
strategy:
|
|
113
|
+
fail-fast: false
|
|
114
|
+
matrix:
|
|
115
|
+
mode: [gateway, dind]
|
|
116
|
+
name: Podman - Beaker in container connection test (${{ matrix.mode }})
|
|
117
|
+
timeout-minutes: 15
|
|
118
|
+
steps:
|
|
119
|
+
- name: Start podman
|
|
120
|
+
run: |
|
|
121
|
+
sudo systemctl stop docker.service docker.socket
|
|
122
|
+
sudo systemctl start podman.socket
|
|
123
|
+
systemctl start --user podman.socket
|
|
124
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
125
|
+
- name: Run Beaker in podman container
|
|
126
|
+
run: |
|
|
127
|
+
if [ "${{ matrix.mode }}" = gateway ]; then
|
|
128
|
+
podman='sudo podman'
|
|
129
|
+
socket=/run/podman/podman.sock
|
|
130
|
+
else
|
|
131
|
+
podman=podman
|
|
132
|
+
socket="/run/user/$(id -u)/podman/podman.sock"
|
|
133
|
+
fi
|
|
134
|
+
$podman run --rm \
|
|
135
|
+
-v "$PWD:/work" -w /work \
|
|
136
|
+
-v "$socket:/run/podman/podman.sock" \
|
|
137
|
+
-e DOCKER_HOST=unix:///run/podman/podman.sock \
|
|
138
|
+
--network podman \
|
|
139
|
+
--security-opt label=disable \
|
|
140
|
+
${{ matrix.mode == 'dind' && '-e DOCKER_IN_DOCKER=true' || '' }} \
|
|
141
|
+
ruby:${{ needs.rubocop_and_matrix.outputs.latest_ruby }} \
|
|
142
|
+
bash -c 'bundle install && bundle exec rake test:acceptance'
|
|
87
143
|
|
|
88
144
|
# verifies that podman service is a dropin replacement for docker
|
|
89
145
|
podman:
|
|
@@ -99,9 +155,9 @@ jobs:
|
|
|
99
155
|
run: |
|
|
100
156
|
sudo systemctl stop docker.service docker.socket && systemctl start --user podman.socket
|
|
101
157
|
echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV"
|
|
102
|
-
- uses: actions/checkout@
|
|
158
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
103
159
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
104
|
-
uses: ruby/setup-ruby@v1
|
|
160
|
+
uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
105
161
|
with:
|
|
106
162
|
ruby-version: ${{ matrix.ruby }}
|
|
107
163
|
bundler-cache: true
|
|
@@ -109,13 +165,18 @@ jobs:
|
|
|
109
165
|
run: bundle exec rake test:acceptance
|
|
110
166
|
|
|
111
167
|
tests:
|
|
168
|
+
if: always()
|
|
112
169
|
needs:
|
|
113
170
|
- rubocop_and_matrix
|
|
114
171
|
- docker
|
|
115
|
-
|
|
172
|
+
- beaker_in_container
|
|
173
|
+
- beaker_in_podman
|
|
116
174
|
- podman
|
|
117
175
|
- rspec
|
|
118
176
|
runs-on: ubuntu-24.04
|
|
119
177
|
name: Test suite
|
|
120
178
|
steps:
|
|
121
|
-
-
|
|
179
|
+
- name: Decide whether the needed jobs succeeded or failed
|
|
180
|
+
uses: re-actors/alls-green@release/v1
|
|
181
|
+
with:
|
|
182
|
+
jobs: ${{ toJSON(needs) }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.2.0](https://github.com/voxpupuli/beaker-docker/tree/3.2.0) (2026-11-02)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/3.1.3...3.2.0)
|
|
6
|
+
|
|
7
|
+
**Implemented enhancements:**
|
|
8
|
+
|
|
9
|
+
- Support el10 hosts [\#212](https://github.com/voxpupuli/beaker-docker/pull/212) ([treydock](https://github.com/treydock))
|
|
10
|
+
- CI: re-enable beaker-in-container acceptance jobs [\#198](https://github.com/voxpupuli/beaker-docker/pull/198) ([miharp](https://github.com/miharp))
|
|
11
|
+
|
|
12
|
+
## [3.1.3](https://github.com/voxpupuli/beaker-docker/tree/3.1.3) (2026-08-21)
|
|
13
|
+
|
|
14
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/3.1.2...3.1.3)
|
|
15
|
+
|
|
16
|
+
**Fixed bugs:**
|
|
17
|
+
|
|
18
|
+
- Fix ssh connection routing under Podman: network naming and container detection [\#194](https://github.com/voxpupuli/beaker-docker/pull/194) ([miharp](https://github.com/miharp))
|
|
19
|
+
|
|
20
|
+
**Closed issues:**
|
|
21
|
+
|
|
22
|
+
- CI: re-enable the beaker\_in\_container acceptance job to cover in-container connection routing [\#195](https://github.com/voxpupuli/beaker-docker/issues/195)
|
|
23
|
+
- `in_container?` only checks `/.dockerenv`, so the gateway connection path never triggers under Podman [\#193](https://github.com/voxpupuli/beaker-docker/issues/193)
|
|
24
|
+
- `DOCKER_IN_DOCKER=true` crashes with NoMethodError on Podman 5: `Networks[NetworkMode]` lookup assumes Docker's network naming [\#192](https://github.com/voxpupuli/beaker-docker/issues/192)
|
|
25
|
+
|
|
3
26
|
## [3.1.2](https://github.com/voxpupuli/beaker-docker/tree/3.1.2) (2026-02-27)
|
|
4
27
|
|
|
5
28
|
[Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/3.1.1...3.1.2)
|
data/Gemfile
CHANGED
|
@@ -12,6 +12,13 @@ HOSTS:
|
|
|
12
12
|
- classifier
|
|
13
13
|
- default
|
|
14
14
|
docker_cmd: '["/sbin/init"]'
|
|
15
|
+
centos10:
|
|
16
|
+
platform: el-10-x86_64
|
|
17
|
+
hypervisor: docker
|
|
18
|
+
image: quay.io/centos/centos:stream10
|
|
19
|
+
roles:
|
|
20
|
+
- agent
|
|
21
|
+
docker_cmd: '["/sbin/init"]'
|
|
15
22
|
debian12:
|
|
16
23
|
platform: debian-12-x86_64
|
|
17
24
|
hypervisor: docker
|
data/beaker-docker.gemspec
CHANGED
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
|
30
30
|
s.add_development_dependency 'irb', '< 2'
|
|
31
31
|
s.add_development_dependency 'rake', '~> 13.0'
|
|
32
32
|
s.add_development_dependency 'rspec', '~> 3.0'
|
|
33
|
-
s.add_development_dependency 'voxpupuli-rubocop', '~> 5.
|
|
33
|
+
s.add_development_dependency 'voxpupuli-rubocop', '~> 5.3.0'
|
|
34
34
|
|
|
35
35
|
# Run time dependencies
|
|
36
36
|
s.add_dependency 'beaker', '>= 4', '< 8'
|
data/docker.md
CHANGED
|
@@ -200,4 +200,17 @@ The tests should then run as normal from there.
|
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
### Docker-in-Docker (dind) ###
|
|
203
|
-
If
|
|
203
|
+
If beaker itself runs inside a container (for example in a CI job) and the test
|
|
204
|
+
containers are created as siblings on the same host, beaker-docker detects
|
|
205
|
+
this automatically (via `/.dockerenv` on docker or `/run/.containerenv` on
|
|
206
|
+
podman) and connects through the bridge gateway and each test container's
|
|
207
|
+
published ssh port. No configuration is needed as long as the published port
|
|
208
|
+
is reachable via the gateway address.
|
|
209
|
+
|
|
210
|
+
If gateway routing does not work in your environment (ssh port not published
|
|
211
|
+
to the host, or a firewall blocking traffic to the gateway), set the
|
|
212
|
+
environment variable DOCKER_IN_DOCKER=true. Beaker-docker then ignores the
|
|
213
|
+
DOCKER_HOST address and published ports, and connects to each test
|
|
214
|
+
container's network IP directly; make sure the beaker container is attached
|
|
215
|
+
to the same network as the test containers. This works with podman as well
|
|
216
|
+
as docker, and is also enabled automatically under WSL.
|
|
@@ -153,7 +153,7 @@ module Beaker
|
|
|
153
153
|
gw = network_settings['Gateway']
|
|
154
154
|
|
|
155
155
|
# also handle scenarios where network_settings['Gateway'] is not set (e.g. docker-ce >= v29)
|
|
156
|
-
gw = network_settings
|
|
156
|
+
gw = container_network(network_settings, host_config)['Gateway'] if gw.nil? || gw.empty?
|
|
157
157
|
|
|
158
158
|
ip = gw unless gw.nil? || gw.empty?
|
|
159
159
|
else
|
|
@@ -170,7 +170,7 @@ module Beaker
|
|
|
170
170
|
unless ip && port
|
|
171
171
|
ip = network_settings['IPAddress'] # podman
|
|
172
172
|
# also handle scenarios where network_settings['IPAddress'] is not set (e.g. docker-ce >= v29)
|
|
173
|
-
ip = network_settings
|
|
173
|
+
ip = container_network(network_settings, host_config)['IPAddress'] if ip.nil? || ip.empty?
|
|
174
174
|
port = (ip && !ip.empty?) ? 22 : nil
|
|
175
175
|
end
|
|
176
176
|
|
|
@@ -363,7 +363,7 @@ module Beaker
|
|
|
363
363
|
host_config = container.json['HostConfig']
|
|
364
364
|
vm_ip = container.json['NetworkSettings']['IPAddress']
|
|
365
365
|
# handle scenarios where network_settings['IPAddress'] is not set (e.g. docker-ce >= v29)
|
|
366
|
-
vm_ip = container.json['NetworkSettings']
|
|
366
|
+
vm_ip = container_network(container.json['NetworkSettings'], host_config)['IPAddress'] if vm_ip.nil? || vm_ip.empty?
|
|
367
367
|
host['vm_ip'] = vm_ip.to_s
|
|
368
368
|
|
|
369
369
|
def host.reboot
|
|
@@ -463,6 +463,15 @@ module Beaker
|
|
|
463
463
|
|
|
464
464
|
private
|
|
465
465
|
|
|
466
|
+
# Look up the network a container is attached to. Podman's Docker-compatible
|
|
467
|
+
# API reports HostConfig.NetworkMode as 'bridge' but keys
|
|
468
|
+
# NetworkSettings.Networks by the actual network name, so fall back to the
|
|
469
|
+
# first attached network when the NetworkMode key is missing.
|
|
470
|
+
def container_network(network_settings, host_config)
|
|
471
|
+
networks = network_settings['Networks'] || {}
|
|
472
|
+
networks[host_config['NetworkMode']] || networks.values.first || {}
|
|
473
|
+
end
|
|
474
|
+
|
|
466
475
|
def root_password
|
|
467
476
|
'root'
|
|
468
477
|
end
|
|
@@ -513,7 +522,7 @@ module Beaker
|
|
|
513
522
|
RUN apt-get update \
|
|
514
523
|
&& apt-get install -y openssh-server openssh-client #{additional_packages.join(' ')}
|
|
515
524
|
DF
|
|
516
|
-
when /el-[
|
|
525
|
+
when /el-([8-9]|10)/, /fedora-(2[2-9]|3)/, /amazon-2023/
|
|
517
526
|
dockerfile += <<~DF
|
|
518
527
|
RUN dnf clean all \
|
|
519
528
|
&& dnf install -y sudo openssh-server openssh-clients #{additional_packages.join(' ')} \
|
|
@@ -639,9 +648,9 @@ module Beaker
|
|
|
639
648
|
nil
|
|
640
649
|
end
|
|
641
650
|
|
|
642
|
-
# return true if we are inside a docker container
|
|
651
|
+
# return true if we are inside a docker or podman container
|
|
643
652
|
def in_container?
|
|
644
|
-
File.file?('/.dockerenv')
|
|
653
|
+
File.file?('/.dockerenv') || File.file?('/run/.containerenv')
|
|
645
654
|
end
|
|
646
655
|
end
|
|
647
656
|
end
|
|
@@ -8,6 +8,7 @@ module Beaker
|
|
|
8
8
|
'ubuntu-14.04-x86_64',
|
|
9
9
|
'fedora-22-x86_64',
|
|
10
10
|
'centos-7-x86_64',
|
|
11
|
+
'el-10-x86_64',
|
|
11
12
|
'sles-12-x86_64',
|
|
12
13
|
'archlinux-2017.12.27-x86_64',
|
|
13
14
|
'amazon-2023-x86_64',
|
|
@@ -686,6 +687,17 @@ module Beaker
|
|
|
686
687
|
expect(hosts[0]['port']).to eq 8022
|
|
687
688
|
end
|
|
688
689
|
end
|
|
690
|
+
|
|
691
|
+
it 'connects to gateway ip inside a podman container' do
|
|
692
|
+
FakeFS do
|
|
693
|
+
FileUtils.mkdir_p('/run')
|
|
694
|
+
FileUtils.touch('/run/.containerenv')
|
|
695
|
+
docker.provision
|
|
696
|
+
|
|
697
|
+
expect(hosts[0]['ip']).to eq '192.0.2.254'
|
|
698
|
+
expect(hosts[0]['port']).to eq 8022
|
|
699
|
+
end
|
|
700
|
+
end
|
|
689
701
|
end
|
|
690
702
|
end
|
|
691
703
|
|
|
@@ -739,6 +751,51 @@ module Beaker
|
|
|
739
751
|
end
|
|
740
752
|
end
|
|
741
753
|
end
|
|
754
|
+
|
|
755
|
+
context 'when using podman where Networks is keyed by network name instead of NetworkMode' do
|
|
756
|
+
let(:container_config) do
|
|
757
|
+
{
|
|
758
|
+
'HostConfig' => {
|
|
759
|
+
'NetworkMode' => 'bridge',
|
|
760
|
+
},
|
|
761
|
+
'NetworkSettings' => {
|
|
762
|
+
'Ports' => {
|
|
763
|
+
'22/tcp' => [
|
|
764
|
+
{
|
|
765
|
+
'HostIp' => '0.0.0.0',
|
|
766
|
+
'HostPort' => 8022,
|
|
767
|
+
},
|
|
768
|
+
],
|
|
769
|
+
},
|
|
770
|
+
'Networks' => {
|
|
771
|
+
'podman' => {
|
|
772
|
+
'Gateway' => '192.0.2.254',
|
|
773
|
+
'IPAddress' => '192.0.2.10',
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
}
|
|
778
|
+
end
|
|
779
|
+
|
|
780
|
+
it 'falls back to the first network for the container IP' do
|
|
781
|
+
ENV['DOCKER_IN_DOCKER'] = 'true'
|
|
782
|
+
docker.provision
|
|
783
|
+
|
|
784
|
+
expect(hosts[0]['ip']).to eq '192.0.2.10'
|
|
785
|
+
expect(hosts[0]['port']).to eq 22
|
|
786
|
+
expect(hosts[0]['vm_ip']).to eq '192.0.2.10'
|
|
787
|
+
end
|
|
788
|
+
|
|
789
|
+
it 'still connects via the published port from the host' do
|
|
790
|
+
ENV['DOCKER_IN_DOCKER'] = nil
|
|
791
|
+
ENV['DOCKER_HOST'] = nil
|
|
792
|
+
docker.provision
|
|
793
|
+
|
|
794
|
+
expect(hosts[0]['ip']).to eq '127.0.0.1'
|
|
795
|
+
expect(hosts[0]['port']).to eq 8022
|
|
796
|
+
expect(hosts[0]['vm_ip']).to eq '192.0.2.10'
|
|
797
|
+
end
|
|
798
|
+
end
|
|
742
799
|
end
|
|
743
800
|
|
|
744
801
|
it 'generates a new /etc/hosts file referencing each host' do
|
|
@@ -857,7 +914,7 @@ module Beaker
|
|
|
857
914
|
'platform' => platform,
|
|
858
915
|
'image' => 'foobar',
|
|
859
916
|
}))
|
|
860
|
-
expect(dockerfile).to
|
|
917
|
+
expect(dockerfile).to include('ENV container docker')
|
|
861
918
|
end
|
|
862
919
|
end
|
|
863
920
|
|
|
@@ -904,7 +961,7 @@ module Beaker
|
|
|
904
961
|
'docker_image_entrypoint' => '/bin/bash',
|
|
905
962
|
}))
|
|
906
963
|
|
|
907
|
-
expect(dockerfile).to
|
|
964
|
+
expect(dockerfile).to include('ENTRYPOINT /bin/bash')
|
|
908
965
|
end
|
|
909
966
|
end
|
|
910
967
|
|
|
@@ -915,7 +972,7 @@ module Beaker
|
|
|
915
972
|
'image' => 'foobar',
|
|
916
973
|
}))
|
|
917
974
|
|
|
918
|
-
expect(dockerfile).to
|
|
975
|
+
expect(dockerfile).to include('zypper -n in openssh')
|
|
919
976
|
end
|
|
920
977
|
|
|
921
978
|
(22..39).to_a.each do |fedora_release|
|
|
@@ -926,7 +983,7 @@ module Beaker
|
|
|
926
983
|
'image' => 'foobar',
|
|
927
984
|
}))
|
|
928
985
|
|
|
929
|
-
expect(dockerfile).to
|
|
986
|
+
expect(dockerfile).to include('dnf install -y sudo')
|
|
930
987
|
end
|
|
931
988
|
end
|
|
932
989
|
|
|
@@ -937,9 +994,9 @@ module Beaker
|
|
|
937
994
|
'image' => 'foobar',
|
|
938
995
|
}))
|
|
939
996
|
|
|
940
|
-
expect(dockerfile).to
|
|
941
|
-
expect(dockerfile).to
|
|
942
|
-
expect(dockerfile).to
|
|
997
|
+
expect(dockerfile).to include('pacman --sync --refresh --noconfirm archlinux-keyring')
|
|
998
|
+
expect(dockerfile).to include('pacman --sync --refresh --noconfirm --sysupgrade')
|
|
999
|
+
expect(dockerfile).to include('pacman --sync --noconfirm curl net-tools openssh')
|
|
943
1000
|
end
|
|
944
1001
|
end
|
|
945
1002
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: beaker-docker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vox Pupuli
|
|
@@ -80,14 +80,14 @@ dependencies:
|
|
|
80
80
|
requirements:
|
|
81
81
|
- - "~>"
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: 5.
|
|
83
|
+
version: 5.3.0
|
|
84
84
|
type: :development
|
|
85
85
|
prerelease: false
|
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
|
88
88
|
- - "~>"
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: 5.
|
|
90
|
+
version: 5.3.0
|
|
91
91
|
- !ruby/object:Gem::Dependency
|
|
92
92
|
name: beaker
|
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
218
218
|
- !ruby/object:Gem::Version
|
|
219
219
|
version: '0'
|
|
220
220
|
requirements: []
|
|
221
|
-
rubygems_version: 4.0.
|
|
221
|
+
rubygems_version: 4.0.20
|
|
222
222
|
specification_version: 4
|
|
223
223
|
summary: Docker hypervisor for Beaker acceptance testing framework
|
|
224
224
|
test_files: []
|