多步驟排序執行可讓您在部署無線更新時執行預安裝及安裝後工作。 這項功能屬於公共預覽重新整理更新資訊清單 v4 架構的一部分。
請在檢閱以下變更之前,參閱 更新清單 文件,這是公開預覽版本更新的一部分。
使用多步驟排序執行時,有兩種類型的步驟:
- 內嵌步驟 (預設值)
- 參考步驟
使用具有單一內嵌步驟的範例更新清單:
{
"updateId": {...},
"isDeployable": true,
"compatibility": [
{
"deviceManufacturer": "du-device",
"deviceModel": "e2e-test"
}
],
"instructions": {
"steps": [
{
"description": "Example APT update that install libcurl4-doc on a host device.",
"handler": "microsoft/apt:1",
"files": [
"apt-manifest-1.0.json"
],
"handlerProperties": {
"installedCriteria": "apt-update-test-1.0"
}
}
]
},
"manifestVersion": "4.0",
"importedDateTime": "2021-11-16T14:54:55.8858676Z",
"createdDateTime": "2021-11-16T14:50:47.3511877Z"
}
包含兩個內嵌步驟的範例更新指令清單:
{
"updateId": {...},
"isDeployable": true,
"compatibility": [
{
"deviceManufacturer": "du-device",
"deviceModel": "e2e-test"
}
],
"instructions": {
"steps": [
{
"description": "Install libcurl4-doc on host device",
"handler": "microsoft/apt:1",
"files": [
"apt-manifest-1.0.json"
],
"handlerProperties": {
"installedCriteria": "apt-update-test-2.2"
}
},
{
"description": "Install tree on host device",
"handler": "microsoft/apt:1",
"files": [
"apt-manifest-tree-1.0.json"
],
"handlerProperties": {
"installedCriteria": "apt-update-test-tree-2.2"
}
}
]
},
"manifestVersion": "4.0",
"importedDateTime": "2021-11-16T20:21:33.6514738Z",
"createdDateTime": "2021-11-16T20:19:29.4019035Z"
}
具有一個參考步驟的範例更新指令清單:
參考子更新的父更新
{ "updateId": {...}, "isDeployable": true, "compatibility": [ { "deviceManufacturer": "du-device", "deviceModel": "e2e-test" } ], "instructions": { "steps": [ { "type": "reference", "description": "Cameras Firmware Update", "updateId": { "provider": "contoso", "name": "virtual-camera", "version": "1.2" } } ] }, "manifestVersion": "4.0", "importedDateTime": "2021-11-17T07:26:14.7484389Z", "createdDateTime": "2021-11-17T07:22:10.6014567Z" }具有內嵌步驟的子級更新
{ "updateId": { "provider": "contoso", "name": "virtual-camera", "version": "1.2" }, "isDeployable": false, "compatibility": [ { "group": "cameras" } ], "instructions": { "steps": [ { "description": "Cameras Update - pre-install step", "handler": "microsoft/script:1", "files": [ "contoso-camera-installscript.sh" ], "handlerProperties": { "scriptFileName": "contoso-camera-installscript.sh", "arguments": "--pre-install-sim-success --component-name --component-name-val --component-group --component-group-val --component-prop path --component-prop-val path", "installedCriteria": "contoso-virtual-camera-1.2-step-0" } }, { "description": "Cameras Update - firmware installation (failure - missing file)", "handler": "microsoft/script:1", "files": [ "contoso-camera-installscript.sh", "camera-firmware-1.1.json" ], "handlerProperties": { "scriptFileName": "missing-contoso-camera-installscript.sh", "arguments": "--firmware-file camera-firmware-1.1.json --component-name --component-name-val --component-group --component-group-val --component-prop path --component-prop-val path", "installedCriteria": "contoso-virtual-camera-1.2-step-1" } }, { "description": "Cameras Update - post-install step", "handler": "microsoft/script:1", "files": [ "contoso-camera-installscript.sh" ], "handlerProperties": { "scriptFileName": "contoso-camera-installscript.sh", "arguments": "--post-install-sim-success --component-name --component-name-val --component-group --component-group-val --component-prop path --component-prop-val path", "installedCriteria": "contoso-virtual-camera-1.2-stop-2" } } ] }, "referencedBy": [ { "provider": "DU-Client-Eng", "name": "MSOE-Update-Demo", "version": "3.1" } ], "manifestVersion": "4.0", "importedDateTime": "2021-11-17T07:26:14.7376536Z", "createdDateTime": "2021-11-17T07:22:09.2232968Z", "etag": "\"ad7a553d-24a8-492b-9885-9af424d44d58\"" }
備註
在 更新指令清單中,如果使用該字串來判斷是否應該執行步驟,則每個步驟都應該有不同的 installedCriteria 字串。
父代更新和子系更新
當更新指令清單彼此參考時,最上層指令清單稱為 父更新 ,而參考步驟中指定的指令清單稱為 子更新。
目前,子更新不能包含任何參考步驟。 這項限制會在匯入時進行驗證,如果未遵循,匯入將會失敗。
父代更新中的內嵌步驟
父更新中指定的內嵌步驟會套用至主機裝置。 在這裡,ADUC_WorkflowData 物件會被傳遞至步驟處理程式(也稱為更新內容處理程式),而不會包含 Selected Components 數據。 這個步驟類型的處理程序 不應該 是 Component-Aware 處理程式。
步驟內容處理程式會針對每個步驟套用 IsInstalled 驗證邏輯。 裝置更新代理程式的步驟處理程式會檢查是否已安裝特定更新,方法是檢查 IsInstalled() 是否導致結果碼 “900”,這表示 'true'。 如果已安裝更新,為了避免重新安裝裝置上的更新,DU 代理程式將會略過未來的步驟,因為我們使用它來判斷是否要執行步驟。
若要報告更新結果,步驟處理程式執行的結果必須寫入至所需結果檔中的ADUC_Result結構,如 --result-file 選項中所指定。 然後,根據執行的結果,針對成功傳回0,針對任何嚴重錯誤傳回 -1 或0xFF。
如需詳細資訊,請參閱 步驟內容處理程式 和 實作自定義元件感知內容處理程式。
父代更新中的參考步驟
父更新中指定的參考步驟會套用至主機上或連線到主機裝置上的元件。 參考步驟是包含另一個更新的更新標識碼的步驟,稱為子更新。
處理參考步驟時,步驟處理器會下載參考步驟資料中指定的分離更新指令清單檔案,然後驗證檔案完整性。 接下來,步驟處理程式會剖析子更新指令清單,並結合父更新指令清單中的數據和父更新指令清單中的檔案 URL 資訊,建立 ADUC_Workflow 物件(也稱為子工作流程數據)。 這個子工作流程數據也有設定為 『1』 的 『level』 屬性。
備註
目前,子更新不能包含任何參考步驟。
中斷連結更新資訊清單
為了避免因 IoT 中樞雙胞胎資料大小限制而導致部署失敗,任何大型更新指令清單將以 JSON 數據檔案的形式提供,也稱為 分離的更新指令清單。
如果含有大量內容的更新被匯入 IoT 中樞的裝置更新中,產生的更新描述檔將會包含另一個名為 Detached Update Manifest 的承載檔案,其中包含更新描述檔的完整數據。
UpdateManifest裝置或模組對應項中的屬性會包含分離的更新清單檔案資訊。
處理 PnP 屬性變更事件時,Device Update 代理程式會自動下載中斷連結的更新指令清單檔案,並建立包含完整更新指令清單數據的ADUC_WorkflowData物件。