-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
52 lines (42 loc) · 1.91 KB
/
index.js
File metadata and controls
52 lines (42 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const os = require('os');
const {execSync} = require('child_process');
const {getInput} = require('@actions/core');
function log(message) {
console.log(message);
}
function getInputStr(argValue) {
if (!argValue)
return 'not specified';
return argValue;
}
const author = getInput('author');
const host = getInput('host');
const campaign = getInput('campaign');
const apikey = getInput('apikey');
const iterationnb = getInput('iterationnb') === "" ? "" : "-t " + getInput('iterationnb');
const iterationdur = getInput('iterationdur') === "" ? "" : "-u " + getInput('iterationdur');
const country = getInput('country') === "" ? "" : "-C " + getInput('country');
const environment = getInput('environment') === "" ? "" : "-E " + getInput('environment');
const robot = getInput('robot') === "" ? "" : "-R " + getInput('robot');
const tag = getInput('tag') === "" ? "" : "-T " + getInput('tag');
const gitCloneCmd = `git clone https://github.com/cerberustesting/cerberus-cicd-github-action.git`;
const chmodCmd = `chmod +x cerberus-cicd-github-action/launchTest.sh`;
const launchTestCmd = `cerberus-cicd-github-action/launchTest.sh -a ${author} -h ${host} -c ${campaign} -k ${apikey} ${iterationnb} ${iterationdur} ${country} ${environment} ${robot} ${tag}`;
log(`AUTHOR: ${getInputStr(author)}`);
log(`HOST: ${getInputStr(host)}`);
log(`CAMPAIGN: ${getInputStr(campaign)}`);
log(`ITERATIONNB: ${getInputStr(iterationnb)}`);
log(`ITERATIONDUR: ${getInputStr(iterationdur)}`);
log(`OVERRIDE COUNTRY: ${getInputStr(country)}`);
log(`OVERRIDE ENVIRONMENT: ${getInputStr(environment)}`);
log(`OVERRIDE ROBOT: ${getInputStr(robot)}`);
log(`OVERRIDE TAG: ${getInputStr(tag)}`);
log('clone project...');
log(gitCloneCmd);
execSync(gitCloneCmd, {stdio: 'inherit'});
log('Changing Rights...');
log(chmodCmd);
execSync(chmodCmd, {stdio: 'inherit'});
log('Executing script...');
log(launchTestCmd);
execSync(launchTestCmd, {stdio: 'inherit'});