-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oliver Ferrigni
committed
Feb 12, 2016
1 parent
177e2a4
commit 24b8243
Showing
9,126 changed files
with
382,954 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.vagrant | ||
Berksfile.lock | ||
*~ | ||
*# | ||
.#* | ||
\#*# | ||
.*.sw[a-z] | ||
*.un~ | ||
|
||
# Bundler | ||
Gemfile.lock | ||
bin/* | ||
.bundle/* | ||
|
||
.kitchen/ | ||
.kitchen.local.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
driver: | ||
name: vagrant | ||
|
||
provisioner: | ||
name: chef_zero | ||
|
||
platforms: | ||
- name: ubuntu-12.04 | ||
- name: centos-6.5 | ||
|
||
suites: | ||
- name: default | ||
run_list: | ||
- recipe[build-cookbook::default] | ||
attributes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source "https://supermarket.chef.io" | ||
|
||
metadata | ||
|
||
cookbook 'delivery-truck' | ||
cookbook 'delivery-sugar', github: 'chef-cookbooks/delivery-sugar' | ||
cookbook 'route53', git: 'https://github.com/cwebberOps/route53.git', branch: 'pdb/nononokogiri' | ||
cookbook 'chef_slack', git: 'https://github.com/chef-cookbooks/chef_slack.git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# build-cookbook | ||
|
||
This is a build cookbook for setting up https://docs.chef.io. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Put files/directories that should be ignored in this file when uploading | ||
# or sharing to the community site. | ||
# Lines that start with '# ' are comments. | ||
|
||
# OS generated files # | ||
###################### | ||
.DS_Store | ||
Icon? | ||
nohup.out | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# SASS # | ||
######## | ||
.sass-cache | ||
|
||
# EDITORS # | ||
########### | ||
\#* | ||
.#* | ||
*~ | ||
*.sw[a-z] | ||
*.bak | ||
REVISION | ||
TAGS* | ||
tmtags | ||
*_flymake.* | ||
*_flymake | ||
*.tmproj | ||
.project | ||
.settings | ||
mkmf.log | ||
|
||
## COMPILED ## | ||
############## | ||
a.out | ||
*.o | ||
*.pyc | ||
*.so | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*/rdoc/ | ||
|
||
# Testing # | ||
########### | ||
.watchr | ||
.rspec | ||
spec/* | ||
spec/fixtures/* | ||
test/* | ||
features/* | ||
Guardfile | ||
Procfile | ||
|
||
# SCM # | ||
####### | ||
.git | ||
*/.git | ||
.gitignore | ||
.gitmodules | ||
.gitconfig | ||
.gitattributes | ||
.svn | ||
*/.bzr/* | ||
*/.hg/* | ||
*/.svn/* | ||
|
||
# Berkshelf # | ||
############# | ||
Berksfile | ||
Berksfile.lock | ||
cookbooks/* | ||
tmp | ||
|
||
# Cookbooks # | ||
############# | ||
CONTRIBUTING | ||
|
||
# Strainer # | ||
############ | ||
Colanderfile | ||
Strainerfile | ||
.colander | ||
.strainer | ||
|
||
# Vagrant # | ||
########### | ||
.vagrant | ||
Vagrantfile | ||
|
||
# Travis # | ||
########## | ||
.travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
User-agent: * | ||
Disallow: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
begin | ||
require "slack-notifier" | ||
rescue LoadError | ||
Chef::Log.debug("Chef slack_handler requires `slack-notifier` gem") | ||
end | ||
|
||
require "timeout" | ||
|
||
module BuildCookbook | ||
class SlackHandler < Chef::Handler | ||
attr_accessor :webhook_url, :channels, :username, :icon_emoj | ||
|
||
def initialize(options = {}) | ||
@webhook_url = options[:webhook_url] | ||
@username = options[:username] || 'delivery' | ||
@channels = options[:channels] || '#delivery' | ||
@icon_emoj = options[:icon_emoj] || ":chef:" | ||
end | ||
|
||
def report | ||
msg = "*[#{node['delivery']['change']['project']}] (#{node['delivery']['change']['stage']}:#{node['delivery']['change']['phase']})* Change Failed: #{make_link(change_url)}" | ||
Chef::Log.debug("Sending report to Slack @chefio.slack.com") | ||
Chef::Log.error msg | ||
slack_message(msg) | ||
end | ||
|
||
def slack_message(content) | ||
slack = Slack::Notifier.new(@webhook_url) | ||
@channels.each do |channel| | ||
config = {} | ||
config['channel'] = channel | ||
config['username'] = @username | ||
slack.ping(content,config) | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# | ||
# Cookbook Name:: build-cookbook | ||
# Library:: _helper | ||
# | ||
# Copyright (C) Chef Software, Inc. 2015 | ||
# | ||
|
||
Chef::Resource.send(:include, Chef::Mixin::ShellOut) | ||
|
||
def bundler_cache_dir | ||
File.join( | ||
node['delivery']['workspace']['root'], | ||
'bundler-cache' | ||
) | ||
end | ||
|
||
def load_data_bag_item(data_bag, item) | ||
dbag = Chef::DataBag.new | ||
dbag.name(data_bag) | ||
dbag.save | ||
dbag_data = Chef::JSONCompat.from_json(File.read(File.join(File.dirname(__FILE__), "..", "files", "data_bags", data_bag, "#{item}.json"))) | ||
dbag_item = Chef::DataBagItem.new | ||
dbag_item.data_bag(data_bag) | ||
dbag_item.raw_data = dbag_data | ||
dbag_item.save | ||
end | ||
|
||
def make_link(url) | ||
"<a href=\"#{url}\">#{url}</a>" | ||
end | ||
|
||
def change_url | ||
"https://delivery.chef.co/e/#{node['delivery']['change']['enterprise']}/#/organizations/#{node['delivery']['change']['organization']}/projects/#{node['delivery']['change']['project']}/changes/#{node['delivery']['change']['change_id']}/status/verify" | ||
end | ||
|
||
|
||
def prev_stage(stage) | ||
case stage | ||
when 'build' | ||
nil | ||
when 'acceptance' | ||
'build' | ||
when 'union' | ||
'acceptance' | ||
when 'rehearsal' | ||
'union' | ||
when 'delivered' | ||
'rehearsal' | ||
end | ||
end | ||
|
||
def next_stage(stage) | ||
case stage | ||
when 'build' | ||
'acceptance' | ||
when 'acceptance' | ||
'union' | ||
when 'union' | ||
'rehearsal' | ||
when 'rehearsal' | ||
'delivered' | ||
when 'delivered' | ||
nil | ||
end | ||
end | ||
|
||
def delivered_stage? | ||
if node['delivery']['change']['stage'] == 'delivered' | ||
true | ||
else | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name 'build-cookbook' | ||
maintainer 'The Authors' | ||
maintainer_email '[email protected]' | ||
license 'all_rights' | ||
description 'Installs/Configures build-cookbook' | ||
long_description 'Installs/Configures build-cookbook' | ||
version '0.1.1' | ||
|
||
depends 'delivery-truck' | ||
depends 'chef_handler' | ||
depends 'chef-sugar' | ||
depends 'route53' | ||
depends 'fastly' | ||
depends 'nodejs' | ||
depends 'chef_slack' | ||
depends 'build-essential' | ||
depends 'fancy_execute' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# Original Cookbook Name:: oc-releng-provisioner | ||
# Recipe:: _github | ||
# | ||
# Copyright 2015, Chef Software, Inc. | ||
# | ||
# All rights reserved - Do Not Redistribute | ||
# | ||
Chef_Delivery::ClientHelper.enter_client_mode_as_delivery | ||
include_recipe 'chef-sugar::default' | ||
|
||
# Load Chef Sugar's core_extensions so we can call `String#flush` on heredocs | ||
require 'chef/sugar/core_extensions' | ||
|
||
build_user_home = "/var/opt/delivery/workspace" | ||
|
||
directory "#{build_user_home}/.ssh" do | ||
owner node['delivery_builder']['build_user'] | ||
group 'root' | ||
mode '0700' | ||
end | ||
|
||
# GitHub support config for Delivery builders | ||
|
||
# Add GitHub to ssh known_hosts | ||
execute "ssh-keyscan -t rsa github.com >> #{build_user_home}/.ssh/known_hosts" do | ||
not_if "grep -q github.com '#{build_user_home}/.ssh/known_hosts'" | ||
end | ||
|
||
github_keys = encrypted_data_bag_item_for_environment('keys', 'github') | ||
|
||
deploy_key_path = ::File.join(build_user_home, '.ssh', 'chef-delivery.pem') | ||
|
||
file deploy_key_path do | ||
content github_keys['chef-delivery'] | ||
owner node['delivery_builder']['build_user'] | ||
group 'root' | ||
mode '0600' | ||
sensitive true | ||
end | ||
|
||
file "#{build_user_home}/.ssh/config" do | ||
content <<-EOH.flush | ||
Host github.com | ||
IdentityFile #{deploy_key_path} | ||
StrictHostKeyChecking no | ||
EOH | ||
owner node['delivery_builder']['build_user'] | ||
group 'root' | ||
mode '0600' | ||
end | ||
Chef_Delivery::ClientHelper.leave_client_mode_as_delivery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
include_recipe 'chef-sugar::default' | ||
|
||
Chef_Delivery::ClientHelper.enter_client_mode_as_delivery | ||
|
||
slack_creds = encrypted_data_bag_item_for_environment('cia-creds','slack') | ||
|
||
if ['union', 'rehearsal', 'delivered'].include?(node['delivery']['change']['stage']) | ||
slack_channels = slack_creds['channels'].push('#operations').push('#chef-docs-bot') | ||
else | ||
slack_channels = slack_creds['channels'].push('#chef-docs-bot') | ||
end | ||
|
||
chef_handler "BuildCookbook::SlackHandler" do | ||
source File.join(node["chef_handler"]["handler_path"], 'slack.rb') | ||
arguments [ | ||
:webhook_url => slack_creds['webhook_url'], | ||
:channels => slack_channels, | ||
:username => slack_creds['username'] | ||
] | ||
supports :exception => true | ||
sensitive true | ||
action :enable | ||
end | ||
|
||
Chef_Delivery::ClientHelper.leave_client_mode_as_delivery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# | ||
# | ||
|
||
execute 'nokogiri config' do | ||
command "bundle config build.nokogiri --use-system-libraries" | ||
cwd node['delivery_builder']['repo'] | ||
environment({ | ||
"PATH" => '/opt/chefdk/embedded/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games' | ||
}) | ||
user node['delivery_builder']['build_user'] | ||
end | ||
|
||
execute 'install deps' do | ||
command "bundle install --deployment" | ||
cwd node['delivery_builder']['repo'] | ||
environment({ | ||
"PATH" => '/opt/chefdk/embedded/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games', | ||
"LDFLAGS" => '-L/opt/chefdk/embedded/lib -lxml2 -L/opt/chefdk/embedded/lib -lz -L/opt/chefdk/embedded/lib -liconv -lm -ldl', | ||
"CFLAGS" => '-I/opt/chefdk/embedded/include/libxml2 -I/opt/chefdk/embedded/include' | ||
}) | ||
user node['delivery_builder']['build_user'] | ||
end |
Oops, something went wrong.