FtpUpload@1 - FTP 上傳 v1 工作

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

Syntax

# FTP upload v1
# Upload files using FTP.
- task: FtpUpload@1
  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.
    #overwrite: true # boolean. Overwrite. Default: true.
    #preservePaths: false # boolean. Preserve file paths. Default: false.
    #trustSSL: false # boolean. Trust server certificate. Default: false.
# FTP Upload v1
# FTP Upload.
- task: FtpUpload@1
  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.
    #overwrite: true # boolean. Overwrite. Default: true.
    #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 如果已指定,則 Connections 不支援 FTPS 的伺服器將會失敗ftps://


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

指定 FTP 伺服器的 URL。


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

指定 FTP 連線的用戶名稱。


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

指定 FTP 連線的密碼。


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

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


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

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


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

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


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

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


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

在上傳之前,以遞歸方式刪除遠端目錄中的所有內容。 將不會刪除現有的目錄。 若要提升效能,請改用 clean


overwrite - 覆蓋
boolean. 預設值:true

覆寫遠端目錄中的現有檔案。


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) 也一樣。


工作控制選項

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

輸出變數

無。

備註

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

注意

此工作有較新版本可在 FtpUpload@2取得。

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

規格需求

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