How to execute a workflow script in memory of the remote target host?

Problem:
Harness workflow execution fails in the script step with a permission denied error message.

Error message example:

bash: /tmp/ZbPDkjR0S-yiKNYv11Yr3A/harnesslauncherZbPDkjR0S-yiKNYv11Yr3A.sh: Permission denied
INFO   2022-08-29 11:01:58    Command finished with status FAILURE
ERROR   2022-08-29 11:01:58    Command execution finished with status FAILURE

Summary:
In Initialise step, Harness copies the scripts to run in /tmp directory.
At the time of execution, we switch to the working directory and execute the script in /tmp directory from there. Currently, the initialising directory is not configurable from the UI. Therefore, it is necessary to have executable permission from /tmp directory of the target host before executing the script.

Solution:
Sometimes, having open executable permission for the /tmp directory doesn’t adhere to the organisation’s security policy.

Therefore to overcome this problem, there is a feature available behind a feature flag INLINE_SSH_COMMAND after enabling it, Harness doesn’t copy the scripts to any location; instead, it keeps it in memory and executes from there.

Please reach out to Harness support to enable this feature flag for your account.

2 Likes