I'm trying to test chef recipe locally using test kitchen docker, I installed chef workstation, chef, and test kitchen but kitchen still complaints "Kitchen not found"
-bash: kitchen: command not found
Here's what I installed on my redhat7 linux machine ;
Chef Workstation version: 22.1.778
Chef Habitat version: 1.6.420
Test Kitchen version: 3.2.2
Cookstyle version: 7.31.1
Chef Infra Client version: 17.9.26
Chef InSpec version: 4.52.9
Chef CLI version: 5.5.6
kitchen.yml
---
driver:
name: docker
provisioner:
name: dummy
verifier:
name: inspec
tranport:
name: docker
platforms:
- name: centos-7
docker_config:
image: centos:7
platform: centos
suites:
- name: default
verifier:
inspec_tests:
- test/integration/default
Error:
kitchen list
-bash: kitchen: command not found
Execute kitchen --version and see the output. It should output you the version of the Test Kitchen if correctly installed
Eg:
kitchen --version
Test Kitchen version 3.x.x
Related
I'm using ECR to store docker images. In a preview environment, I'm making a few changes in values.yaml so that image gets pulled from ECR.
cat pim/dam/preview/values.yaml
expose:
Annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-delete-policy: hook-succeeded
config:
exposer: Ingress
http: true
tlsacme: false
cleanup:
Args:
- --cleanup
Annotations:
helm.sh/hook: pre-delete
helm.sh/hook-delete-policy: hook-succeeded
preview:
image:
repository: abc.dkr.ecr.us-east-1.amazonaws.com/pim-dam
tag:
pullPolicy: IfNotPresent
When i run jx preview --app pim-dam --dir ../.. i can see extraValues.yaml file is getting created which overrides my values.yamlfile.The problem with extraValues.preview.image.repository is it adds organisation after registry name which is not the case with ECR.
How do I override extraValues.yaml ? or How do I tell Jenkinsx not to include $ORG in extraValues .yaml?
current:
extraValues.preview.image.repository: $DOCKER_REGISTRY/$ORG/$APPNAME
required:
extraValues.preview.image.repository: $DOCKER_REGISTRY/$APPNAME
cat extraValues.yaml
expose:
Annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-delete-policy: hook-succeeded
config:
domain: 54.183.236.166.nip.io
exposer: Ingress
http: "true"
preview:
image:
repository: abcd.dkr.ecr.us-east-1.amazonaws.com/tejesh-unbxd/pim-dam
tag: 0.0.0-SNAPSHOT-PR-11-2
The output of jx version is:
NAME VERSION
jx 1.3.980
jenkins x platform 0.0.3513
Kubernetes cluster v1.10.6
kubectl v1.12.1
helm client v2.11.0+g2e55dbe
helm server v2.12.2+g7d2b0c7
git git version 2.14.4
Operating System Unkown Linux distribution Linux version 4.14.72-73.55.amzn2.x86_64 (mockbuild#ip-10-0-1-219) (gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)) #1 SMP Thu Sep 27 23:37:24 UTC 2018
I need to test my application with Docker Image httpd and when i add it to the current .kitchen.yaml file it fails with the error:
root#ip-172-31-1-22:~/test1# kitchen test
-----> Starting Kitchen (v1.23.2)
-----> Cleaning up any prior instances of <default-httpd>
-----> Destroying <default-httpd>...
Finished destroying <default-httpd> (0m0.00s).
-----> Testing <default-httpd>
-----> Creating <default-httpd>...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Create failed on instance <default-httpd>. Please see .kitchen/logs/default-httpd.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
root#ip-172-31-1-22:~/test1#
My Kitchen.yaml file
driver:
name: docker
use_sudo: false
#image: httpd
provisioner:
hosts: aws
name: ansible_playbook
#roles_path: roles
require_ansible_repo: true
ansible_verbose: true
ansible_version: latest
require_chef_for_busser: false
playbook: default.yml
verifier:
name: inspec
platforms:
#- name: ubuntu
- name: httpd
driver_config:
run_command: /bin/systemd
privileged: true
provision_command:
- systemctl enable sshd.service
suites:
- name: default
verifier:
inspec_tests:
- path: /root/kitchen/test/integration/default/test.rb
Use Case:
1> Deoloy a Httpd base container
2> Use Ansible Play book to move a index.html file
3> Use ansible tos tart and stop the services
4> Run an inspec to check if the tests are successful
What is the right procedure to deploy an httpd using kitchen.yaml and to test the use case.
1> Is this the correct Approch??
2> Should i simply write a Ansible playbook to install httpd and then move my html files.
3> If the Answer to Q2 is yes, then doesn't it defeat the purpose of having an httpd Container already
since you are using ansible, then use docker modules to deploy httpd
I'm trying to setup the Concourse CI locally by following the documentation. Everything goes great until I try to run a sample hello-world pipeline. The job results in this error...
runc create: exit status 1: container_linux.go:264: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:56: mounting \\\"/worker-state/3.8.0/assets/bin/init\\\" to rootfs \\\"/worker-state/volumes/live/a8d3b403-19e7-4f16-4a8a-40409a9b017f/volume/rootfs\\\" at \\\"/worker-state/volumes/live/a8d3b403-19e7-4f16-4a8a-40409a9b017f/volume/rootfs/tmp/garden-init\\\" caused \\\"open /worker-state/volumes/live/a8d3b403-19e7-4f16-4a8a-40409a9b017f/volume/rootfs/tmp/garden-init: permission denied\\\"\""
Looks like I'm getting a permissions error but I've double-checked that the container is running in privileged mode.
$ docker inspect --format='{{.HostConfig.Privileged}}' concourse_concourse_1
true
Docker Compose File
version: '3'
services:
concourse-db:
image: postgres
environment:
- POSTGRES_DB=concourse
- POSTGRES_PASSWORD=concourse_pass
- POSTGRES_USER=concourse_user
- PGDATA=/database
concourse:
image: concourse/concourse
command: quickstart
privileged: true
depends_on: [concourse-db]
ports: ["8080:8080"]
environment:
- CONCOURSE_POSTGRES_HOST=concourse-db
- CONCOURSE_POSTGRES_USER=concourse_user
- CONCOURSE_POSTGRES_PASSWORD=concourse_pass
- CONCOURSE_POSTGRES_DATABASE=concourse
- CONCOURSE_EXTERNAL_URL
- CONCOURSE_BASIC_AUTH_USERNAME
- CONCOURSE_BASIC_AUTH_PASSWORD
- CONCOURSE_NO_REALLY_I_DONT_WANT_ANY_AUTH=true
- CONCOURSE_WORKER_GARDEN_NETWORK
Pipeline
---
jobs:
- name: job-hello-world
public: true
plan:
- task: hello-world
config:
platform: linux
image_resource:
type: docker-image
source: {repository: busybox}
run:
path: echo
args: [hello world]
Concourse Version
$ curl http://192.168.99.100:8080/api/v1/info
{"version":"3.12.0","worker_version":"2.0"}
Other Versions
$ docker --version
Docker version 18.04.0-ce, build 3d479c0
$ docker-machine --version
docker-machine version 0.14.0, build 89b8332
$ docker-compose --version
docker-compose version 1.21.0, build unknown
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 10.13.1 (17B1003)
Kernel Version: Darwin 17.2.0
Boot Volume: OSX
While everything on the surface may look like it's up to date. It's important to note that docker-machine runs docker inside of VMs which can get stale if you're not updating them on a regular basis and Concourse needs kernel 3.19 or higher.
Running docker info can shed some light on the situation from Docker server's perspective.
What worked for me was...
$ docker-compose down
$ docker-machine upgrade
$ docker-compose up -d
I am trying to use kitchen-docker driver on a GNU/Linux machine. I have installed the kitchen-docker gem using chef gem install command.
This is an extract of my .kitchen.yml file:
---
driver:
name: docker
provisioner:
name: chef_zero
verifier:
name: inspec
platforms:
- name: centos-7.2
driver_config:
image: centos:7.2
platform: centos
suites:
- name: zaz
run_list:
- recipe[foo::bar]
...
...
I have Docker installed on it's latest version using Docker repositories for Centos. The service is running and Docker is in my path. However when I try to run a simple kitchen list using that .kitchen.yml I get this error:
[FakeyMcFakeFace#workstation foo]$ kitchen list
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: You must first install the Docker CLI tool http://www.docker.io/gettingstarted/
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
Why is docker not being recognized by Kitchen? If I run the diagnose -all option I just see it is failing on the dependencies check:
backtrace:
- "/home/FakeyMcFakeFace/.chefdk/gem/ruby/2.3.0/gems/kitchen-docker-2.6.0/lib/kitchen/driver/docker.rb:93:in
`rescue in verify_dependencies'"
What am I missing here?
To copy down from the comments, kitchen-docker requires passwordless sudo (if using sudo) right now, the error message is misleading
I've gotten a question when usde ansible to configurate a docker container.
Here is my ansible playbook:
---
-name: localhost
hosts: localhost
vars:
- ansible_python_interpreter: python
tasks:
- name: busybox test
docker:
image: busybox
name: test
but when I run the file with :
ansible-playbook ad.yml
I got following error:
from docker.client import APIError as DockerAPIError
ImportError: No module named docker.client
no docker.client? I have installed docker-py, but still got this question , how can I fix this ?? h....e....l....p....
I think the problem is caused by the way how I install the ansible. After I reinstall the ansible through python-pip, this problem has been solved successfully.
zypper install python-pip
pip install ansible
use this to solve the problem on suse.