Commit e71fc4be authored by Duc Ha's avatar Duc Ha Committed by GitHub
Browse files

Merge pull request #134 from majormoses/master

[CI] improve lint process:
parents 94374235 3d0a37f2
language: ruby
sudo: false
cache:
- bundler
before_install:
- gem install bundler
addons:
apt:
sources:
- chef-current-trusty
packages:
- chefdk
# might add this back later
# addons:
# apt:
# sources:
# - chef-current-trusty
# packages:
# - chefdk
# Don't `bundle install` which takes about 1.5 mins
install: echo "skip bundle install"
# Install bundle, to hell with saving a minute as it causes users to
# search and realize that this is coming from some unpinned chefdk install
install:
- echo "bundle install"
- bundle install
# ruby versions to test
rvm:
- 2.3.0
# Ensure we make ChefDK's Ruby the default
before_script:
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
script:
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/rubocop --version
- /opt/chefdk/embedded/bin/rubocop --fail-level warning
- /opt/chefdk/embedded/bin/foodcritic --version
- /opt/chefdk/embedded/bin/foodcritic . --exclude spec
- /opt/chefdk/embedded/bin/rspec --version
- /opt/chefdk/embedded/bin/rspec
- bundle exec rubocop --version
- bundle exec rubocop
- bundle exec foodcritic --version
- bundle exec foodcritic . --exclude spec
# we might want the do some stuff with chefdk later here but do not want to do
# that before other types of lint based testing.
# you might want to do something like `eval "$(/opt/chefdk/bin/chef shell-init bash)" && $SOME_CHEFDK_BINARY`
......@@ -2,7 +2,7 @@
source 'https://rubygems.org'
gem 'buff-extensions', '1.0.0'
gem 'buff-extensions', '~> 2.0'
gem 'chef'
gem 'chefspec'
gem 'kitchen-inspec'
......@@ -10,12 +10,12 @@ gem 'kitchen-vagrant'
gem 'test-kitchen'
group :lint do
gem 'foodcritic'
gem 'foodcritic', '~> 11.2.0'
gem 'rainbow'
gem 'rubocop'
gem 'rubocop', '~> 0.48.0'
end
group :unit do
gem 'berkshelf'
gem 'berkshelf', '~> 5.6'
gem 'fauxhai'
end
......@@ -41,8 +41,8 @@ if node['sumologic']['credentials']
creds = node['sumologic']['credentials']
if creds[:secret_file]
secret = Chef::EncryptedDataBagItem.load_secret(creds[:secret_file])
item = Chef::EncryptedDataBagItem.load(creds[:bag_name], creds[:item_name], secret)
secret = Chef::EncryptedDataBagItem.load_secret(creds[:secret_file]) # ~FC086
item = Chef::EncryptedDataBagItem.load(creds[:bag_name], creds[:item_name], secret) # ~FC086
else
item = if ChefVault::Item.vault?(creds[:bag_name], creds[:item_name])
ChefVault::Item.load(creds[:bag_name], creds[:item_name])
......
......@@ -8,7 +8,7 @@ sumo_access_key = node['SUMO_ACCESS_KEY'] # set in .kitchen.yml
sumo_access_key_var = '<@SUMO_ACCESS_KEY@>'
BAG_PATH = Chef::Config[:data_bag_path]
TARGET_BAG = 'sumo-creds/api-creds.json'
TARGET_BAG = 'sumo-creds/api-creds.json'.freeze
BAG_FILE = BAG_PATH + '/' + TARGET_BAG
BACKUP_FILE = BAG_FILE + '.old'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment