34 changes: 34 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# devcontainer


For format details, see https://aka.ms/devcontainer.json.

For config options, see the README at:
https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet

``` json
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pdk --version",
}
```



16 changes: 5 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pdk --version",
}
12 changes: 6 additions & 6 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
fixtures:
repositories:
cron_core: "git://github.com/puppetlabs/puppetlabs-cron_core"
facts: 'https://github.com/puppetlabs/puppetlabs-facts.git'
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
provision: 'https://github.com/puppetlabs/provision.git'
cron_core: "https://github.com/puppetlabs/puppetlabs-cron_core"
facts: 'https://github.com/puppetlabs/puppetlabs-facts'
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent'
provision: 'https://github.com/puppetlabs/provision'
bootstrap: "https://github.com/puppetlabs/puppetlabs-bootstrap"
puppet_conf: "https://github.com/puppetlabs/puppetlabs-puppet_conf"
deploy_pe: 'git://github.com/jarretlavallee/puppet-deploy_pe.git'
deploy_pe: 'https://github.com/jarretlavallee/puppet-deploy_pe'
ruby_task_helper: "https://git@github.com/puppetlabs/puppetlabs-ruby_task_helper"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib"
25 changes: 25 additions & 0 deletions .github/workflows/main_pr_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Call main PR testing workflows

on:
workflow_dispatch:
pull_request:
paths-ignore:
- '**.md'
- 'examples/**'
- 'CODEOWNERS'
- 'LICENSE'

jobs:
spec_testing:
name: "Spec testing"
uses: ./.github/workflows/spec.yml

lts_testing:
name: "PE LTS Testing"
needs: spec_testing
uses: ./.github/workflows/pe_lts_testing.yml

latest_testing:
name: "PE latest Testing"
needs: spec_testing
uses: ./.github/workflows/pe_latest_testing.yml
24 changes: 22 additions & 2 deletions .github/workflows/pe_latest_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "PE Latest Acceptance Testing"

on:
workflow_dispatch:
pull_request:
workflow_call:

env:
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
Expand Down Expand Up @@ -50,14 +50,34 @@ jobs:
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
# store the result of the curl call in $forge_response
- name: Curl Forge for PE versions
id: curl_forge
run: |
echo "::set-output name=forge_response::$(curl https://forge.puppet.com/private/versions/pe)"
- name: Set latest release
id: latest_release
run: |
out=$(jq -c '[.[] | select(.lts == false)][0].latest | {"collection": [.]}' <<<'${{ steps.curl_forge.outputs.forge_response }}')
echo "::set-output name=latest::$out"
- name: Setup Acceptance Test Matrix
id: get-matrix
run: |
echo "::set-output name=matrix::$(cat spec/fixtures/matrix/latest.json)"
if [[ -e spec/fixtures/matrix/latest.json ]]; then
out=$(jq -c '. + ($matrix | .[])' --slurpfile matrix spec/fixtures/matrix/latest.json <<<'${{ steps.latest_release.outputs.latest }}')
echo "::set-output name=matrix::$out"
else
echo "::set-output name=matris::{}"
fi
- name: "Honeycomb: Record Setup Test Matrix time"
if: ${{ always() }}
run: |
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
Acceptance:
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
needs:
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/pe_lts_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "PE LTS Acceptance Testing"

on:
workflow_dispatch:
pull_request:
workflow_call:

env:
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
Expand Down Expand Up @@ -50,14 +50,34 @@ jobs:
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
# Store the result of the curl call in $forge_response
- name: Curl Forge for PE versions
id: curl_forge
run: |
echo "::set-output name=forge_response::$(curl https://forge.puppet.com/private/versions/pe)"
- name: Set latest release
id: latest_release
run: |
out=$(jq -c '[.[] | select(.lts == true)][0].latest | {"collection": [.]}' <<<'${{ steps.curl_forge.outputs.forge_response }}')
echo "::set-output name=latest::$out"
- name: Setup Acceptance Test Matrix
id: get-matrix
run: |
echo "::set-output name=matrix::$(cat spec/fixtures/matrix/lts.json)"
if [[ -e spec/fixtures/matrix/lts.json ]]; then
out=$(jq -c '. + ($matrix | .[])' --slurpfile matrix spec/fixtures/matrix/lts.json <<<'${{ steps.latest_release.outputs.latest }}')
echo "::set-output name=matrix::$out"
else
echo "::set-output name=matris::{}"
fi
- name: "Honeycomb: Record Setup Test Matrix time"
if: ${{ always() }}
run: |
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
Acceptance:
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
needs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Spec Tests"

on:
workflow_dispatch:
pull_request:
workflow_call:

env:
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
Expand Down
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ Style/SymbolArray:
EnforcedStyle: brackets
RSpec/NamedSubject:
Enabled: false
Style/CollectionMethods:
Enabled: false
Style/LineEndConcatenation:
Enabled: false
Lint/AssignmentInCondition:
Expand All @@ -94,6 +92,8 @@ Style/GuardClause:
Enabled: false
RSpec/EmptyExampleGroup:
Enabled: false
Style/CollectionMethods:
Enabled: false
RSpec/MessageSpies:
EnforcedStyle: receive
Style/WordArray:
Expand Down
5 changes: 2 additions & 3 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ spec/default_facts.yml:
Enabled: False
"Style/ClassAndModuleChildren":
Enabled: False
"Style/CollectionMethods":
Enabled: False
"Style/LineEndConcatenation":
Enabled: False
"Lint/AssignmentInCondition":
Expand All @@ -59,7 +57,8 @@ spec/default_facts.yml:
Enabled: False
"RSpec/EmptyExampleGroup":
Enabled: False

"Style/CollectionMethods":
Enabled: False
Gemfile:
optional:
":development":
Expand Down
65 changes: 65 additions & 0 deletions 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
common:

".gitlab-ci.yml":
delete: true
appveyor.yml:
delete: true
.gitpod.Dockerfile:
unmanaged: true
.gitpod.yml:
unmanaged: true
.github/workflows/nightly.yml:
unmanaged: true
.github/workflows/pr_test.yml:
unmanaged: true
.github/workflows/auto_release.yml:
unmanaged: true
.github/workflows/spec.yml:
checks: 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop'
unmanaged: true
.github/workflows/release.yml:
unmanaged: true
.travis.yml:
delete: true
spec/spec_helper.rb:
mock_with: ":rspec"
coverage_report: true
Rakefile:
changelog_user: "puppetlabs"

spec/default_facts.yml:
extra_facts:
pe_server_version: '2019.8.6'
puppet_metrics_collector:
have_systemd: true
.rubocop.yml:
default_configs:
"RSpec/NamedSubject":
Enabled: False
"Style/ClassAndModuleChildren":
Enabled: False
"Style/LineEndConcatenation":
Enabled: False
"Lint/AssignmentInCondition":
Enabled: False
"Lint/RescueException":
Enabled: False
"Lint/UnderscorePrefixedVariableName":
Enabled: False
"Lint/UselessAssignment":
Enabled: False
"Style/Documentation":
Enabled: False
"Style/GlobalVars":
Enabled: False
"Style/GuardClause":
Enabled: False
"RSpec/EmptyExampleGroup":
Enabled: False
"Style/CollectionMethods":
Enabled: False
Gemfile:
optional:
":development":
- gem: github_changelog_generator
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v7.1.0](https://github.com/puppetlabs/puppetlabs-puppet_metrics_collector/tree/v7.1.0) (2022-07-19)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_metrics_collector/compare/v7.0.5...v7.1.0)

### Added

- \(SUP-3472\) Add file sync storage metric collection [\#160](https://github.com/puppetlabs/puppetlabs-puppet_metrics_collector/pull/160) ([jarretlavallee](https://github.com/jarretlavallee))

### Fixed

- \(GH-154\) Switch from change time to modify time [\#155](https://github.com/puppetlabs/puppetlabs-puppet_metrics_collector/pull/155) ([MirandaStreeter](https://github.com/MirandaStreeter))

## [v7.0.5](https://github.com/puppetlabs/puppetlabs-puppet_metrics_collector/tree/v7.0.5) (2021-10-12)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_metrics_collector/compare/v7.0.4...v7.0.5)
Expand Down
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
2 changes: 1 addition & 1 deletion files/create-metrics-archive
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ retention_days="${retention_days:-30}"
timestamp="$(date +%Y.%m.%d.%H.%M.%S)"
output_file="puppet-metrics-${timestamp}.tar.gz"

find "$metrics_directory" -type f -ctime -"$retention_days" -and \( -name "*json" -or -name "*gz" \) | \
find "$metrics_directory" -type f -mtime -"$retention_days" -and \( -name "*json" -or -name "*gz" \) | \
tar --create --gzip --file "$output_file" --files-from - --transform "s,^${metrics_directory#/},puppet-metrics-${timestamp}," || {
echo "Error: could not create metrics archive: $output_file from $metrics_directory"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion files/metrics_tidy
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ paths_regex="$(IFS='|'; echo "${valid_paths[*]}")"
}

# Delete files in a Puppet service metrics directory older than the retention period, in days.
find "$metrics_directory" -type f -ctime +"$retention_days" -delete
find "$metrics_directory" -type f -mtime +"$retention_days" -delete

# Compress the remaining files in a Puppet service metrics directory.
# Store the list of files in a temp file so that `tar` and `rm` will operate on the same files
Expand Down
5 changes: 5 additions & 0 deletions lib/facter/puppet_metrics_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@
{ have_pe_psql: false }
end
end

chunk(:file_sync_storage_enabled) do
{ file_sync_storage_enabled: (Puppet::FileSystem.exist?('/etc/puppetlabs/puppetserver/bootstrap.cfg') &&
Puppet::FileSystem.read('/etc/puppetlabs/puppetserver/bootstrap.cfg').include?('file-sync-storage-service')) }
end
end
Loading