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

set flag for container to container communication #84

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ jobs:
- name: Run acceptance tests
run: bundle exec rake test:acceptance

beaker_in_container:
runs-on: ubuntu-latest
name: Docker - Beaker in container connection test
steps:
- uses: actions/checkout@v3
# use this and not container key from gha to not have a docker network from github
- name: Run Beaker in docker container
uses: addnab/docker-run-action@v3
with:
image: puppet/puppet-dev-tools:2023-02-24-1bca42e
options: -v ${{ github.workspace }}:/work
run: |
cd /work
ls -la
bundle install
export DOCKER_IN_DOCKER=true
bundle exec rake test:acceptance

podman:
runs-on: ubuntu-latest
strategy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ doc
# Vagrant folder
.vagrant/
.vagrant_files/
vendor/bundle
11 changes: 2 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-12-21 18:24:52 UTC using RuboCop version 1.12.1.
# on 2023-03-03 13:24:13 UTC using RuboCop version 1.12.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -541,13 +541,6 @@ Style/GuardClause:
Exclude:
- 'lib/beaker/hypervisor/docker.rb'

# Offense count: 39
# Cop supports --auto-correct.
# Configuration parameters: UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Style/HashSyntax:
EnforcedStyle: hash_rockets

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowIfModifier.
Expand Down Expand Up @@ -690,7 +683,7 @@ Style/StringConcatenation:
- 'lib/beaker/hypervisor/docker.rb'
- 'spec/spec_helper.rb'

# Offense count: 66
# Offense count: 64
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Expand Down
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ A quick acceptance test, named because it has no pre-suites to run
beaker_test_base_dir = File.join(beaker_gem_dir, 'acceptance/tests/base')
load_path_option = File.join(beaker_gem_dir, 'acceptance/lib')

ENV['BEAKER_setfile'] = 'acceptance/config/nodes/hosts.yaml'
ENV['BEAKER_setfile'] = 'acceptance/config/nodes/hosts.yaml' unless ENV.key?('BEAKER_setfile')
sh("beaker",
"--hosts", "acceptance/config/nodes/hosts.yaml",
# We can't run these tests until the rsync support in the main
# beaker/host.rb is updated to work with passwords.
# "--tests", beaker_test_base_dir,
Expand Down
7 changes: 4 additions & 3 deletions lib/beaker/hypervisor/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def get_ssh_connection_info(container)
port: nil
}

container_json = container.json
container_json = container.json
network_settings = container_json['NetworkSettings']
host_config = container_json['HostConfig']
host_config = container_json['HostConfig']

ip = nil
port = nil
Expand All @@ -161,9 +161,10 @@ def get_ssh_connection_info(container)

# Host to Container
port22 = network_settings.dig('PortBindings','22/tcp')
if port22.nil? && network_settings.key?('Ports')
if port22.nil? && network_settings.key?('Ports') && !nested_docker?
port22 = network_settings.dig('Ports','22/tcp')
end

ip = port22[0]['HostIp'] if port22
port = port22[0]['HostPort'] if port22

Expand Down