aws / amazon-freertos

DEPRECATED - See README.md
https://aws.amazon.com/freertos/
MIT License
2.54k stars 1.1k forks source link

[General] OtaJobEventActivate not getting triggered when OTA job created using aws cli #3451

Closed kiran-g closed 2 years ago

kiran-g commented 2 years ago

Briefly summarize the issue being raised I am able to initiate OTA update via console. But OTA is stuck when initiating job via cli. I could see that 'OtaJobEventActivate' is not triggered even after "Received entire update and validated the signature" is shown in log

Describe the desired outcome I want my OTA create job script to be able to successfully complete an OTA job

System information

Code/Steps to reproduce the current status

echo '[
  {
    "fileName": $fwimagefilename,                
    "fileType": 1,
    "fileLocation": {
      "stream": {
        "streamId": $streamid,                         
        "fileId":123
      }                        
    },
    "codeSigning": {
      "awsSignerJobId": $signingjobid     
    }
  }
]' |  jq -n  --arg  fwimagefilename $FIRMWAREIMAGENAME --arg  streamid $OTASTREAMID \
     --arg signingjobid  $SIGNJOBID -f /dev/stdin > $CREATE_JOB_CLI_INPUT_JSON_FILE

aws iot create-ota-update --ota-update-id $OTAJOBNAME  --target-selection SNAPSHOT \
 --description "a cli ota update" --files file://$CREATE_JOB_CLI_INPUT_JSON_FILE  \
 --targets arn:aws:iot:$AWS_REGION:$AWS_ACCOUNT_ID:thing/$THINGNAME \
 --role-arn arn:aws:iam::$AWS_ACCOUNT_ID:role/$OTAROLE
pvyawaha commented 2 years ago

Hello @kiran-g ,

The activate event is for activating the new firmware and in case of ESP32 it is rebooting the device so that bootloader will boot new image. When you are creating the job using CLI you are using file type ID of non zero and by default 0 is for self-firmware unless you have changed the OTA config for that. ( see configOTA_FIRMWARE_UPDATE_FILE_TYPE_ID )

If you can try using 0 for filetype ID when creating job using CLI and you should receive the activate event. This is set to 0 by default when you create a job using console.

Please try that and let me know how it goes.

prasadvya commented 2 years ago

Hello @kiran-g ,

Did that resolved your issue?

kiran-g commented 2 years ago

Yes. This issue is resolved. Thanks a lot for the help. You may please close the ticket.

On Thu, Feb 3, 2022, 23:14 prasadvya @.***> wrote:

Hello @kiran-g https://github.com/kiran-g ,

Did that resolved your issue?

— Reply to this email directly, view it on GitHub https://github.com/aws/amazon-freertos/issues/3451#issuecomment-1029240651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXRVRD5QFTLTMEQGS2QEM3UZK5IVANCNFSM5M2SACCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>