共用方式為


FtpUpload@2 - FTP 上傳 v2 任務

使用此工作,使用 FTP 或透過 FTPS 安全地將檔案上傳至遠端電腦。

語法

# FTP upload v2
# Upload files using FTP.
- task: FtpUpload@2
  inputs:
    credentialsOption: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'. Alias: credsType. Required. Authentication Method. Default: serviceEndpoint.
    serverEndpoint: # string. Required when credsType = serviceEndpoint. FTP Service Connection. 
    #serverUrl: # string. Required when credsType = inputs. Server URL. 
    #username: # string. Required when credsType = inputs. Username. 
    #password: # string. Required when credsType = inputs. Password. 
    #implicitFTPS: false # boolean. Use implicit FTPS. Default: false.
    rootDirectory: # string. Alias: rootFolder. Required. Root folder. 
    filePatterns: '**' # string. Required. File patterns. Default: **.
    remoteDirectory: '/upload/$(Build.BuildId)/' # string. Alias: remotePath. Required. Remote directory. Default: /upload/$(Build.BuildId)/.
  # Advanced
    #enableUtf8: false # boolean. Enable UTF8 support. Default: false.
    #clean: false # boolean. Delete remote directory. Default: false.
    #cleanContents: false # boolean. Optional. Use when clean = false. Clear remote directory contents. Default: false.
    #preservePaths: false # boolean. Preserve file paths. Default: false.
    #trustSSL: false # boolean. Trust server certificate. Default: false.
    #customCmds: # string. FTP Commands.
# FTP upload v2
# Upload files using FTP.
- task: FtpUpload@2
  inputs:
    credentialsOption: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'. Alias: credsType. Required. Authentication Method. Default: serviceEndpoint.
    serverEndpoint: # string. Required when credsType = serviceEndpoint. FTP Service Connection. 
    #serverUrl: # string. Required when credsType = inputs. Server URL. 
    #username: # string. Required when credsType = inputs. Username. 
    #password: # string. Required when credsType = inputs. Password. 
    rootDirectory: # string. Alias: rootFolder. Required. Root folder. 
    filePatterns: '**' # string. Required. File patterns. Default: **.
    remoteDirectory: '/upload/$(Build.BuildId)/' # string. Alias: remotePath. Required. Remote directory. Default: /upload/$(Build.BuildId)/.
  # Advanced
    #enableUtf8: false # boolean. Enable UTF8 support. Default: false.
    #clean: false # boolean. Delete remote directory. Default: false.
    #cleanContents: false # boolean. Optional. Use when clean = false. Clear remote directory contents. Default: false.
    #preservePaths: false # boolean. Preserve file paths. Default: false.
    #trustSSL: false # boolean. Trust server certificate. Default: false.
    #customCmds: # string. FTP Commands.

輸入

credentialsOption - 驗證方法
輸入別名credsTypestring。 必須的。 允許的值:serviceEndpoint(FTP 服務連線)、inputs(輸入認證)。 預設值: serviceEndpoint

指定驗證方法。 使用 FTP 服務連線或輸入連線認證。


serverEndpoint - FTP 服務連線
stringcredsType = serviceEndpoint時為必要項。

指定 FTP 伺服器的服務連線。 若要建立一個,請按兩下 [管理] 連結並建立新的一般服務連線,然後輸入伺服器URL的FTP伺服器URL,例如 ftp://server.example.com和所需的認證。

如果目標伺服器支援 FTPS,無論指定的通訊協定(ftp://ftps://),都會建立安全連線。 若要只允許安全的連線,請使用 ftps:// 通訊協定,例如 ftps://server.example.com。 如果指定 ftps://,不支援 FTPS 的伺服器連線將會失敗。


serverUrl - 伺服器 URL
stringcredsType = inputs時為必要項。

指定 FTP 伺服器的 URL。


username - 用戶名稱
stringcredsType = inputs時為必要項。

指定 FTP 連線的用戶名稱。


password - 密碼
stringcredsType = inputs時為必要項。

指定 FTP 連線的密碼。


implicitFTPS - 使用隱式 FTPS
boolean。 預設值: false


rootDirectory - 根資料夾
輸入別名rootFolderstring。 必須的。

指定要上傳檔案的來源資料夾。


filePatterns - 檔案模式
string。 必須的。 預設值: **

指定要上傳之檔案的檔案路徑或模式。 字串支援多行迷你模式。 深入瞭解 檔案比對模式


remoteDirectory - 遠端目錄
輸入別名remotePathstring。 必須的。 預設值: /upload/$(Build.BuildId)/

指定工作上傳檔案之遠端 FTP 伺服器上的目錄。


enableUtf8 - 啟用UTF8支援
boolean。 預設值: false

啟用 FTP 連接的 UTF-8 支援 (OPTS UTF8 ON)。


clean - 刪除遠端目錄
boolean。 預設值: false

先刪除遠端目錄,包括其內容,再上傳。


cleanContents - 清除遠端目錄內容
boolean。 選擇性。 clean = false時使用 。 預設值: false

遞歸刪除遠端目錄中的所有內容,再上傳。 將不會刪除現有的目錄。 為了提升效能,請改用 clean


preservePaths - 保留檔案路徑
boolean。 預設值: false

如果選取,則會在上傳檔案的遠端目錄下重新建立相對本機目錄結構。 否則,檔案會直接上傳至遠端目錄,而不會建立其他子目錄。

例如,假設您的源資料夾是 /home/user/source/,其中包含檔案 foo/bar/foobar.txt,而您的遠端目錄為:/uploads/。 勾選取此布林值,檔案會上傳至 /uploads/foo/bar/foobar.txt。 如果未選取此布林值,檔案會上傳至 /uploads/foobar.txt


trustSSL - 信任伺服器證書
boolean。 預設值: false

使用 ftps://信任 FTP 伺服器的 SSL 憑證,即使它是自我簽署或無法由證書頒發機構單位 (CA) 驗證也一樣。


customCmds - FTP 命令
string

連接時將發送到遠端 FTP 伺服器的可選 FTP 命令。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制項選項和一般工作屬性

輸出變數

沒有。

備註

使用此工作,使用 FTP 或透過 FTPS 安全地將檔案上傳至遠端電腦。

我可以在哪裡深入瞭解檔案比對模式?

需求

要求 說明
管線類型 YAML、傳統組建、傳統版本
執行於 Agent、DeploymentGroup
要求 沒有
能力 此工作不符合作業中後續工作的任何需求。
命令限制 此工作會使用下列 命令限制執行: 受限制
Settable 變數 此工作有權 設定下列變數:已停用設定變數
代理程式版本 2.182.1 或更新
工作類別 效用

另請參閱