test-kitchen / kitchen-dokken

Test Kitchen driver/provisioner for lightning faster Chef Infra cookbook testing with Docker
Other
197 stars 91 forks source link

fails in `docker_config_creds` with NPE when missing "auths" key in ~/.docker/config.json #290

Closed psacc closed 1 year ago

psacc commented 1 year ago

:ghost: Brief Description

dokken expects that ~/.docker/config.json contains an "auths" key, fails in docker_config_creds with NPE otherwise.

There is a workaround, adding the key as an empty array avoids the issue, example:

{
  "credsStore": "osxkeychain",
  "auths": []
}

Version

test-kitchen-3.5.0, kitchen-dokken-2.17.4

Environment

I'm on macOS with docker via rancher-desktop distribution.

Scenario

I'm running a recipe using the dokken plugin.

Steps to Reproduce

Just run the test. Code is available via https://github.com/aws/aws-parallelcluster-cookbook but all recipes using dokken fail.

Expected Result

The recipe is executed.

Actual Result

D      ------Exception-------
D      Class: Kitchen::ActionFailed
D      Message: 5 actions failed.
>>>>>>     Failed to complete #create action: [undefined method `each' for nil:NilClass] on ephemeral-drives-setup-redhat8
>>>>>>     Failed to complete #create action: [undefined method `each' for nil:NilClass] on ephemeral-drives-setup-ubuntu2004
>>>>>>     Failed to complete #create action: [undefined method `each' for nil:NilClass] on ephemeral-drives-setup-alinux2
>>>>>>     Failed to complete #create action: [undefined method `each' for nil:NilClass] on ephemeral-drives-setup-ubuntu1804
>>>>>>     Failed to complete #create action: [undefined method `each' for nil:NilClass] on ephemeral-drives-setup-centos7
D      ----------------------
D      ------Backtrace-------
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/command.rb:181:in `report_errors'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/command.rb:172:in `run_action'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/command/test.rb:41:in `block in call'
D      /opt/cinc-workstation/embedded/lib/ruby/3.0.0/benchmark.rb:293:in `measure'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/command/test.rb:37:in `call'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/cli.rb:52:in `perform'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/cli.rb:250:in `test'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/bin/kitchen:11:in `block in <top (required)>'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/errors.rb:183:in `with_friendly_errors'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/bin/kitchen:11:in `<top (required)>'
D      /usr/local/bin/kitchen:389:in `load'
D      /usr/local/bin/kitchen:389:in `<main>'
D      ----End Backtrace-----
D      -Composite Exception--
D      Class: Kitchen::ActionFailed
D      Message: Failed to complete #create action: [undefined method `each' for nil:NilClass] on ephemeral-drives-setup-redhat8
D      ----------------------
D      ------Backtrace-------
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:444:in `docker_config_creds'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:464:in `docker_creds_for_image'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:663:in `block in pull_image'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:676:in `with_retries'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:658:in `pull_image'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:648:in `pull_if_missing'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:473:in `pull_platform_image'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/kitchen-dokken-2.17.4/lib/kitchen/driver/dokken.rb:80:in `create'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:495:in `public_send'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:495:in `block in perform_action'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:563:in `synchronize_or_call'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:524:in `block in action'
D      /opt/cinc-workstation/embedded/lib/ruby/3.0.0/benchmark.rb:293:in `measure'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:523:in `action'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:495:in `perform_action'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:404:in `create_action'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:392:in `block (2 levels) in transition_to'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/lifecycle_hooks.rb:47:in `run_with_hooks'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:391:in `block in transition_to'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:390:in `each'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:390:in `transition_to'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:161:in `verify'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:190:in `block in test'
D      /opt/cinc-workstation/embedded/lib/ruby/3.0.0/benchmark.rb:293:in `measure'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/instance.rb:186:in `test'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/command.rb:195:in `public_send'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/command.rb:195:in `run_action_in_thread'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.5.0/lib/kitchen/command.rb:166:in `block (2 levels) in run_action'
D      /opt/cinc-workstation/embedded/lib/ruby/gems/3.0.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
D      ----End Backtrace-----

:heavy_plus_sign: Additional context

There is a PR that will solve this already: https://github.com/test-kitchen/kitchen-dokken/pull/287

damacus commented 1 year ago

Closed via #287