From 20354a5264d5333f42ab41de0e599aff5afb5aa1 Mon Sep 17 00:00:00 2001 From: Howard Edwards Date: Mon, 23 Sep 2024 13:51:46 -0400 Subject: [PATCH] Additional permission tweaks for staging and production environment (#1218) --- deploy/roles/application/tasks/main.yml | 2 +- server/services/TestService.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deploy/roles/application/tasks/main.yml b/deploy/roles/application/tasks/main.yml index ac23f4ca0..db5b9b7ff 100644 --- a/deploy/roles/application/tasks/main.yml +++ b/deploy/roles/application/tasks/main.yml @@ -17,7 +17,7 @@ line: 'aria-bot ALL=(ALL) NOPASSWD:{{source_dir}}/deploy/scripts/export-and-exec.sh' validate: 'visudo -cf %s' become: yes - when: deployment_mode == 'sandbox' + when: deployment_mode != 'development' # TODO: these permissions changes are a workaround solution diff --git a/server/services/TestService.js b/server/services/TestService.js index 6b798a13b..39bf93e21 100644 --- a/server/services/TestService.js +++ b/server/services/TestService.js @@ -11,7 +11,13 @@ async function runImportScript(git_hash) { let importScriptDirectoryPrefix = isDevelopmentProcess ? '.' : './server'; let command = `${deployDirectoryPrefix}/deploy/scripts/export-and-exec.sh ${process.env.IMPORT_CONFIG} node ${importScriptDirectoryPrefix}/scripts/import-tests/index.js`; if (git_hash) command += ` -c ${git_hash}`; - if (process.env.ENVIRONMENT === 'sandbox') command = `sudo ${command}`; + if ( + process.env.ENVIRONMENT === 'sandbox' || + process.env.ENVIRONMENT === 'staging' || + process.env.ENVIRONMENT === 'production' + ) { + command = `sudo ${command}`; + } exec(command, (error, stdout, stderr) => { if (error) { reject(error);