Install and configure the Chef adapter to associate with Binary Artifact
Repository.
Chef prerequisites |
- Chef Development Kit version: 0.10.0
- chef-client version: 12.5.1
- berks version: 4.0.1
- kitchen version: 1.4.2
- Server access to the host running Chef with sufficient
privileges to modify Chef files
|
- Assumptions
-
- A functioning Chef environment
- Chef is used in the actual deployment of software (eg: deploying
a jar/war/ear or an rpm to the intended target)
- The instance of Nexus hosting the Build Artifacts is up, running
and integrated to the above said CollabNet TeamForge
instance.
Add custom source for Chef in TeamForge
-
In TeamForge, go to the Project Admin page of the
project for which you wish to integrate this Chef deployment scenario.
-
Select Tools from the left pane.
-
Click Add Tool.
-
Select Other for SELECT TOOL TYPE option.
-
Select the Include Traceability check box.
-
Select Custom Activity Source for ‘Source Type’.
-
Select the desired Nexus/Binary source in the Associated
Source field.
-
Finish any other confirmation, then click SHOW
CONFIGURATION before saving the configuration. Copy all
configuration parameters to a text file for use in later steps.
Configuring Chef
-
Add the following code to your deployment cookbook’s
metadata.rb file.
depends 'teamforge-associations', '~> 0.1.0'
-
Add the following code to your recipes/default.rb file of
your deployment cookbook.
include_recipe 'teamforge-associations::alldetails'
-
Edit your deployment recipe to notify the TeamForge EventQ reporting
recipe when it is run. This can be done by adding the following code to your
deployment resource.
notifies :enable, 'chef_handler[CustomHandler::AllDetails]'
-
Edit your deployment recipe to notify the TeamForge EventQ reporting
recipe when it is run. This can be done by adding the following code to your
deployment resource.
default['teamforge-associations']['alldetails']['nexus_artifact_url'] = <NEXUS ARTIFACT URL>
Note: Where the URL is the REST API or the direct URL of the Nexus Artifact
that is going to be deployed.
default['teamforge-associations']['alldetails']['ctf_url'] = <CTF URL>
default['teamforge-associations']['alldetails']['ctf_user'] = <CTF USER>
Note: This user must have rights to get/post schema on EventQ.
default[‘teamforge-associations’]['alldetails']['orc_server'] = '<ORC QUEUE SERVER>'
default['teamforge-associations’]['alldetails']['orc_user'] = '<QUEUE USERNAME>'
default['teamforge-associations']['alldetails']['orc_src_assoc_key'] = ‘<SOURCE ASSOCIATION KEY>’
default['teamforge-associations']['alldetails']['orc_queue_name'] = 'eventq.custom'
default['teamforge-associations']['passwords']['secret_path'] = '<PATH TO SECRET KEY>'
Note: This parameter contains the generic path on each node to the
encryption key that has been used to encrypt the EventQ password
that resides on the Chef server as an encrypted data bag.
-
Create a data bag named
“passwords”
on the Chef server and add two encrypted data bag items named 'ctf_password’ and
‘orc_password’ containing the encrypted CTF password for the user set in
default['teamforge-associations']['alldetails']['ctf_user']
and the EventQ password for the user set up in
default['teamforge-associations’]['alldetails']['orc_user']
respectively.
The
passwords must be contained in a field named “password” in their respective data
bags. Please refer to http://docs.chef.io for information on
using data bags.
-
Once all changes are in place upload the cookbook to the server. Any nodes that
this cookbook is assigned to will automatically pick up these changes when they
run chef-client next. If you wish to assign it to any new
nodes, follow the usual procedure to bootstrap the node and assign this cookbook
to its runlist.
Test the integration by running through an entire cycle to ensure EventQ
receives the Chef deployment activity and also that the Chef deployment is
associating properly to the configured binary artifact.