共用方式為


FtpUpload@2 - FTP 上傳 v2 工作

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

Syntax

# 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.
# 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
    #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.

輸入

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

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


serverEndpoint - FTP 服務連線
string. 當 credsType = serviceEndpoint 時為必要。

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

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


serverUrl - 伺服器 URL
string. 當 credsType = inputs 時為必要。

指定 FTP 伺服器的 URL。


username - 使用者
string. 當 credsType = inputs 時為必要。

指定 FTP 連線的使用者名稱。


password - 密碼
string. 當 credsType = inputs 時為必要。

指定 FTP 連線的密碼。


implicitFTPS - 使用隱含 FTPS
boolean. 預設值:false


rootDirectory - 根資料夾
輸入別名: rootFolderstring. 必要。

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


filePatterns - 檔案模式
string. 必要。 預設值:**

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


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

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


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

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


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

信任 FTP 伺服器的 SSL 憑證, ftps:// 即使它是自我簽署,還是無法由憑證授權單位單位 (CA) 進行驗證。


customCmds - FTP 命令
string.

選擇性 FTP 命令,將在連線時傳送至遠端 FTP 伺服器。


工作控制選項

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

輸出變數

無。

備註

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

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

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
執行于 Agent、DeploymentGroup
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 此工作會使用下列 命令限制來執行:受限制
Settable 變數 此工作有權 設定下列變數:已停用設定變數
代理程式版本 2.182.1 或更新版本
工作類別 公用程式
需求 描述
管線類型 YAML、傳統組建、傳統版本
在 上執行 Agent、DeploymentGroup
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任何
可設定變數 任何
代理程式版本 所有支援的代理程式版本。
工作類別 公用程式

另請參閱