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

Dokken tries to connect to docker when loaded by chef exec rake #222

Open
fuegas opened this issue Mar 9, 2021 · 2 comments
Open

Dokken tries to connect to docker when loaded by chef exec rake #222

fuegas opened this issue Mar 9, 2021 · 2 comments

Comments

@fuegas
Copy link

fuegas commented Mar 9, 2021

When my repository contains a kitchen.yml with driver dokken and docker-engine is not running, I can't run the static code analysis using cookstyle because kitchen is loaded by rake which loads kitchen-dokken which tries to connect to docker (which is not running) and thus the whole command fails.

We experienced that none of our CI jobs worked anymore from the moment we added a kitchen.yml our developers could use to start testing locally. After a search we found that chef exec rake -vT failed as well with the following error:

kitchen-dokken could not connect to the docker host at unix:///var/run/docker.sock. Is docker running?

Most of our developers do not run docker-engine all the time (saving RAM/CPU resources and such), neither is our CI pipeline configured for dokken yet. Purely because we have a kitchen.yml with a dokken driver, a platform and a suite name we can't run our static code analysis unless docker-engine is running. In my opinion the dependency on a running docker-engine shouldn't be there unless we're invoking kitchen itself.

Version

Chef Workstation version: 21.2.303
Chef Infra Client version: 16.10.17
Chef InSpec version: 4.26.13
Chef CLI version: 3.1.1
Chef Habitat version: 1.6.181
Test Kitchen version: 2.10.0
Cookstyle version: 7.8.3

Environment

OS-X Big Sur 11.2.2

Scenario

I'm trying to run cookstyle while docker-engine is not running.

Steps to Reproduce

  1. Create a kitchen.yml with the following content:

    ---
    driver:
      name: dokken
    platforms:
      - name: debian-10
    suites:
      - name: default
  2. Make sure docker-engine is unreachable

  3. Run chef exec rake -vT

Expected Result

I'd expect a list of possible tasks:

rake style                           # Run foodcritic and cookstyle on this cookbook
rake style:cookstyle                 # Run RuboCop
rake style:cookstyle:auto_correct    # Auto-correct RuboCop offenses
rake test                            # Run unit and functional tests
rake test:kitchen:all                # Run all test instances
rake test:kitchen:converge:all       # Run all converge instances
rake test:kitchen:create:all         # Run all create instances
rake test:kitchen:default-debian-10  # Run default-debian-10 test instance
rake test:kitchen:destroy            # Destroys all active kitchen resources
rake test:kitchen:destroy:all        # Run all destroy instances
rake test:kitchen:setup:all          # Run all setup instances
rake test:kitchen:verify:all         # Run all verify instances
rake test:unit                       # Run ChefSpec unit tests

Actual Result

You see an error:

kitchen-dokken could not connect to the docker host at unix:///var/run/docker.sock. Is docker running?
@marcparadise
Copy link
Contributor

@fuegas could you include the Rakefile in question? Following the steps outlined with a custom (empty) rakefile, chef exec is not causing any kitchen content to load (dokken or otherwise).

@fuegas
Copy link
Author

fuegas commented Jun 24, 2021

Hi @marcparadise,

The content (which causes the error) is:

namespace :test do
  begin
    require 'kitchen/rake_tasks'
    desc 'Run kitchen integration tests'
    Kitchen::RakeTasks.new
  rescue StandardError => e
    puts ">>> Kitchen error: #{e}, omitting #{task.name}" unless ENV['CI']
  end
end

This is written because we wanted multiple checks to be usable from CLI and in pipelines without duplicating the commands.

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

No branches or pull requests

2 participants