Skip to content

Commit 3c466eb

Browse files
freddydkmazhelez
andauthored
Removal of 450 Script Analyzer problems (microsoft#686)
### The only real code change is in ReadSecrets - If you precede a secret name with an asterisk in ReadSecrets/get, it will be encrypted (as well as base64 encoded) - Secrets used as SecureString in code will be requested as encrypted (codeSignCertificatePassword and KeyVaultCertificatePassword) - allows us to use ConvertTo-SecureString (without the -plaintext clause) - Refactor connection to Azure KeyVault to only get credentials once and keep clientSecret as secureString This part also contains a bug fix that was introduced in GetKeyVaultSecret during secrets refactoring (identified by secretName parameter was never used) ### Whitespace only changes: - Missing BOM on .ps1 files (all now have BOM - half didn't) - Whitespace trailing lines (fixed everywhere) ### Suppressions: - Suppress Analyzer on parameter blocks on test runners - Suppress ConvertTo-SecureString (with plain text) in ReadSecretsHelper - since we get GitHub secrets in clear text in code. - Variables initialized in BeforeAll in tests - Assigning isWindows, isMacOS and isLinux when running PS5 ### Renaming functions to not use dash in names (must then follow cmdlets) ### Removing actor+token from ReadSettings action as this is no longer needed - Functionality needing these have been moved to seperate actions --------- Co-authored-by: freddydk <[email protected]> Co-authored-by: Maria Zhelezova <[email protected]>
1 parent 7d7c20d commit 3c466eb

File tree

131 files changed

+770
-699
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+770
-699
lines changed

.github/workflows/CleanupTempRepos.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Cleanup after failed E2E
1+
name: Cleanup after failed E2E
22

33
on:
44
workflow_dispatch:

.github/workflows/Deploy.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
directCommit:
1717
type: boolean
1818
description: Push directly to the target branch. If not set, a PR will be created.
19-
required: false
19+
required: false
2020
default: false
2121
defaultBcContainerHelperVersion:
2222
description: 'Which version of BcContainerHelper to use? (latest, preview, private, a specific version number or a direct download URL like https://github.com/freddydk/navcontainerhelper/archive/master.zip - leave empty to use latest)'
@@ -34,11 +34,11 @@ jobs:
3434
steps:
3535
- name: Validate Deployment
3636
if: github.repository_owner == 'microsoft'
37-
env:
37+
env:
3838
branch: ${{ github.event.inputs.branch }}
3939
repository: ${{ github.repository }}
4040
runId: ${{ github.run_id }}
41-
run: |
41+
run: |
4242
if ($env:branch -match 'preview') {
4343
Write-Host "Deploying to preview branch. No validation required"
4444
} else {

.github/workflows/E2E.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
run: |
104104
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
105105
. (Join-Path "." "e2eTests/SetupRepositories.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -token '${{ Secrets.E2EPAT }}' -bcContainerHelperVersion '${{ github.event.inputs.bcContainerHelperVersion }}'
106-
106+
107107
Analyze:
108108
runs-on: [ ubuntu-latest ]
109109
needs: [ Check ]
@@ -127,8 +127,8 @@ jobs:
127127
128128
$testrunsJson = @{
129129
"matrix" = @{
130-
"include" = @(
131-
@('private','public') | ForEach-Object {
130+
"include" = @(
131+
@('private','public') | ForEach-Object {
132132
$visibility = $_
133133
@('appSourceApp','PTE') | ForEach-Object {
134134
$type = $_

Actions/AL-Go-Helper.ps1

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Param(
1+
Param(
22
[switch] $local
33
)
44

@@ -62,8 +62,11 @@ if ($isPsCore) {
6262
else {
6363
$byteEncodingParam = @{ "Encoding" = "byte" }
6464
$allowUnencryptedAuthenticationParam = @{ }
65+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'isWindows', Justification = 'Will only run on PS5')]
6566
$isWindows = $true
67+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'isLinux', Justification = 'Will only run on PS5')]
6668
$isLinux = $false
69+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'isMacOS', Justification = 'Will only run on PS5')]
6770
$IsMacOS = $false
6871
}
6972

@@ -1603,9 +1606,6 @@ function CreateDevEnv {
16031606
throw "$_ is an illegal property in adminCenterApiCredentials setting"
16041607
}
16051608
}
1606-
if ($adminCenterApiCredentials.Keys -contains 'ClientSecret') {
1607-
$adminCenterApiCredentials.ClientSecret = ConvertTo-SecureString -String $adminCenterApiCredentials.ClientSecret -AsPlainText -Force
1608-
}
16091609
}
16101610
}
16111611
}

Actions/AL-Go-TestRepoHelper.ps1

+136-137
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Test-Property {
1+
function Test-Property {
22
Param(
33
[HashTable] $json,
44
[string] $settingsDescription,
@@ -71,7 +71,7 @@ function Test-Json {
7171
# templateUrl should not be in Project or Workflow settings
7272
Test-Property -settingsDescription $settingsDescription -json $json -key 'templateUrl' -maynot
7373

74-
# schedules and runs-on should not be in Project or Workflow settings
74+
# schedules and runs-on should not be in Project or Workflow settings
7575
'nextMajorSchedule','nextMinorSchedule','currentSchedule','githubRunner','runs-on' | ForEach-Object {
7676
Test-Property -settingsDescription $settingsDescription -json $json -key $_ -shouldnot
7777
}
@@ -118,7 +118,7 @@ function Test-ALGoRepository {
118118
Param(
119119
[string] $baseFolder = $ENV:GITHUB_WORKSPACE
120120
)
121-
121+
122122
if ($ENV:ALGoOrgSettings) {
123123
Write-Host "Checking AL-Go Org Settings variable (ALGoOrgSettings)"
124124
Test-JsonStr -jsonStr "$ENV:ALGoOrgSettings" -settingsDescription 'ALGoOrgSettings variable' -type 'Variable'
@@ -149,141 +149,140 @@ function Test-ALGoRepository {
149149
}
150150

151151
function Write-Big {
152-
Param(
153-
[string] $str
154-
)
155-
$chars = @{
156-
"0" = @'
157-
___
158-
/ _ \
159-
| | | |
160-
| | | |
161-
| |_| |
162-
\___/
163-
'@.Split("`n")
164-
"1" = @'
165-
__
166-
/_ |
167-
| |
168-
| |
169-
| |
170-
|_|
171-
'@.Split("`n")
172-
"2" = @'
173-
___
174-
|__ \
175-
) |
176-
/ /
177-
/ /_
178-
|____|
179-
'@.Split("`n")
180-
"3" = @'
181-
____
182-
|___ \
183-
__) |
184-
|__ <
185-
___) |
186-
|____/
187-
'@.Split("`n")
188-
"4" = @'
189-
_ _
190-
| || |
191-
| || |_
192-
|__ _|
193-
| |
194-
|_|
195-
'@.Split("`n")
196-
"5" = @'
197-
_____
198-
| ____|
199-
| |__
200-
|___ \
201-
___) |
202-
|____/
203-
'@.Split("`n")
204-
"6" = @'
205-
__
206-
/ /
207-
/ /_
208-
| '_ \
209-
| (_) |
210-
\___/
211-
'@.Split("`n")
212-
"7" = @'
213-
______
214-
|____ |
215-
/ /
216-
/ /
217-
/ /
218-
/_/
219-
'@.Split("`n")
220-
"8" = @'
221-
___
222-
/ _ \
223-
| (_) |
224-
> _ <
225-
| (_) |
226-
\___/
227-
'@.Split("`n")
228-
"9" = @'
229-
___
230-
/ _ \
231-
| (_) |
232-
\__, |
233-
/ /
234-
/_/
235-
'@.Split("`n")
236-
"." = @'
237-
238-
239-
240-
241-
_
242-
(_)
243-
'@.Split("`n")
244-
"v" = @'
245-
246-
247-
__ __
248-
\ \ / /
249-
\ V /
250-
\_(_)
251-
'@.Split("`n")
252-
"p" = @'
253-
_____ _
254-
| __ \ (_)
255-
| |__) | __ _____ ___ _____ __
256-
| ___/ '__/ _ \ \ / / |/ _ \ \ /\ / /
257-
| | | | | __/\ V /| | __/\ V V /
258-
|_| |_| \___| \_/ |_|\___| \_/\_/
259-
'@.Split("`n")
260-
"d" = @'
261-
_____
262-
| __ \
263-
| | | | _____ __
264-
| | | |/ _ \ \ / /
265-
| |__| | __/\ V /
266-
|_____/ \___| \_(_)
267-
'@.Split("`n")
268-
"a" = @'
269-
_ _____ __ _____ _ _ _ _ _
270-
/\ | | / ____| / _| / ____(_) | | | | | | |
271-
/ \ | | ______| | __ ___ | |_ ___ _ __ | | __ _| |_| |__| |_ _| |__
272-
/ /\ \ | | |______| | |_ |/ _ \ | _/ _ \| '__| | | |_ | | __| __ | | | | '_ \
273-
/ ____ \| |____ | |__| | (_) | | || (_) | | | |__| | | |_| | | | |_| | |_) |
274-
/_/ \_\______| \_____|\___/ |_| \___/|_| \_____|_|\__|_| |_|\__,_|_.__/
275-
'@.Split("`n")
276-
}
277-
152+
Param(
153+
[string] $str
154+
)
155+
$chars = @{
156+
"0" = @(
157+
" ___ "
158+
" / _ \ "
159+
"| | | |"
160+
"| | | |"
161+
"| |_| |"
162+
" \___/ "
163+
)
164+
"1" = @(
165+
" __ "
166+
"/_ |"
167+
" | |"
168+
" | |"
169+
" | |"
170+
" |_|"
171+
)
172+
"2" = @(
173+
" ___ "
174+
"|__ \ "
175+
" ) |"
176+
" / / "
177+
" / /_ "
178+
"|____|"
179+
)
180+
"3" = @(
181+
" ____ "
182+
"|___ \ "
183+
" __) |"
184+
" |__ < "
185+
" ___) |"
186+
"|____/ "
187+
)
188+
"4" = @(
189+
" _ _ "
190+
"| || | "
191+
"| || |_ "
192+
"|__ _|"
193+
" | | "
194+
" |_| "
195+
)
196+
"5" = @(
197+
" _____ "
198+
"| ____|"
199+
"| |__ "
200+
"|___ \ "
201+
" ___) |"
202+
"|____/ "
203+
)
204+
"6" = @(
205+
" __ "
206+
" / / "
207+
" / /_ "
208+
"| '_ \ "
209+
"| (_) |"
210+
" \___/ "
211+
)
212+
"7" = @(
213+
" ______ "
214+
"|____ |"
215+
" / / "
216+
" / / "
217+
" / / "
218+
" /_/ "
219+
)
220+
"8" = @(
221+
" ___ "
222+
" / _ \ "
223+
"| (_) |"
224+
" > _ < "
225+
"| (_) |"
226+
" \___/ "
227+
)
228+
"9" = @(
229+
" ___ "
230+
" / _ \ "
231+
"| (_) |"
232+
" \__, |"
233+
" / / "
234+
" /_/ "
235+
)
236+
"." = @(
237+
" "
238+
" "
239+
" "
240+
" "
241+
" _ "
242+
"(_)"
243+
)
244+
"v" = @(
245+
" "
246+
" "
247+
"__ __"
248+
"\ \ / /"
249+
" \ V / "
250+
" \_(_)"
251+
)
252+
"p" = @(
253+
" _____ _ "
254+
"| __ \ (_) "
255+
"| |__) | __ _____ ___ _____ __"
256+
"| ___/ '__/ _ \ \ / / |/ _ \ \ /\ / /"
257+
"| | | | | __/\ V /| | __/\ V V / "
258+
"|_| |_| \___| \_/ |_|\___| \_/\_/ "
259+
)
260+
"d" = @(
261+
" _____ "
262+
"| __ \ "
263+
"| | | | _____ __"
264+
"| | | |/ _ \ \ / /"
265+
"| |__| | __/\ V / "
266+
"|_____/ \___| \_(_)"
267+
)
268+
"a" = @(
269+
" _ _____ __ _____ _ _ _ _ _ "
270+
" /\ | | / ____| / _| / ____(_) | | | | | | | "
271+
" / \ | | ______| | __ ___ | |_ ___ _ __ | | __ _| |_| |__| |_ _| |__ "
272+
" / /\ \ | | |______| | |_ |/ _ \ | _/ _ \| '__| | | |_ | | __| __ | | | | '_ \ "
273+
" / ____ \| |____ | |__| | (_) | | || (_) | | | |__| | | |_| | | | |_| | |_) | "
274+
"/_/ \_\______| \_____|\___/ |_| \___/|_| \_____|_|\__|_| |_|\__,_|_.__/ "
275+
)
276+
}
278277

279-
0..5 | ForEach-Object {
280-
$line = $_
281-
$str.ToCharArray() | ForEach-Object {
282-
if ($chars.Keys -contains $_) {
283-
$ch = $chars."$_"
284-
Write-Host -noNewline $ch[$line]
278+
$lines = $chars."a".Count
279+
for ($line = 0; $line -lt $lines; $line++) {
280+
foreach ($ch in $str.ToCharArray()) {
281+
if ($chars.Keys -contains $ch) {
282+
$bigCh = $chars."$ch"
283+
Write-Host -noNewline $bigCh[$line]
284+
}
285285
}
286+
Write-Host
286287
}
287-
Write-Host
288-
}
289288
}

0 commit comments

Comments
 (0)