add multiple artifacts in zip file

0

I've got multiple files that I want to publish to my python greengrass component.
Currently I have the following in my receipe :

"Manifests": \[  
    {  
      "Name": "Linux",  
      "Platform": {  
        "os": "linux"  
      },  
      "Lifecycle": {  
        "Run": {  
          "Script": "python3 -u {artifacts:path}/main.py ",  
          "RequiresPrivilege": "false"  
        } },  
 	    "Artifacts": \[  
        {  
          "URI": "s3://jeteye/components/artifacts/mycomponent/0.1.3/main.py",  
          "Unarchive": "NONE"  
        },  
        {  
          "URI": "s3://jeteye/components/artifacts/mycomponent/0.1.3/FileUtility.py",  
          "Unarchive": "NONE"  
        } ]  }  ]  

and during deploy i upload them to s3 using:
aws s3 cp ${SCRIPTPATH}/../src/mycomponent/0.0.1/main.py s3://${BUCKET}/components/artifacts/mycomponent/0.1.3/main.py
aws s3 cp ${SCRIPTPATH}/../src/mycomponent/0.0.1/FileUtility.py s3://${BUCKET}/components/artifacts/mycomponent/0.1.3/FileUtility.py

aws greengrassv2 create-component-version --inline-recipe fileb://${SCRIPTPATH}/../deploy/mycomponent.json

this works alright.
Now I want to put those 2 files in 1 zip file as an artifact like:

mkdir -p ${SCRIPTPATH}/../src/mycomponent/tmp
cd ${SCRIPTPATH}/../src/mycomponent/0.0.1 ; zip -r ${SCRIPTPATH}/../src/mycomponent/tmp/latest.zip *
aws s3 cp ${SCRIPTPATH}/../src/mycomponent/tmp/latest.zip s3://${BUCKET}/components/artifacts/mycomponent/0.1.14/mycomponent.zip

and changed my artifacts section of the receipe to:

"Artifacts": [
{
"URI": "s3://jeteye/components/artifacts/mycomponent/0.1.4/mycomponent.zip",
"Unarchive": "ZIP"
}

this doesn't work.
the mycomponent.zip is in s3 , in greengrass.log it shows:

2021-12-01T04:00:21.218Z [WARN] (pool-2-thread-172) com.aws.greengrass.deployment.DeploymentConfigMerger: merge-config. merge-config-service BROKEN. {serviceName=mycomponent}
2021-12-01T04:00:21.218Z [ERROR] (pool-2-thread-172) com.aws.greengrass.deployment.activator.DeploymentActivator: merge-config. Deployment failed. {deploymentId=e0269c0e-4183-4da1-9733-4a0149e08dee}
com.aws.greengrass.deployment.exceptions.ServiceUpdateException: Service mycomponent in broken state after deployment
at com.aws.greengrass.deployment.DeploymentConfigMerger.waitForServicesToStart(DeploymentConfigMerger.java:194)
at com.aws.greengrass.deployment.activator.DefaultActivator.activate(DefaultActivator.java:84)
at com.aws.greengrass.deployment.DeploymentConfigMerger.updateActionForDeployment(DeploymentConfigMerger.java:150)
at com.aws.greengrass.deployment.DeploymentConfigMerger.lambda$mergeInNewConfig$0(DeploymentConfigMerger.java:102)
at com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService.runUpdateActions(UpdateSystemPolicyService.java:95)
at com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService.lambda$startup$0(UpdateSystemPolicyService.java:165)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

what else needs to be done to be able to upload multiple files in 1 zipped artifact ? what am i missing ?

clogwog
gefragt vor 2 Jahren424 Aufrufe
2 Antworten
0

also just changed the

  "Lifecycle": {  
    "Run": {  
      "Script": "python3 -u {artifacts:decompressedPath}/mycomponent/main.py ",  
      "RequiresPrivilege": "false"  
    }  

but that doesn't seem to matter.
searching for the path i can see it is located in:

root@ljeteye:/greengrass/v2# find . | grep main.py
./packages/artifacts-unarchived/mycomponent/0.1.15/mycomponent/main.py

so it arrived...

clogwog
beantwortet vor 2 Jahren
0

alright.. that last change did work, but only after a restart of greengrass.

clogwog
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen