Hi all I have spent quite a bit of time and I CANNOT work out why azcopy works in a step but not when is wrapped in a stage. I need to work using stages see below. The commented out code does not work when using stages.
Error
I get Error parsing source location "d:a\1\s\etc.... Failed to enumerate directory
I noticed
When using stages the log
AzCopy\AzCopy.exe" /Source:"D:\a\1\s\src\Dev\settings\AppSettings.json
when using step only
AzCopy\AzCopy.exe" /Source:"D:\a\1\s\src\Dev\settings
trigger:
- none
variables:
- group: AppVariables
- group: AppVariables2
- name: workingdirectory
value: '$(System.DefaultWorkingDirectory)/$(AppSettingsJson)'
resources:
repositories:
- repository: templates
type: git
name: Dev/Core
# stages:
# - stage: upload_Dev_File
# displayName: 'Upload File'
# jobs:
# - deployment: DevDeploy
# pool:
# vmImage: 'windows-latest'
# environment: $(DevEnvironment)
# strategy:
# runOnce:
# deploy:
# steps:
# - task: AzureFileCopy@3
# displayName: 'Deploy file to blob storage'
# inputs:
# SourcePath: $(workingdirectory)
# azureSubscription: '$(MyAzureSubscription)'
# Destination: AzureBlob
# storage: appStorage
# ContainerName: myApp
# BlobPrefix: Dev/Settings
pool:
vmImage: 'windows-latest'
steps:
- task: AzureFileCopy@3
displayName: 'Deploy file to blob storage'
inputs:
SourcePath: $(workingdirectory)
azureSubscription: '$(MyAzureSubscription)'
Destination: AzureBlob
storage: appStorage
ContainerName: myApp
BlobPrefix: Dev/Settings
I have also tried version 2 and 4 with no luck.Happy to do in powershell if easier. Any suggestions on what is going wrong here?
many thanks
I get Error parsing source location "d:a\1\s\etc.... Failed to enumerate directory
For this issue, I think the agent could not find the files in the s
folder. This is because when the stage is run, a new agent is used to run it.
Below is my reproduction of this problem:
As workaround, we need to add a checkout
step in the stage .
- stage: upload_Dev_File
displayName: 'Upload File'
jobs:
- deployment: DevDeploy
pool:
vmImage: 'windows-latest'
environment: $(DevEnvironment)
strategy:
runOnce:
deploy:
steps:
- checkout: RepoName
- task: AzureFileCopy@3
displayName: 'Deploy file to blob storage'
inputs:
SourcePath: '$(workingdirectory)'
azureSubscription: '$(MyAzureSubscription)'
Destination: 'AzureBlob'
storage: 'appStorage'
ContainerName: 'myApp'
BlobPrefix: 'Dev/Settings'
After adding checkout step, it works well: