• Stars
    star
    144
  • Rank 244,796 (Top 6 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Software to manage a chef-zero instance and use it to test changes on production servers.

Taste Tester

Continuous Integration

Intro

Ohai!

Welcome to Taste Tester, software to manage a chef-zero instance and use it to test changes on production servers.

At its core, Taste Tester starts up a chef-zero server on localhost, uploads a repository to it, ssh's to a remote server and points its configs to your new chef-zero instance.

Further, it keeps track of where in git you were when that happened so future uploads will do the right thing, even as you switch branches.

Taste Tester can be controlled via a variety of config-file options, and can be further customized by writing a plugin.

Synopsis

Typical usage is:

vi cookbooks/...             # Make your changes and commit locally
taste-tester impact          # Check where your changes are used
taste-tester test -s [host]  # Put host in Taste Tester mode
ssh root@[host]              # Log in to host
  # Run chef and watch it break
vi cookbooks/...             # Fix your cookbooks
taste-tester upload          # Upload the diff
ssh root@[host]
  # Run chef and watch it succeed
<Verify your changes were actually applied as intended!>
taste-tester untest [host]   # Put host back in production
                             #   (optional - will revert itself after 1 hour)

See the help for further information.

Prerequisites

  • Taste Tester assumes that /etc/chef/client.rb and /etc/chef/client.pem on your servers is a symlink and that your real config is /etc/chef/client-prod.rb and /etc/chef/client-prod.pem, respectively.

  • Taste Tester assumes that it's generally safe to "go back" to production. I.e. We set things up so you can set a cronjob to un-taste-test a server after the desired amount of time, which means it must be (relatively) safe to revert back.

  • Taste Tester assumes you use a setup similar to grocery-delivery in production. Specifically that you don't use versions or environments.

  • Taste Tester assumes you have password-less SSH authentication to the hosts you want to test on, i.e. SSH public/private keys, SSH certificates, Kerberos

Dependencies

  • Mixlib::Config
  • Colorize
  • BetweenMeals
  • Minitar
  • Chef

Automatic Untesting

Taste Tester touches /etc/chef/test_timestamp on the remote server as far into the future as the user wants to test (default is 1h). You should have a cronjob to check the timestamp of this file, and if it is old, remove it and put the symlinks for /etc/chef/client.rb back to where they belong.

A small shell script to do this is included called taste-untester. We recommend running this at least every 15 minutes.

If you let Taste Tester setup reverse-SSH tunnels, make sure your untester is also killing the ssh tunnel whose PID is in /etc/chef/test_timestamp (taste-untester will do this for you).

Config file

The default config file is /etc/taste-tester-config.rb but you may use -c to specify another. The config file works the same as client.rb does for Chef - there are a series of keywords that take an argument and anything else is just standard Ruby.

All command-line options are available in the config file:

  • debug (bool, default: false)
  • timestamp (bool, default: false)
  • config_file (string, default: /etc/taste-tester-config.rb)
  • plugin_path (string, no default)
  • repo (string, default: #{ENV['HOME']}/ops)
  • testing_time (int, default: 3600)
  • chef_client_command (string, default: chef-client)
  • json (bool, default: false)
  • skip_repo_checks (bool, default: false)
  • skip_pre_upload_hook (bool, default: false)
  • skip_post_upload_hook (bool, default: false)
  • skip_pre_test_hook (bool, default: false)
  • skip_post_test_hook (bool, default: false)
  • skip_repo_checks_hook (bool, default: false)

The following options are also available:

  • base_dir - The directory in the repo under which to find chef configs. Default: chef
  • cookbook_dirs - An array of cookbook directories relative to base_dir. Default: ['cookbooks']
  • role_dir - A directory of roles, relative to base_dir. Default: roles
  • databag_dir - A directory of databags, relative to base_dir. Default: databags
  • ref_file - The file to store the last git revision we uploaded in. Default: #{ENV['HOME']}/.chef/taste-tester-ref.txt
  • checksum_dir - The checksum directory to put in knife.conf for users. Default: #{ENV['HOME']}/.chef/checksums
  • bundle - use a single tar.gz file for transporting cookbooks, roles and databags to clients. Experimental. Value is tri-state:
    • false - server uses knife upload, client uses chef_server
    • :compatible - make server support both methods, client uses tar.gz
    • true - server only creates tar.gz, client uses tar.gz Default: false
  • impact - analyze local changes to determine which hosts/roles to test. Default: false
  • ssh_cmd_gen_template - Provide a command to run, whose stdout will be a vanilla ssh command Taste Tester will invoke to access test nodes. The command should be a template and will be passed the following variables:
    • jumps - any jumphost arguments supplied via -J option
    • host - the host to SSH to
    • user - the user to SSH as For example: ssh_gen %{jumps} --user %{user} %{host} Default: nil

Plugin

The plugin should be a ruby file which defines several class methods. It is class_eval()d into a Hooks class.

The following functions can optionally be defined:

  • self.pre_upload(dryrun, repo, last_ref, cur_ref)

Stuff to do before we upload anything to chef-zero. Repo is a BetweenMeals::Repo object. last_ref is the last git ref we uploaded and cur_ref is the git ref the repo is currently at,

  • self.post_upload(dryrun, repo, last_ref, cur_ref)

Stuff to do after we upload to chef-zero.

  • self.pre_test(dryrun, repo, hosts)

Stuff to do before we put machines in test mode. hosts is an array of hostnames.

  • self.test_remote_cmds(dryrun, hostname)

Additional commands to run on the remote host when putting it in test mode. Should return an array of strings. hostname is the hostname.

  • self.test_remote_client_rb_extra_code(hostname)

Should return a string of additional code to include in the remote client.rb. Example uses: defining json_attribs

  • self.post_test(dryrun, repo, hosts)

Stuff to do after putting all hosts in test mode.

  • self.repo_checks(dryrun, repo)

Additional checks you want to do on the repo as sanity checks.

  • self.find_impact(changes)

Custom implementation of impact analysis. Uses knife deps by default. May return any data structure, provided one or both of self.post_impact or self.print_impact are defined.

  • self.post_impact(basic_impact)

Stuff to do after preliminary impact analysis. May be used to extend the information generated by self.find_impact, reformat the data structure, etc.

  • self.print_impact(final_impact)

Custom output of calculated impact, useful if defining either of the other impact hooks. Must return a truthy value to prevent the default output from printing.

  • self.post_error(dryrun, exception, mode, hostname)

A hook which will be called just before taste-tester throws an exception/exits. Passes down the exception object and the mode taste-tester was invoked with for further analysis and doing any additional logging, output, or cleanup.

Plugin example

This is an example /etc/taste-tester-plugin.rb to add a user-defined string to client-taste-tester.rb on the remote system:

Hooks.class_eval do
  def self.test_remote_client_rb_extra_code(_hostname)
    %(
      # This comment gets added to client-taste-tester.rb
      # This one too.
      )
  end
end

Be sure to pass this plugin file with -p on the command line or set it as plugin_path in your taste-tester-config.rb file.

License

See the LICENSE file.

More Repositories

1

react

The library for web and native user interfaces.
JavaScript
218,990
star
2

react-native

A framework for building native applications using React
C++
114,975
star
3

create-react-app

Set up a modern web app by running one command.
JavaScript
101,534
star
4

docusaurus

Easy to maintain open source documentation websites.
TypeScript
51,169
star
5

jest

Delightful JavaScript Testing.
TypeScript
41,554
star
6

rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
C++
26,895
star
7

folly

An open-source C++ library developed and used at Facebook.
C++
26,731
star
8

flow

Adds static typing to JavaScript to improve developer productivity and code quality.
OCaml
22,040
star
9

zstd

Zstandard - Fast real-time compression algorithm
C
21,685
star
10

relay

Relay is a JavaScript framework for building data-driven React applications.
Rust
18,099
star
11

hhvm

A virtual machine for executing programs written in Hack.
C++
17,960
star
12

prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
Python
17,624
star
13

fresco

An Android library for managing images and the memory they use.
Java
17,026
star
14

lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
TypeScript
16,985
star
15

yoga

Yoga is a cross-platform layout engine which implements Flexbox. Follow https://twitter.com/yogalayout for updates.
C++
16,729
star
16

infer

A static analyzer for Java, C, C++, and Objective-C
OCaml
14,599
star
17

flipper

A desktop debugging platform for mobile developers.
TypeScript
13,124
star
18

watchman

Watches files and records, or triggers actions, when they change.
C++
12,124
star
19

react-devtools

An extension that allows inspection of React component hierarchy in the Chrome and Firefox Developer Tools.
11,024
star
20

hermes

A JavaScript engine optimized for running React Native.
C++
9,167
star
21

chisel

Chisel is a collection of LLDB commands to assist debugging iOS apps.
Python
9,072
star
22

jscodeshift

A JavaScript codemod toolkit.
JavaScript
8,850
star
23

buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
Java
8,568
star
24

proxygen

A collection of C++ HTTP libraries including an easy to use HTTP server.
C++
7,978
star
25

stylex

StyleX is the styling system for ambitious user interfaces.
JavaScript
7,921
star
26

facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
Swift
7,644
star
27

litho

A declarative framework for building efficient UIs on Android.
Java
7,633
star
28

pyre-check

Performant type-checking for python.
OCaml
6,620
star
29

facebook-android-sdk

Used to integrate Android apps with Facebook Platform.
Kotlin
6,020
star
30

redex

A bytecode optimizer for Android apps
C++
5,951
star
31

componentkit

A React-inspired view framework for iOS.
Objective-C++
5,740
star
32

sapling

A Scalable, User-Friendly Source Control System.
Rust
5,635
star
33

fishhook

A library that enables dynamically rebinding symbols in Mach-O binaries running on iOS.
C
5,061
star
34

PathPicker

PathPicker accepts a wide range of input -- output from git commands, grep results, searches -- pretty much anything. After parsing the input, PathPicker presents you with a nice UI to select which files you're interested in. After that you can open them in your favorite editor or execute arbitrary commands.
Python
5,033
star
35

metro

πŸš‡ The JavaScript bundler for React Native
JavaScript
4,996
star
36

prop-types

Runtime type checking for React props and similar objects
JavaScript
4,427
star
37

idb

idb is a flexible command line interface for automating iOS simulators and devices
Objective-C
4,356
star
38

Haxl

A Haskell library that simplifies access to remote data, such as databases or web-based services.
Haskell
4,220
star
39

FBRetainCycleDetector

iOS library to help detecting retain cycles in runtime.
Objective-C++
4,178
star
40

memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots
TypeScript
4,088
star
41

duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Haskell
3,995
star
42

fbt

A JavaScript Internationalization Framework
JavaScript
3,836
star
43

regenerator

Source transformer enabling ECMAScript 6 generator functions in JavaScript-of-today.
JavaScript
3,795
star
44

mcrouter

Mcrouter is a memcached protocol router for scaling memcached deployments.
C++
3,186
star
45

buck2

Build system, successor to Buck
Rust
3,177
star
46

wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
C++
3,016
star
47

wdt

Warp speed Data Transfer (WDT) is an embeddedable library (and command line tool) aiming to transfer data between 2 systems as fast as possible over multiple TCP paths.
C++
2,827
star
48

igl

Intermediate Graphics Library (IGL) is a cross-platform library that commands the GPU. It provides a single low-level cross-platform interface on top of various graphics APIs (e.g. OpenGL, Metal and Vulkan).
C++
2,674
star
49

fbthrift

Facebook's branch of Apache Thrift, including a new C++ server.
C++
2,513
star
50

mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
C++
2,423
star
51

Ax

Adaptive Experimentation Platform
Python
2,226
star
52

jsx

The JSX specification is a XML-like syntax extension to ECMAScript.
HTML
1,941
star
53

fbjs

A collection of utility libraries used by other Meta JS projects.
JavaScript
1,939
star
54

react-native-website

The React Native website and docs
JavaScript
1,875
star
55

screenshot-tests-for-android

Generate fast deterministic screenshots during Android instrumentation tests
Java
1,727
star
56

idx

Library for accessing arbitrarily nested, possibly nullable properties on a JavaScript object.
JavaScript
1,687
star
57

TextLayoutBuilder

An Android library that allows you to build text layouts more easily.
Java
1,464
star
58

mvfst

An implementation of the QUIC transport protocol.
C++
1,384
star
59

SoLoader

Native code loader for Android
Java
1,269
star
60

facebook-python-business-sdk

Python SDK for Meta Marketing APIs
Python
1,211
star
61

ThreatExchange

Trust & Safety tools for working together to fight digital harms.
C++
1,092
star
62

mariana-trench

A security focused static analysis tool for Android and Java applications.
C++
1,022
star
63

CacheLib

Pluggable in-process caching engine to build and scale high performance services
C++
1,018
star
64

fatal

Fatal is a library for fast prototyping software in modern C++. It provides facilities to enhance the expressive power of C++. The library is heavily based on template meta-programming, while keeping the complexity under-the-hood.
C++
993
star
65

transform360

Transform360 is an equirectangular to cubemap transform for 360 video.
C
991
star
66

openr

Distributed platform for building autonomic network functions.
C++
879
star
67

fboss

Facebook Open Switching System Software for controlling network switches.
C++
842
star
68

facebook-php-business-sdk

PHP SDK for Meta Marketing API
PHP
787
star
69

ktfmt

A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.
Kotlin
776
star
70

winterfell

A STARK prover and verifier for arbitrary computations
Rust
691
star
71

pyre2

Python wrapper for RE2
C++
629
star
72

openbmc

OpenBMC is an open software framework to build a complete Linux image for a Board Management Controller (BMC).
C
607
star
73

SPARTA

SPARTA is a library of software components specially designed for building high-performance static analyzers based on the theory of Abstract Interpretation.
C++
604
star
74

chef-cookbooks

Open source chef cookbooks.
Ruby
561
star
75

IT-CPE

Meta's Client Platform Engineering tools. Some of the tools we have written to help manage our fleet of client systems.
Ruby
553
star
76

time

Meta's Time libraries
Go
471
star
77

facebook-nodejs-business-sdk

Node.js SDK for Meta Marketing APIs
JavaScript
464
star
78

facebook-sdk-for-unity

The facebook sdk for unity.
C#
461
star
79

lexical-ios

Lexical iOS is an extensible text editor framework that integrates the APIs and philosophies from Lexical Web with a Swift API built on top of TextKit.
Swift
446
star
80

Rapid

The OpenStreetMap editor driven by open data, AI, and supercharged features
JavaScript
425
star
81

FAI-PEP

Facebook AI Performance Evaluation Platform
Python
379
star
82

facebook-java-business-sdk

Java SDK for Meta Marketing APIs
Java
374
star
83

chef-utils

Utilities related to Chef
Ruby
287
star
84

opaque-ke

An implementation of the OPAQUE password-authenticated key exchange protocol
Rust
262
star
85

dns

Collection of Meta's DNS Libraries
Go
251
star
86

facebook360_dep

Facebook360 Depth Estimation Pipeline - https://facebook.github.io/facebook360_dep
HTML
238
star
87

akd

An implementation of an auditable key directory
Rust
207
star
88

tac_plus

A Tacacs+ Daemon tested on Linux (CentOS) to run AAA via TACACS+ Protocol via IPv4 and IPv6.
C
205
star
89

facebook-ruby-business-sdk

Ruby SDK for Meta Marketing API
Ruby
200
star
90

dotslash

Simplified executable deployment
Rust
165
star
91

usort

Safe, minimal import sorting for Python projects.
Python
161
star
92

grocery-delivery

The Grocery Delivery utility for managing cookbook uploads to distributed Chef backends.
Ruby
151
star
93

TestSlide

A Python test framework
Python
139
star
94

homebrew-fb

OS X Homebrew formulas to install Meta open source software
Ruby
122
star
95

sapp

Post Processor for Facebook Static Analysis Tools.
Python
122
star
96

squangle

SQuangLe is a C++ API for accessing MySQL servers
C++
119
star
97

threat-research

Welcome to the Meta Threat Research Indicator Repository, a dedicated resource for the sharing of Indicators of Compromise (IOCs) and other threat indicators with the external research community
Python
115
star
98

ocamlrep

Sets of libraries and tools to write applications and libraries mixing OCaml and Rust. These libraries will help keeping your types and data structures synchronized, and enable seamless exchange between OCaml and Rust
Rust
97
star
99

bpfilter

BPF-based packet filtering framework
C
79
star
100

facebook-business-sdk-codegen

Codegen project for our business SDKs
PHP
74
star