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

Secrets refactoring #650

Merged
merged 106 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
2b1da43
Attempt 1
freddydk Aug 5, 2023
8143cd5
casing
freddydk Aug 5, 2023
0e3f73e
get and dump secrets
freddydk Aug 5, 2023
d4d5eaa
use with
freddydk Aug 5, 2023
4e13f78
str
freddydk Aug 5, 2023
b1deb36
rename to env:Secrets
freddydk Aug 5, 2023
130fb76
fix env vars
freddydk Aug 6, 2023
c8ef1c4
inherit
freddydk Aug 6, 2023
010ea9f
syntax
freddydk Aug 6, 2023
22fc940
secrets
freddydk Aug 6, 2023
ed459b1
move secrets
freddydk Aug 6, 2023
4601524
do not set empty secrets
freddydk Aug 7, 2023
7712a48
remove
freddydk Aug 7, 2023
ed11c2c
use secrets
freddydk Aug 7, 2023
9580920
secrets is set
freddydk Aug 7, 2023
bf5d470
comment
freddydk Aug 7, 2023
0a5ea37
support unread secrets
freddydk Aug 7, 2023
20f1763
do not rewrite settings in ReadSecrets
freddydk Aug 7, 2023
ec28d33
get type and init projects
freddydk Aug 7, 2023
64cfb1d
do not rewrite settings in DetermineArtifact
freddydk Aug 7, 2023
61f6397
spell
freddydk Aug 7, 2023
cf05ca7
catch
freddydk Aug 7, 2023
474cf21
fail on CR or LF
freddydk Aug 7, 2023
1416767
remove trailing spaces
freddydk Aug 7, 2023
50d9f30
add additional comment + try/catch
freddydk Aug 7, 2023
099c184
do not download probingPaths
freddydk Aug 7, 2023
946740a
test null
freddydk Aug 7, 2023
e1b3ca0
settingValue
freddydk Aug 7, 2023
1ad10db
test str
freddydk Aug 7, 2023
8e4f60c
analyzerepo
freddydk Aug 7, 2023
d429047
id
freddydk Aug 7, 2023
e902976
secrets
freddydk Aug 7, 2023
abc2a79
frombase64
freddydk Aug 7, 2023
708584b
syntax
freddydk Aug 7, 2023
cd32172
Merge branch 'main' into OnlyNeededSecrets
freddydk Aug 7, 2023
1703bc2
indent
freddydk Aug 7, 2023
0417e6c
use SettingsName
freddydk Aug 7, 2023
3d314db
setuprepos
freddydk Aug 7, 2023
2092068
required
freddydk Aug 7, 2023
53f7757
add wait
freddydk Aug 7, 2023
e84223d
remove env artifact names
freddydk Aug 7, 2023
bbef0e3
fix test
freddydk Aug 7, 2023
419b55c
Scriptanalyzer fixes
freddydk Aug 7, 2023
a2415a8
Use Write-Host as OutputError might not be avail.
freddydk Aug 8, 2023
92f3393
Support include in appDependencyProbingPaths
freddydk Aug 8, 2023
3ce738f
err
freddydk Aug 8, 2023
1e40f3d
throw
freddydk Aug 8, 2023
4b290bf
exit 1
freddydk Aug 8, 2023
f711471
throw
freddydk Aug 8, 2023
a260abc
byref
freddydk Aug 8, 2023
bba2d04
mock write-host
freddydk Aug 8, 2023
d69412f
mock write-host
freddydk Aug 8, 2023
1cb3489
mock setshould
freddydk Aug 8, 2023
d06cd79
setshould
freddydk Aug 8, 2023
50b5434
review comments
freddydk Aug 8, 2023
4b8499f
review
freddydk Aug 8, 2023
5ebdcd5
Update Actions/ReadSecrets/ReadSecrets.ps1
freddydk Aug 8, 2023
32f3896
json
freddydk Aug 8, 2023
dee0043
bug
freddydk Aug 8, 2023
dfd58b7
Merge pull request #195 from freddydk/OnlyNeededSecrets2
freddydk Aug 8, 2023
b74a854
throw
freddydk Aug 8, 2023
3f69213
myerr2
freddydk Aug 8, 2023
f7cf235
arr
freddydk Aug 8, 2023
fcaeb6b
setshould
freddydk Aug 8, 2023
3193bdf
exit 1 with line
freddydk Aug 8, 2023
236aa11
err pref
freddydk Aug 8, 2023
eb680f5
no line
freddydk Aug 8, 2023
7d70394
no errpref
freddydk Aug 8, 2023
d8967fd
multiline
freddydk Aug 8, 2023
dc61fd2
refactor actions
freddydk Aug 8, 2023
f5d09a2
do not fail
freddydk Aug 8, 2023
6210b05
no throw
freddydk Aug 8, 2023
bfecb41
err msg
freddydk Aug 8, 2023
786eb6d
dump
freddydk Aug 8, 2023
7172204
dump
freddydk Aug 8, 2023
8238c9e
use json
freddydk Aug 8, 2023
6e5cdce
do not output secrets as env
freddydk Aug 8, 2023
a8583fd
appfolders is mandatory
freddydk Aug 8, 2023
92ee7da
Merge pull request #196 from freddydk/OnlyNeededSecrets2
freddydk Aug 8, 2023
335d1e7
fix test
freddydk Aug 8, 2023
51c2db2
fix test
freddydk Aug 8, 2023
831ab9e
do not use secret env var
freddydk Aug 8, 2023
d9001e9
remove individual secret var
freddydk Aug 8, 2023
a457b03
scriptanalyzer
freddydk Aug 9, 2023
d6a2851
remove individual secret env vars
freddydk Aug 9, 2023
c1fb5c1
debug
freddydk Aug 9, 2023
261fd72
not tolower
freddydk Aug 9, 2023
61c1bd1
windows and linux
freddydk Aug 9, 2023
f781ae7
win+linux
freddydk Aug 9, 2023
1dc5d4d
Update Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1
freddydk Aug 9, 2023
f750e8b
review comments
freddydk Aug 9, 2023
b6c7bbd
Merge branch 'OnlyNeededSecrets' of https://github.com/freddydk/AL-Go…
freddydk Aug 9, 2023
1dce044
dont read appDependencyProbingPathsSecrets secret
freddydk Aug 9, 2023
30689c2
remove appFolders etc.
freddydk Aug 9, 2023
a9e1a84
update
freddydk Aug 9, 2023
75d883e
Merge pull request #197 from freddydk/Only2
freddydk Aug 9, 2023
e2b7981
do not doubleget artifactUrl
freddydk Aug 9, 2023
4574632
set artifact
freddydk Aug 9, 2023
c4966dc
doNotCheckArtifact
freddydk Aug 9, 2023
e1b22a5
Update RELEASENOTES.md
freddydk Aug 9, 2023
2e66443
Update RELEASENOTES.md
freddydk Aug 9, 2023
7d76e81
Update RELEASENOTES.md
freddydk Aug 9, 2023
ddba1e5
Update RELEASENOTES.md
freddydk Aug 9, 2023
46d9ab3
Update RELEASENOTES.md
freddydk Aug 9, 2023
ff263bf
review + test fix
freddydk Aug 9, 2023
c012b2f
review comment
freddydk Aug 9, 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
486 changes: 249 additions & 237 deletions Actions/AL-Go-Helper.ps1

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions Actions/AddExistingApp/AddExistingApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,9 @@ function expandfile {
}
}

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$telemetryScope = $null
$bcContainerHelperPath = $null

# IMPORTANT: No code that can fail should be outside the try/catch

try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
$branch = ''
Expand Down Expand Up @@ -189,7 +186,7 @@ try {
try {
$settingsJsonFile = Join-Path $projectFolder $ALGoSettingsFile
$SettingsJson = Get-Content $settingsJsonFile -Encoding UTF8 | ConvertFrom-Json
if (@($settingsJson.appFolders)+@($settingsJson.testFolders)) {
if (@($settingsJson.appFolders) + @($settingsJson.testFolders)) {
if ($ttype -eq "Test App") {
if ($SettingsJson.testFolders -notcontains $foldername) {
$SettingsJson.testFolders += @($folderName)
Expand Down Expand Up @@ -219,7 +216,7 @@ try {
$workspace | Set-JsonContentLF -Path $workspaceFile
}
catch {
throw "$workspaceFileName is malformed.$([environment]::Newline) $($_.Exception.Message)"
throw "$workspaceFileName is malformed.$([environment]::Newline) $($_.Exception.Message)"
}
}
}
Expand All @@ -230,8 +227,8 @@ try {
TrackTrace -telemetryScope $telemetryScope
}
catch {
OutputError -message "AddExistingApp action failed.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath
Expand Down
10 changes: 9 additions & 1 deletion Actions/AddExistingApp/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ runs:
_url: ${{ inputs.url }}
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: try { ${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y') } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 }
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
branding:
icon: terminal
color: blue
5 changes: 1 addition & 4 deletions Actions/AnalyzeTests/AnalyzeTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ Param(
[string] $project
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$telemetryScope = $null
$bcContainerHelperPath = $null

# IMPORTANT: No code that can fail should be outside the try/catch

try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
$BcContainerHelperPath = DownloadAndImportBcContainerHelper -baseFolder $ENV:GITHUB_WORKSPACE
Expand Down Expand Up @@ -49,8 +46,8 @@ try {
TrackTrace -telemetryScope $telemetryScope
}
catch {
OutputError -message "AnalyzeTests action failed.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath
Expand Down
10 changes: 9 additions & 1 deletion Actions/AnalyzeTests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ runs:
_token: ${{ inputs.token }}
_parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_project: ${{ inputs.project }}
run: try { ${{ github.action_path }}/AnalyzeTests.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 }
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/AnalyzeTests.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
branding:
icon: terminal
color: blue
45 changes: 20 additions & 25 deletions Actions/CalculateArtifactNames/CalculateArtifactNames.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,44 @@ Param(
[string] $suffix
)

function Set-EnvVariable([string] $name, [string] $value) {
function Set-OutputVariable([string] $name, [string] $value) {
Write-Host "Assigning $value to $name"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "$name=$value"
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "$name=$value"
}

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0

$settings = $env:Settings | ConvertFrom-Json

if ($project -eq ".") {
$project = $settings.repoName
if ($project -eq ".") {
$project = $settings.repoName
}

$branchName = $branchName.Replace('\','_').Replace('/','_')
$projectName = $project.Replace('\','_').Replace('/','_')
$branchName = $branchName.Replace('\', '_').Replace('/', '_')
$projectName = $project.Replace('\', '_').Replace('/', '_')

# If the buildmode is default, then we don't want to add it to the artifact name
if ($buildMode -eq 'Default') {
$buildMode = ''
if ($buildMode -eq 'Default') {
$buildMode = ''
}
Set-EnvVariable -name "BuildMode" -value $buildMode
Set-OutputVariable -name "BuildMode" -value $buildMode

if($suffix) {
# Add the date to the suffix
$suffix = "$suffix-$([DateTime]::UtcNow.ToString('yyyyMMdd'))"
if ($suffix) {
# Add the date to the suffix
$suffix = "$suffix-$([DateTime]::UtcNow.ToString('yyyyMMdd'))"
}
else {
# Default suffix is the build number
$suffix = "$($settings.repoVersion).$($settings.appBuild).$($settings.appRevision)"
# Default suffix is the build number
$suffix = "$($settings.repoVersion).$($settings.appBuild).$($settings.appRevision)"
}

'Apps','Dependencies','TestApps','TestResults','BcptTestResults','BuildOutput','ContainerEventLog' | ForEach-Object {
$name = "$($_)ArtifactsName"
$value = "$($projectName)-$($branchName)-$buildMode$_-$suffix"

Set-EnvVariable -name $name -value $value
'Apps', 'Dependencies', 'TestApps', 'TestResults', 'BcptTestResults', 'BuildOutput', 'ContainerEventLog' | ForEach-Object {
$name = "$($_)ArtifactsName"
$value = "$($projectName)-$($branchName)-$buildMode$_-$suffix"
Set-OutputVariable -name $name -value $value
}

# Set this build artifacts name
'Apps', 'TestApps' | ForEach-Object {
$name = "ThisBuild$($_)ArtifactsName"
$value = "thisbuild-$($projectName)-$($buildMode)$($_)"

Set-EnvVariable -name $name -value $value
$name = "ThisBuild$($_)ArtifactsName"
$value = "thisbuild-$($projectName)-$($buildMode)$($_)"
Set-OutputVariable -name $name -value $value
}
10 changes: 9 additions & 1 deletion Actions/CalculateArtifactNames/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ runs:
_buildMode: ${{ inputs.buildMode }}
_branchName: ${{ inputs.branchName }}
_suffix: ${{ inputs.suffix }}
run: try { ${{ github.action_path }}/CalculateArtifactNames.ps1 -project $ENV:_project -buildMode $ENV:_buildMode -branchName $ENV:_branchName -suffix $ENV:_suffix } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("*",'').Replace("*",' ')))"; exit 1 }
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/CalculateArtifactNames.ps1 -project $ENV:_project -buildMode $ENV:_buildMode -branchName $ENV:_branchName -suffix $ENV:_suffix
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
branding:
icon: terminal
color: blue
5 changes: 1 addition & 4 deletions Actions/CheckForUpdates/CheckForUpdates.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ Param(
[bool] $directCommit
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$telemetryScope = $null
$bcContainerHelperPath = $null

# IMPORTANT: No code that can fail should be outside the try/catch

try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
. (Join-Path -Path $PSScriptRoot -ChildPath "yamlclass.ps1")
Expand Down Expand Up @@ -542,8 +539,8 @@ try {
TrackTrace -telemetryScope $telemetryScope
}
catch {
OutputError -message "CheckForUpdates action failed.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath
Expand Down
10 changes: 9 additions & 1 deletion Actions/CheckForUpdates/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ runs:
_update: ${{ inputs.update }}
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: try { ${{ github.action_path }}/CheckForUpdates.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -templateUrl $ENV:_templateUrl -templateBranch $ENV:_templateBranch -update ($ENV:_update -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y') } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 }
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/CheckForUpdates.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -templateUrl $ENV:_templateUrl -templateBranch $ENV:_templateBranch -update ($ENV:_update -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
branding:
icon: terminal
color: blue
7 changes: 2 additions & 5 deletions Actions/CreateApp/CreateApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ Param(
[bool] $directCommit
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$telemetryScope = $null
$bcContainerHelperPath = $null
$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())

# IMPORTANT: No code that can fail should be outside the try/catch

try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
$branch = ''
Expand Down Expand Up @@ -67,7 +64,7 @@ try {
if ($type -eq "Performance Test App") {
try {
$settings = ReadSettings -baseFolder $baseFolder -project $project
$settings = AnalyzeRepo -settings $settings -token $token -baseFolder $baseFolder -project $project -doNotIssueWarnings
$settings = AnalyzeRepo -settings $settings -token $token -baseFolder $baseFolder -project $project -doNotIssueWarnings -doNotCheckAppDependencyProbingPaths
$folders = Download-Artifacts -artifactUrl $settings.artifact -includePlatform
$sampleApp = Join-Path $folders[0] "Applications.*\Microsoft_Performance Toolkit Samples_*.app"
if (Test-Path $sampleApp) {
Expand Down Expand Up @@ -143,8 +140,8 @@ try {

}
catch {
OutputError -message "CreateApp action failed.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath
Expand Down
10 changes: 9 additions & 1 deletion Actions/CreateApp/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ runs:
_sampleSuite: ${{ inputs.sampleSuite }}
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: try { ${{ github.action_path }}/CreateApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -type $ENV:_type -name $ENV:_name -publisher $ENV:_publisher -idrange $ENV:_idrange -sampleCode ($ENV:_sampleCode -eq 'Y') -sampleSuite ($ENV:_sampleSuite -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y') } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 }
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/CreateApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -type $ENV:_type -name $ENV:_name -publisher $ENV:_publisher -idrange $ENV:_idrange -sampleCode ($ENV:_sampleCode -eq 'Y') -sampleSuite ($ENV:_sampleSuite -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
branding:
icon: terminal
color: blue
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ Param(
[bool] $directCommit
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$telemetryScope = $null
$bcContainerHelperPath = $null

# IMPORTANT: No code that can fail should be outside the try/catch

try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
$branch = ''
Expand Down Expand Up @@ -59,8 +56,8 @@ try {
TrackTrace -telemetryScope $telemetryScope
}
catch {
OutputError -message "CreateDevelopmentEnvironment action failed.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath
Expand Down
10 changes: 9 additions & 1 deletion Actions/CreateDevelopmentEnvironment/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ runs:
_reUseExistingEnvironment: ${{ inputs.reUseExistingEnvironment }}
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: try { ${{ github.action_path }}/CreateDevelopmentEnvironment.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -environmentName $ENV:_environmentName -project $ENV:_project -adminCenterApiCredentials $ENV:_adminCenterApiCredentials -reUseExistingEnvironment ($ENV:_reUseExistingEnvironment -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y') } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 }
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/CreateDevelopmentEnvironment.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -environmentName $ENV:_environmentName -project $ENV:_project -adminCenterApiCredentials $ENV:_adminCenterApiCredentials -reUseExistingEnvironment ($ENV:_reUseExistingEnvironment -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
branding:
icon: terminal
color: blue
5 changes: 1 addition & 4 deletions Actions/CreateReleaseNotes/CreateReleaseNotes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ Param(
[string] $target_commitish
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$telemetryScope = $null
$bcContainerHelperPath = $null

# IMPORTANT: No code that can fail should be outside the try/catch

try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1")
$BcContainerHelperPath = DownloadAndImportBcContainerHelper -baseFolder $ENV:GITHUB_WORKSPACE
Expand Down Expand Up @@ -72,8 +69,8 @@ try {
TrackTrace -telemetryScope $telemetryScope
}
catch {
OutputError -message "CreateReleaseNotes action failed.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath
Expand Down
10 changes: 9 additions & 1 deletion Actions/CreateReleaseNotes/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ runs:
_parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_tag_name: ${{ inputs.tag_name }}
_target_commitish: ${{ inputs.target_commitish }}
run: try { ${{ github.action_path }}/CreateReleaseNotes.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -tag_name $ENV:_tag_name -target_commitish $ENV:_target_commitish } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 }
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/CreateReleaseNotes.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -tag_name $ENV:_tag_name -target_commitish $ENV:_target_commitish
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
branding:
icon: terminal
color: blue
Loading
Loading