Skip to content

Commit

Permalink
chore(attest): run with sudo if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ilgayev committed Nov 16, 2023
1 parent 19ab181 commit 9ff37e0
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 10 deletions.
40 changes: 35 additions & 5 deletions attest/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10896,13 +10896,43 @@ async function run(config) {
};

if (config.cimon.releasePath != '') {
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec(
'bash',
[CIMON_SCRIPT_PATH, CIMON_SUBCMD, config.cimon.releasePath],
options
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info(
`Running Cimon from release path: ${config.cimon.releasePath}`
);
if (sudo) {
retval = await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec(
'sudo',
[
'-E',
'sh',
CIMON_SCRIPT_PATH,
CIMON_SUBCMD,
config.cimon.releasePath,
],
options
);
} else {
retval = await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec(
'sh',
[CIMON_SCRIPT_PATH, CIMON_SUBCMD, config.cimon.releasePath],
options
);
}
} else {
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec('bash', [CIMON_SCRIPT_PATH, CIMON_SUBCMD], options);
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info('Running Cimon from latest release path');
if (sudo) {
retval = await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec(
'sudo',
['-E', 'sh', CIMON_SCRIPT_PATH, CIMON_SUBCMD],
options
);
} else {
retval = await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec(
'sh',
[CIMON_SCRIPT_PATH, CIMON_SUBCMD],
options
);
}
}
fs__WEBPACK_IMPORTED_MODULE_5__.rmSync(CIMON_SCRIPT_PATH);

Expand Down
40 changes: 35 additions & 5 deletions attest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,43 @@ async function run(config) {
};

if (config.cimon.releasePath != '') {
await exec.exec(
'bash',
[CIMON_SCRIPT_PATH, CIMON_SUBCMD, config.cimon.releasePath],
options
core.info(
`Running Cimon from release path: ${config.cimon.releasePath}`
);
if (sudo) {
retval = await exec.exec(
'sudo',
[
'-E',
'sh',
CIMON_SCRIPT_PATH,
CIMON_SUBCMD,
config.cimon.releasePath,
],
options
);
} else {
retval = await exec.exec(
'sh',
[CIMON_SCRIPT_PATH, CIMON_SUBCMD, config.cimon.releasePath],
options
);
}
} else {
await exec.exec('bash', [CIMON_SCRIPT_PATH, CIMON_SUBCMD], options);
core.info('Running Cimon from latest release path');
if (sudo) {
retval = await exec.exec(
'sudo',
['-E', 'sh', CIMON_SCRIPT_PATH, CIMON_SUBCMD],
options
);
} else {
retval = await exec.exec(
'sh',
[CIMON_SCRIPT_PATH, CIMON_SUBCMD],
options
);
}
}
fs.rmSync(CIMON_SCRIPT_PATH);

Expand Down

0 comments on commit 9ff37e0

Please sign in to comment.