MiguelSlv
MiguelSlv

Reputation: 15153

Setting up sourcepath for deploy task on azure devops

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://learn.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)'

Upvotes: 0

Views: 1012

Answers (2)

Levi Lu-MSFT
Levi Lu-MSFT

Reputation: 30343

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)/'

Upvotes: 1

Daniel Mann
Daniel Mann

Reputation: 59037

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.

Upvotes: 0

Related Questions