Azure Device Update for IoT Hub에서 다중 단계 순서로 실행하면 무선 업데이트를 배포할 때 사전 설치 및 사후 설치 작업을 실행할 수 있습니다. 이 기능은 디바이스 업데이트 업데이트 매니페스트 스키마 버전 4의 일부입니다. 자세한 내용은 디바이스 업데이트 업데이트 매니페스트를 참조하세요.
다중 단계 순서 실행은 인라인 단계와 참조 단계의 두 가지 형식을 가질 수 있습니다. 인라인 단계는 코드를 실행하는 명령이며 기본 형식입니다. 참조 단계는 다른 업데이트에 대한 식별자를 포함하는 단계입니다.
부모 업데이트 및 자식 업데이트
업데이트 매니페스트가 다른 업데이트 매니페스트를 참조하는 경우 최상위 매니페스트를 부모 업데이트라고 하며 참조 단계에서 지정된 매니페스트를 자식 업데이트라고 합니다. 자식 업데이트는 참조 단계를 포함할 수 없으며 인라인 단계만 포함할 수 있습니다. 디바이스 업데이트는 가져오기 시 이 제한의 유효성을 검사하고 충족되지 않으면 업데이트에 실패합니다.
부모 업데이트의 인라인 단계
디바이스 업데이트 에이전트는 부모 업데이트에 지정된 인라인 단계를 호스트 디바이스에 적용합니다.
ADUC_WorkflowData 업데이트 콘텐츠 처리기라고도 하는 단계 처리기에 전달되는 개체에는 데이터가 포함되지 Selected Components 않습니다. 이 유형의 단계에 대한 처리기는 처리기가 되어서는 Component-Aware 안 됩니다.
디바이스 업데이트 에이전트의 단계 콘텐츠 처리기는 각 단계에 대한 유효성 검사 논리를 적용합니다 IsInstalled . 단계 처리기는 결과 코드를 900반환하는지, 아니면 true인지를 확인하여 업데이트가 이미 설치되어 있는지 IsInstalled() 확인하고, 이 결과를 사용하여 단계를 수행할지 여부를 확인합니다. 디바이스에 이미 있는 업데이트를 다시 설치하지 않도록 하려면 업데이트가 이미 설치된 경우 디바이스 업데이트 에이전트는 이후 단계를 건너뜁니다.
업데이트 결과를 보고하려면 옵션에 지정된 --result-file 대로 원하는 결과 파일의 구조체에 단계 처리기 실행 ADUC_Result 결과를 씁니다. 실행 결과에 따라 성공을 반환 0 하고 반환하거나 0xFF 치명적인 오류를 반환 -1 합니다.
자세한 내용은 단계 처리기 및 사용자 지정 구성 요소 인식 콘텐츠 처리기를 구현하는 방법을 참조하세요.
부모 업데이트의 참조 단계
디바이스 업데이트 에이전트는 부모 업데이트에 지정된 참조 단계를 호스트 디바이스의 구성 요소 또는 연결된 구성 요소에 적용합니다. 참조 단계를 처리할 때 단계 처리기는 단계에서 지정된 분리된 업데이트 매니페스트 파일을 다운로드하고 파일 무결성의 유효성을 검사합니다.
그런 다음 단계 처리기는 자식 업데이트 매니페스트의 데이터와 부모 업데이트 매니페스트의 파일 URL 정보를 결합하여 자식 업데이트 매니페스트를 구문 분석하고 자식 워크플로 데이터라고도 하는 개체를 만듭니다 ADUC_Workflow . 이 자식 워크플로 데이터에는 .로 설정된 속성이 level 있습니다 1.
예제
다음 예제 업데이트 매니페스트에는 하나의 인라인 단계가 있습니다.
{
"updateId": {...},
"isDeployable": true,
"compatibility": [
{
"manufacturer": "du-device",
"model": "e2e-test"
}
],
"instructions": {
"steps": [
{
"description": "Example APT update that installs 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": [
{
"manufacturer": "du-device",
"model": "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": [
{
"manufacturer": "du-device",
"model": "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 - preinstall 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 - postinstall 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-step-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 경우 업데이트 매니페스트에서 각 단계에 다른 installedCriteria 값을 지정해야 합니다.
분리된 업데이트 매니페스트
Azure IoT Hub 쌍 데이터 크기 제한으로 인해 배포 실패를 방지하기 위해 디바이스 업데이트는 분리된 업데이트 매니페스트라는 JSON 데이터 파일로 디바이스에 대규모 업데이트 매니페스트를 제공합니다. 대규모 콘텐츠 업데이트를 디바이스 업데이트로 가져올 때 생성된 업데이트 매니페스트에는 전체 업데이트 매니페스트 데이터가 포함된 다른 Detached Update Manifest페이로드 파일이 포함됩니다.
디바이스 또는 모듈 쌍의 속성에는 UpdateManifest 분리된 업데이트 매니페스트 파일 정보가 포함됩니다. PnP PropertyChanged 이벤트를 처리할 때 디바이스 업데이트 에이전트는 분리된 업데이트 매니페스트 파일을 자동으로 다운로드하고 전체 업데이트 매니페스트 데이터가 포함된 개체를 만듭니다 ADUC_WorkflowData .