Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintainers Process #130

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: windows

"on":
pull_request:
push:
branches:
- master

jobs:
windows_agent:
runs-on: windows-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Install Chef
uses: actionshub/chef-install@master
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Create directory
run: mkdir D:\a\berks-cookbooks\
- name: Create Link
run: cmd /c mklink /d D:\a\cookbooks\ D:\a\berks-cookbooks\
- name: Vendor Cookbooks
working-directory: D:\a\
run: berks vendor -b D:\a\sensu-go-chef\sensu-go-chef\Berksfile
- name: Chef Zero
working-directory: D:\a\cookbooks\sensu-go\
env:
CHEF_LICENSE: accept-no-persist
run: chef-client -z -o sensu_test::agent
- name: Verify
run: >
chef exec inspec
exec
D:\a\sensu-go-chef\sensu-go-chef\test\integration\agent\agent_spec.rb
env:
CHEF_LICENSE: accept-no-persist
windows_ctl:
runs-on: windows-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Install Chef
uses: actionshub/chef-install@master
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Create directory
run: mkdir D:\a\berks-cookbooks\
- name: Create Link
run: cmd /c mklink /d D:\a\cookbooks\ D:\a\berks-cookbooks\
- name: Vendor Cookbooks
working-directory: D:\a\
run: berks vendor -b D:\a\sensu-go-chef\sensu-go-chef\Berksfile
- name: Chef Zero
working-directory: D:\a\cookbooks\sensu-go\
env:
CHEF_LICENSE: accept-no-persist
run: chef-client -z -o sensu_test::ctl
- name: GitHub Windows Path (Deprecated Add-Path)
run: >
echo "c:\Program Files\Sensu\sensu-cli\bin\sensuctl"
| Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Verify
run: >
chef exec inspec
exec D:\a\sensu-go-chef\sensu-go-chef\test\integration\ctl\ctl_spec.rb
env:
CHEF_LICENSE: accept-no-persist
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This CHANGELOG follows the format located [here](https://github.com/sensu-plugin

## [Unreleased]

- Updated Contributing to document maintainers processes (@derekgroh)
- Introduced CI/CD testing for windows for agent and ctl (@derekgroh)

## [1.3.0] - 2020-10-28

### Fixed
Expand Down
26 changes: 19 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
Contributing
============
# Contributing

TODO: Fill out your contributing process, or just stick with the default.

Steps
-----
## Steps

Thanks for your interest in sensu-go cookbook! If you'd like to help out please:

1. Fork it
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Add tests for the new feature; ensure they pass (`rake`)
1. Add tests for the new feature; ensure they pass See [TESTING.md](./TESTING.md)
1. Add a changelog entry under `## [Unreleased]` and the appropriate sub header for the type of change per our [guidelines](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create a new Pull Request

## Maintainer

Maintainers are GitHub Members who help review Pull Request and help organize and triage issues.

### Pre Conditions

1. Shown consistent and quality contributions to this repository as well as active engagement in the Sensu ecosystem.
1. MFA enabled on your Github account

### Process

1. Open an [issue](https://github.com/sensu/sensu-go-chef/issues/new) indicating that you would like to become a maintainer
1. Endorsed by two or more active maintainers with no vetos against them
1. Have acknowledged that they have read and will abide by the terms outlined in the [Code of Conduct](https://sensu.io/conduct)
1. Will be invited to the organization, teams, slack channels, etc as outlined via internal maintainer processes.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ gem 'berkshelf'
gem 'chef-sugar'

group :development do
gem 'foodcritic'
gem 'chefspec'
gem 'cookstyle', '~> 4.0'
gem 'guard'
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'foodcritic'
require 'kitchen'
require 'chefspec'
require 'cookstyle'
Expand Down
48 changes: 0 additions & 48 deletions kitchen.appveyor.yml

This file was deleted.

17 changes: 13 additions & 4 deletions resources/ctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@
destination sensuctl_bin
overwrite true
action :nothing
notifies :delete, 'directory[c:\sensutemp]'
end

windows_path sensuctl_bin

directory 'c:\sensutemp' do
action :delete
action :nothing
recursive true
end
end
Expand All @@ -93,9 +94,17 @@
action :configure do
if shell_out('sensuctl user list').error?
converge_by 'Reconfiguring sensuctl' do
execute 'configure sensuctl' do
command sensuctl_configure_cmd
sensitive true unless new_resource.debug
unless platform?('windows')
execute 'configure sensuctl' do
command sensuctl_configure_cmd
sensitive true unless new_resource.debug
end
end
if platform?('windows')
powershell_script 'configure sensuctl' do
code sensuctl_configure_cmd
sensitive true unless new_resource.debug
end
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/recipes/sensu_ctl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@

it 'does nothing for an archive' do
expect(chef_run).to nothing_archive_file('Extract Sensuctl')
archive_file_resource = chef_run.archive_file('Extract Sensuctl')
expect(archive_file_resource).to notify('directory[c:\sensutemp]')
end

it 'notifies to extract the archive' do
Expand All @@ -90,7 +92,7 @@
end

it 'deletes the temporary directory `c:\sensutemp`' do
expect(chef_run).to delete_directory('c:\sensutemp')
expect(chef_run).to nothing_directory('c:\sensutemp')
end

it 'configures the sensu cli' do
Expand Down
4 changes: 3 additions & 1 deletion test/cookbooks/sensu_test/recipes/agent.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
sensu_agent 'default'
sensu_agent 'default' do
ignore_failure true
end
4 changes: 3 additions & 1 deletion test/cookbooks/sensu_test/recipes/ctl.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
sensu_ctl 'default' do
action [:install, :configure]
backend_url 'http://172.128.10.2:8080'
username 'guest'
password 'i<3sensu'
backend_url 'https://caviar.tf.sensu.io:8080/'
end
13 changes: 9 additions & 4 deletions test/integration/ctl/ctl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
describe package('sensu-go-cli') do
it { should be_installed }
end

describe command('sensuctl user list') do
its('stdout') { should match /Username/ }
its('exit_status') { should eq 0 }
end
end

if os.windows?
Expand All @@ -33,9 +38,9 @@
describe file('c:\Program Files\Sensu\sensu-cli\bin\sensuctl\sensuctl.exe') do
it { should exist }
end
end

describe command('sensuctl user list') do
its('stdout') { should match /Username/ }
its('exit_status') { should eq 0 }
describe command('sensuctl entity list') do
its('stdout') { should match /backend/ }
its('exit_status') { should eq 0 }
end
end