stf icon indicating copy to clipboard operation
stf copied to clipboard

How do I add adb keys without STF UI?

Open wyp0011 opened this issue 8 years ago • 4 comments

What's the problem (or question)?

Hi, I am going to use STF in my ci jobs. When job build, reserve and connect a STF device, and release it after use. But there is a question, I use job name as login name. When a new job build, there is a new user. I can easily get available devices in STF by API, but I still need add adb keys in STF UI. So, how do I add adb keys without STF UI?

wyp0011 avatar Aug 25 '16 03:08 wyp0011

I think you can write a function to read adbkey in table(devices).

0x88l avatar Sep 02 '16 03:09 0x88l

@0x88l I tried to write adbkey in table(devices), it did not work. When I run adb devices -l, the devices turned out to be unauthorized.

wyp0011 avatar Sep 05 '16 02:09 wyp0011

This would be interesting, add a new API endpoint with CRUD of ADB Keys.

manuman94 avatar Nov 26 '21 09:11 manuman94

Ok, I've made a research through Github openstf issues and I found that it is already implemented.

Was added in this PR: https://github.com/openstf/stf/pull/770

Example of cURL adding a new adb key:

curl --location --request POST 'http://<OPENSTF_HOST>/api/v1/user/adbPublicKeys' \
--header 'Authorization: Bearer YOUR_OPENSTF_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "publickey": "<YOUR_ADB_PUBLIC_KEY>"
}'

Result:

{"success":true}

I think this issue could be marked as closed :)

manuman94 avatar Nov 26 '21 09:11 manuman94