Skip to content

Write the module #1

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
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
13 changes: 13 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
fixtures:
forge_modules:
stdlib: "puppetlabs/stdlib"
yumrepo_core: "puppetlabs/yumrepo_core"
apt: "puppetlabs-apt"
inifile: "puppetlabs-inifile"
registry: "puppetlabs-registry"
concat: "puppetlabs/concat"
repositories:
provision: 'https://github.com/puppetlabs/provision.git'
facts: 'https://github.com/puppetlabs/puppetlabs-facts.git'
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
18 changes: 2 additions & 16 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
- cron: '0 0 * * *'

env:
HONEYCOMB_WRITEKEY: ${{ secrets.HONEYCOMB_TOKEN }}
HONEYCOMB_DATASET: litmus tests

jobs:
setup_matrix:
Expand Down Expand Up @@ -184,19 +186,3 @@ jobs:
run: |
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'

slack-workflow-status:
if: always()
name: Post Workflow Status To Slack
needs:
- Acceptance
runs-on: ubuntu-20.04
steps:
- name: Slack Workflow Notification
uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1
with:
# Required Input
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
# Optional Input
channel: '#team-ia-bots'
name: 'GABot'
2 changes: 2 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: "PR Testing"
on: [pull_request]

env:
HONEYCOMB_WRITEKEY: ${{ secrets.HONEYCOMB_TOKEN }}
HONEYCOMB_DATASET: litmus tests

jobs:
setup_matrix:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:

env:
HONEYCOMB_WRITEKEY: ${{ secrets.HONEYCOMB_TOKEN }}
HONEYCOMB_DATASET: litmus tests

jobs:
setup_matrix:
Expand Down
4 changes: 3 additions & 1 deletion .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
common:
disable_legacy_facts: true
owner: 'ractf'
honeycomb: false
honeycomb:
writekey: "${{ secrets.HONEYCOMB_TOKEN }}"

.travis.yml:
delete: true
Expand All @@ -17,5 +18,6 @@ appveyor.yml:
unmanaged: false
.github/workflows/nightly.yml:
unmanaged: false
slack-notifications: false
.github/workflows/release.yml:
unmanaged: false
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ end

PuppetLint.configuration.send('disable_relative')


if Bundler.rubygems.find_name('github_changelog_generator').any?
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
Expand Down
11 changes: 11 additions & 0 deletions manifests/controller.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include polaris::controller
class polaris::controller (
Boolean $manage_service = true,
Stdlib::Ensure::Service $service_ensure = 'running',
) {
}
8 changes: 8 additions & 0 deletions manifests/controller/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include polaris::controller::config
class polaris::controller::config {
}
8 changes: 8 additions & 0 deletions manifests/controller/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include polaris::controller::service
class polaris::controller::service {
}
11 changes: 11 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include polaris
class polaris (
Boolean $manage_package = true,
String $package_name = 'polaris',
String $package_ensure = 'latest',
) {}
13 changes: 13 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include polaris::install
class polaris::install {
if $polaris::manage_package {
ensure_packages($polaris::package_name, {
ensure => $polaris::package_ensure,
})
}
}
42 changes: 42 additions & 0 deletions manifests/node.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include polaris::node
class polaris::node (
Sensitive[String] $sensitive_consul_token,
Sensitive[String] $sensitive_single_user_username,
Sensitive[String] $sensitive_single_user_password,
Optional[String] $sentry_dsn,

Boolean $manage_service = true,
Stdlib::Ensure::Service $service_ensure = 'running',

Integer $thread_pool_size = 5,
Integer $task_threat_pool_size = 5,
Integer $reconciliation_tick_frequency = 20000,
Integer $host_info_sync_frequency = 20000,
String $scheduling_algorithm = 'roundRobin',
Integer $threadpool_timeout_seconds = 30,
Stdlib::Port $min_port = 20000,
Stdlib::Port $max_port = 65535,
String $client_refresh_interval = '10 seconds',
String $consul_host = 'localhost',
Stdlib::Port $consul_port = '8500',
String $consul_service_id = 'polaris-controller',
String $consul_retry_interval = '5 seconds',
Stdlib::Port $application_connector_port = 9090,
Stdlib::Port $admin_connector_port = 9090,
Boolean $kill_orphans = true,
) {
contain polaris::repo
contain polaris::install
contain polaris::node::config
contain polaris::node::service

Class['polaris::repo']
-> Class['polaris::install']
-> Class['polaris::node::config']
-> Class['polaris::node::service']
}
8 changes: 8 additions & 0 deletions manifests/node/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include polaris::node::config
class polaris::node::config {
}
19 changes: 19 additions & 0 deletions manifests/node/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @summary Manage the Polaris Node service
#
# This class manages this Polaris Node service, which is packaged with the Polaris RPM.
#
# @api private
#
class polaris::node::service {
if $polaris::node::manage_service {
$service_enable = $polaris::node::service_ensure ? {
'running' => true,
'stopped' => false,
}

service {'polaris-node':
ensure => $polaris::node::service_ensure,
enable => $service_enable,
}
}
}
20 changes: 20 additions & 0 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# @summary Install the Polaris RPM repo
#
# This class manages the installation of the RACTF RPM repo.
# In future this may support DEBs, and may become its own module.
#
# @api private
#
class polaris::repo {
if $polaris::manage_repo {
if $facts['os']['family'] == 'RedHat' {
yumrepo { 'ractf':
name => 'RACTF',
descr => 'RACTF Package Repo',
baseurl => 'TODO'
}
} else {
fail('Non-RedHat based operating systems are not supported yet')
}
}
}
17 changes: 9 additions & 8 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
"license": "AGPL-3.0-or-later",
"source": "https://github.com/ractf/puppet-polaris",
"dependencies": [

{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 7.0.0"
},
{
"name": "puppetlabs/yumrepo_core",
"version_requirement": ">= 1.0.7"
}
],
"operatingsystem_support": [
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7"
]
}
],
"requirements": [
Expand All @@ -30,5 +31,5 @@
],
"pdk-version": "2.2.0",
"template-url": "https://github.com/puppetlabs/pdk-templates#main",
"template-ref": "heads/main-0-g51828b4"
"template-ref": "heads/main-0-gb4d80a6"
}
2 changes: 2 additions & 0 deletions pdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
ignore: []
13 changes: 13 additions & 0 deletions spec/classes/controller/config_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::controller::config' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/controller/service_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::controller::service' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::controller' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::install' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/node/config_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::node::config' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/node/service_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::node::service' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/node_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::node' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/polaris_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end
13 changes: 13 additions & 0 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'polaris::repo' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end