Skip to content

A CLI to analyze artifacts from a Chef Infra Server

License

Notifications You must be signed in to change notification settings

chef/chef-analyze

chef-analyze

Build status Code coverage

A CLI to analyze artifacts from a Chef Infra Server.

Umbrella Project: Chef Workstation

Project State: Prototyping

Issues Response Time Maximum: Not yet defined

Pull Request Response Time Maximum: Not yet defined

Installation

We highly recommend using Chef Workstation, which includes chef-analyze out of the box. If for some reason you can't use Chef Workstation you can manually install the Habitat package chef/chef-analyze.

hab pkg install -b chef/chef-analyze

Development Documentation

The development of this CLI is being done inside a Chef Habitat Studio, you will need to have Chef Habitat installed on your local workstation to proceed with any development task.

Building

From within a Chef Habitat Studio, you can build the chef-analyze CLI by:

  1. Building a native Habitat package.
    $ hab studio enter
    [1][default:/src:0]# build
    
  2. Helper method to build cross-platform binaries.
    $ hab studio enter
    [1][default:/src:0]# build_cross_platform
    
    NOTE: The generated binaries will be located inside the bin/ directoy.

Testing

From within a Chef Habitat Studio, you can run both, unit and integration tests:

  1. Unit tests. (Go-based)
    $ hab studio enter
    [1][default:/src:0]# unit_tests
    
  2. Integration tests. (Go-based)
    $ hab studio enter
    [1][default:/src:0]# integration_tests
    
    NOTE: The integration tests require a binary to test against, this helper automatically triggers a cross-platform build and uses the generated binary for the running platform.

Code coverage

This repository requires any change to always increase, or at least, maintain the percentage of code coverage, to execute the current coverage run:

$ hab studio enter
[1][default:/src:0]# code_coverage

For details about the code coverage open the generated HTML report located at coverage/coverage.html.

Patching a local Chef Workstation Install

You can override the chef-analyze binary that comes inside your local Chef Workstation install by running make patch_local_workstation at the top level folder of this repository. Then just simply run chef-analyze or chef analyze to use the top-level chef wrapper.

Contributing

For information on contributing to this project please see our Contributing Documentation

License & Copyright

  • Copyright:: Copyright (c) 2019 Chef Software, Inc.
  • License:: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.