Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying an unpublished application version to a device #16

Open
joonakilpinen opened this issue Sep 28, 2022 · 4 comments
Open

Deploying an unpublished application version to a device #16

joonakilpinen opened this issue Sep 28, 2022 · 4 comments
Assignees

Comments

@joonakilpinen
Copy link

I'm trying to build a pipeline that creates a new unpublished version of our application and deploys it onto a testing device.

Following the standalone app example, I tried this:

iectl publisher edgemanagement application uploadunpublishedversion \
    --appid "${APP_ID}" \
    --versionnumber "${version_new}"

iectl portal batches submit-batch \
    --appid "${APP_ID}" \
    --operation "installApplication" \
    --data "$(jq -c --null-input --arg deviceId "${DEVICE_ID}" '
      {
        "infoMap": {
          "devices":[
            $deviceId
          ]
        }
      }')" \
    --verbose

But this causes an error:

Error: request failed with status code 400 and response {"errors":[{"code":"notFound.appVersion","message":"App version not found.","errorCode":400,"field":"VersionVO","logref":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","parentLogref":""}]}

Investigating the network traffic from IEM web ui when I deploy from there, I can see it is making a request to:

https://${IEM_URL}/p.service/api/v4/applications/${APP_ID}/versions/${VERSION_ID}/batch?operation=installApplication&isRetainSecret=false&allow=true

and the infoMap only contains the target deviceIds.

So, how could I pass the versionId when using iectl? If this is currently not possible with iectl, would it be possible to obtain the needed headers from iectl and do the same request for example with curl?

Side note: I think running iectl portal batches submit-batch --help should show what information can/should be passed in infoMap. There is currently no mention of {"devices": [ $deviceIds ]}.

Using iectl version 1.3.1 on linux.

@paveel-h
Copy link
Contributor

Hi, is that application located in catalog?

@joonakilpinen
Copy link
Author

Hi, the application is not published in the catalog. My idea was that it should not be published into the catalog until it's really ready for usage. So my aim is to automate deployment of (possibly non-functional) development versions of the application in to a testing device, so I can test it before publishing.

This is doable from the application page in web gui, but I see no way of doing it with iectl.

@paveel-h
Copy link
Contributor

paveel-h commented Jan 9, 2023

Hi, you need to first import the application to catalog from where it is possible to deploy the application to the edge device. Please note that we will update the exaple to the latest iectl 2.0

@joonakilpinen
Copy link
Author

So the problem is that we do not want to publish an unfinished and quite possibly broken application into the catalog. Instead, we just want to install the unpublished application onto a testing device, so we can verify that it actually works before publishing. This should be doable with iectl alone, as it is also by using the web interface of IEM.

I have worked around this by using curl and jq for making the necessary http calls instead of using iectl.
The procedure goes like this:

  • Get access token for further requests by posting username & password to $IEM_URL/p.service/api/v4/login/direct with curl
  • Use iectl to create and upload a new unpublished version of the application.
  • Get application details with curl from $IEM_URL/p.service/api/v4/dev-apps/$APP_ID
  • Use jq to find and extract version identifier from the response JSON
  • Finally use curl to make a FORM post to: $IEM_URL/p.service/api/v4/applications/$APP_ID/versions/$VERSION_ID/batch?operation=installApplication&isRetainSecret=false&allow=true with infoMap containing the deviceId of our testing device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants