-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcleanup.js
35 lines (30 loc) · 1000 Bytes
/
cleanup.js
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
const core = require('@actions/core');
const { exec } = require("child_process");
const path = require('path');
const fb_env = {
'FIREBOLT_USER': core.getInput('firebolt-username'),
'FIREBOLT_PASSWORD': core.getInput('firebolt-password'),
'FIREBOLT_SERVER': core.getInput('api-endpoint'),
'FIREBOLT_DEFAULT_REGION': core.getInput('region')
}
const action_workdir = path.join(__dirname, "../../")
function resolve_local_file(file_path) {
return path.join(action_workdir, file_path)
}
function stop_all(db_name, on_success, on_error) {
python_bin = path.join(core.getState('python_path'), 'python');
exec(python_bin + ' ' + resolve_local_file('scripts/stop_all.py') + ' ' + db_name,
{ env: fb_env },
function(error, stdout, stderr) {
error == null ? on_success(stdout) : on_error(error.message);
});
}
try {
stop_all(
core.getState('database_name'),
() => { },
errMsg => core.setFailed(errMsg)
)
} catch (error) {
core.setFailed(error.message);
}