Commit c6c35de4 authored by Lance Albertson's avatar Lance Albertson
Browse files

Sous Chefs Adoption



- Standardise files with files in sous-chefs/repo-management
- Cookstyle fixes
- Remove EL6 and add Amazon Linux
- Switch to using https endpoints and gpgcheck enabled
- Migrate to InSpec testing
Signed-off-by: default avatarLance Albertson <lance@osuosl.org>
parent 4d82a6d6
---
name: Branch Cleanup
# This workflow is triggered on all closed pull requests.
# However the script does not do anything if a merge was not performed.
"on":
pull_request:
types: [closed]
env:
NO_BRANCH_DELETED_EXIT_CODE: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: jessfraz/branch-cleanup-action@master
---
name: ci
name: ci
on:
pull_request:
push:
branches:
- master
"on":
pull_request:
push:
branches:
- master
jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Chef Delivery
uses: actionshub/chef-delivery@master
env:
CHEF_LICENSE: accept-no-persist
jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Chef Delivery
uses: actionshub/chef-delivery@master
env:
CHEF_LICENSE: accept-no-persist
dokken:
needs: [delivery]
runs-on: ubuntu-latest
strategy:
matrix:
os:
- 'centos-6'
- 'centos-7'
- 'centos-8'
suite:
- 'default'
fail-fast: false
yamllint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run yaml Lint
uses: actionshub/yamllint@master
steps:
- name: Check out code
uses: actions/checkout@master
- name: Install Chef
uses: actionshub/chef-install@master
- name: Dokken
uses: actionshub/kitchen-dokken@master
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
mdl:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Markdown Lint
uses: actionshub/markdownlint@master
final:
needs: [dokken]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
dokken:
needs: [mdl, yamllint, delivery]
runs-on: ubuntu-latest
strategy:
matrix:
os:
- 'amazonlinux-2'
- 'centos-7'
- 'centos-8'
suite:
- 'default'
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@master
- name: Install Chef
uses: actionshub/chef-install@master
- name: Dokken
uses: actionshub/kitchen-dokken@master
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
final:
needs: [dokken]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
name: delivery
on: [push, pull_request]
jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Chef Delivery
uses: actionshub/chef-delivery@master
env:
CHEF_LICENSE: accept-no-persist
\ No newline at end of file
rules "~MD013", "~MD024", "~MD025"
source 'https://supermarket.chef.io'
cookbook 'test', path: 'test/cookbooks/test'
metadata
# yum-erlang_solutions Cookbook CHANGELOG
This file is used to list changes made in each version of the yum-erlang_solutions cookbook.
## Unreleased
- resolved cookstyle error: spec/default_spec.rb:22:7 warning: `ChefDeprecations/DeprecatedChefSpecPlatform`
- Sous Chefs Adoption
- Standardise files with files in sous-chefs/repo-management
- Cookstyle fixes
- Remove EL6 and add Amazon Linux
- Switch to using https endpoints and gpgcheck enabled
- Migrate to InSpec testing
## 2.0.0 (2018-02-16)
- Require Chef 12.14+ and remove compat_resource dep
- Require Chef 12.14+ and remove `compat_resourc`e dep
- Testing improvements
- Use a SPDX compliant license string
## 1.0.3 (2016-12-22)
- Depend on the latest compat_resource cookbook
- Depend on the latest `compat_resource` cookbook
- Cookstyle fixes
## 1.0.2 (2016-12-05)
- Documentation fixes
- Avoid deprecation warnings
## 1.0.1 (2016-11-14)
- Resolve releasever issues
## 1.0.0 (2016-09-06)
- Testing updates
- Resolve foodcritic warnings
- Add chef_version metadata
- Add `chef_version` metadata
- Remove support for Chef 11
## v0.3.1 (2015-12-01)
- Removed an attribute case statement that caused the cookbook to fail on RHEL 7.X releases
## v0.3.0 (2015-12-01)
- Added dependency on yum-epel
- Added integration testing in Travis with kitchen-dokken
## v0.2.4 (2015-11-23)
- Fix setting bool false property values
## v0.2.3 (2015-10-28)
- Fixing Chef 13 nil property deprecation warnings
## v0.2.2 (2014-09-22)
- Add default['yum']['erlang_solutions']['managed'] attribute to control if the repository is managed. Defaults to true.
- Add `default['yum']['erlang_solutions']['managed']` attribute to control if the repository is managed. Defaults to true.
- Updated Test Kitchen config to 3.X format
- Add source_url and issues_url metadata
- Add `source_url` and `issues_url` metadata
- Add supported platforms to metadata
- Update yum cookbook requirement from ~3.0 to ~3.2
- Update Chefspec format to 4.X
......@@ -59,10 +73,13 @@ This file is used to list changes made in each version of the yum-erlang_solutio
- Add Chef standard chefignore and gitgnore files
## v0.2.0 (2014-02-14)
- Updated test harness
## v0.1.4
- Added CHANGELOG
## v0.1.0
- Initial release
# yum-erlang_solutions Cookbook
[![Build Status](https://travis-ci.org/chef-cookbooks/yum-erlang_solutions.svg?branch=master)](http://travis-ci.org/chef-cookbooks/yum-erlang_solutions) [![Cookbook Version](https://img.shields.io/cookbook/v/yum-erlang_solutions.svg)](https://supermarket.chef.io/cookbooks/yum-erlang_solutions)
[![Cookbook Version](https://img.shields.io/cookbook/v/yum-erlang_solutions.svg)](https://supermarket.chef.io/cookbooks/yum-erlang_solutions)
[![CI State](https://github.com/sous-chefs/yum-erlang_solutions/workflows/ci/badge.svg)](https://github.com/sous-chefs/yum-erlang_solutions/actions?query=workflow%3Aci)
[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
The yum-erlang_solutions cookbook takes over management of the default repositoryids used by erlang_solutions. It allows attribute manipulation of `erlang_solutions`.
## Maintainers
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).
## Requirements
### Platforms
- RHEL/CentOS and derivatives
- Fedora
- Amazon Linux
### Chef
......@@ -81,22 +89,27 @@ node.default['yum']['erlang_solutions']['sslverify'] = false
include_recipe 'yum-erlang_solutions'
```
## License & Authors
## Contributors
**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))
This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false)
**Copyright:** 2011-2016, Chef Software, Inc.
### Backers
```
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Thank you to all our backers!
http://www.apache.org/licenses/LICENSE-2.0
![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40)
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100)
default['yum']['erlang_solutions']['baseurl'] = "http://packages.erlang-solutions.com/rpm/centos/#{node['platform_version'].to_i}/$basearch"
default['yum']['erlang_solutions']['description'] = "Centos #{node['platform_version'].to_i} - $basearch - Erlang Solutions"
default['yum']['erlang_solutions']['gpgkey'] = 'http://packages.erlang-solutions.com/debian/erlang_solutions.asc'
default['yum']['erlang_solutions']['gpgcheck'] = false
if platform?('amazon')
default['yum']['erlang_solutions']['baseurl'] = 'https://packages.erlang-solutions.com/rpm/centos/7/$basearch'
default['yum']['erlang_solutions']['description'] = 'CentOS 7 - $basearch - Erlang Solutions'
else
default['yum']['erlang_solutions']['baseurl'] = 'https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch'
default['yum']['erlang_solutions']['description'] = 'CentOS $releasever - $basearch - Erlang Solutions'
end
default['yum']['erlang_solutions']['gpgkey'] = 'https://packages.erlang-solutions.com/debian/erlang_solutions.asc'
default['yum']['erlang_solutions']['gpgcheck'] = true
default['yum']['erlang_solutions']['enabled'] = true
default['yum']['erlang_solutions']['managed'] = true
driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
privileged: true # because Docker and SystemD
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>
chef_license: accept-no-persist
......@@ -9,33 +9,19 @@ transport:
provisioner:
name: dokken
deprecations_as_errors: true
verifier:
name: inspec
platforms:
- name: amazonlinux
driver:
image: dokken/amazonlinux
pid_one_command: /sbin/init
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: centos-6
driver:
image: dokken/centos-6
pid_one_command: /sbin/init
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
......@@ -3,6 +3,8 @@ driver:
provisioner:
name: chef_zero
enforce_idempotency: true
multiple_converge: 2
deprecations_as_errors: true
chef_license: accept-no-persist
......@@ -10,11 +12,7 @@ verifier:
name: inspec
platforms:
- name: amazonlinux
driver_config:
box: mvbcoding/awslinux
- name: amazonlinux-2
- name: centos-6
- name: centos-7
- name: centos-8
......@@ -22,3 +20,4 @@ suites:
- name: default
run_list:
- recipe[yum-erlang_solutions::default]
- recipe[test]
name 'yum-erlang_solutions'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Installs/Configures yum-erlang_solutions'
version '2.0.0'
name 'yum-erlang_solutions'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Installs/Configures yum-erlang_solutions'
version '2.0.0'
source_url 'https://github.com/sous-chefs/yum-erlang_solutions'
issues_url 'https://github.com/sous-chefs/yum-erlang_solutions/issues'
chef_version '>= 12.15'
depends 'yum-epel'
%w(amazon centos fedora oracle redhat scientific).each do |os|
supports os
end
source_url 'https://github.com/chef-cookbooks/yum-erlang_solutions'
issues_url 'https://github.com/chef-cookbooks/yum-erlang_solutions/issues'
chef_version '>= 12.15'
supports 'amazon'
supports 'centos'
supports 'oracle'
supports 'redhat'
supports 'scientific'
......@@ -19,33 +19,7 @@
include_recipe 'yum-epel'
yum_repository 'erlang_solutions' do
description node['yum']['erlang_solutions']['description'] unless node['yum']['erlang_solutions']['description'].nil?
baseurl node['yum']['erlang_solutions']['baseurl'] unless node['yum']['erlang_solutions']['baseurl'].nil?
mirrorlist node['yum']['erlang_solutions']['mirrorlist'] unless node['yum']['erlang_solutions']['mirrorlist'].nil?
gpgcheck node['yum']['erlang_solutions']['gpgcheck'] unless node['yum']['erlang_solutions']['gpgcheck'].nil?
gpgkey node['yum']['erlang_solutions']['gpgkey'] unless node['yum']['erlang_solutions']['gpgkey'].nil?
enabled node['yum']['erlang_solutions']['enabled'] unless node['yum']['erlang_solutions']['enabled'].nil?
cost node['yum']['erlang_solutions']['cost'] unless node['yum']['erlang_solutions']['cost'].nil?
exclude node['yum']['erlang_solutions']['exclude'] unless node['yum']['erlang_solutions']['exclude'].nil?
enablegroups node['yum']['erlang_solutions']['enablegroups'] unless node['yum']['erlang_solutions']['enablegroups'].nil?
failovermethod node['yum']['erlang_solutions']['failovermethod'] unless node['yum']['erlang_solutions']['failovermethod'].nil?
http_caching node['yum']['erlang_solutions']['http_caching'] unless node['yum']['erlang_solutions']['http_caching'].nil?
include_config node['yum']['erlang_solutions']['include_config'] unless node['yum']['erlang_solutions']['include_config'].nil?
includepkgs node['yum']['erlang_solutions']['includepkgs'] unless node['yum']['erlang_solutions']['includepkgs'].nil?
keepalive node['yum']['erlang_solutions']['keepalive'] unless node['yum']['erlang_solutions']['keepalive'].nil?
max_retries node['yum']['erlang_solutions']['max_retries'] unless node['yum']['erlang_solutions']['max_retries'].nil?
metadata_expire node['yum']['erlang_solutions']['metadata_expire'] unless node['yum']['erlang_solutions']['metadata_expire'].nil?
mirror_expire node['yum']['erlang_solutions']['mirror_expire'] unless node['yum']['erlang_solutions']['mirror_expire'].nil?
priority node['yum']['erlang_solutions']['priority'] unless node['yum']['erlang_solutions']['priority'].nil?
proxy node['yum']['erlang_solutions']['proxy'] unless node['yum']['erlang_solutions']['proxy'].nil?
proxy_username node['yum']['erlang_solutions']['proxy_username'] unless node['yum']['erlang_solutions']['proxy_username'].nil?
proxy_password node['yum']['erlang_solutions']['proxy_password'] unless node['yum']['erlang_solutions']['proxy_password'].nil?
repositoryid node['yum']['erlang_solutions']['repositoryid'] unless node['yum']['erlang_solutions']['repositoryid'].nil?
sslcacert node['yum']['erlang_solutions']['sslcacert'] unless node['yum']['erlang_solutions']['sslcacert'].nil?
sslclientcert node['yum']['erlang_solutions']['sslclientcert'] unless node['yum']['erlang_solutions']['sslclientcert'].nil?
sslclientkey node['yum']['erlang_solutions']['sslclientkey'] unless node['yum']['erlang_solutions']['sslclientkey'].nil?
sslverify node['yum']['erlang_solutions']['sslverify'] unless node['yum']['erlang_solutions']['sslverify'].nil?
timeout node['yum']['erlang_solutions']['timeout'] unless node['yum']['erlang_solutions']['timeout'].nil?
action :create
only_if { node['yum']['erlang_solutions']['managed'] }
end
node['yum']['erlang_solutions'].each do |config, value|
send(config.to_sym, value) unless value.nil? || config == 'managed'
end
end if node['yum']['erlang_solutions']['managed']
......@@ -12,23 +12,7 @@ describe 'yum-erlang_solutions::default' do
it 'renders the yum repository with defaults' do
expect(chef_run).to create_yum_repository('erlang_solutions').with(
repositoryid: 'erlang_solutions',
baseurl: 'http://packages.erlang-solutions.com/rpm/centos/7/$basearch'
)
end
end
context 'centos-6' do
let(:chef_run) do
ChefSpec::SoloRunner.new(
platform: 'centos',
version: '6'
).converge(described_recipe)
end
it 'renders the yum repository with defaults' do
expect(chef_run).to create_yum_repository('erlang_solutions').with(
repositoryid: 'erlang_solutions',
baseurl: 'http://packages.erlang-solutions.com/rpm/centos/6/$basearch'
baseurl: 'https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch'
)
end
end
......
name 'test'
version '0.0.0'
@test "install a package" {
yum -y install erlang
}
os_release = os.name == 'amazon' ? '7' : os.release.to_i
describe yum.repo 'erlang_solutions' do
it { should exist }
it { should be_enabled }
its('baseurl') { "https://packages.erlang-solutions.com/rpm/centos/#{os_release}/x86_64/" }
end
describe command "erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell" do
its('exit_status') { should eq 0 }
end
Markdown is supported
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