项目作者: chef-boneyard

项目描述 :
DEPRECATED: Delivery build cb for pipelines
高级语言: Ruby
项目地址: git://github.com/chef-boneyard/delivery-truck.git
创建时间: 2015-02-18T19:52:33Z
项目社区:https://github.com/chef-boneyard/delivery-truck

开源协议:Apache License 2.0

下载


Umbrella Project: Automate

Project State: Deprecated

Issues Response Time Maximum: None

Pull Request Response Time Maximum: None

delivery-truck

delivery-truck is a Chef Delivery build_cookbook for continuously delivering
Chef cookbooks and applications.

To quickly get started you just need to set delivery-truck to
be your build cookbook in your .delivery/config.json.

  1. {
  2. "version": "2",
  3. "build_cookbook": {
  4. "name": "delivery-truck",
  5. "git": "https://github.com/chef-cookbooks/delivery-truck.git"
  6. }
  7. }

Customizing Behavior using .delivery/config.json

The behavior of the delivery-truck cookbook phase recipes can be easily
controlled by specifying certain values in your .delivery/config.json file.
The control these values offer you is limited and not meant as a method to
drastically alter the way the recipe functions.

lint

The lint phase will execute foodcritic but you can specify
which rules you would like to follow directly from your config.json.

  • ignore_rules - Provide a list of foodcritic rules you would like to ignore.
  • only_rules - Explicitly state which foodcritic rules you would like to run.
    Any other rules except these will be ignored.
  • excludes - Explicitly state which relative paths foodcritic should ignore.
  • fail_tags - Explicitly state which rules should cause the run to fail. Defaults
    to correctness.
  1. {
  2. "version": "2",
  3. "build_cookbook": {
  4. "name": "delivery-truck",
  5. "git": "https://github.com/chef-cookbooks/delivery-truck.git"
  6. },
  7. "delivery-truck": {
  8. "lint": {
  9. "foodcritic": {
  10. "ignore_rules": ["FC001"],
  11. "only_rules": ["FC002"],
  12. "excludes": ["spec", "test"],
  13. "fail_tags": ["any"]
  14. }
  15. }
  16. }
  17. }

By default, the lint phase will run RuboCop, but
only on cookbooks that have a .rubocop.yml file.

You can over-ride this behavior to use cookstyle
instead of RuboCop by enabling it in your config.json.

  1. {
  2. "version": "2",
  3. "build_cookbook": {
  4. "name": "delivery-truck",
  5. "git": "https://github.com/chef-cookbooks/delivery-truck.git"
  6. },
  7. "delivery-truck": {
  8. "lint": {
  9. "enable_cookstyle": true
  10. }
  11. }
  12. }

Note: To enable cookstyle, your builders/runners must be running ChefDK version
v0.14 or higher.

publish

From the publish phase you can quickly and easily deploy cookbooks to
your Chef Server, Supermarket Server and your entire project to a Github account.

  • chef_server - Set to true/false depending on whether you would like to
    upload any modified cookbooks to the Chef Server associated with Delivery.
  • supermarket - Specify the Supermarket Server you would like to use to
    share any modified cookbooks.
  • github - Specify the Github repository you would like to push your project
    to. In order to work you must create a shared secrets data bag item (see “Handling
    Secrets” below) with a key named github with the value being a
    deploy key with
    access to that repo.
  • git - Same as github but for Open Source Git Servers. (The data bag item
    should have a key named git)
  1. {
  2. "version": "2",
  3. "build_cookbook": {
  4. "name": "delivery-truck",
  5. "git": "https://github.com/chef-cookbooks/delivery-truck.git"
  6. },
  7. "delivery-truck": {
  8. "publish": {
  9. "chef_server": true,
  10. "supermarket": "https://supermarket.chef.io",
  11. "github": "<org>/<project>",
  12. "git": "ssh://git@stash:2222/<project-name>/<repo-name>"
  13. }
  14. }
  15. }

example data bag

  1. {
  2. "id": "<your ID here>",
  3. "github": "<private key>",
  4. "git": "<private key>"
  5. }

deploy

By default deploy will trigger a chef-client run through push-jobs to all
the nodes that belong to the current environment in delivery and have the
modified cookbook(s) in their run_list. You can customize the search query.

  1. {
  2. "delivery-truck": {
  3. "deploy": {
  4. "search": "recipes:my_push_jobs"
  5. }
  6. }
  7. }

Skipped Phases

The following phases have no content and can be skipped: functional,
quality, security and smoke.

  1. {
  2. "version": "2",
  3. "build_cookbook": {
  4. "name": "delivery-truck",
  5. "git": "https://github.com/chef-cookbooks/delivery-truck.git"
  6. },
  7. "skip_phases": [
  8. "functional",
  9. "quality",
  10. "security",
  11. "smoke"
  12. ]
  13. }

Depends on delivery-truck

If you would like to enjoy all the functionalities that delivery-truck provides
on you own build cookbook you need to add it into your metadata.rb

  1. name 'build_cookbook'
  2. maintainer 'The Authors'
  3. maintainer_email 'you@example.com'
  4. license 'all_rights'
  5. description 'Installs/Configures build'
  6. long_description 'Installs/Configures build'
  7. version '0.1.0'
  8. depends 'delivery-truck'

Additionally delivery-truck depends on delivery-sugar so you need to add
them both to your Berksfile

  1. source "https://supermarket.chef.io"
  2. metadata
  3. cookbook 'delivery-truck', github: 'chef-cookbooks/delivery-truck'
  4. cookbook 'delivery-sugar', github: 'chef-cookbooks/delivery-sugar'

Handling Secrets (ALPHA)

This cookbook implements a rudimentary approach to handling secrets. This process
is largely out of band from Chef Delivery for the time being.

delivery-truck will look for secrets in the delivery-secrets data bag on the
Delivery Chef Server. It will expect to find an item in that data bag named
<ent>-<org>-<project>. For example, this cookbook is kept in the
‘Delivery-Build-Cookbooks’ org of the ‘chef’ enterprise so it’s data bag name is
chef-Delivery-Build-Cookbooks-delivery-truck.

This cookbook expects this data bag item to be encrypted with the same
encrypted_data_bag_secret that is on your builders. You will need to ensure that
the data bag is available on the Chef Server before you run this cookbook for
the first time otherwise it will fail.

To get this data bag you can use the DSL get_project_secrets to get the
contents of the data bag.

  1. my_secrets = get_project_secrets
  2. puts my_secrets['id'] # chef-Delivery-Build-Cookbooks-delivery-truck

License & Authors

  1. Copyright:: 2015 Chef Software, Inc
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.