0
votes

This is my first pipeline so i am sure i am missing something really simple.

I create and run successfully a azure pipeline. Now i want to create a release and transfer it to my ftp server, so i created a release, connected it to the build artifact and then add a stage.

On the stage i add a ftp task to upload the release. The problem is what i should set on the root field. I try many things but none works. I set the value using the browsing window but points to an invalid location. I try many variations with no success.

This is the yml:

steps:
- task: FtpUpload@2
  displayName: 'FTP Upload: /'
  inputs:
    credentialsOption: inputs
    serverUrl: '*****'
    username: ****
    password: '*****'
    rootDirectory: /
    remoteDirectory: '/azure/$(Build.BuildId)/'

This is the log:

2019-11-22T15:14:43.8429924Z ##[section]Starting: FTP Upload: $(System.DefaultWorkingDirectory)/_AzureTP-ASP.NET Core (.NET Framework)-CI 2019-11-22T15:14:44.0673529Z ============================================================================== 2019-11-22T15:14:44.0673684Z Task : FTP upload 2019-11-22T15:14:44.0673747Z Description : Upload files using FTP 2019-11-22T15:14:44.0673783Z Version : 2.157.0 2019-11-22T15:14:44.0673817Z Author : Microsoft Corporation 2019-11-22T15:14:44.0673852Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/ftp-upload 2019-11-22T15:14:44.0673903Z ============================================================================== 2019-11-22T15:14:44.6355305Z ##[error]Error: ENOENT: no such file or directory, stat 'D:\a\r1\a_AzureTP-ASP.NET Core (.NET Framework)-CI'

ENOENT: no such file or directory, stat 'D:\a\r1\a\$(Build.SourcesDirectory)'

2
Did you get a chance to try out below answer? Please let me know how did it go? We can discuss it and work out a better solution together.Levi Lu-MSFT
I solved before by using navigation on Root folder field. The filed ended with the value ´$(System.DefaultWorkingDirectory)/_AzureTP-ASP.NET Core-CI/drop/ConsoleApp.zip.´MiguelSlv
But then i try your solution too. It works.MiguelSlv

2 Answers

1
votes

Root Directory should be point to the folder where the build artifacts resides. In the release pipeline,the build artifacts usually is downloaded in folder C:\agent\_work\r1\awhich is referenced by $(System.DefaultWorkingDirectory) or $(System.ArtifactsDirectory). You can check the release variables here

Below yaml is for example. Hope it helps

steps: - task: FtpUpload@2 displayName: 'FTP Upload: /' inputs: credentialsOption: inputs serverUrl: '*****' username: **** password: '*****' rootDirectory: '$(System.DefaultWorkingDirectory)' filePatterns: '**' remoteDirectory: '/azure/$(Build.BuildId)/'

0
votes

Build variables don't exist in the context of a release. You're trying to use build variables. Refer to the "predefined variables" documentation, to which a link is provided on the variables tab of your release.