beaker-docker 2.4.0 → 2.5.1

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: c3f0bbe394205e745cae22a3fdc5b7fbbfc8c1d249a66c0643965be119889e74
4
- data.tar.gz: 74fcee3180ea629537014d1c584fe7d3823819533a8e0a6ff713dc1414bd8779
3
+ metadata.gz: 663845682645f35c699e62cb65407975264952a259b7f80c962130d63750ec5c
4
+ data.tar.gz: d841fc687d1e0b2478d0145aea14149595b37c015b048fb4e6f4eb7f41e70f21
5
5
  SHA512:
6
- metadata.gz: d960dca1afe2a89bf8bec6d87c739ca7d0b5cf5def2c9f9c454e6fe47d2cb59b428d2bc89c622932c65218826318fa3e8595bcea51415bfb3c57f064e00be151
7
- data.tar.gz: d2f9001431ded7693d1147ad6f7de4662dab404e826dd234e0947296ddc6617f588ce5a9980e9887c3ecb1394fa4d045328b1c8480ac74e2bb603d97212f63c5
6
+ metadata.gz: 8fe5794c4c016d120c4ea55f2ee9ae6371be415664a727e1e48bebd61ffe7f79fed7563b15c694b77151e890c056273cd1d1ec1003191bfe1094c91ba5676616
7
+ data.tar.gz: 1f39d9e2c41d9eb34188cef8ca0942478f1cf7fbf32404d7f25e6461cdfadc21dba7d110288458dfd2d5fe1615a084643c9b846b57332b5f27f131677573f64e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.5.1](https://github.com/voxpupuli/beaker-docker/tree/2.5.1) (2024-11-20)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/2.5.0...2.5.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Update sshd configuration \(UsePAM no, sshd\_config.d\) [\#148](https://github.com/voxpupuli/beaker-docker/pull/148) ([jay7x](https://github.com/jay7x))
10
+
11
+ ## [2.5.0](https://github.com/voxpupuli/beaker-docker/tree/2.5.0) (2024-09-20)
12
+
13
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/2.4.0...2.5.0)
14
+
15
+ **Implemented enhancements:**
16
+
17
+ - add ContainerDocker and ContainerSwarm [\#145](https://github.com/voxpupuli/beaker-docker/pull/145) ([evgeni](https://github.com/evgeni))
18
+ - Add ContainerPodman class [\#130](https://github.com/voxpupuli/beaker-docker/pull/130) ([bastelfreak](https://github.com/bastelfreak))
19
+
20
+ **Merged pull requests:**
21
+
22
+ - fix tests after Beaker::Platform refactoring [\#146](https://github.com/voxpupuli/beaker-docker/pull/146) ([evgeni](https://github.com/evgeni))
23
+
3
24
  ## [2.4.0](https://github.com/voxpupuli/beaker-docker/tree/2.4.0) (2024-08-13)
4
25
 
5
26
  [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/2.3.1...2.4.0)
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'beaker/hypervisor/docker'
4
+
5
+ module Beaker
6
+ class Container < Beaker::Docker
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'beaker/hypervisor/container'
4
+
5
+ module Beaker
6
+ class ContainerDocker < Beaker::Container
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'beaker/hypervisor/container'
4
+
5
+ module Beaker
6
+ class ContainerPodman < Beaker::Container
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'beaker/hypervisor/container'
4
+
5
+ module Beaker
6
+ class ContainerSwarm < Beaker::Container
7
+ end
8
+ end
@@ -525,7 +525,6 @@ module Beaker
525
525
  dockerfile += <<~DF
526
526
  RUN zypper -n in openssh #{additional_packages.join(' ')} \
527
527
  && ssh-keygen -A \
528
- && sed -ri 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config \
529
528
  && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/*
530
529
  DF
531
530
  when /archlinux/
@@ -534,7 +533,6 @@ module Beaker
534
533
  && pacman --sync --refresh --noconfirm --sysupgrade \
535
534
  && pacman --sync --noconfirm #{additional_packages.join(' ')} \
536
535
  && ssh-keygen -A \
537
- && sed -ri 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config \
538
536
  && systemctl enable sshd
539
537
  DF
540
538
  else
@@ -552,13 +550,15 @@ module Beaker
552
550
  # Also, disable reverse DNS lookups to prevent every. single. ssh
553
551
  # operation taking 30 seconds while the lookup times out.
554
552
  # Also unbreak users with a bunch of SSH keys loaded in their keyring.
553
+ # Also unbreak CentOS9 & Fedora containers on Ubuntu 24.04 host (UsePAM no)
555
554
  dockerfile += <<~DF
556
- RUN sed -ri \
555
+ RUN find /etc/ssh/sshd_config /etc/ssh/sshd_config.d/ -type f -exec sed -ri \
557
556
  -e 's/^#?PermitRootLogin .*/PermitRootLogin yes/' \
558
557
  -e 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' \
559
558
  -e 's/^#?UseDNS .*/UseDNS no/' \
559
+ -e 's/^#?UsePAM .*/UsePAM no/' \
560
560
  -e 's/^#?MaxAuthTries.*/MaxAuthTries 1000/' \
561
- /etc/ssh/sshd_config
561
+ {} \\;
562
562
  DF
563
563
 
564
564
  # Any extra commands specified for the host
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeakerDocker
4
- VERSION = '2.4.0'
4
+ VERSION = '2.5.1'
5
5
  end
@@ -6,7 +6,6 @@ require 'fakefs/spec_helpers'
6
6
  module Beaker
7
7
  platforms = [
8
8
  'ubuntu-14.04-x86_64',
9
- 'cumulus-2.2-x86_64',
10
9
  'fedora-22-x86_64',
11
10
  'centos-7-x86_64',
12
11
  'sles-12-x86_64',
@@ -190,14 +189,14 @@ module Beaker
190
189
  end
191
190
 
192
191
  it 'accepts alpine as valid platform' do
193
- host['platform'] = 'alpine-3.8-x86_64'
192
+ host['platform'] = Beaker::Platform.new('alpine-3.8-x86_64')
194
193
  expect(test_container).to receive(:exec).at_least(:twice)
195
194
  docker.install_ssh_components(test_container, host)
196
195
  end
197
196
 
198
197
  it 'raises an error with an unsupported platform' do
199
- host['platform'] = 'boogeyman-2000-x86_64'
200
- expect { docker.install_ssh_components(test_container, host) }.to raise_error(RuntimeError, /boogeyman/)
198
+ host['platform'] = Beaker::Platform.new('windows-11-64')
199
+ expect { docker.install_ssh_components(test_container, host) }.to raise_error(RuntimeError, /windows/)
201
200
  end
202
201
  end
203
202
 
@@ -632,16 +631,16 @@ module Beaker
632
631
  describe '#dockerfile_for' do
633
632
  FakeFS.deactivate!
634
633
  it 'raises on an unsupported platform' do
635
- expect { docker.send(:dockerfile_for, { 'platform' => 'a_sidewalk', 'image' => 'foobar' }) }.to raise_error(/platform a_sidewalk not yet supported/)
634
+ expect { docker.send(:dockerfile_for, make_host('none', { 'platform' => 'solaris-11-64', 'image' => 'foobar' })) }.to raise_error(/platform solaris-11-64 not yet supported/)
636
635
  end
637
636
 
638
637
  it 'sets "ENV container docker"' do
639
638
  FakeFS.deactivate!
640
639
  platforms.each do |platform|
641
- dockerfile = docker.send(:dockerfile_for, {
642
- 'platform' => platform,
643
- 'image' => 'foobar',
644
- })
640
+ dockerfile = docker.send(:dockerfile_for, make_host('none', {
641
+ 'platform' => platform,
642
+ 'image' => 'foobar',
643
+ }))
645
644
  expect(dockerfile).to match(/ENV container docker/)
646
645
  end
647
646
  end
@@ -649,15 +648,15 @@ module Beaker
649
648
  it 'adds docker_image_first_commands as RUN statements' do
650
649
  FakeFS.deactivate!
651
650
  platforms.each do |platform|
652
- dockerfile = docker.send(:dockerfile_for, {
653
- 'platform' => platform,
654
- 'image' => 'foobar',
655
- 'docker_image_first_commands' => [
656
- 'special one',
657
- 'special two',
658
- 'special three',
659
- ],
660
- })
651
+ dockerfile = docker.send(:dockerfile_for, make_host('none', {
652
+ 'platform' => platform,
653
+ 'image' => 'foobar',
654
+ 'docker_image_first_commands' => [
655
+ 'special one',
656
+ 'special two',
657
+ 'special three',
658
+ ],
659
+ }))
661
660
 
662
661
  expect(dockerfile).to match(/RUN special one\nRUN special two\nRUN special three/)
663
662
  end
@@ -666,15 +665,15 @@ module Beaker
666
665
  it 'adds docker_image_commands as RUN statements' do
667
666
  FakeFS.deactivate!
668
667
  platforms.each do |platform|
669
- dockerfile = docker.send(:dockerfile_for, {
670
- 'platform' => platform,
671
- 'image' => 'foobar',
672
- 'docker_image_commands' => [
673
- 'special one',
674
- 'special two',
675
- 'special three',
676
- ],
677
- })
668
+ dockerfile = docker.send(:dockerfile_for, make_host('none', {
669
+ 'platform' => platform,
670
+ 'image' => 'foobar',
671
+ 'docker_image_commands' => [
672
+ 'special one',
673
+ 'special two',
674
+ 'special three',
675
+ ],
676
+ }))
678
677
 
679
678
  expect(dockerfile).to match(/RUN special one\nRUN special two\nRUN special three/)
680
679
  end
@@ -683,11 +682,11 @@ module Beaker
683
682
  it 'adds docker_image_entrypoint' do
684
683
  FakeFS.deactivate!
685
684
  platforms.each do |platform|
686
- dockerfile = docker.send(:dockerfile_for, {
687
- 'platform' => platform,
688
- 'image' => 'foobar',
689
- 'docker_image_entrypoint' => '/bin/bash',
690
- })
685
+ dockerfile = docker.send(:dockerfile_for, make_host('none', {
686
+ 'platform' => platform,
687
+ 'image' => 'foobar',
688
+ 'docker_image_entrypoint' => '/bin/bash',
689
+ }))
691
690
 
692
691
  expect(dockerfile).to match(%r{ENTRYPOINT /bin/bash})
693
692
  end
@@ -695,10 +694,10 @@ module Beaker
695
694
 
696
695
  it 'uses zypper on sles' do
697
696
  FakeFS.deactivate!
698
- dockerfile = docker.send(:dockerfile_for, {
699
- 'platform' => 'sles-12-x86_64',
700
- 'image' => 'foobar',
701
- })
697
+ dockerfile = docker.send(:dockerfile_for, make_host('none', {
698
+ 'platform' => Beaker::Platform.new('sles-12-x86_64'),
699
+ 'image' => 'foobar',
700
+ }))
702
701
 
703
702
  expect(dockerfile).to match(/zypper -n in openssh/)
704
703
  end
@@ -706,10 +705,10 @@ module Beaker
706
705
  (22..39).to_a.each do |fedora_release|
707
706
  it "uses dnf on fedora #{fedora_release}" do
708
707
  FakeFS.deactivate!
709
- dockerfile = docker.send(:dockerfile_for, {
710
- 'platform' => "fedora-#{fedora_release}-x86_64",
711
- 'image' => 'foobar',
712
- })
708
+ dockerfile = docker.send(:dockerfile_for, make_host('none', {
709
+ 'platform' => Beaker::Platform.new("fedora-#{fedora_release}-x86_64"),
710
+ 'image' => 'foobar',
711
+ }))
713
712
 
714
713
  expect(dockerfile).to match(/dnf install -y sudo/)
715
714
  end
@@ -717,14 +716,14 @@ module Beaker
717
716
 
718
717
  it 'uses pacman on archlinux' do
719
718
  FakeFS.deactivate!
720
- dockerfile = docker.send(:dockerfile_for, {
721
- 'platform' => 'archlinux-current-x86_64',
722
- 'image' => 'foobar',
723
- })
719
+ dockerfile = docker.send(:dockerfile_for, make_host('none', {
720
+ 'platform' => Beaker::Platform.new('archlinux-current-x86_64'),
721
+ 'image' => 'foobar',
722
+ }))
724
723
 
725
724
  expect(dockerfile).to match(/pacman --sync --refresh --noconfirm archlinux-keyring/)
726
725
  expect(dockerfile).to match(/pacman --sync --refresh --noconfirm --sysupgrade/)
727
- expect(dockerfile).to match(/pacman --sync --noconfirm curl ntp net-tools openssh/)
726
+ expect(dockerfile).to match(/pacman --sync --noconfirm curl net-tools openssh/)
728
727
  end
729
728
  end
730
729
 
@@ -747,21 +746,21 @@ module Beaker
747
746
  end
748
747
 
749
748
  it 'execs sshd on alpine' do
750
- host['platform'] = 'alpine-3.8-x86_64'
749
+ host['platform'] = Beaker::Platform.new('alpine-3.8-x86_64')
751
750
  expect(test_container).to receive(:exec).with(array_including('sed'))
752
751
  expect(test_container).to receive(:exec).with(%w[/usr/sbin/sshd])
753
752
  docker.send(:fix_ssh, test_container, host)
754
753
  end
755
754
 
756
755
  it 'restarts ssh service on ubuntu' do
757
- host['platform'] = 'ubuntu-20.04-x86_64'
756
+ host['platform'] = Beaker::Platform.new('ubuntu-20.04-x86_64')
758
757
  expect(test_container).to receive(:exec).with(array_including('sed'))
759
758
  expect(test_container).to receive(:exec).with(%w[service ssh restart])
760
759
  docker.send(:fix_ssh, test_container, host)
761
760
  end
762
761
 
763
762
  it 'restarts sshd service otherwise' do
764
- host['platform'] = 'boogeyman-2000-x86_64'
763
+ host['platform'] = Beaker::Platform.new('centos-6-x86_64')
765
764
  expect(test_container).to receive(:exec).with(array_including('sed'))
766
765
  expect(test_container).to receive(:exec).with(%w[service sshd restart])
767
766
  docker.send(:fix_ssh, test_container, host)
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: 2.4.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-08-13 00:00:00.000000000 Z
14
+ date: 2024-11-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fakefs
@@ -151,6 +151,10 @@ files:
151
151
  - docker.md
152
152
  - lib/beaker-docker.rb
153
153
  - lib/beaker-docker/version.rb
154
+ - lib/beaker/hypervisor/container.rb
155
+ - lib/beaker/hypervisor/container_docker.rb
156
+ - lib/beaker/hypervisor/container_podman.rb
157
+ - lib/beaker/hypervisor/container_swarm.rb
154
158
  - lib/beaker/hypervisor/docker.rb
155
159
  - spec/beaker/hypervisor/docker_spec.rb
156
160
  - spec/spec_helper.rb
@@ -176,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
180
  - !ruby/object:Gem::Version
177
181
  version: '0'
178
182
  requirements: []
179
- rubygems_version: 3.5.11
183
+ rubygems_version: 3.5.22
180
184
  signing_key:
181
185
  specification_version: 4
182
186
  summary: Docker hypervisor for Beaker acceptance testing framework