stf
stf copied to clipboard
How do I add adb keys without STF UI?
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?
I think you can write a function to read adbkey in table(devices).
@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.
This would be interesting, add a new API endpoint with CRUD of ADB Keys.
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 :)