1

I am using the Workflow portion of Chef Automate to deliver cookbooks to my Chef Server. I have successfully uploaded 2 cookbooks on the Chef Server through the pipeline.

On the Chef Server:
apache is at version 0.2.3
another_test is at version 0.1.1

I wanted to make a change to apache to depend on another_test, so I updated the metadata for apache and bumped the version to 0.2.4.

The metadata file for apache has depends 'another_test' and another_test has no dependencies.

The Berksfile for apache is

source :chef_server
source 'https://supermarket.chef.io'
metadata

When I make the delivery review call, the pipeline kicks off but I get a failure in the unit test phase of the Verify stage.

execute[unit_rspec_apache] action run

================================================================================
Error executing action `run` on resource 'execute[unit_rspec_apache]' ================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of rspec --format documentation --color ----
STDOUT: [2017-11-21T14:06:57+00:00] ERROR: Connection refused connecting to https://localhost/universe, retry 1/5
[2017-11-21T14:07:02+00:00] ERROR: Connection refused connecting to https://localhost/universe, retry 2/5
[2017-11-21T14:07:07+00:00] ERROR: Connection refused connecting to https://localhost/universe, retry 3/5
[2017-11-21T14:07:12+00:00] ERROR: Connection refused connecting to https://localhost/universe, retry 4/5
[2017-11-21T14:07:17+00:00] ERROR: Connection refused connecting to https://localhost/universe, retry 5/5

An error occurred in a `before(:suite)` hook. Failure/Error: raise NoSolutionError.new(demands, e)

Berkshelf::NoSolutionError: Unable to satisfy constraints on package another_test, which does not exist, due to solution constraint (apache = 0.2.4). Solution constraints that may result in a constraint on another_test: [(apache = 0.2.4) -> (another_test >= 0.0.0)]
Missing artifacts: another_test
Demand that cannot be met: (apache = 0.2.4)
Unable to find a solution for demands: apache (0.2.4)

Because of this failure, the new version of apache 0.2.4 is never uploaded to the Chef Server.

EDIT: I have tested using a dependency form the supermarket and it passes the verify stage. So I had depends 'java' in apache and that gets uploaded fine. The problem starts when I am depending on a cookbook that comes from my chef server.

EDIT 2: I can log into the runner and do knife cookbook list. This proves to me that the runner can access the chef server and see what cookbooks exist there. I have also tried changing the Berksfile for apache to have source 'https://<full-url-to-chef-server/organizations/myorg' in place of source :chef_server

James
  • 11
  • 3
  • Having not used Workflow I don't want to post this as an answer, but it looks like the `:chef_server` source in Berks is failing because Workflow doesn't know about your Chef Server (at least not at that phase). How would you expect it to have set up the knife.rb config? – coderanger Nov 21 '17 at 15:21
  • Well this runs on the 'runner' node which has its own knife.rb already set up. That knife file does know about my chef server. – James Nov 21 '17 at 17:59
  • Seems like you are on to something, the knife.rb for the runner does not know what the chef_server url is – James Nov 21 '17 at 18:09
  • Indeed, unfortunately for historical reasons, the default URL is https://localhost/. – coderanger Nov 21 '17 at 18:10
  • (though you can also see that happen when using local most because that re-points at a magic internal server on localhost) – coderanger Nov 21 '17 at 18:11
  • The /etc/chef/client.rb file on the runner has the "chef_server_url" set correctly. I can do a "sudo knife cookbook list" from the runner and see all the cookbooks on the chef server – James Nov 21 '17 at 21:05

1 Answers1

0

I had to edit the /var/opt/delivery/workspace/.chef/knife.rb file on the runner node. I added this line at the bottom of the file: chef_server_url 'https://chef-server/organizations/myorg'.

This knife config file is used by the dbuild user on the runner node. It reads this file to determine the URL for the chef server.

James
  • 11
  • 3
  • That's odd, because `chef_server_url` should already have been correctly populated by the `automate-ctl install-runner` command. – Tricky Nov 24 '17 at 16:01