Azure DevOps 服務
本文列出了你用來執行企業即時遷移(ELM)的 Azure DevOps CLI 指令和參數,以及 CLI 在遷移過程中回傳的狀態和階段值。
Commands
移轉命令
| 命令 | 必要參數 | 可選參數 | HTTP | Description |
|---|---|---|---|---|
list |
--org |
--project、--include-all、--detect |
GET | 列出遷移。 預設情況下,CLI 只會回傳每個儲存庫的主動遷移資料。 用於 --include-all 包含已完成、失敗及暫停的遷移。 |
status |
--org、--repository-id |
--detect |
GET | 取得一次遷移的詳細狀態。 |
create |
--org、--repository-id、--target-repository、--agent-pool |
--target-owner-user-id、--service-endpoint-id、--github-token、--validate-only、--cutover-date、--skip-validation、--enable-boards-github-connection、--enable-auto-discover-pipelines、--pipeline-service-connection-id、--detect |
郵件 | 建立新的遷移。 如果沒通過--service-endpoint-id,CLI 會檢查ELM_GITHUB_TOKEN並執行 GitHub 裝置流程來驗證目標。 |
pause |
--org、--repository-id |
--detect |
PUT | 暫停正在進行的遷移。 |
resume |
--org、--repository-id |
--validate-only、--migration、--detect |
PUT | 恢復停止的遷移。 |
cutover set |
--org、--repository-id、--date |
--detect |
PUT | 安排切換的日期和時間。 價值必須是未來的。 |
cutover cancel |
--org、--repository-id |
--detect |
PUT | 取消預定的切換。 只有在階段為 Synchronization時才有效;當階段進展到 Cutover時,該 被拒絕。 發送DateTimeOffset.MinValue哨兵(0001-01-01T00:00:00+00:00),因為伺服器忽略null了 。scheduledCutoverDate |
cutover review |
--org、--repository-id |
--detect |
GET | 列出未處理項目及等待核准的管線驗證需求。 |
cutover approve |
--org、--repository-id |
--accept-failures、--pipelines-verified、--detect |
PUT | 透過接受未處理的項目和/或驗證重新接線的管線來批准切換。 至少提供其中一種 --accept-failures 或 --pipelines-verified。 Irreversible — no revoke API;用+重塑來恢復 abandon 。 |
abandon |
--org、--repository-id |
--remove-read-only、--yes、--detect |
刪除 | 放棄遷徙。 遷移記錄不會被清除,且管線重新配線資料會被保留,因此後續遷移時可以重複使用。 除非你通過 --yes,否則會有確認提示。 |
管線重配命令(預覽)
管線重配會重新定位指向指向遷移後 GitHub 倉庫中來源 Azure Repos 的管線。 遷移時,重新接線總是可行,兩種模式之一:
-
自動發現 —
--enable-auto-discover-pipelines--pipeline-service-connection-id與 。createELM 同步工作會走訪原始碼倉庫,並為每個參考它的管線建立克隆定義。 -
手動 — 之後
createpipelines submit用 註冊特定管線。 你可以混合兩種模式,隨時調整註冊人數pipelines update。
| 命令 | 必要參數 | 可選參數 | HTTP | Description |
|---|---|---|---|---|
pipelines list |
--org、--repository-id |
--detect |
GET | 列出管線重新接線的配置及各管線狀態。 |
pipelines submit |
--org、--repository-id、--pipeline-ids |
--service-connection-id、--repository-mapping、--detect |
郵件 | 加入專門的管線重新配線。 |
pipelines update |
--org、--repository-id |
--add-ids、--remove-ids、--retry-ids、--service-connection-id、--repository-mapping、--detect |
PUT | 批量新增、移除、重試或更改已註冊管線的服務連線。 至少需要一個更新標記。 |
pipelines retry |
--org、--repository-id、--pipeline-ids |
--detect |
PUT | 重試,管線重新布線失敗。 |
pipelines delete |
--org、--repository-id、--migration-id |
--yes、--detect |
刪除 | 刪除管線重新接線資料(設定與複製定義)以便遷移。 利用此資料清理失敗遷移時的重新接線資料; abandon 光靠這件事並不能消除。 |
參數詳細資料
| 參數 | 類型 | 使用對象 | Description |
|---|---|---|---|
--org |
URL | 全部 | Azure DevOps組織 URL,例如 https://dev.azure.com/<org>。 將此值設為預設值。 |
--repository-id |
GUID | 除了其他 list |
Azure Repos repository GUID. 取值從 az repos show --query id。 遷移僅以 API 回應沒有獨立的遷移 ID 欄位來識別 repositoryId ,且每個儲存庫最多只能有一個活躍遷移。 |
--target-repository |
URL | create |
例如 https://<enterprise>.ghe.com/<org>/<repo>目標儲存庫 URL。 必須以 http:// 或 https://開頭。 伺服器會驗證這個值。 |
--target-owner-user-id |
字串 | create |
目標倉庫擁有者的 GitHub 使用者 ID(帳號)。 當啟用伺服器端基於憑證的擁有者解析時,已被棄用並忽略。 |
--service-endpoint-id |
GUID | create |
Optional. Azure DevOps 服務連線 ID 用於同步 GitHub Enterprise Server 連線,用於同步提交到目標。 設定後,GitHub 裝置流程會被跳過。 不依賴使用者身份驗證——你仍然可以同時供應 --github-token 或 ELM_GITHUB_TOKEN 搭配使用。 |
--github-token |
字串 | create |
可選的 GitHub 使用者憑證(或 PAT)用於目標主機上的使用者身份驗證。 如果遺漏且--service-endpoint-id未提供,CLI 會檢查ELM_GITHUB_TOKEN並執行 GitHub 裝置流程。 |
--agent-pool |
字串 | create |
遷移工作的代理人群組名稱。 |
--validate-only |
旗標 |
create、resume |
在 create:只執行遷移前檢查。 開啟 resume:切換到僅驗證模式。 僅驗證結果在運行成功後24小時失效;在該期間開始(或升級)完整遷移。 |
--migration |
旗標 | resume |
將成功且僅驗證的執行升級為完整遷移(集合 validateOnly=false 與 statusRequested=active)。 僅當上一次僅驗證的執行以 結束 status: Succeeded時才有效。 與 --validate-only互斥。 |
--cutover-date |
ISO 8601 認證 | create |
例如 2030-12-31T11:59:00Z,在創建時預先排程切換。 |
--date |
ISO 8601 認證 | cutover set |
例如,安排切換日期和時間 2030-12-31T11:59:00Z。 應該是未來的事。 |
--skip-validation |
字串 | create |
我們強烈建議您避免使用此參數,因為它會大幅增加遷移失敗的風險,詳見 《企業即時遷移導論》(ELM)中所述。 以逗號分隔的驗證政策名稱清單,或非負整數位元遮罩。 政策名稱(不區分大小寫):, , , NoneActivePullRequestCountPullRequestDeltaSizeAgentPoolExistsMaxFileSizeMaxPullRequestSizeMaxPushPackSizeMaxReferenceNameLengthTargetRepositoryDoesNotExistSourceRepositoryContainsLfsObjectsSourceRepositoryNotReadOnlyBoardsGitHubConnectionProvisioningAll |
--enable-boards-github-connection (--enable-boards-gh) |
旗標 | create |
切換時選擇配置Azure Boards GitHub連線。 默認為關閉。 要求在遷移執行前,必須先在目標GitHub組織安裝 Azure Boards GitHub 應用程式。 |
--enable-auto-discover-pipelines (--auto-discover) |
旗標 | create |
切換時請選擇自動啟用管線發現。 默認為關閉。 需要 --pipeline-service-connection-id;若你在未連接服務的情況下通過此標記,CLI 會拒絕該指令。 |
--pipeline-service-connection-id (--pipeline-sc-id) |
GUID | create |
建立時附上 Project 範圍的 GitHub 服務連線 ID,用於管線重新布線。 自動發現所需;手動模式下可選,該模式會預先連接連線,之後 pipelines submit 的通話只需 --pipeline-ids。 |
--accept-failures |
整數 | cutover approve |
在切換前需要接受多少未處理的遷移資源。 提供這個和/或 --pipelines-verified。 |
--pipelines-verified |
旗標 | cutover approve |
確認所有重新布線的管線都已驗證。 退貨cutover review時requiresPipelineVerificationAcknowledgment: true必須。 可以在同一通電話中合併使用 --accept-failures 。 |
--pipeline-ids |
內情列表 |
pipelines submit、pipelines retry |
管線定義ID。 接受空格分隔(42 43 44)或逗號分隔(42,43,44)的值。 |
--service-connection-id |
GUID |
pipelines submit、pipelines update |
Project 範圍的 GitHub 服務連線 ID。 若連線在建立時已連接或透過 submit,則可選pipelines update。 |
--add-ids / --remove-ids / --retry-ids |
內情列表 | pipelines update |
在重新配線集中新增、移除或重試的管線 ID。 |
--repository-mapping |
字串 |
pipelines submit、pipelines update |
儲存庫映射以 <sourceRepoId>=<targetOwner>/<targetRepo>. 目標必須是形式 owner/repo ,而非網址。 可以多次提供。 |
--migration-id |
整數 | pipelines delete |
遷移 ID 用於管線重新配線清理。 從 Migration NN:validationIssues 文本 migrations status中的前綴讀出來。 |
--remove-read-only |
旗標 | abandon |
切換後,原始碼 Azure DevOps 儲存庫會設為唯讀。 新增這個旗標以恢復寫入權限。 只適用於切換後。 |
--yes (-y) |
旗標 |
abandon、pipelines delete |
跳過互動式確認提示。 對於腳本清理很有用。 |
--include-all |
旗標 | list |
回傳每個儲存庫的完整遷移歷史,包括已完成、失敗及暫停遷移。 (--include-inactive 是一個已停用的別名。) |
--detect |
旗標 | 全部 | 從 git 遠端自動偵測組織(預設: true)。 使用 --detect false 來停用。 |
遷移階段
| Stage | Description |
|---|---|
| 排隊中 | 移民被接受;工作還沒開始。 |
| Validation | 進行遷移前檢查。 |
| Synchronization | 複製與同步資料庫內容。 |
| 切換 | 正在執行最終同步並轉移到 GitHub。 |
| Cutover 評論 | 切換已達預定時間,但有未解決的故障,目前正在等待 cutover approve (或重新排程)。 |
| 準備剪接 | 已獲批准,等待下一個 ELM 專案進行最終切割。 |
| 已移轉 | 遷移完成。 GitHub 是記錄系統。 |
移轉狀態
| Status | Meaning |
|---|---|
| Active | 移民正在進行中。 |
| 成功 | 目前階段已成功完成。 |
| 已完成 | 移民已進入末期 Migrated 。 |
| 失敗 | 發生錯誤 問題解決後,你可以繼續遷移。 |
| 已暫停 | 手動暫停。 你可以繼續遷移。 |