Trying the Azure file copy for the first time so not sure where I'm going wrong as it keeps failing with the details seen further below. It does create the 'Test' container though.
Also tried by changing the task version to 2 and 3. Same result
Any suggestions where to start looking?
Copied from 'View Yaml'
steps:
- task: AzureFileCopy#4
displayName: 'AzureBlob File Copy'
inputs:
SourcePath: '$(System.DefaultWorkingDirectory)/interace/interface brands/v20.08'
azureSubscription: Development
Destination: AzureBlob
storage: updates
ContainerName: Test
Log output:
2020-08-20T12:51:39.0807389Z INFO: AzCopy.exe: A newer version 10.6.0 is available to download
2020-08-20T12:51:39.0810239Z
2020-08-20T12:51:39.0923021Z ##[debug]Trying to disconnect from Azure and clear context at process scope
2020-08-20T12:51:39.0975253Z ##[debug]Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
2020-08-20T12:51:39.0997871Z ##[debug]Populating RepositorySourceLocation property for module Az.Accounts.
2020-08-20T12:51:39.1022385Z ##[debug]Loading module from path 'C:\Modules\az_3.1.0\Az.Accounts\1.9.2\Az.Accounts.psm1'.
2020-08-20T12:51:39.1250145Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop
2020-08-20T12:51:39.5095303Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop
2020-08-20T12:51:40.0741695Z ##[debug]Caught exception from task script.
2020-08-20T12:51:40.0773655Z ##[debug]Error record:
2020-08-20T12:51:40.1256747Z ##[debug]Upload to container: 'test' in storage account: 'updates' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2020-08-20T12:51:40.1267682Z ##[debug]At D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\4.171.3\Utility.ps1:109 char:5
2020-08-20T12:51:40.1278911Z ##[debug]+ throw "$errorMessage $helpMessage"
2020-08-20T12:51:40.1290483Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-08-20T12:51:40.1301825Z ##[debug] + CategoryInfo : OperationStopped: (Upload to conta...efilecopyreadme:String) [], RuntimeException
2020-08-20T12:51:40.1313423Z ##[debug] + FullyQualifiedErrorId : Upload to container: 'test' in storage account: 'updates' with blob prefix: '' fa iled with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2020-08-20T12:51:40.1323723Z ##[debug]
2020-08-20T12:51:40.1343144Z ##[debug]Script stack trace:
2020-08-20T12:51:40.1387327Z ##[debug]at ThrowError, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\4.171.3\Utility.ps1: line 109
2020-08-20T12:51:40.1399427Z ##[debug]at Upload-FilesToAzureContainer, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\4.171.3\Utility.ps1: line 248
2020-08-20T12:51:40.1410626Z ##[debug]at <ScriptBlock>, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\4.171.3\AzureFileCopy.ps1: line 181
2020-08-20T12:51:40.1421592Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-08-20T12:51:40.1433593Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-08-20T12:51:40.1445293Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-08-20T12:51:40.1456696Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-08-20T12:51:40.1475711Z ##[debug]Exception:
2020-08-20T12:51:40.1517637Z ##[debug]System.Management.Automation.RuntimeException: Upload to container: 'test' in storage account: 'updates' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2020-08-20T12:51:40.1704018Z ##[error]Upload to container: 'test' in storage account: 'updates' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2020-08-20T12:51:40.1706605Z ##[debug]Processed: ##vso[task.logissue type=error]Upload to container: 'test' in storage account: 'updates' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2020-08-20T12:51:40.1726755Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-08-20T12:51:40.2315295Z ##[section]Finishing: AzureBlob File Copy
Azure file copy to blob failing
Since you tested the task version to 2 and 3 and got the same error, I guess there might be something wrong with authentication error from Azure instead of the task itsself.
We need to make sure the Service Principal we use in this task have access to the Storage Account. You could try to navigate to Storage accounts
-> Access control page and Add a role assignment(Storage Blob Data Contributor/owner role) to my Service Principal/Managed Identity:
Besides, check also your Service Connection in your Azure DevOps Project Settings for identifying that you are using the correct Resource Group.
You could check this thread for some more details.
Related
I have pipeline agents installed on multiple machines and each one has a .env file, since each one has slightly different local values for the environment vars.
One of them is not working, however. The agent was installed and configured the same way on every machine.
In my pipeline I have a command line task that works in the $(Build.Repository.LocalPath) folder. When it runs the command mvn clean install -DskipTests=true, I get the error thrown in the title about an empty string. In the file, I've made sure that M2_HOME is pointing to the maven directory and that Java and Maven are added to "Path". The formatting looks like this, and it is the same format for every .env file on all the machines. Any clues?
JAVA_HOME=C:\\softwarebuild\\soft\\java\\jdk-11.0.2
M2_HOME=C:\\Users\\[redacted]\\.m2\\wrapper\\dists\\apache-maven-3.6.0-bin\\3rgjh30jneo7541hun7uggltkb\\apache-maven-3.6.0
Path=JAVA_HOME;M2_HOME\\bin
EDIT: I ran with system diagnostics turned on. Is it telling me it can't find cmd.exe? The first line of "cmdline.ps1" is just [CmdletBinding()]:
2022-01-24T18:20:55.0366255Z Script contents:
2022-01-24T18:20:55.0380447Z mvn clean install -DskipTests=true
2022-01-24T18:20:55.0643303Z ##[debug]AGENT_VERSION: '2.196.2'
2022-01-24T18:20:55.0803490Z ##[debug]AGENT_TEMPDIRECTORY:
'C:\agents\_work\_temp'
2022-01-24T18:20:55.0844911Z ##[debug]Asserting container path exists:
'C:\agents\_work\_temp'
2022-01-24T18:20:55.1197587Z ##[debug]Leaving
C:\agents\_work\_tasks\CmdLine_d9bafed4-0b18-4f58-968d-
86655b4d2ce9\2.198.0\cmdline.ps1.
2022-01-24T18:20:55.1295729Z ##[debug]Caught exception from task script.
2022-01-24T18:20:55.1356782Z ##[debug]Error record:
2022-01-24T18:20:55.2573018Z ##
[debug]C:\agents\_work\_tasks\CmdLine_d9bafed4-0b18-4f58-968d-
86655b4d2ce9\2.198.0\cmdline.ps1 : Cannot bind argument to parameter
'LiteralPath' because it is an empty string.
2022-01-24T18:20:55.2589074Z ##[debug]At line:1 char:1
2022-01-24T18:20:55.2616630Z ##[debug]+ .
'C:\agents\_work\_tasks\CmdLine_d9bafed4-0b18-4f58-968d-86655b4d2ce ...
2022-01-24T18:20:55.2641009Z ##[debug]+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-01-24T18:20:55.2664818Z ##[debug] + CategoryInfo :
InvalidData: (:) [cmdline.ps1], ParameterBindingValidationException
2022-01-24T18:20:55.2688247Z ##[debug] + FullyQualifiedErrorId :
ParameterArgumentValidationErrorEmptyStringNotAllowed,cmdline.ps1
2022-01-24T18:20:55.2711281Z ##[debug]
2022-01-24T18:20:55.2751043Z ##[debug]Script stack trace:
2022-01-24T18:20:55.2827845Z ##[debug]at <ScriptBlock>,
C:\agents\_work\_tasks\CmdLine_d9bafed4-0b18-4f58-968d-
86655b4d2ce9\2.198.0\cmdline.ps1: line 42
2022-01-24T18:20:55.2852703Z ##[debug]at <ScriptBlock>, <No file>: line
1
2022-01-24T18:20:55.2878438Z ##[debug]at <ScriptBlock>, <No file>: line
22
2022-01-24T18:20:55.2903959Z ##[debug]at <ScriptBlock>, <No file>: line
18
2022-01-24T18:20:55.2932146Z ##[debug]at <ScriptBlock>, <No file>: line
1
2022-01-24T18:20:55.2974680Z ##[debug]Exception:
2022-01-24T18:20:55.3223441Z ##
[debug]System.Management.Automation.ParameterBindingValidationException:
Cannot bind argument to parameter 'LiteralPath' because it is an empty
string.
I was missing an evironment variable called "ComSpec". The script was expecting to find that variable, with the value of the path pointing to cmd.exe.
I am trying to use Snyk Security Scan task in Azure Pipeline (Classic). My Application runtime is .Net and framework is ASP.Net 4.4.1 . There is no issue regarding authentication as i had create valid service connection of Snyk.
When i am running my pipeline it is giving error "Could not detect supported target files in D:\a\1\s".
log of failed Snyk Security Scan task:
##[debug]debug=undefined
##[debug]task result: Failed
** We have a problem! :( **
##[error]There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
##[debug]Processed: ##vso[task.issue type=error;]There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
##[debug]Processed: ##vso[task.complete result=Failed;]There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
I had this same problem and needed to take advantage of the "Custom path to manifest file to test" field with an absolute location of the packages file: C:\agent_work[buildId]\s[solution folder][project folder]\packages.config
This was running on a private build server.
I'm using Azure DevOps (visualstudio.com) and trying to get a Linux Build Agent up and running on a local server. This was working previously, but I upgraded the Linux server from Ubuntu 16.04 to 18.04. That broke my previous build agent.
So I removed the previous build agent and installed an up to date one. The new one registered easily, but when I try and run a build, it fails to check out sources.
Anybody know what might cause this problem, or where I can go for help? I don't manage our Azure DevOps. I'm just trying to get the Linux part working as it was.
Edit: I should note that running ./externals/tee/tf produces zero output (and returns with the same 100 code). Maybe it has something to do with java. I'm running Java(TM) SE Runtime Environment (build 12.0.2+10).
##[debug]Evaluating condition for step: 'Checkout'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
##[section]Starting: Checkout
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
##[debug]Processed: ##vso[plugininternal.updaterepositorypath alias=__designer_repo;]/home/***/myagent/_work/1/s
##[debug]Repository requires to be placed at '/home/***/myagent/_work/1/s', current location is '/home/***/myagent/_work/1/s'
Prepending PATH environment variable with directory containing 'tf'.
##[debug]Processed: ##vso[task.prependpath]/home/***/myagent/externals/tee
##[debug]PATH: '/home/***/myagent/externals/tee:/home/***/bin:/home/***/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
Querying workspace information.
##[debug]tf workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt
##[debug]Starting process:
##[debug] File name: 'tf'
##[debug] Arguments: 'workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt'
##[debug] Working directory: '/home/***/myagent/_work/1/s'
##[debug] Require exit code zero: 'True'
##[debug] Encoding web name: ; code page: ''
##[debug] Force kill process on cancellation: 'False'
##[debug] Redirected STDIN: 'False'
##[debug] Persist current code page: 'False'
##[debug] Keep redirected STDIN open: 'False'
##[debug] High priority process: 'False'
##[debug]Updated oom_score_adj to 500 for PID: 1921.
##[debug]Process started with process id 1921, waiting for process exit.
##[debug]STDOUT/STDERR stream read finished.
##[debug]STDOUT/STDERR stream read finished.
##[debug]Finished process 1921 with exit code 100, and elapsed time 00:00:03.3458546.
##[error]Exit code 100 returned from process: file name 'tf', arguments 'workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt'.
##[debug]Processed: ##vso[task.logissue type=error;]Exit code 100 returned from process: file name 'tf', arguments 'workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt'.
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug] at Agent.Plugins.Repository.TeeCliManager.WorkspacesAsync(Boolean matchWorkspaceNameOnAnyComputer)
at Agent.Plugins.Repository.TfsVCSourceProvider.GetSourceAsync(AgentTaskPluginExecutionContext executionContext, RepositoryResource repository, CancellationToken cancellationToken)
at Agent.Plugins.Repository.CheckoutTask.RunAsync(AgentTaskPluginExecutionContext executionContext, CancellationToken token)
at Agent.PluginHost.Program.Main(String[] args)
##[section]Finishing: Checkout
When I saw that the tf command produced no output, I was pretty sure it had to be a java problem. I had tried many different versions of java and none of them worked. But with Oracle java 1.8.0_221 it finally worked.
I downloaded the .tar.gz file, extracted it, and overwrote the /usr/bin/java* symlinks to point to the 1.8 copies and then it worked.
I've just upgraded to the Windows 10 Pro creators update | 1703 | OS Build: 15063.138.
When docker tries to start I get the following error:
Unable to create: You cannot call a method on a null-valued expression.
at <ScriptBlock>, <No file>: line 137
at Get-NetAdapter<End>, <No file>: line 181
at New-Switch, <No file>: line 137
at <ScriptBlock>, <No file>: line 381
at Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters)
at Docker.Backend.ContainerEngine.Linux.Start(Settings settings)
at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.<Register>b__0(Object[] parameters)
at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)
Now I've tried all the usual troubleshooting methods to try to fix it but have had no luck i.e. uninstall docker reninstall, turn off hyper-V then turn it back on again.
I've even tried running the following commands using Powershell in C:\Program Files\Docker\Docker\resources
.\MobyLinux.ps1 -Destroy
.\MobyLinux.ps1 -Create
The create task throws the following error:
? : You cannot call a method on a null-valued expression.
At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:137 char:37
+ ... Get-NetAdapter | ? { $_.Name.StartsWith("vEthernet ($SwitchName)") }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Where-Object], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands.WhereObjectCommand
Any ideas how to fix this?
For anyone experiencing the same what i did to fix it was.
Uninstall Docker and Remove Hyper-V from the control panel. Go into
device manager -> network adapters.
Right click and uninstall any that are not your actual physical network card
Reboot and Turn Hyper-V back on and reinstall Docker (Or just install Docker as it turns on Hyper-V for you).
I am executing Jenkins Job which Builds my .csproj file and execute few PS scripts.
Issue is I get a successful email even if my PS script fails,How should I tell my Jenkins Job to trigger me an email also if PS script is failing.
Error Logs-
Copy-Item : The process cannot access the file
'\\10.0.1.190\d$\Build\RPC\abcde.RPC.AirSearch\Common.Logging.Core.dll' because it is being used by another process.
At C:\Users\Administrator\AppData\Local\Temp\hudson9059014122834846757.ps1:3 char:1
+ Copy-Item "C:\AirSearchBnd\src\abcde.Air.Search.RPC.Host\bin\Release\*" "\\$en ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Copy-Item], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand
[AirSearchBnd] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\ADMINI~1\AppData\Local\Temp\hudson9149103993066004448.ps1'"
[SC] CreateService SUCCESS
SERVICE_NAME: AirSearchWindowsService
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 13784
FLAGS :
> C:\Program Files (x86)\Git\bin\git.exe tag -l RPCBUILD_6 # timeout=10
> C:\Program Files (x86)\Git\bin\git.exe tag -a -f -m Jenkins Git plugin tagging with RPCBUILD_6 RPCBUILD_6 # timeout=10
Pushing tag RPCBUILD_6 to repo Dev
> C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> C:\Program Files (x86)\Git\bin\git.exe push https://github.com/abcdeHoldings/abcde.Services.Air.Search.git RPCBUILD_6
Email was triggered for: Always
Sending email for trigger: Always
Request made to compress build log
Sending email to: abcde#software.com abcde#software.com abcde#software.com abcde#software.com
Finished: SUCCESS
The easiest way is to configure Jenkins to send e-mails on failed builds and in the Powershell step add the following at the end:
if ($error) { exit 1 }
The problem with Jenkins Powershell plugin is that it doesn't honor the errors that happen in Powershell, only the exit code of the shell itself, this will force build to fail and trigger the email.
There is an option of "Attaching Build Log". You can read the build log to see, if the ps script has failed.