ftpazure-pipelines

Why does FtpUpload@2 suceed sometimes and sometimes fail when updating the ftp server when using Azure DevOps?


I have a pipeline which runs Monday - Friday and usually it will work as expected and update the web app.

enter image description here

However every now and then (about 1 a week) it will fail with this error.

##[warning]FTPError: 550 Access is denied. 
connecting to: ftp.mywebsite.site:21
connected: 220 Microsoft FTP Service
##[error]FTPError: 550 Access is denied. 

Below is the section of the yaml file in question

    - task: FtpUpload@2
    displayName: 'FTP Upload Test Site'
    inputs:
      credentialsOption: inputs
      serverUrl: $(ftpServerSite)
      username: $(ftpUser)
      password: $(ftpPassword)
      rootDirectory: '$(build.artifactstagingdirectory)/$(subFolder)'
      remoteDirectory: $(remoteDirSite)
      clean: true
      cleanContents: true
      preservePaths: true
      trustSSL: true

It is the same code every time and the variables do not change and yet for some reason every now and then we get the fail. Any ideas why please and how we can resolve this?

When I made the change below

clean: false
#cleanContents: true

I then saw this error

/home/vsts/work/1/a/spicetheworld/Microsoft.IdentityModel.Tokens.dll to: /mywebsite/Microsoft.IdentityModel.Tokens.dll

##[warning]FTPError: 550 The process cannot access the file because it is being used by another process. 

Solution

  • If it’s a transient error, add the retryCountOnTaskFailure element to the task’s inputs