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

[DinD/CI] Did not find config file: /opt/kitchen/client.rb #149

Open
docwhat opened this issue Mar 26, 2018 · 9 comments
Open

[DinD/CI] Did not find config file: /opt/kitchen/client.rb #149

docwhat opened this issue Mar 26, 2018 · 9 comments

Comments

@docwhat
Copy link

docwhat commented Mar 26, 2018

This is bug #105 continued but only for the case of running in DinD or CI.

# DinD ChefDK dockerfile
FROM chef/chefdk:current

RUN apt-get update \
      && apt-get install -y apt-transport-https ca-certificates curl software-properties-common

RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
      && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
      && apt-get update \
      && apt-get install -y docker-ce
# Start it this way...
$ docker run \
      -it --rm \
      --init \
      --volume=/var/run/docker.sock:/var/run/docker.sock:rw \
      --volume=/sys/fs/cgroup:/sys/fs/cgroup:rw \
      --tmpfs=/tmp --tmpfs=/cookbook \
      --volume=<full-path-to-a-cookbook>:/cookbook-ro:ro
      <name-for-image-above> bash
root@docker: rsync -a /cookbook-ro/ /cookbook/
root@docker: chef exec kitchen converge
-----> Starting Kitchen (v1.20.0)
-----> Converging <default-ubuntu-1604>...
       Creating kitchen sandbox in /root/.dokken/kitchen_sandbox/293e786b89-default-ubuntu-1604
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 6.3.1...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
[2018-03-26T20:05:59+00:00] WARN: *****************************************
[2018-03-26T20:05:59+00:00] WARN: Did not find config file: /opt/kitchen/client.rb, using command line options.
[2018-03-26T20:05:59+00:00] WARN: *****************************************
[2018-03-26T20:05:59+00:00] WARN: No cookbooks directory found at or above current directory.  Assuming /.
[2018-03-26T20:05:59+00:00] WARN: No cookbooks directory found at or above current directory.  Assuming /.
[2018-03-26T20:05:59+00:00] FATAL: Cannot load configuration from /opt/kitchen/dna.json
[2018-03-26T20:05:59+00:00] FATAL: Cannot load configuration from /opt/kitchen/dna.json
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-ubuntu-1604>.  Please see .kitchen/logs/default-ubuntu-1604.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
@acondrat
Copy link

acondrat commented Aug 7, 2018

Hi,

Is there any workaround for this issue? I can reproduce it 100% of time.

Thanks

@docwhat
Copy link
Author

docwhat commented Aug 7, 2018

Nope. I can reproduce it 100% of the time, too...

@espoelstra
Copy link

When you are running DiD I believe you MUST creat the same folder layout on the host as you are attempting to mount things into the inner container from. Eg /var/jenkins_home/workspace is used in a Jenkins Docker and -v $(pwd):/src/files is used in a Docker run by Jenkins to build a job, then on the host of the Jenkins Docker I also need /var/jenkins_home/workspace to exist, even if I was using -v ~/projects/jenkins_docker/jenkins_home:/var/jenkins_home/ when spinning up the Jenkins container.

@zakame
Copy link

zakame commented Dec 2, 2018

I was exploring integrating dokken with drone and encountered this as well.

The solution seems to be indicated in where dokken makes its sandboxes:

-----> Starting Kitchen (v1.23.2)
-----> Creating <default-ubuntu-1604>...
       Creating kitchen sandbox at /root/.dokken/kitchen_sandbox/b0dce010a4-default-ubuntu-1604
       Creating verifier sandbox at /root/.dokken/verifier_sandbox/b0dce010a4-default-ubuntu-1604
       Building work image..

As the sandboxes reside in /root/.dokken, this directory can be mounted from the host back into the DinD, e.g. in .drone.yml

pipeline:
  test:
    image: chef/chefdk:latest
    environment:
      - KITCHEN_LOCAL_YAML=.kitchen.dokken.yml
    commands:
      - chef --version
      - kitchen test centos-7
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /root/.dokken:/root/.dokken

@askz
Copy link

askz commented Jan 4, 2019

Hi @zakame I tried it but I get the same error... Any update on this ?

@jtimberman
Copy link

I can confirm that mounting the volume /root/.dokken as described will work in our DinD CI system.

I think this is a specific configuration thing that needs to be done on each project and isn't in scope of Dokken.

@bbros-dev
Copy link

Been wrestling with this today.

Conclusion: I wonder if one of the following two options is the path of least resistance:

  1. Build Dokken images starting from the docker:dind, and some history here.
  2. Fix the local transport kitchen-local.

@ramereth
Copy link
Contributor

ramereth commented Mar 3, 2021

@bbros-dev related to kitchen-local... I believe that functionality is already included with the exec transport already built into kitchen. You can see an example of using that provider in the ark cookbook GitHub Action tests.

@bbros-dev
Copy link

Thanks @ramereth we've moved away from DinD and more generally Docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants