beaker-docker 1.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f4f7b1cd703a47b1d9e0ef3ee4674fefca4859b051f1a9d3d90cd84e9d00314
4
- data.tar.gz: c7a93b50fd1d1c17bf54d58082131e29e6e20837a46ec65e12e013fa1fdb3aca
3
+ metadata.gz: 0ce1f4aae26967ce3b8f4d3d24db2a23c2a09b19a749d40bdd7c731d64201f3b
4
+ data.tar.gz: 711d8f36b0f39494206dbf6c06ffc602f213ad8681ba423529d413240c3d9c9c
5
5
  SHA512:
6
- metadata.gz: ffc27af960c9686c3371d52e124a759456d57c64172443c061b573a4ffbb5756529c5ac686e379e707dc0480e495c7b64111745ba5930e3094803a07ed3534b4
7
- data.tar.gz: 8633cd8a006ed012159784c42934818162d33a1d5d9062d520ed1152e001773aa1de5701ce3e71de263d25fa5b38d3948b61e12936b26c7a1440c64933e4c315
6
+ metadata.gz: b7c52174a22413d6aa3a99cd0c9e98e8c3cef1c4f973edf9c3a0bd5c4c5e1c854c87c5147310e93ea387bb08ea1a11e6cd71d4dd44dd291db73619f2663f29bc
7
+ data.tar.gz: 13bf5b863f187e020040ac56504bae971bc0f27ae07ccd4e598325762782a269d56297cacd00b732a0fdd25e89d746aa7d7193aa8234f225c94c20d304a28ace
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0](https://github.com/voxpupuli/beaker-docker/tree/1.2.0) (2022-08-11)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/1.1.1...1.2.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Use ssh-keygen -A on modern Enterprise Linux [\#66](https://github.com/voxpupuli/beaker-docker/pull/66) ([ekohl](https://github.com/ekohl))
10
+ - Add Docker hostfile parameter docker\_image\_first\_commands [\#65](https://github.com/voxpupuli/beaker-docker/pull/65) ([Rathios](https://github.com/Rathios))
11
+
12
+ ## [1.1.1](https://github.com/voxpupuli/beaker-docker/tree/1.1.1) (2022-02-17)
13
+
14
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/1.1.0...1.1.1)
15
+
16
+ **Fixed bugs:**
17
+
18
+ - Arch Linux: do not install openssh twice [\#58](https://github.com/voxpupuli/beaker-docker/pull/58) ([bastelfreak](https://github.com/bastelfreak))
19
+
20
+ **Merged pull requests:**
21
+
22
+ - Remove beaker from Gemfile [\#62](https://github.com/voxpupuli/beaker-docker/pull/62) ([bastelfreak](https://github.com/bastelfreak))
23
+ - CI: Switch centos:8 to centos:stream8 image [\#61](https://github.com/voxpupuli/beaker-docker/pull/61) ([bastelfreak](https://github.com/bastelfreak))
24
+
25
+ ## [1.1.0](https://github.com/voxpupuli/beaker-docker/tree/1.1.0) (2022-01-27)
26
+
27
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/1.0.1...1.1.0)
28
+
29
+ **Implemented enhancements:**
30
+
31
+ - Use host\_packages helper to reuse logic from beaker [\#59](https://github.com/voxpupuli/beaker-docker/pull/59) ([ekohl](https://github.com/ekohl))
32
+
3
33
  ## [1.0.1](https://github.com/voxpupuli/beaker-docker/tree/1.0.1) (2021-09-13)
4
34
 
5
35
  [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/1.0.0...1.0.1)
data/Gemfile CHANGED
@@ -2,24 +2,6 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- def location_for(place, fake_version = nil)
6
- if place =~ /^git:([^#]*)#(.*)/
7
- [fake_version, { :git => $1, :branch => $2, :require => false }].compact
8
- elsif place =~ /^file:\/\/(.*)/
9
- ['>= 0', { :path => File.expand_path($1), :require => false }]
10
- else
11
- [place, { :require => false }]
12
- end
13
- end
14
-
15
-
16
- # We don't put beaker in as a test dependency because we
17
- # don't want to create a transitive dependency
18
- group :acceptance_testing do
19
- gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 4.30')
20
- end
21
-
22
-
23
5
  if File.exists? "#{__FILE__}.local"
24
6
  eval(File.read("#{__FILE__}.local"), binding)
25
7
  end
@@ -3,7 +3,7 @@ HOSTS:
3
3
  centos8:
4
4
  platform: el-8-x86_64
5
5
  hypervisor: docker
6
- image: centos:8
6
+ image: quay.io/centos/centos:stream8
7
7
  roles:
8
8
  - master
9
9
  - agent
@@ -31,6 +31,5 @@ Gem::Specification.new do |s|
31
31
  # Run time dependencies
32
32
  s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
33
33
  s.add_runtime_dependency 'docker-api', '~> 2.1'
34
-
34
+ s.add_runtime_dependency 'beaker', '>= 4.34'
35
35
  end
36
-
data/docker.md CHANGED
@@ -23,13 +23,22 @@ The base image to use for the container is named by the image key.
23
23
  type: foss
24
24
 
25
25
  ### Docker hosts file, with image modification ###
26
- You can specify extra commands to be executed in order to modify the image with the `docker_image_commands` key.
26
+ You can specify extra commands to be executed in order to modify the image with the keys `docker_image_commands` and
27
+ `docker_image_first_commands`.
28
+
29
+ `docker_image_commands` is executed after initial setup. `docker_image_first_commands` is executed before any other
30
+ commands and can be used eg. to configure a proxy.
27
31
 
28
32
  HOSTS:
29
33
  ubuntu-12-10:
30
34
  platform: ubuntu-12.10-x64
31
35
  image: ubuntu:12.10
32
36
  hypervisor: docker
37
+ docker_image_first_commands:
38
+ - echo 'Acquire::http::Proxy "http://proxy.example.com:3128";'> /etc/apt/apt.conf.d/01proxy
39
+ - echo "export http_proxy=http://proxy.example.com:3128"> /etc/profile.d/proxy.sh
40
+ - echo "export https_proxy=http://proxy.example.com:3128">> /etc/profile.d/proxy.sh
41
+ - echo "export no_proxy=127.0.0.1,::1">> /etc/profile.d/proxy.sh
33
42
  docker_image_commands:
34
43
  - 'apt-get install -y myapp'
35
44
  - 'myapp --setup'
@@ -53,7 +62,7 @@ Instead of using ssh as the CMD for a container, beaker will use the entrypoint
53
62
 
54
63
  HOSTS:
55
64
  puppetserver:
56
- platform: ubuntu-1604-x86_64
65
+ platform: ubuntu-1604-x86_64
57
66
  hypervisor: docker
58
67
  image: puppet/puppetserver-standalone:6.0.1
59
68
  use_image_entry_point: true
@@ -401,8 +401,7 @@ module Beaker
401
401
  when /el-[89]/, /fedora-(2[2-9]|3[0-9])/
402
402
  container.exec(%w(dnf clean all))
403
403
  container.exec(%w(dnf install -y sudo openssh-server openssh-clients))
404
- container.exec(%w(ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key))
405
- container.exec(%w(ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key))
404
+ container.exec(%w(ssh-keygen -A))
406
405
  container.exec(%w(sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/*))
407
406
  when /^el-/, /centos/, /fedora/, /redhat/, /eos/
408
407
  container.exec(%w(yum clean all))
@@ -516,29 +515,35 @@ module Beaker
516
515
  ENV container docker
517
516
  EOF
518
517
 
518
+ # Commands before any other commands. Can be used for eg. proxy configuration
519
+ dockerfile += (host['docker_image_first_commands'] || []).map { |command|
520
+ "RUN #{command}\n"
521
+ }.join('')
522
+
519
523
  # additional options to specify to the sshd
520
524
  # may vary by platform
521
525
  sshd_options = ''
522
526
 
523
527
  # add platform-specific actions
524
528
  service_name = "sshd"
529
+ additional_packages = host_packages(host)
525
530
  case host['platform']
526
531
  when /ubuntu/, /debian/
527
532
  service_name = "ssh"
528
533
  dockerfile += <<~EOF
529
534
  RUN apt-get update
530
- RUN apt-get install -y openssh-server openssh-client #{Beaker::HostPrebuiltSteps::DEBIAN_PACKAGES.join(' ')}
535
+ RUN apt-get install -y openssh-server openssh-client #{additional_packages.join(' ')}
531
536
  RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/*
532
537
  EOF
533
538
  when /cumulus/
534
539
  dockerfile += <<~EOF
535
540
  RUN apt-get update
536
- RUN apt-get install -y openssh-server openssh-client #{Beaker::HostPrebuiltSteps::CUMULUS_PACKAGES.join(' ')}
541
+ RUN apt-get install -y openssh-server openssh-client #{additional_packages.join(' ')}
537
542
  EOF
538
543
  when /el-[89]/, /fedora-(2[2-9]|3)/
539
544
  dockerfile += <<~EOF
540
545
  RUN dnf clean all
541
- RUN dnf install -y sudo openssh-server openssh-clients #{Beaker::HostPrebuiltSteps::RHEL8_PACKAGES.join(' ')}
546
+ RUN dnf install -y sudo openssh-server openssh-clients #{additional_packages.join(' ')}
542
547
  RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
543
548
  RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
544
549
  RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/*
@@ -546,14 +551,14 @@ module Beaker
546
551
  when /^el-/, /centos/, /fedora/, /redhat/, /eos/
547
552
  dockerfile += <<~EOF
548
553
  RUN yum clean all
549
- RUN yum install -y sudo openssh-server openssh-clients #{Beaker::HostPrebuiltSteps::UNIX_PACKAGES.join(' ')}
554
+ RUN yum install -y sudo openssh-server openssh-clients #{additional_packages.join(' ')}
550
555
  RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
551
556
  RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
552
557
  RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/*
553
558
  EOF
554
559
  when /opensuse/, /sles/
555
560
  dockerfile += <<~EOF
556
- RUN zypper -n in openssh #{Beaker::HostPrebuiltSteps::SLES_PACKAGES.join(' ')}
561
+ RUN zypper -n in openssh #{additional_packages.join(' ')}
557
562
  RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
558
563
  RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
559
564
  RUN sed -ri 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config
@@ -561,9 +566,9 @@ module Beaker
561
566
  EOF
562
567
  when /archlinux/
563
568
  dockerfile += <<~EOF
564
- RUN pacman --noconfirm -Sy archlinux-keyring
565
- RUN pacman --noconfirm -Syu
566
- RUN pacman -S --noconfirm openssh #{Beaker::HostPrebuiltSteps::ARCHLINUX_PACKAGES.join(' ')}
569
+ RUN pacman --sync --refresh --noconfirm archlinux-keyring
570
+ RUN pacman --sync --refresh --noconfirm --sysupgrade
571
+ RUN pacman --sync --noconfirm #{additional_packages.join(' ')}
567
572
  RUN ssh-keygen -A
568
573
  RUN sed -ri 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config
569
574
  RUN systemctl enable sshd
@@ -1,3 +1,3 @@
1
1
  module BeakerDocker
2
- VERSION = '1.0.1'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -692,6 +692,23 @@ module Beaker
692
692
  end
693
693
  end
694
694
 
695
+ it 'should add docker_image_first_commands as RUN statements' do
696
+ FakeFS.deactivate!
697
+ platforms.each do |platform|
698
+ dockerfile = docker.send(:dockerfile_for, {
699
+ 'platform' => platform,
700
+ 'image' => 'foobar',
701
+ 'docker_image_first_commands' => [
702
+ 'special one',
703
+ 'special two',
704
+ 'special three',
705
+ ]
706
+ })
707
+
708
+ expect( dockerfile ).to be =~ /RUN special one\nRUN special two\nRUN special three/
709
+ end
710
+ end
711
+
695
712
  it 'should add docker_image_commands as RUN statements' do
696
713
  FakeFS.deactivate!
697
714
  platforms.each do |platform|
@@ -751,7 +768,9 @@ module Beaker
751
768
  'image' => 'foobar',
752
769
  })
753
770
 
754
- expect( dockerfile ).to be =~ /RUN pacman -S --noconfirm openssh/
771
+ expect( dockerfile ).to match(/RUN pacman --sync --refresh --noconfirm archlinux-keyring/)
772
+ expect( dockerfile ).to match(/RUN pacman --sync --refresh --noconfirm --sysupgrade/)
773
+ expect( dockerfile ).to match(/RUN pacman --sync --noconfirm curl ntp net-tools openssh/)
755
774
  end
756
775
  end
757
776
  end
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: 1.0.1
4
+ version: 1.2.0
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: 2021-09-13 00:00:00.000000000 Z
14
+ date: 2022-08-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -97,6 +97,20 @@ dependencies:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
99
  version: '2.1'
100
+ - !ruby/object:Gem::Dependency
101
+ name: beaker
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '4.34'
107
+ type: :runtime
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '4.34'
100
114
  description: For use for the Beaker acceptance testing tool
101
115
  email:
102
116
  - voxpupuli@groups.io
@@ -144,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0'
146
160
  requirements: []
147
- rubygems_version: 3.2.22
161
+ rubygems_version: 3.2.33
148
162
  signing_key:
149
163
  specification_version: 4
150
164
  summary: Beaker DSL Extension Helpers!