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!

Customs Action running on Linux Agent



  • I'm trying to write custom action that would wrap for the wget command and run it on a linux agent.

    My first attempt produced this error, am I using the correct class and call?

    Build 101 for Cusmod Linux 9.4.0 (1/08/2013 4:50:08 p.m.)
    Action Group 1: test
    Action 1: Uses '/usr/bin/wget' to dowload Cusmod/deployment-scripts/Database//*.sh
    Preparing remote servers for execution...
    Preparing DWDCW-DSAS01 for execution...
    Preparing SYBDEV_dwdcs-cmas01 for execution...
    Preparation complete.
    Initializing action...
    An unhandled exception occurred while executing this action: System.InvalidOperationException: Action is not supported on this type of agent (requires IPersistedObjectExecuter) at Inedo.BuildMaster.Windows.ServiceApplication.SlimPlanActionExecuter.RemoteAction_InitializeRemoteConfiguration(Object sender, RemoteConfigurationEventArgs e) at Inedo.BuildMaster.Extensibility.Actions.RemoteActionBase.OnInitializeRemoteConfiguration(RemoteConfigurationEventArgs e) at Inedo.BuildMaster.Extensibility.Actions.RemoteActionBase.OnBeforeExecute(EventArgs e) at Inedo.BuildMaster.Extensibility.Actions.ActionBase.Execute(IActionCancellationToken cancellationToken, ExecutionContext context, ExtensionConfigurerBase extensionConfigurer, Boolean resumeNextOnError, Boolean logErrorsAsWarnings)

    My code looks like this

    public sealed class WGetArtifactoryRemoteAction : CommandLineActionBase
    {
    ...

    protected override void Execute()
    {
        this.ExecuteRemoteCommand("/usr/bin/wget", "-m -e robots=off -nd http://artifactory:8081/artifactory/Cusmod/server/9.4.0/123/Server_9.4.0.123.tar.gz");
    }
    
    protected override string ProcessRemoteCommand(string name, string[] args)
    {
        return this.ExecuteCommandLine(name, args[0], this.RemoteConfiguration.SourceDirectory);
    }
    

    }



  • Hi Andrew,

    The ProcessRemoteCommand method only works when working with .NET-based agents. Behind the scenes, that method will serialize the action and use a sort of remoting to run that method on the remote server. With an SSH-based agent, this is obviously not possible.

    The CommandLineActionBase abstracts a lot of the complexity in executing remote processes. Just ignore the ProcessRemoteCommand method (throw a NotImplementedException) and try run the ExecuteCommandLine method from Execute.

    FYI - this is all being refactored in 4.0, and we're trying to phase out as many ProcessRemoteCommand-based actions as possible.


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation