Skip to content

Commit

Permalink
Merge pull request #14 from techthoughts2/Enhancements
Browse files Browse the repository at this point in the history
Enhancements
  • Loading branch information
techthoughts2 authored Dec 16, 2023
2 parents ea3c34d + d17f97b commit cd9e04e
Show file tree
Hide file tree
Showing 16 changed files with 147 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"ratelimit",
"Ryver",
"Sightview",
"Stroustrup"
"Stroustrup",
"telegramchannel",
"telegramtoken"
]
}

8 changes: 4 additions & 4 deletions CloudFormation/Manual/PSGalleryPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ Parameters:
# https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
CodeBuildImage:
Type: String
Default: aws/codebuild/standard:6.0
Default: aws/codebuild/standard:7.0
Description: AWS CodeBuild image selection
AllowedValues:
- aws/codebuild/standard:6.0
- aws/codebuild/amazonlinux2-x86_64-standard:4.0
- aws/codebuild/standard:7.0
- aws/codebuild/amazonlinux2-x86_64-standard:5.0
- aws/codebuild/windows-base:2019-2.0

ResourceType:
Expand Down Expand Up @@ -268,7 +268,7 @@ Resources:
CodeBuildRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub '${ServiceName}-CodeBuildRole'
RoleName: !Sub '${ServiceName}-PipeLine-CodeBuildRole'
Tags:
- Key: ServiceName
Value: !Ref ServiceName
Expand Down
4 changes: 2 additions & 2 deletions CloudFormation/Manual/PowerShellCodeBuildGit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ Resources:
#ComputeType: !Ref CodeBuildComputeType
ComputeType: BUILD_GENERAL1_SMALL
Type: LINUX_CONTAINER
Image: aws/codebuild/standard:6.0
Image: aws/codebuild/standard:7.0
# EnvironmentVariables:
# - Name: ARTIFACT_S3_BUCKET
# Value: !Ref something
Expand Down Expand Up @@ -807,7 +807,7 @@ Resources:
#ComputeType: !Ref CodeBuildComputeType
ComputeType: BUILD_GENERAL1_SMALL
Type: LINUX_CONTAINER
Image: aws/codebuild/standard:6.0
Image: aws/codebuild/standard:7.0
# EnvironmentVariables:
# - Name: ARTIFACT_S3_BUCKET
# Value: !Ref something
Expand Down
93 changes: 92 additions & 1 deletion CloudFormation/PSGalleryExplorer/ChildTemplates/PSGEAlarms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Resources:
Properties:
ActionsEnabled: true
AlarmActions:
- !Sub arn:aws:sns:us-west-2:${AWS::AccountId}:alertTopic
- !ImportValue AlertSNSTopic
AlarmDescription: Alarms if the PubXML file is more than 8 days old.
AlarmName: PubXMLMonitor
ComparisonOperator: GreaterThanOrEqualToThreshold
Expand All @@ -147,6 +147,97 @@ Resources:
TreatMissingData: notBreaching
# Unit: String

# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-dashboard.html
PSGEPubXMLMonitorDashboard:
Type: AWS::CloudWatch::Dashboard
Properties:
DashboardName: !Sub '${ServiceName}-PSGEPubXMLMonitorDashboard'
DashboardBody: !Sub |
{
"widgets": [
{
"height": 11,
"width": 11,
"y": 0,
"x": 0,
"type": "metric",
"properties": {
"metrics": [
[
"PSGalleryExplorer",
"PubXMLAge",
"PubXML",
"DaysOld",
{
"region": "us-west-2",
"label": "Data Cache Age (Days)"
}
]
],
"view": "timeSeries",
"stacked": false,
"region": "us-west-2",
"period": 86400,
"stat": "Maximum",
"start": "-P90D",
"end": "P0D",
"title": "PSGalleryExplorer Data Cache Age Metric",
"yAxis": {
"left": {
"label": "Days Old",
"min": 0
}
},
"annotations": {
"horizontal": [
{
"label": "Untitled annotation",
"value": 8
}
]
}
}
},
{
"height": 11,
"width": 11,
"y": 0,
"x": 11,
"type": "metric",
"properties": {
"metrics": [
[
"AWS/CloudFront",
"Requests",
"Region",
"Global",
"DistributionId",
"E253EO4S3ELURG",
{
"region": "us-east-1"
}
]
],
"view": "timeSeries",
"stacked": false,
"region": "us-west-2",
"period": 86400,
"stat": "Sum",
"start": "-P90D",
"end": "P0D",
"title": "Data Cache Download Requests",
"yAxis": {
"left": {
"label": "Download Count",
"min": 0
}
},
"setPeriodToTimeRange": true
}
}
]
}
Outputs:
PubXMLMonitorARN:
Description: Arn for PubXMLMonitor Lambda
Expand Down
3 changes: 1 addition & 2 deletions CloudFormation/PSGalleryExplorer/ChildTemplates/PSGESSM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Resources:
# Schedule: rate(5 minutes)
# ScheduleOffset: Integer
ScheduleTimezone: 'US/Central'
StartDate: '2023-03-01T21:30:00-06:00'
StartDate: '2023-04-20T21:30:00-06:00'
Tags:
- Key: ServiceName
Value: !Ref ServiceName
Expand Down Expand Up @@ -181,7 +181,6 @@ Resources:
- 'aws s3 cp "C:\${ServiceName}\FinalZip\${ServiceName}.zip" "s3://${bucketName}"'
- bucketName:
'Fn::ImportValue': PubXMLDataBN
- !Sub $nowEpoch = Get-Date -UFormat %s; $metadata = @{ 'zipCreated' = $nowEpoch }; $metadataFilePath = 'C:\${ServiceName}\FinalZip\${ServiceName}.json'; $metadata | ConvertTo-Json -Depth 10 | Out-File -FilePath $metadataFilePath -Force
- !Sub
- 'aws s3 cp "C:\${ServiceName}\FinalZip\${ServiceName}.json" "s3://${bucketName}"'
- bucketName:
Expand Down
12 changes: 6 additions & 6 deletions CodeBuild/install_modules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ $VerbosePreference = 'SilentlyContinue'
$modulesToInstall = [System.Collections.ArrayList]::new()
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'Pester'
ModuleVersion = '5.4.0'
ModuleVersion = '5.5.0'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'InvokeBuild'
ModuleVersion = '5.10.2'
ModuleVersion = '5.10.4'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
Expand Down Expand Up @@ -69,25 +69,25 @@ $null = $modulesToInstall.Add(([PSCustomObject]@{
}))
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'AWS.Tools.Common'
ModuleVersion = '4.1.275'
ModuleVersion = '4.1.472'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'AWS.Tools.CloudFormation'
ModuleVersion = '4.1.275'
ModuleVersion = '4.1.472'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'AWS.Tools.S3'
ModuleVersion = '4.1.275'
ModuleVersion = '4.1.472'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'AWS.Tools.SimpleSystemsManagement'
ModuleVersion = '4.1.275'
ModuleVersion = '4.1.472'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
Expand Down
15 changes: 14 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.5.2]

- Module Changes
- `Confirm-XMLDataSet` now evaluates `LastWriteTime` instead of `CreationTime` to determine cache freshness requirements
- Added additional corps to list
- Build Updates
- AWS Deployment Updates
- Updated CodeBuild containers from `aws/codebuild/standard:6.0` to `aws/codebuild/standard:7.0`
- Changed alarm for cache data to reference correct SNS topic for alerts
- Added CloudWatch dashboard for data cache age metric
- Misc
- Added metric dashboards to docs section

## [2.5.0]

- Module Updates
Expand All @@ -16,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added the `InsightView` parameter to both `Find-ModuleByCommand` and `Find-PSGModule`
- This provides a new results view that focuses on community insights
- Build Updates
- SSM Task now generates metadata file
- SSM Task now copies metadata file
- InvokeBuild bumped from `5.10.2` to `5.10.3`
- Convert bumped from `1.2.0` to `1.5.0`
- Removed all test case uses of `Assert-MockCalled`
Expand Down
10 changes: 10 additions & 0 deletions docs/PSGalleryExplorer-Metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# PSGalleryExplorer Metrics

## Metric Dashboards

Up-to-date visualizations representing the age of the data cache and the frequency of download requests.

<iframe
src="https://cloudwatch.amazonaws.com/dashboard.html?dashboard=PSGalleryExplorer-PSGEPubXMLMonitorDashboard&context=eyJSIjoidXMtZWFzdC0xIiwiRCI6ImN3LWRiLTY5OTQ4Mzc4NjgzMSIsIlUiOiJ1cy1lYXN0LTFfSzFtQzlzdDRrIiwiQyI6IjZnbWR0bWllNTk4OW45NWwyMjBkdjRyMmZzIiwiSSI6InVzLWVhc3QtMTpmM2JkNmQ1Mi00NTg4LTRiOGEtYWVlOC0zYWVlNDk3NmUwN2QiLCJNIjoiUHVibGljIn0="
style="width:100%; height:640px;"
></iframe>
2 changes: 1 addition & 1 deletion docs/PSGalleryExplorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Name: PSGalleryExplorer
Module Guid: e9252e8e-2073-4084-9562-cf60ad84603d
Download Help Link: NA
Help Version: 2.5.0
Help Version: 2.5.2
Locale: en-US
---

Expand Down
4 changes: 2 additions & 2 deletions install_modules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ $VerbosePreference = 'SilentlyContinue'
$modulesToInstall = [System.Collections.ArrayList]::new()
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'Pester'
ModuleVersion = '5.4.0'
ModuleVersion = '5.5.0'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'InvokeBuild'
ModuleVersion = '5.10.3'
ModuleVersion = '5.10.4'
BucketName = 'PSGallery'
KeyPrefix = ''
}))
Expand Down
8 changes: 4 additions & 4 deletions lambdafunctions/PowerShell/PubXMLMonitor/PubXMLMonitor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# $env:TELEGRAM_SECRET
# $env:SERVICE_NAME

#Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion='4.1.275'}
#Requires -Modules @{ModuleName='AWS.Tools.CloudWatch';ModuleVersion='4.1.275'}
#Requires -Modules @{ModuleName='AWS.Tools.SimpleSystemsManagement';ModuleVersion='4.1.275'}
#Requires -Modules @{ModuleName='AWS.Tools.S3';ModuleVersion='4.1.275'}
#Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion='4.1.472'}
#Requires -Modules @{ModuleName='AWS.Tools.CloudWatch';ModuleVersion='4.1.472'}
#Requires -Modules @{ModuleName='AWS.Tools.SimpleSystemsManagement';ModuleVersion='4.1.472'}
#Requires -Modules @{ModuleName='AWS.Tools.S3';ModuleVersion='4.1.472'}
#Requires -Modules @{ModuleName='PoshGram';ModuleVersion='2.3.0'}

# Uncomment to send the input event to CloudWatch Logs
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ nav:
- Find-ModuleByCommand.md: Find-ModuleByCommand.md
- Find-PSGModule.md: Find-PSGModule.md
- Data Collection: PSGalleryExplorer-Data_Collection.md
- Metrics: PSGalleryExplorer-Metrics.md
- FAQ: PSGalleryExplorer-FAQ.md
- Change Log: CHANGELOG.md
# - Functions:
Expand Down
4 changes: 4 additions & 0 deletions src/PSGalleryExplorer/Imports.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function Get-DataLocation {
}

$script:corps = @(
'2AT B.V.'
'3Shape A/S'
'AWS'
'Amazon'
'Amazon.com, Inc'
Expand All @@ -30,6 +32,7 @@ $script:corps = @(
'Cisco Systems'
'Cisco'
'Cisco Systems, Inc.'
'Cybersecurity Engineering'
'DSC Community'
'Dell Inc.'
'Dell Technologies'
Expand Down Expand Up @@ -100,6 +103,7 @@ $script:corps = @(
'VMware Inc.'
'Virtual Engine'
'waldo.be'
'WebMD Health Services'
'Worxspace'
'XtremIO Dell EMC'
'Yevrag35, LLC.'
Expand Down
2 changes: 1 addition & 1 deletion src/PSGalleryExplorer/PSGalleryExplorer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGalleryExplorer.psm1'

# Version number of this module.
ModuleVersion = '2.5.0'
ModuleVersion = '2.5.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
2 changes: 1 addition & 1 deletion src/PSGalleryExplorer/Private/Confirm-XMLDataSet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function Confirm-XMLDataSet {
return $result
}
if ($fileData) {
$creationDate = $fileData.CreationTime
$creationDate = $fileData.LastWriteTime
$now = Get-Date
if (($now - $creationDate).Days -ge 9) {
# Write-Verbose 'Data file requires refresh.'
Expand Down
1 change: 1 addition & 0 deletions src/Tests/Unit/Private/Confirm-XMLDataSet.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ InModuleScope 'PSGalleryExplorer' {
CreationTime = [datetime]'01/06/20 21:17:21'
CreationTimeUtc = [datetime]'01/07/20 05:17:21'
LastAccessTime = [datetime]'01/06/20 21:17:22'
LastWriteTime = [datetime]'01/06/20 21:17:21'
}
} #endMock
Mock -CommandName Get-Date -MockWith {
Expand Down

0 comments on commit cd9e04e

Please sign in to comment.