Skip to content

Commit

Permalink
Sous Chefs Adoption (#15)
Browse files Browse the repository at this point in the history
* Cookstyle fixes

Signed-off-by: Lance Albertson <[email protected]>

* Standardize files for Sous Chefs

Signed-off-by: Lance Albertson <[email protected]>

* Update README.md

Signed-off-by: Lance Albertson <[email protected]>

* Update metadata.rb to Sous Chefs

Signed-off-by: Lance Albertson <[email protected]>

* Comment out broken ChefSpec

Signed-off-by: Lance Albertson <[email protected]>

* Remove Guardfile

Signed-off-by: Lance Albertson <[email protected]>

* Migrate to modern custom resources

Signed-off-by: Lance Albertson <[email protected]>

* Switch to just testing on Ubuntu

Signed-off-by: Lance Albertson <[email protected]>

* Add InSpec tests

Signed-off-by: Lance Albertson <[email protected]>

* Add GH CI config

Signed-off-by: Lance Albertson <[email protected]>

* Update CHANGELOG

Signed-off-by: Lance Albertson <[email protected]>

* Add documentation

Signed-off-by: Lance Albertson <[email protected]>

* Remove kind_of references in resources in resources in resources in resources

Signed-off-by: Lance Albertson <[email protected]>
  • Loading branch information
ramereth authored Sep 8, 2021
1 parent 5167787 commit fe75b0e
Show file tree
Hide file tree
Showing 46 changed files with 1,189 additions and 445 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
version: 2.1
orbs:
kitchen: sous-chefs/kitchen@2
workflows:
danger:
jobs:
- kitchen/danger:
name: danger
context: Danger-Minimal
9 changes: 9 additions & 0 deletions .delivery/project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[local_phases]
unit = "rspec spec/"
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "echo skipping"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://EditorConfig.org

# top-most EditorConfig file
root=true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# 2 space indentation
indent_style = space
indent_size = 2

# Avoid issues parsing cookbook files later
charset = utf-8

# Avoid cookstyle warnings
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use chefworkstation
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @sous-chefs/maintainers
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: ci

"on":
pull_request:
push:
branches:
- main

jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run Chef Delivery
uses: actionshub/chef-delivery@main
env:
CHEF_LICENSE: accept-no-persist

yamllint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run yaml Lint
uses: actionshub/yamllint@main

mdl:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run Markdown Lint
uses: actionshub/markdownlint@main

integration:
needs: [mdl, yamllint, delivery]
runs-on: ubuntu-latest
strategy:
matrix:
os:
- 'ubuntu-2004'
suite:
- 'default'
fail-fast: false

steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Chef
uses: actionshub/chef-install@main
- name: Dokken
uses: actionshub/test-kitchen@main
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
19 changes: 19 additions & 0 deletions .github/workflows/md-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: md-links

"on":
pull_request:
push:
branches: [main]

jobs:
md-links:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: markdown-link-check
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: "yes"
folder-path: "documentation"
25 changes: 25 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Mark stale issues and pull requests

"on":
schedule: [cron: "0 0 * * *"]

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
close-issue-message: >
Closing due to inactivity.
If this is still an issue please reopen or open another issue.
Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help!
Thanks, Sous-Chefs.
days-before-close: 7
days-before-stale: 365
stale-issue-message: >
Marking stale due to inactivity.
Remove stale label or comment or this will be closed in 7 days.
Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help!
Thanks, Sous-Chefs.
51 changes: 41 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,49 @@
.vagrant
Berksfile.lock
*.rbc
.config
InstalledFiles
pkg
test/tmp
test/version_tmp
tmp
_Store
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
/cookbooks
*.tmp
*.bk
*.bkup

# editor files
.idea
.*.sw[a-z]

# Bundler
# ruby/bundler/rspec files
.ruby-version
.ruby-gemset
.rvmrc
Gemfile.lock
bin/*
.bundle/*
.bundle
*.gem
coverage
spec/reports

# YARD / rdoc artifacts
.yardoc
_yardoc
doc/
rdoc

# chef infra stuff
Berksfile.lock
.kitchen
kitchen.local.yml
vendor/
.coverage/
.zero-knife.rb
Policyfile.lock.json

.kitchen/
.kitchen.local.yml
/tmp
# vagrant stuff
.vagrant/
.vagrant.d/
1 change: 1 addition & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rules "~MD013", "~MD024", "~MD026", "~MD029", "~MD033"
20 changes: 20 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
PreCommit:
TrailingWhitespace:
enabled: true
YamlLint:
enabled: true
Rspec:
enabled: true
required_executable: 'rspec'
Cookstyle:
enabled: true
required_executable: 'cookstyle'
command: ["cookstyle"]
Delivery:
enabled: true
required_executable: 'delivery'
flags: ['local', 'all']
CommitMsg:
HardTabs:
enabled: true
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"chef-software.chef",
"rebornix.ruby",
"editorconfig.editorconfig"
]
}
13 changes: 13 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
extends: default
rules:
line-length:
max: 256
level: warning
document-start: disable
braces:
forbid: false
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
6 changes: 5 additions & 1 deletion Berksfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
source 'http://api.berkshelf.com'
source 'https://supermarket.chef.io'

metadata

group :integration do
cookbook 'test', path: 'test/fixtures/cookbooks/test'
end
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ This file is used to list changes made in each version of the GitHub cookbook.
## Unreleased

- Sous-Chefs adoption
- Migrate to modern custom resources and enable `unified_mode`
- Remove dependency on libarchive
- Cookstyle fixes
- Fix URI deprecation issues
- Replace `extract` method with using the `archive_file` native resource
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Community Guidelines

This project follows the Chef Community Guidelines <https://docs.chef.io/community_guidelines.html>
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Contributing

Please refer to
[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
47 changes: 47 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Reference: http://danger.systems/reference.html

# A pull request summary is required. Add a description of the pull request purpose.
# Changelog must be updated for each pull request that changes code.
# Warnings will be issued for:
# Pull request with more than 400 lines of code changed
# Pull reqest that change more than 5 lines without test changes
# Failures will be issued for:
# Pull request without summary
# Pull requests with code changes without changelog entry

def code_changes?
code = %w(libraries attributes recipes resources files templates)
code.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end

def test_changes?
tests = %w(spec test kitchen.yml kitchen.dokken.yml)
tests.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end

failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10

warn 'This is a big Pull Request.' if git.lines_of_code > 400

warn 'This is a Table Flip.' if git.lines_of_code > 2000

# Require a CHANGELOG entry for non-test changes.
if !git.modified_files.include?('CHANGELOG.md') && code_changes?
failure 'Please include a CHANGELOG entry.'
end

# Require Major Minor Patch version labels
unless github.pr_labels.grep /minor|major|patch/i
warn 'Please add a release label to this pull request'
end

# A sanity check for tests.
if git.lines_of_code > 5 && code_changes? && !test_changes?
warn 'This Pull Request is probably missing tests.'
end
13 changes: 0 additions & 13 deletions Gemfile

This file was deleted.

12 changes: 0 additions & 12 deletions Guardfile

This file was deleted.

Loading

0 comments on commit fe75b0e

Please sign in to comment.