package templates templ Usage(secure string, host string, username string) {

usage

Continuous integration jobs

In a continuous integration job, download the agent, chmod it and run it.

{`
           # linux
           `}curl http{secure}://{host}/static/agent > agent{`
           chmod 755 agent
           `}./agent --id ID ws{secure}://{host}{`
           rm -f agent

           # windows
           `}curl http{secure}://{host}/static/agent.exe > agent.exe{`
           `}agent --id ID ws{secure}://{host}{`
           del agent.exe
          `}

Above, ID is a unique id for the job, the so-called rendez-cous ID. This should not conflict with IDs used by other agents. The ID is used for a rendez-vous between the end-user on a local system and the continuous integration job running on a build agent. If you don't specify an id, a random id will be generated. If you specify a duplicate ID, the server will generate a new one andd the agent will tell you what id to use. Clients can now connect to the Converge server with the ID to establish a connection to the CI job through Converge. Communication between end-user and agent is encrypted using SSH and the rendez-vous server is unable to read the contents. The rendez-vous server is nothing more then a glorified bit pipe, simply transferring data between end-user SSH client and the agent which runs an embedded SSH server.

NOTE: When running the agent on windows, an exit of the remote session using exit in powershell or command prompt does not terminate the shell completely. To terminate the client ssh session must be killed by closing the terminal. Cleanup of remote processes on the agent appears to work properly despite this problem. It is just that exit of the windows shell (powershell or command prompt) is not detected properly.

The agent has more command-line options than shown here. Download the agent and run it without arguments to see all options.

Local clients: using ssh with a proxy command

wsproxy is a command that can be used as a proxy command for SSH which performs the connection to the remote server. This command needs to be downloaded only once (see downloads). It does not depend on the converge implementation but only on the websocket standards. Other tools that provide a mapping of stdio to a websocket can also be used instead of wsproxy.

Next step is to run a local SSH or SFTP client:

                                                                                                                              {`
          `}ssh -oServerAliveInterval=10 -oProxyCommand="wsproxy ws{secure}://{host}/client/ID"  { username }{"@localhost"}   {`
          `}sftp -oServerAliveInterval=10 -oProxyCommand="wsproxy ws{secure}://{host}/client/ID" { username }{"@localhost"}   {`
          `}

Local clients: using SSH with a local TCP forwarding proxy

This option is less convenient than the proxy command because it requires two separate commands to execute.

Local clients can connect using regular ssh and sftp commands through a tunnel that translates a local TCP port to a websocket connection in converge. See the downloads section. This runs a local client that allows SSH to port 10000 and connects to converge using a websocket connection.

Next step is to run a local SSH of SFTP client:

                                                           {`
          `}ssh -oServerAliveInterval=10 -p 10000 { username }{"@localhost"}          {`
          `}sftp -oServerAliveInterval=10 -oPort=10000 { username }{"@localhost"}     {`
          `}

Remote shell usage

The agent supports a --shells command-line option by which a comma-separated list of shells can be prepended to the default search path for shells, e.g. --shells zsh,csh,sh (linux) or cmd,powershell for windows.

The agent sets a agentdir environment variable that points to the directory where the agent is running.

Linux

{`
            # cd back to the agent directory
            cd $agentdir

            # extend session lifetime
            touch $agentdir/.hold
                      `}
                      

Windows Command Prompt

{`
            # cd back to the agent directory
            cd %agentdir%

            # extend session lifetime
            echo > %agentdir%\.hold
                     `}

Windows Powershell

{`
            # cd back to the agent directory
            cd $env:agentdir

            # extend session lifetime
            $null > $env:agentdir\.hold
                     `}

Authentication

The { username } user above is configured in the Converge server and is communicated to the agent when the agent is started as well as the password.

Another way to authenticate is through an .authorized_keys file in the same directory as where the agent is started. This can be setup as follows before starting the agent:

                                         {`
          `}# linux                                                 {`
          `}echo "ssh-rsa dkddkdkkk a@b.c" > .authorized_keys       {`
          `}echo "ssh-rsa adfadjfdf d@e.f" >> .authorized_keys      {`
          `}                                                        {`
          `}# windows                                               {`
          `}echo ssh-rsa dkddkdkkk a@b.c > .authorized_keys         {`
          `}echo ssh-rsa adfadjfdf d@e.f >> .authorized_keys
                      

Note that on windows you should not used quotes.

} templ UsageTab(secure string, host string, username string) { @BasePage(2) { @Usage(secure, host, username) } }