Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Linux script in Script Repository doesn't use variables on any scope
-
I have a Linux script defined in the Script Repository.
When the script is used in a deployment plan it does not have a value for any of the variables even when using {}
'#!/bin/bash Note: The single quote is an escape to show the # in this post . $HOME/.bash_profile echo This is from the script repository. echo Server Level DeployDir $DeploymentScripts echo BM Func AppNm ${ApplicationName} echo BM Func RelNum $ReleaseNumber echo BM Func BldNum $BuildNumber echo Script Level DeployPath $DeploymentPath echo Script Level DeployMain $DeploymentMainFile
The script has two parameters defined
Parameter Description Default Value DeploymentMainFile Main SQL file DEPLOY.SQL DeploymentPath Deployment path DB
If I create new using Add Action - Execute Shell Script
Most of the values are there.
There may be a different problem with script parameters and Execute Shell Script.'#!/bin/bash Note: The single quote is an escape to show the # in this post . $HOME/.bash_profile echo This is from the Add Action - Execute Shell Script. echo Server Level DeployDir $DeploymentScripts echo BM Func AppNm ${ApplicationName} echo BM Func RelNum $ReleaseNumber echo BM Func BldNum $BuildNumber echo Script Level DeployPath $DeploymentPath echo Script Level DeployMain $DeploymentMainFile
The script has two parameters
DeploymentPath="myDeployPath" DeploymentMainFile="myDeployFile"
Result:
3: DB test parms (Shell Script) DeploymentMainFile: DB_deploy.sql, DeploymentPath: db/dbdeploy Source and target directory are the same; splitting... AgentBasedAction initialization complete: Temp Directory: /tmp/buildmaster/_A233/_S242/TMP Source Directory: /tmp/buildmaster/_A233/_S242/SRC Target Directory: /tmp/buildmaster/_A233/_S242/WRK Server: DB-DEPLOYMENT (Id: 405) Initializing action... Initialization complete. Executing... Executing DB test parms v11... This is from the script repository. Server Level DeployDir BM Func AppNm BM Func RelNum BM Func BldNum Script Level DeployPath Script Level DeployMain Script returned: 0 Script completed. Execution complete. Finalizing... Target directory unused; joining with source. Finalization complete. 0.61s Succeeded 4: Execute Shell Script Execute "#!/bin/bash . $HOME/.bash_profile echo This is f..." Source and target directory are the same; splitting... AgentBasedAction initialization complete: Temp Directory: /tmp/buildmaster/_A233/_S242/TMP Source Directory: /tmp/buildmaster/_A233/_S242/SRC Target Directory: /tmp/buildmaster/_A233/_S242/WRK Server: DB-DEPLOYMENT (Id: 405) Initializing action... Initialization complete. Executing... This is from the Add Action - Execute Shell Script. Server Level DeployDir /deployment_scripts/buildmaster BM Func AppNm MyApp BM Func RelNum 2.1.0 BM Func BldNum 150507004 Script Level DeployPath Script Level DeployMain Script returned: 0 Script completed. Execution complete. Finalizing... Target directory unused; joining with source. Finalization complete.
Product: BuildMaster
Version: 4.6.4
-
Apparently only the PowerShell scripts support variables in parameters and in scripts at this time, so we will have to add this feature for shell scripts as well. Ideally it will be included with the initial 4.7 release, but may be a maintenance release behind that.
For now, if you use the Execute Shell Script action and enter the script as text or a file, it should work as you expect.