Open henriquebrisola opened 1 month ago
In the first instance, I would like to understand why you are experiencing this error ("concurrent operations")? This should have never happened as #adftools does disable triggers one by one synchronously.
Unfortunately I don't know why this happens, no one should be changing anything directly in production, more than one deploy on master could happen, but I guess it is rare. Maybe some api is changing the trigger status. I not aware of all other projects happening wihtin the company that might influence on this, so my choice is to solve by code.
Did you try to set $ErrorActionPreference = 'Continue'
before running the Publish?
No, but continue is the default value and there is no other value set for it.
Woundn't that also make everything else continue even when somethings should report the error?
I created workaround, I added the $opt.TriggerStopMethod = 'DeployableOnly'
(which starting back is not working due to #386) and then created a method to read all trigger files with runtimeState Started, so I was able to make sure they start back again after the deploy is done.
$triggersEnabledInRepo = ( # Get all triggers enabled in the Repo
Get-ChildItem -Path (
Join-Path -Path $fullRootPath -ChildPath '\trigger'
) -Recurse |
Select-String '"runtimeState": "Started"' |
Get-Item
).Basename
$triggersEnabledInRepo | ForEach-Object { # Start all triggers enabled in the Repo
try{
Write-Host "Starting" $_
Start-AzDataFactoryV2Trigger `
-ResourceGroupName "$ResourceGroupName" `
-DataFactoryName "$DataFactoryName" `
-TriggerName $_ `
-Force | out-null
}
catch{
Write-Host "Faile to start" $_
}
}
Hello, I am having an issue sometimes that if one of the triggers fails to be stopped, the whole deploy operation fails. Can we please add this simple try/catch to solve this issue? We might even add a number of tries in the future.