Does Raw scripting support "Substitute Variables in Files" feature in Linux environment

Hi,

I’m unable to user this feature in Linux environments. I’m using raw scripting and I have posted all the my code in GIT and trying to execute them. When I try to do so it is failing to replace the variables.

  1. I’m downloading the script from GIT to my target server.
  2. trying to trigger them from octopus - my step definition is below

cd “#{download_path}”

unzip -o *.zip

sh CTT_pkg_download.sh

sh export_script.sh

sh import_script.sh

the error is below:

14:48:11 Error | CTT_pkg_download.sh: line 8: #{download_path}/#{CTTFile_name}: No such file or directory
14:48:11 Error | sh: export_script.sh: No such file or directory
14:48:11 Error | sh: import_script.sh: No such file or directory
14:48:12 Verbose | Disposing SSH connection…
14:48:12 Verbose | Updating manifest with output variables
14:48:12 Verbose | Updating manifest with action evaluated variables
14:48:12 Fatal | The remote script failed with exit code 127
14:48:12 Fatal | The action CTT deployment on murex_10.31.201.160 failed

Note: 1) I have selected the option “Substitute variables in files” option under “Configure Features” and provided my script file names under “Substitute Variables in Files” section

Hi Siva

Thanks for getting in touch!

Raw scripting executes the script as is - it does not use Calamari, and therefore cant use any of the additional features that Calamari supports, such as the Substitute Variables in Files. It can replace variables in an inline script (as that happens on the server), but not within a file.

It’s probably worth checking out the raw scripting documentation for more information on the limitations and trade-offs with raw scripting.

If you want to use these features, you’ll need to disable raw scripting and use Calamari. Since the introduction of the self-contained version of Calamari, we no longer need Mono installed which makes life easier.

Hope that helps!

Cheers,
Matt

Thanks Matt.

Is there any workaround to over come this problem. I have to use raw scripting.

Hi Siva

Can you give me a bit more background? What is preventing the use of Calamari?

At this point, the options I can see are:

  • use either Calamari on Mono
  • use Self-Contained Calamari
  • in your inline script, pass your variables into your scripts as parameters

Hope that helps.

Cheers,
Matt

Hi Matt,

Thanks for your quick response.

The current system on which Im working is more secured and is owned by external team. For any modifications/Installations, we need to get approvals from different levels and which is time consuming. Getting approvals is the biggest challenge. So we thought we will go with raw scripting.

regards,
-Siva

Hi Siva

Thanks for letting me know. In that case, your best bet is to pass the variables through to your scripts as parameters, and access them inside your script as $1, $2 etc.

Hope that helps.

Cheers,
Matt

Hi Matt,

I was implementing the same approach.

regards,
-Siva

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.