-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ps1
More file actions
149 lines (118 loc) · 3.58 KB
/
main.ps1
File metadata and controls
149 lines (118 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
[CmdletBinding()]
param()
Install-PSResource -Repository PSGallery -TrustRepository -Name Net
Install-PSResource -Repository PSGallery -TrustRepository -Name PublicIP
Import-Module "$PSScriptRoot/Helpers.psm1"
$CONTEXT_GITHUB = $env:CONTEXT_GITHUB | ConvertFrom-Json -Depth 100
LogGroup 'Context: [GITHUB]' {
$CONTEXT_GITHUB | ConvertTo-Json -Depth 100
}
LogGroup 'Context: [ENV]' {
$env:CONTEXT_ENV
}
# LogGroup 'Context: [VARS]' {
# $env:CONTEXT_VARS
# }
LogGroup 'Context: [JOB]' {
$env:CONTEXT_JOB
}
# LogGroup 'Context: [JOBS]' {
# $env:CONTEXT_JOBS
# }
LogGroup 'Context: [STEPS]' {
$env:CONTEXT_STEPS
}
LogGroup 'Context: [RUNNER]' {
$env:CONTEXT_RUNNER
}
# LogGroup 'Context: [SECRETS]' {
# $env:CONTEXT_SECRETS
# }
LogGroup 'Context: [STRATEGY]' {
$env:CONTEXT_STRATEGY
}
LogGroup 'Context: [MATRIX]' {
$env:CONTEXT_MATRIX
}
# LogGroup 'Context: [NEEDS]' {
# $env:CONTEXT_NEEDS
# }
LogGroup 'Context: [INPUTS]' {
$env:CONTEXT_INPUTS
}
LogGroup 'Network Info' {
Write-Host "$(Get-NetIPConfiguration | Out-String)"
}
LogGroup 'Public IP Info' {
Write-Host "$(Get-PublicIP | Out-String)"
}
LogGroup "File system at [$pwd]" {
Get-ChildItem -Path . -Force | Select-Object -ExpandProperty FullName | Sort-Object
}
LogGroup 'Environment Variables' {
$vars = [ordered]@{}
Get-ChildItem env: | Where-Object { $_.Name -notlike 'CONTEXT_*' } | Sort-Object Name | ForEach-Object {
$name = $_.Name
$value = $_.Value | Set-MaskedValue
$vars.Add($name, $value)
}
[pscustomobject]$vars | Format-List | Out-String
}
LogGroup '[System.Environment]' {
$props = @{}
$propsObject = [PSCustomObject]@{}
[System.Environment] | Get-Member -Static -MemberType Property | Where-Object { $_.Name -notin 'StackTrace' } |
ForEach-Object {
$props[$_.Name] = [System.Environment]::$($_.Name)
}
$props.GetEnumerator() | Sort-Object Name | ForEach-Object {
$propsObject | Add-Member -MemberType NoteProperty -Name $_.Name -Value $_.Value
}
$propsObject | Format-List | Out-String
}
LogGroup 'PowerShell variables' {
$vars = [ordered]@{}
Get-Variable | Where-Object { $_.Name -notlike 'CONTEXT_*' } | Select-Object -Property Name, Value | Sort-Object Name | ForEach-Object {
$name = $_.Name
$value = $_.Value | Set-MaskedValue
$vars.Add($name, $value)
}
[pscustomobject]$vars | Format-List | Out-String
}
LogGroup 'PSVersionTable' {
$PSVersionTable | Select-Object * | Format-List | Out-String
}
LogGroup 'Installed Modules - List' {
$modules = Get-PSResource | Sort-Object -Property Name
$modules | Select-Object Name, Version, CompanyName, Author | Format-Table -AutoSize -Wrap | Out-String
}
$modules.Name | Select-Object -Unique | ForEach-Object {
$name = $_
LogGroup "Installed Modules - Details - [$name]" {
$modules | Where-Object Name -EQ $name | Select-Object * | Format-List | Out-String
}
}
LogGroup 'ExecutionContext' {
$ExecutionContext | ConvertTo-Json -Depth 3
}
LogGroup 'Host' {
$Host | Select-Object * | Format-List | Out-String
}
LogGroup 'Host - Json' {
$Host | ConvertTo-Json -Depth 3
}
LogGroup 'MyInvocation' {
$MyInvocation | Select-Object * | Format-List | Out-String
}
LogGroup 'PSCmdlet' {
$PSCmdlet | Select-Object * | Format-List | Out-String
}
LogGroup 'PSSessionOption' {
$PSSessionOption | Select-Object * | Format-List | Out-String
}
LogGroup 'PSStyle' {
$PSStyle | Select-Object * | Format-List | Out-String
}
LogGroup 'PSStyle - Json' {
$PSStyle | ConvertTo-Json -Depth 3
}