A job in octopus which has a task to copy few folders from one environment to another environment using a power-shell script over azure. Inside the power-shell I am calling a node js script (https://github.com/Azure/api-management-developer-portal ) in my repository. It is running fine on my local machine so as well on the octopus server. But it is coming with some warning like below,
13:22:29 Error | Alive[################################################################] 100.0000%
13:22:29 Error | Finished[#############################################################] 100.0000%
13:22:29 Error | Alive[################################################################] 100.0000%
13:22:29 Error | Finished[#############################################################] 100.0000%
13:22:29 Error | Alive[################################################################] 100.0000%
13:22:29 Error | Finished[#############################################################] 100.0000%
13:22:29 Error | WARNING: uploading C:\Octopus\Work\20200610122124-353927-1979\dist\content\14d214dc-6afc-8581-efb8-fad4a024bb05
13:22:29 Error | Alive[################################################################] 100.0000%
13:22:29 Error | Finished[#############################################################] 100.0000%
13:22:29 Error | WARNING: uploading C:\Octopus\Work\20200610122124-353927-1979\dist\content\1f5e7cc3-ce40-cc82-0963-fd044ce161a1
13:22:29 Error | Alive[################################################################] 100.0000%
13:22:29 Error | Finished[#############################################################] 100.0000%
13:22:29 Error | WARNING: uploading C:\Octopus\Work\20200610122124-353927-1979\dist\content\22683897-1a40-cfb4-e59a-7be7637a44d2
13:22:29 Error | Alive[################################################################] 100.0000%
snippet of my power-shell script,
if($SourceContext -and $destinationTenantAccess)
{
#Install required libraries to run the migration script
npm i
#Execute migration script
node ./scripts/migrate --sourceEndpoint $SourceEndpoint --destEndpoint $DestinationEndpoint --publishEndpoint $DestPublishEndpoint --sourceId $sourceTenantAccess.Id --sourceKey $sourceTenantAccess.PrimaryKey --destId $destinationTenantAccess.Id --destKey $destinationTenantAccess.PrimaryKey
}
else
{
Write-Error ( "Unable to find SAS Tokens, Developer Portal migration Failed." )
}
note this is not failing my build, but I want to remove these errors. Any clue how to fix it ?
Hi @jyotiprakash126 ,
Thanks for getting in touch! These warnings/errors look to be coming from the custom script, so it looks like you’d just need to modify the script itself in order to redirect the output as needed. I would reckon that would clean it up in the way (or close to) the way you’re after. If needed, the following Microsoft doc page might be of help as well.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-5.1
I hope this helps! Let me know how you go, or if you have any further questions going forward.
Best regards,
Kenny
Hi Kenny,
I checked and also tried to run the script with 4>&1 3>&1 2>&1. But getting the same issue. Here is my script,
if(!$APIMSourceEndpoint)
{ $APIMSourceEndpoint = $SourceAPIManagerName+".management.azure-api.net" }
if(!$APIMDestinationEndpoint)
{$APIMDestinationEndpoint = $APIManagerName+".management.azure-api.net"}
if(!$APIMDestPublishEndpoint)
{$APIMDestPublishEndpoint = $APIManagerName+".developer.azure-api.net"}
$apimSourceContext = New-AzApiManagementContext -ResourceGroupName $SourceResourceGroup -ServiceName $SourceAPIManagerName
if($apimSourceContext)
{$sourceTenantAccess=Get-AzApiManagementTenantAccess -Context $apimSourceContext}
$apimContext = New-AzApiManagementContext -ResourceGroupName $ResourceGroup -ServiceName $APIManagerName
if($apimContext)
{$destinationTenantAccess=Get-AzApiManagementTenantAccess -Context $apimContext}
$projectVariables = [ordered]@{"Resource Group Source" = $SourceResourceGroup
"API Manager Name Source" = $SourceAPIManagerName
"Resource Group" = $ResourceGroup
"API Manager Name Destination" = $APIManagerName
"API Manager Source Endpoint" = $APIMSourceEndpoint
"API Manager Destination Endpoint" = $APIMDestinationEndpoint
"API Manager Destination Publish Endpoint" = $APIMDestPublishEndpoint
"API Manager Source PrimaryKey" = $sourceTenantAccess.PrimaryKey
"API Manager Destination PrimaryKey " = $destinationTenantAccess.PrimaryKey}
Write-DeploymentParameterHeader -component "Developer Portal Migration" -variables $projectVariables
Write-DeploymentHeader
if($apimSourceContext -and $destinationTenantAccess)
{
Write-Host "migrate --sourceEndpoint "$APIMSourceEndpoint --destEndpoint $APIMDestinationEndpoint --publishEndpoint $APIMDestPublishEndpoint --sourceId $sourceTenantAccess.Id --sourceKey $sourceTenantAccess.PrimaryKey --destId $destinationTenantAccess.Id --destKey $destinationTenantAccess.PrimaryKey
npm i
#Execute migration script
node ./scripts/migrate --no-warnings --sourceEndpoint $APIMSourceEndpoint --destEndpoint $APIMDestinationEndpoint --publishEndpoint $APIMDestPublishEndpoint --sourceId $sourceTenantAccess.Id --sourceKey $sourceTenantAccess.PrimaryKey --destId $destinationTenantAccess.Id --destKey $destinationTenantAccess.PrimaryKey
}
else
{
Write-Error ( "Unable to find SAS Tokens, Developer Portal migration Failed." )
}
Hi @jyotiprakash126 ,
Thanks for following up! That sure doesn’t look right, and I’m sorry to hear you’re still hitting this issue. To dig a bit deeper into what could possibly be causing this, could you send a verbose task log for us to look through? The following doc page outlines how you can produce and export this log.
I’m hoping that provides more detail and context around this one. Feel free to mark this thread as private or email the log to us at support@octopus.com and I can grab it there.
I look forward to hearing back!
Best regards,
Kenny
system
(system)
Closed
18 July 2020 03:34
6
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.