Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use podman instead of docker for beaker-docker #48

Draft
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Jan 7, 2024

No description provided.

Comment on lines 103 to 105
run: bundle exec metadata2gha --domain ${{ inputs.domain }} --pidfile-workaround ${{ inputs.pidfile_workaround }} --beaker-facter "${{ inputs.beaker_facter }}"
run: bundle exec metadata2gha --domain ${{ inputs.domain }} --beaker-facter "${{ inputs.beaker_facter }}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that the reason for the change? A lot of thing happen recently and I fail to follow… the PR description does not help 😁

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Podman doesn't need the pidfile workaround stuff, as it doesn't have the same bug as docker.

default: ubuntu-20.04
default: ubuntu-22.04
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman can't run unprivileged containers on 20.04

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps puppet_metadata should generate the host it runs on and be aware that EL7 needs to run on 20.04 while running anything else on 22.04? Pretty sure you can set the runs-on part via a matrix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or: We merge this into a v3 branch and introduce this to modules after they drop EL7 from CI?

@evgeni
Copy link
Member Author

evgeni commented Jan 7, 2024

this breaks EL7 containers, but makes el8 work w/o pidfile workaround.

you win one, you loose one.

log from the EL7 run:

2024-01-07T14:51:29.3739641Z �[00;00m�[00;37mCreating container from image 292708dfc06f
2024-01-07T14:51:29.3740961Z �[00;00m�[00;37mpost
2024-01-07T14:51:29.3741676Z /containers/create
2024-01-07T14:51:29.3742410Z {"name"=>"beaker-centos7-64-puppet8.example.com-911583c0f1b0"}
2024-01-07T14:51:29.3744428Z {"Image":"292708dfc06f","Hostname":"centos7-64-puppet8.example.com","HostConfig":{"PortBindings":{"22/tcp":[{"HostPort":"4948","HostIp":"0.0.0.0"}]},"PublishAllPorts":true,"RestartPolicy":{"Name":"always"},"Privileged":true}}
2024-01-07T14:51:29.3947641Z �[00;00m�[00;37mget
2024-01-07T14:51:29.3948627Z /containers/d2173071e59ebc73b2dd049a99424038d258e66cbeccd83b09ad6573ec921dcc/json
2024-01-07T14:51:29.3949395Z {}
2024-01-07T14:51:29.3949784Z 
2024-01-07T14:51:29.4000245Z �[00;00m�[00;37mget
2024-01-07T14:51:29.4000828Z /info
2024-01-07T14:51:29.4001238Z {}
2024-01-07T14:51:29.4001687Z 
2024-01-07T14:51:29.7605600Z �[00;00m�[00;37mStarting container d2173071e59ebc73b2dd049a99424038d258e66cbeccd83b09ad6573ec921dcc
2024-01-07T14:51:29.7606831Z �[00;00m�[00;37mpost
2024-01-07T14:51:29.7607940Z /containers/d2173071e59ebc73b2dd049a99424038d258e66cbeccd83b09ad6573ec921dcc/start
2024-01-07T14:51:29.7608974Z {}
2024-01-07T14:51:29.7609379Z {}
2024-01-07T14:51:29.9790901Z �[00;00m�[00;37mget
2024-01-07T14:51:29.9791948Z /containers/d2173071e59ebc73b2dd049a99424038d258e66cbeccd83b09ad6573ec921dcc/stats
2024-01-07T14:51:29.9793186Z {:stream=>0}
2024-01-07T14:51:29.9793556Z 
2024-01-07T14:51:29.9841694Z �[00;00m�[00;37mget
2024-01-07T14:51:29.9842655Z /containers/d2173071e59ebc73b2dd049a99424038d258e66cbeccd83b09ad6573ec921dcc/json
2024-01-07T14:51:29.9843810Z {}
2024-01-07T14:51:29.9844109Z 
2024-01-07T14:51:29.9863904Z �[00;00m�[00;32mUsing container connection at 127.0.0.1:4948
2024-01-07T14:51:29.9865580Z �[00;00m�[00;37mnode available as ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@127.0.0.1 -p 4948
2024-01-07T14:51:29.9867175Z �[00;00m�[00;37mget
2024-01-07T14:51:29.9867738Z /containers/d2173071e59ebc73b2dd049a99424038d258e66cbeccd83b09ad6573ec921dcc/json
2024-01-07T14:51:29.9868460Z {}
2024-01-07T14:51:29.9868658Z 
2024-01-07T14:51:29.9883839Z �[00;00m�[00;37m
2024-01-07T14:51:29.9884723Z centos7-64-puppet8.example.com 14:51:29$ cat /etc/resolv.conf
2024-01-07T14:51:29.9887725Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"]}
2024-01-07T14:51:30.1878916Z �[00;00m�[01;31m  Warning: Try 1 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:51:30.1880080Z �[00;00m�[01;31m  Warning: Trying again in 3 seconds
2024-01-07T14:51:33.1919970Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:51:33.3756358Z �[00;00m�[01;31m  Warning: Try 2 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:51:33.3757262Z �[00;00m�[01;31m  Warning: Trying again in 5 seconds
2024-01-07T14:51:38.3768823Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:51:38.5605308Z �[00;00m�[01;31m  Warning: Try 3 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:51:38.5606762Z �[00;00m�[01;31m  Warning: Trying again in 8 seconds
2024-01-07T14:51:46.5695177Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:51:46.7531827Z �[00;00m�[01;31m  Warning: Try 4 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:51:46.7532695Z �[00;00m�[01;31m  Warning: Trying again in 13 seconds
2024-01-07T14:51:59.7620117Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:51:59.9455997Z �[00;00m�[01;31m  Warning: Try 5 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:51:59.9457019Z �[00;00m�[01;31m  Warning: Trying again in 21 seconds
2024-01-07T14:52:20.9674262Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:52:21.1512103Z �[00;00m�[01;31m  Warning: Try 6 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:52:21.1513052Z �[00;00m�[01;31m  Warning: Trying again in 34 seconds
2024-01-07T14:52:55.1862281Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:52:55.3707975Z �[00;00m�[01;31m  Warning: Try 7 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:52:55.3709196Z �[00;00m�[01;31m  Warning: Trying again in 55 seconds
2024-01-07T14:53:50.3776013Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:53:50.5615216Z �[00;00m�[01;31m  Warning: Try 8 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:53:50.5616353Z �[00;00m�[01;31m  Warning: Trying again in 89 seconds
2024-01-07T14:55:19.6516629Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:55:19.8353476Z �[00;00m�[01;31m  Warning: Try 9 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:55:19.8354405Z �[00;00m�[01;31m  Warning: Trying again in 144 seconds
2024-01-07T14:57:43.9139993Z �[00;00m�[00;37m  Attempting ssh connection to 127.0.0.1, user: root, opts: {:***"root", :port=>"4948", :forward_agent=>false, :auth_methods=>["password", "publickey", "hostbased", "keyboard-interactive"], :logger=>#<Logger:0x00007f7f9c16af08 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f7f9c877be8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f7f9c16aeb8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f7f9c877440>, @mon_data_owner_object_id=6440>>, :password_prompt=>#<Net::SSH::Prompt:0x00007f7f9c874bc8>, :user=>"root"}
2024-01-07T14:57:44.0985968Z �[00;00m�[01;31m  Warning: Try 10 -- Host 127.0.0.1 unreachable: Errno::ECONNRESET - Connection reset by peer
2024-01-07T14:57:44.0986856Z �[00;00m�[01;31m  Warning: Trying again in 233 seconds
2024-01-07T15:00:19.7514549Z ##[error]The operation was canceled.

@@ -152,6 +152,12 @@ jobs:
name: "${{ matrix.name }}"
steps:
- uses: actions/checkout@v4
- name: Setup podman
if: ${{ inputs.beaker_hypervisor == 'docker_podman' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually support docker_podman as a type? How it work is:
https://github.com/voxpupuli/beaker/blob/9e1013356cb06cca682c8e385c7232c7c64502cc/lib/beaker/hypervisor.rb#L30-L32

So that translates to require "beaker/hypervisor/docker_podman", which AFAIK doesn't exist. At least https://github.com/voxpupuli/beaker-docker/blob/master/lib/beaker/hypervisor/docker_podman.rb is a 404.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that still needs creation. Otherwise there is no way to distinguish docker and podman, as they are in the same docker.rb

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the primary question should be "do we want people to be able to select docker vs podman" (so creating a docker_podman.rb with essentially module Beaker, class DockerPodman < Beaker::Docker, end, end in it) or should we default to podman and just ignore "real" docker.

Personally, I think letting people select is better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think we should use a docker_podman.rb. That enables people to chosse and we've an option to patch code for podman. There are scenarios where it works in a slightly different way, so having an option to apply patches makes sense to me.

Edit:
required changes:

Tested at: voxpupuli/puppet-zabbix#935

bastelfreak added a commit to bastelfreak/beaker-docker that referenced this pull request Mar 17, 2024
This allows us to set the beaker hypervisor not only to `docker`,
but also to `docker_podmand`. This enables us to implement podman
specific patches (if we ever need to). But it also makes it easier
for modules to specify if they want to use podman or docker. See
voxpupuli/gha-puppet#48 for reference.
bastelfreak added a commit to bastelfreak/beaker-docker that referenced this pull request Mar 17, 2024
This allows us to set the beaker hypervisor not only to `docker`,
but also to `docker_podmand`. This enables us to implement podman
specific patches (if we ever need to). But it also makes it easier
for modules to specify if they want to use podman or docker. See
voxpupuli/gha-puppet#48 for reference.
bastelfreak added a commit to bastelfreak/beaker-docker that referenced this pull request Mar 17, 2024
This allows us to set the beaker hypervisor not only to `docker`,
but also to `docker_podmand`. This enables us to implement podman
specific patches (if we ever need to). But it also makes it easier
for modules to specify if they want to use podman or docker. See
voxpupuli/gha-puppet#48 for reference.
bastelfreak added a commit to bastelfreak/beaker-hostgenerator that referenced this pull request Mar 17, 2024
This adds support for a `docker_podman` hypervisor. it will call the
default docker implementation at the moment. See voxpupuli/gha-puppet#48
for context.
@bastelfreak
Copy link
Member

For https://github.com/voxpupuli/puppet-zabbix/actions/runs/8317740866 I noticed that Ubuntu 20.04/22.04 and Debian 12 trigger the following error:
{"cause":"container state improper","message":"container state improper","response":409}
bug: containers/podman#21051

That's fixed in podman 4.2.0 but Ubuntu 22.04 only brings 3.4.4. I hacked something together (from containers/podman#21051) to install a newer version: bastelfreak@b347ebf

And that works now: https://github.com/voxpupuli/puppet-zabbix/actions/runs/8318272708/job/22760921294

@evgeni evgeni force-pushed the podman branch 2 times, most recently from 57b0e00 to 57576c5 Compare March 27, 2024 17:58
bastelfreak added a commit to bastelfreak/beaker-docker that referenced this pull request Mar 27, 2024
This allows us to set the beaker hypervisor not only to `docker`,
but also to `docker_podmand`. This enables us to implement podman
specific patches (if we ever need to). But it also makes it easier
for modules to specify if they want to use podman or docker. See
voxpupuli/gha-puppet#48 for reference.
bastelfreak added a commit to bastelfreak/beaker-docker that referenced this pull request Mar 27, 2024
This allows us to set the beaker hypervisor not only to `docker`,
but also to `docker_podmand`. This enables us to implement podman
specific patches (if we ever need to). But it also makes it easier
for modules to specify if they want to use podman or docker. See
voxpupuli/gha-puppet#48 for reference.
bastelfreak added a commit to bastelfreak/beaker-docker that referenced this pull request Mar 27, 2024
This allows us to set the beaker hypervisor not only to `docker`,
but also to `docker_podmand`. This enables us to implement podman
specific patches (if we ever need to). But it also makes it easier
for modules to specify if they want to use podman or docker. See
voxpupuli/gha-puppet#48 for reference.
bastelfreak added a commit to bastelfreak/beaker-docker that referenced this pull request Mar 27, 2024
This allows us to set the beaker hypervisor not only to `docker`,
but also to `docker_podmand`. This enables us to implement podman
specific patches (if we ever need to). But it also makes it easier
for modules to specify if they want to use podman or docker. See
voxpupuli/gha-puppet#48 for reference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants