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?
-
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
-
$CurrentDirectory
should beWRK
when there is no "overridden" source directory (i.e. any path or something like~\Src
). Is it not resolving that correctly?
-
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