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

[TEST] check on PR #2830

Draft
wants to merge 91 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
173e72c
linter
eriqua Sep 19, 2022
a4b0c10
Create ps-rule.yaml (#2066)
elbatane Sep 19, 2022
9db67f6
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule
eriqua Sep 19, 2022
dc031fc
exclude parameters
eriqua Sep 19, 2022
b1533f1
[Hackaton] First test for PSRule exclusions on KeyVault (#2067)
kareldewinter Sep 19, 2022
c71f513
[Hackathon] Token replacement for the resource group module (#2068)
elbatane Sep 19, 2022
d16203b
merge main
eriqua Sep 19, 2022
9a0a600
pathIgnore
eriqua Sep 19, 2022
9cc1d1f
[Hackathon] PSRule addition for VNet resource (#2070)
karthikvenkat17 Sep 20, 2022
893bd8f
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule
eriqua Sep 20, 2022
855f161
clean up token replacement
eriqua Sep 20, 2022
81b5a9f
clean up token replacement further
eriqua Sep 20, 2022
7aa8000
resize token replacement
eriqua Sep 20, 2022
f10a381
[Hackathon] Added suppression group for dependency resources (#2071)
karthikvenkat17 Sep 20, 2022
15ceeaa
typo
eriqua Sep 20, 2022
5dc4099
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule
eriqua Sep 20, 2022
153fad8
modulePath
eriqua Sep 20, 2022
c0ed856
job name
eriqua Sep 20, 2022
dea25f8
no psrule
eriqua Sep 20, 2022
d2a89d8
no psrule step
eriqua Sep 20, 2022
19cfe71
fix inputpath
eriqua Sep 20, 2022
20e405b
comment out continue on error option
eriqua Sep 20, 2022
4a07c2a
Align KV
eriqua Sep 20, 2022
589d704
kv no psrule
eriqua Sep 20, 2022
0b6c7ad
replace
eriqua Sep 20, 2022
393bfb5
no replace
eriqua Sep 20, 2022
16fab36
replace 1
eriqua Sep 20, 2022
75f8b6c
indent
eriqua Sep 20, 2022
5c417db
align vnet
eriqua Sep 20, 2022
09a730f
align vnet and enable deployment
eriqua Sep 20, 2022
fd46528
linter test removed
eriqua Sep 20, 2022
e919e8b
psrule back
eriqua Sep 20, 2022
b91e86c
vnet no deploy
eriqua Sep 20, 2022
7a202b3
comment deployment
eriqua Sep 20, 2022
04924d5
[Hackaton] Align 3 module workflows to use PSRule test matrix (#2065)
eriqua Sep 20, 2022
5c737f1
[Hackathon] PSRule output in markdown (#2072)
karthikvenkat17 Sep 20, 2022
b9c0b5a
[Hackaton] Psrule output on csv format with detailed results (#2089)
elanzel Sep 21, 2022
f16b432
[Hackaton] csv output on Keyvault module (#2091)
elanzel Sep 21, 2022
16971bd
[Hackathon] Set PSRule output script (#2093)
elbatane Sep 21, 2022
bca177c
[Hackaton] Added PSRule Output to job summary (#2110)
elanzel Sep 22, 2022
f7fd0c4
[Hackaton] Hack/topic6 virtual network PSrule on GitHub Action (#2111)
fabmas Sep 22, 2022
f46f59f
merge dev
eriqua Sep 22, 2022
7dd7541
job summary out
eriqua Sep 22, 2022
16bd91a
Print to job schedule back to action
eriqua Sep 22, 2022
e90593b
action shell
eriqua Sep 22, 2022
09270f6
remove module input
eriqua Sep 22, 2022
c48e66d
cleanup vnet
eriqua Sep 22, 2022
da2a9de
[Hackaton] Fix job summary output in GH action (#2112)
eriqua Sep 22, 2022
f4c8e31
[hackaton]: Hack/topic6 fabmas/psrule test updated RG, KV, VNET (#2113)
fabmas Sep 22, 2022
4e994d8
[Hackathon] Suppress rules where not required (#2115)
karthikvenkat17 Sep 22, 2022
08c7194
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule
eriqua Sep 22, 2022
fa35168
merge laters main
eriqua Feb 17, 2023
81477ed
kv test
eriqua Feb 17, 2023
5ec0d0a
disable deployment
eriqua Feb 17, 2023
ecfcb77
templateFilePath
eriqua Feb 17, 2023
b71e87c
templateFilePath in workflow template
eriqua Feb 17, 2023
c8603c5
disable pester
eriqua Feb 17, 2023
348ce2b
psrule action update
eriqua Feb 17, 2023
0e0b861
psrule action update
eriqua Feb 17, 2023
09aa0b6
remove not used script
eriqua Feb 17, 2023
13f14fe
update old workflows
eriqua Feb 17, 2023
fe031b2
remove not used setting
eriqua Feb 17, 2023
f18bffb
template update
eriqua Feb 17, 2023
9dc0952
update action output
eriqua Feb 17, 2023
26f07a7
update action output as file
eriqua Feb 17, 2023
0f20d94
update job summary file
eriqua Feb 17, 2023
d605eb5
PsRule
eriqua Feb 17, 2023
68cd41c
comment other jobs
eriqua Feb 17, 2023
9e35804
test path
eriqua Feb 17, 2023
9797e18
write warning
eriqua Feb 17, 2023
9c415fe
action shell
eriqua Feb 17, 2023
01c0ffc
update step
eriqua Feb 17, 2023
71076ef
update step no grouping
eriqua Feb 17, 2023
e9a11ed
regroup
eriqua Feb 17, 2023
352421c
undo template comment
eriqua Feb 17, 2023
30208f0
Update .github/actions/templates/validateModulePSRule/action.yml
eriqua Feb 17, 2023
7787a61
Update .github/actions/templates/validateModulePSRule/action.yml
eriqua Feb 17, 2023
69f7c2c
Update .github/workflows/platform.librarycheck.psrule.yml
eriqua Feb 17, 2023
eb44755
remove script init
eriqua Feb 17, 2023
5310ea5
psrule job name
eriqua Feb 17, 2023
f3fbcb4
Merge branch 'main' into hack/topic6-erikag/test-psrule
eriqua Feb 20, 2023
11c7297
cleanup
eriqua Feb 20, 2023
c87ee2a
condition
eriqua Feb 20, 2023
8770299
psrule on diff
eriqua Feb 21, 2023
1547700
psrule on diff
eriqua Feb 21, 2023
7a4057a
remove token replacement
eriqua Feb 21, 2023
c9e77cf
bump version
eriqua Feb 21, 2023
97af200
ignoreUnchangedPath yaml
eriqua Feb 21, 2023
dd54271
token replacement
eriqua Feb 21, 2023
cacc7cd
ignoreUnchangedPath
eriqua Feb 21, 2023
7e8b2ce
Update platform.prcheck.psrule.yml
eriqua Apr 1, 2023
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
125 changes: 125 additions & 0 deletions .github/workflows/platform.prcheck.psrule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: '.Platform: PR Check PSRule pre-flight validation'

on:
pull_request:
branches:
- main

env:
variablesPath: 'settings.yml'
modulesPath: 'modules'
TOKEN_NAMEPREFIX: '${{ secrets.TOKEN_NAMEPREFIX }}'

jobs:
psrule:
name: 'PSRule validation'
runs-on: ubuntu-20.04
steps:
# Analyze module library with PSRule
- name: Checkout
uses: actions/checkout@v3
- name: Set environment variables
uses: ./.github/actions/templates/setEnvironmentVariables
with:
variablesPath: ${{ env.variablesPath }}
- name: 'Replace tokens in template file'
uses: azure/powershell@v1
with:
azPSVersion: 'latest'
inlineScript: |
# Grouping task logs
Write-Output '::group::Replace tokens in template file'

# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'pipelines' 'tokensReplacement' 'Convert-TokensInFileList.ps1')

# Populate tokens
$Tokens = @{
subscriptionId = '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId = '${{ secrets.ARM_MGMTGROUP_ID }}'
tenantId = '${{ env.ARM_TENANT_ID }}'
}

## Add local (source control) tokens
$tokenMap = @{}
foreach ($token in (Get-ChildItem env: | Where-Object -Property Name -Like "localToken_*")) {
$tokenMap += @{ $token.Name.Replace('localToken_','','OrdinalIgnoreCase') = $token.value }
}
Write-Verbose ('Using local tokens [{0}]' -f ($tokenMap.Keys -join ', ')) -Verbose
$Tokens += $tokenMap

## Swap 'namePrefix' token if empty and provided as a GitHub secret
if([String]::IsNullOrEmpty($Tokens['namePrefix'])){
Write-Verbose 'Using [namePrefix] token from GitHub' -Verbose
$Tokens['namePrefix'] = '${{ env.TOKEN_NAMEPREFIX }}'
}

# Get File Path List
$modulesFolderPath = Join-Path $env:GITHUB_WORKSPACE '${{ env.modulesPath }}'
$moduleTestFiles = [System.Collections.ArrayList]@()
$moduleTestFiles += Get-ChildItem -Path $env:GITHUB_WORKSPACE -Filter *.test.bicep -Recurse -Force -Name

# Construct Token Function Input
$ConvertTokensInputs = @{
FilePathList = $moduleTestFiles
Tokens = $Tokens
TokenPrefix = '${{ env.tokenPrefix }}'
TokenSuffix = '${{ env.tokenSuffix }}'
}

Write-Verbose "Convert Tokens Input:`n $($ConvertTokensInputs | ConvertTo-Json -Depth 10)" -Verbose

# Invoke Token Replacement Functionality [For Module]
$null = Convert-TokensInFileList @ConvertTokensInputs -verbose

Write-Output '::endgroup::'
- name: Run PSRule analysis
uses: microsoft/[email protected]
continue-on-error: true # Setting this whilst PSRule gets bedded in, in this project
env:
PSRULE_INPUT_IGNOREUNCHANGEDPATH: true
with:
modules: 'PSRule.Rules.Azure'
inputPath: '${{ env.modulesPath }}/'
outputFormat: Csv
outputPath: '${{ env.modulesPath }}/PSRule-output.csv'
- name: 'Parse CSV content'
uses: azure/powershell@v1
with:
azPSVersion: 'latest'
inlineScript: |
# Grouping task logs
Write-Output '::group::Parse CSV content'

# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'pipelines' 'PSRuleValidation' 'Set-PSRuleGitHubOutput.ps1')

# Populate parameter input
$ParameterInput = @{
inputFilePath = '${{ env.modulesPath }}/PSRule-output.csv'
outputFilePath = '${{ env.modulesPath }}/PSRule-output.md'
skipPassedRulesReport = $true
}

# Invoke function
$null = Set-PSRuleGitHubOutput @ParameterInput

Write-Output '::endgroup::'
- name: Output to GitHub job summaries
if: always()
shell: pwsh
run: |
# Grouping task logs
Write-Output '::group::Output to GitHub job summaries'

$mdPSRuleOutputFilePath = Join-Path $env:GITHUB_WORKSPACE '${{ env.modulesPath }}/PSRule-output.md'

if (-not (Test-Path $mdPSRuleOutputFilePath)) {
Write-Warning ('Input file [{0}] not found' -f $mdPSRuleOutputFilePath)
return ''
} else {
Get-Content $mdPSRuleOutputFilePath >> $env:GITHUB_STEP_SUMMARY
Write-Verbose ('Successfully printed out file [{0}] to Job Summaries' -f $mdPSRuleOutputFilePath) -Verbose
}

Write-Output '::endgroup::'
1 change: 1 addition & 0 deletions ps-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ output:
- 'en-US'

input:
ignoreUnchangedPath: true
pathIgnore:
# Ignore other files in the repository.
- '**/*'
Expand Down