ARTIFACTORY: How to Configure Artifactory with Chef Repositories

AuthorFullName__c
Yonatan Brand
articleNumber
000004199
FirstPublishedDate
2018-07-06T14:09:32Z
lastModifiedDate
2025-05-14

ARTIFACTORY: How to Configure Artifactory with Chef Repositories

First, install the Chef Development Kit (ChefDK). Note: The Knife command-line tool does not
support basic authentication, only authentication with RSA keys. If your Artifactory instance requires
authentication, you'll need to install RubyGems knife-art plugin. For installation instructions, please
refer to the Artifactory User Guide.

To configure a Knife client to work with Artifactory:

  1. Create Chef repositories using the Quick Setup. This will create a virtual Chef repository that aggregates a remote (chef-remote) and a local (chef-local) repositories.
  2. Edit your knife.rb file (located in $USER_HOME/.chef/). If it doesn’t exist, create it using this 
    $ vim knife.rb

In the following example, as Artifactory requires authentication, we added a basic
authentication configuration to the URL. To do this yourself, you will need to install the knife-
art plugin
 mentioned in the prerequisites above. To check whether the plugin was installed successfully you can use the command knife artifactory:
User-added image

3. After installing and configuring the Knife client to work with Artifactory, you'll need to resolve a package from the default Chef registry:

User-added image


User-added image

The seven_zip package is successfully installed. 

 

How to deploy your own cookbook to Artifactory

  1. Here’s an example of a new cookbook that’s been generated in the cookbooks location: User-added image
  2. After creating the cookbook, it is now ready for deployment to Artifactory. In order to deploy to Artifactory, we will use the following command: User-added image
  3. And here’s the package, successfully deployed to Artifactory:

User-added image