Skip to content

Commit 433582d

Browse files
Upgrade plugins to adapt to grant permission and device action (#229)
* Upgrade plugins to adapt to grant permission and device action Co-authored-by: Yingjie Li <yingjieli@microsoft.com>
1 parent 72a465c commit 433582d

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

vsts_extension/Tasks/HydraLabDeployTest/hydra-lab-deploy-test.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,20 @@ async function run() {
188188
}
189189
console.log('##[section]instrumentationArgs: %s', JSON.stringify(instrumentationArgs));
190190

191+
const neededPermissionsInput: string | undefined = tl.getInput('neededPermissions');
192+
let neededPermissions: object = [];
193+
if (neededPermissionsInput && neededPermissionsInput.length > 0) {
194+
neededPermissions = JSON.parse(neededPermissionsInput)
195+
}
196+
console.log('##[section]neededPermissions: %s', JSON.stringify(neededPermissions));
197+
198+
const deviceActionsInput: string | undefined = tl.getInput('deviceActions');
199+
let deviceActions: object = {};
200+
if (deviceActionsInput && deviceActionsInput.length > 0) {
201+
deviceActions = JSON.parse(deviceActionsInput)
202+
}
203+
console.log('##[section]deviceActions: %s', JSON.stringify(deviceActions));
204+
191205
let runningInfo: string = getRequiredInput('runningInfo');
192206

193207
let pipelineLink: string | undefined = undefined;
@@ -261,7 +275,7 @@ async function run() {
261275
console.log('##[section]Generate Group AccessKey Failed!')
262276
}
263277

264-
let testTaskId: any = await triggerTestRun(HydraLabAPIConfig, runningType, deviceIdentifier, fileSetId, testSuiteClass, timeoutSec, maxStepCount, deviceTestCount, pipelineLink, accessKey, frameworkType, reportAudience, instrumentationArgs, needUninstall, needClearData)
278+
let testTaskId: any = await triggerTestRun(HydraLabAPIConfig, runningType, deviceIdentifier, fileSetId, testSuiteClass, timeoutSec, maxStepCount, deviceTestCount, pipelineLink, accessKey, frameworkType, reportAudience, instrumentationArgs, needUninstall, needClearData, neededPermissions, deviceActions)
265279
console.log(`##[section]Triggered test task id: ${testTaskId} successful!`);
266280

267281
let sleepSecond: number = Math.round(timeoutSec / 3);
@@ -475,7 +489,7 @@ async function generateDeviceGroupAccessKey(HydraLabAPIConfig: any, deviceIdenti
475489
return responseContent.key
476490
}
477491

478-
async function triggerTestRun(HydraLabAPIConfig: any, runningType: string, deviceIdentifier: string, fileSetId: string, testSuiteClass: string | undefined, timeoutSec: number, maxStepCount: number | undefined, deviceTestCount: number | undefined, pipelineLink: string | undefined, accessKey: any | undefined, frameworkType: string | undefined, reportAudience?: string, instrumentationArgs?: object, needUninstall?: boolean, needClearData?: boolean): Promise<object> {
492+
async function triggerTestRun(HydraLabAPIConfig: any, runningType: string, deviceIdentifier: string, fileSetId: string, testSuiteClass: string | undefined, timeoutSec: number, maxStepCount: number | undefined, deviceTestCount: number | undefined, pipelineLink: string | undefined, accessKey: any | undefined, frameworkType: string | undefined, reportAudience?: string, instrumentationArgs?: object, needUninstall?: boolean, needClearData?: boolean, neededPermissions?: object, deviceActions?: object): Promise<object> {
479493
let json: object = {};
480494

481495
Object.assign(json, { 'runningType': runningType });
@@ -520,6 +534,14 @@ async function triggerTestRun(HydraLabAPIConfig: any, runningType: string, devic
520534
}
521535
Object.assign(json, { "needUninstall": needUninstall });
522536
Object.assign(json, { "needClearData": needClearData });
537+
538+
if (neededPermissions) {
539+
Object.assign(json, { "neededPermissions": neededPermissions });
540+
}
541+
542+
if (deviceActions) {
543+
Object.assign(json, { "deviceActions": deviceActions });
544+
}
523545

524546
let requestParameters = {
525547
method: "post",

vsts_extension/Tasks/HydraLabDeployTest/task.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"version": {
1616
"Major": 2,
1717
"Minor": 0,
18-
"Patch": 11
18+
"Patch": 12
1919
},
2020
"instanceNameFormat": "Deploy Tests of ${pkgName} to HydraLab",
2121
"inputs": [
@@ -201,6 +201,22 @@
201201
"required": false,
202202
"helpMarkDown": "Example: Arg1=Value1, Value2; Arg2=Value3"
203203
},
204+
{
205+
"name": "neededPermissions",
206+
"type": "string",
207+
"label": "Needed Permissions",
208+
"defaultValue": "",
209+
"required": false,
210+
"helpMarkDown": "Example: [\"android.permission.FOREGROUND_SERVICE\",\"android.permission.FOREGROUND_SERVICE\"]"
211+
},
212+
{
213+
"name": "deviceActions",
214+
"type": "multiLine",
215+
"label": "Device Actions",
216+
"defaultValue": "",
217+
"required": false,
218+
"helpMarkDown": "Json String"
219+
},
204220
{
205221
"name": "runningInfo",
206222
"type": "pickList",

vsts_extension/vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifestVersion": 1,
33
"id": "hydra-lab",
44
"name": "Hydra Lab",
5-
"version": "2.0.11",
5+
"version": "2.0.12",
66
"publisher": "",
77
"public": true,
88
"targets": [

0 commit comments

Comments
 (0)