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!

    How get Source / Current Directory within custom action?

    Scheduled Pinned Locked Moved Support
    buildmaster
    3 Posts 1 Posters 4 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'm transferring a file over SSH in a custom extension. If the user doesn't provide a destination folder then I'm defaulting to the working directory using:

      string destFileName = destFileOps.GetWorkingDirectory(this.Context.ApplicationId, this.Context.DeployableId ?? 0, "hello.sh");
      

      This evaluates to /tmp/buildmaster/_A5/_S5/WRK/hello.sh

      But if I use "Execute Shell Action" and just give it the filename of hello.sh it seems to expect it to be in the $CurrentDirectory which I believe defaults to the SRC directory.

      What is the alternative to GetWorkingDirectory for the source/current directory?

      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

        $CurrentDirectory should be WRK when there is no "overridden" source directory (i.e. any path or something like ~\Src). Is it not resolving that correctly?

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

          Turns out it does work, there was another issue preventing it from running.

          What's got me confused though is that the script is being run from the SRC directory (that's what the unix pwd command implies) when it was copied to the WRK folder as you can see from the log.

          Downloading http://192.168.59.103:8081/artifactory/libs-release-local/myapp/0.1/33/trial.sh artifact to C:\BuildMaster\_SVCTMP\trial.sh
          Transfer C:\BuildMaster\_SVCTMP\trial.sh to /tmp/buildmaster/_A5/_S5/WRK/trial.sh over SSH
          Execution complete. Finalizing...
          Target directory used. Abandoning source.
          Finalization complete.
          Source and target directory are the same; splitting...
          AgentBasedAction initialization complete:
            Temp Directory: /tmp/buildmaster/_A5/_S5/TMP
            Source Directory: /tmp/buildmaster/_A5/_S5/SRC
            Target Directory: /tmp/buildmaster/_A5/_S5/WRK
            Server: DockerVM (Id: 2)
          Initializing action...
          Initialization complete. Executing...
          trial.sh
          /tmp/buildmaster/_A5/_S5/SRC
          Script returned: 0
          Script completed.
          Execution complete. Finalizing...
          Target directory unused; joining with source.
          Finalization complete.
          Source and target directory are the same; splitting...
          AgentBasedAction initialization complete:
            Temp Directory: /tmp/buildmaster/_A5/_S5/TMP
            Source Directory: /tmp/buildmaster/_A5/_S5/SRC
            Target Directory: /tmp/buildmaster/_A5/_S5/WRK
            Server: DockerVM (Id: 2)
          Initializing action...
          Initialization complete. Executing...
          echo result: Hello World, we've made it!
          ls result: trial.sh
          pwd result: /tmp/buildmaster/_A5/_S5/SRC
          
          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