Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    variableslinuxbuildmaster
    2 Posts 1 Posters 3 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        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.

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post
        Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation