Reputation: 4471
I manage a static website. No database, no server-side processing like ASP.NET (IIS), PHP, etc. This website is comprised of just HTML, CSS, some JavaScript, and a few graphic files. I'm trying to use Azure Pipelines for this. This is my first time using Azure Pipelines. I chose an HTML template to start the YAML pipeline.
I'm using the FTP Upload
task. The source code is in Azure DevOps Repos. I'm testing the Pipeline by trying to FTP the files to a test folder on the hosting server (not a part of Azure). In testing the pipeline, I get this error:
##[error]Error: Failed find: ENOENT: no such file or directory, stat '/bin/pyvenv'
I don't know what I should put as the rootDirectory. I thought it appropriate to put the "/". Here's the YAML:
# HTML
# Archive your static HTML project and save it with the build record.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- none
pool:
vmImage: 'ubuntu-latest'
steps:
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(build.sourcesDirectory)'
includeRootFolder: false
- task: FtpUpload@2
inputs:
credentialsOption: 'inputs'
serverUrl: 'ftp://ftp.destination.com'
username: '$(TheUsername)'
password: '$(ThePassword)'
rootDirectory: '/'
filePatterns: '**'
remoteDirectory: '/test'
clean: false
cleanContents: false
preservePaths: false
trustSSL: false
What should I put for the rootDirectory?
Upvotes: 0
Views: 11187
Reputation: 902
The root directory is your source code directory from where your compiled code is, in your case it should be checkout path.
I think you should use should use $(System.DefaultWorkingDirectory)/rootFolderName
.
Here root folder should be your repo name. You try printing the content of the $(System.DefaultWorkingDirectory) to check whether you need to use $(System.DefaultWorkingDirectory) only or any nested folder inside it.
Upvotes: 1
Reputation: 8298
The task ArchiveFiles
field archiveFile
default value is $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
.
According to your YAML build definition, you have archived the folder $(build.sourcesDirectory)
to the path $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
, and next task is FtpUpload, then field rootDirectory should be $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
and it will upload the zip file to a remote machine.
If you want to upload the static website, you could also set the field rootDirectory to $(Build.SourcesDirectory)
. Check the doc build variables for more details.
Upvotes: 0
Reputation: 1394
Have you tried
rootDirectory: '.'
OR
rootDirectory: '$(Pipeline.Workspace)'
?
Upvotes: 2