[8.0.0.3378] New ssh code does no longer work as expected

Hi,
I’m running some build actions on my Apple Mac Mini for years via ssh.
Since I updated to 3.0.0.3378 with the new ssh code, my build actions fail.
Note: I’m not using ssh batch execute which is mentioned in the blog.

The problem seems to be a “cd directory” command which is no longer working.
The ssh connection now always stays in the home folder. I tried with bash and zsh (in ssh open connection).

The cd action does NOT show any error, extended logging returns
[No output received]

What I’m doing wrong?

Regards
Martin

Hi Martin

I can reproduce this here. It’s not going to be easy to fix. I didn’t realise that the Rebex library we switched to runs each command independently - I can work around that part by sharing the session between actions (I think) however getting the exit code for each command is now an issue.

The previous library was great when it worked, but there were so many cases where it didn’t work properly and we were forced to change because of that.

I will look into this further today and see what we can do to resolve this (switching back is not a viable option).

Hi Martin

An update - we have reworked the actions to solve this - and it’s working perfectly when testing against openssh servers on linux and windows - however against osx (I am testing against Sonoma 14.6.1 M1 Pro) I am seeing extra output which is causing an issue with detecting if a command completed ok.

I have contacted the library vendor (Rebex) to try and resolve this. As soon as we have a solution we’ll upload a new build with the fix.

Hi Vincent,

thanks for the update.

If it takes more time to fix, I will roll back.
Can you please share a link to the latest FB version without this new ssh lib?

Regards
Martin

https://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800_3364.exe

You can find the version history here

Hi Martin

We have a build with a fix

https://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800_3387.exe

Please do let us know how it goes. We have tested with macos, linux and windows and it works well in our testing.

FWIW, the issue we were seeing with macos is because it uses zsh as the default shell (changed with catalina). zsh sends a bunch of extra data over ssh (escape/control codes) which the ssh client doesn’t handle. We found a work around, by switching to bash immediately after login. Of course of macos removes bash in the future then this will be an issue - but it’s a workable solution for now.

We are working to get the client vendor to handle this issue better (with a dumb terminal mode).

Hi Vincent,

thanks for the fix. I did some tests and here are my results:

  1. It works a lot better now and the connection is now persisted between calls.
  2. However exit code of failed commands is not recognised as in the old implementation.

Observations

I send a ‘ps’ command.

Old implementation returns:

PID TTY           TIME CMD
45644 ttys000    0:00.02 -zsh
45650 ttys000    0:00.01 bash
0
Attempting to get exit code of last command.

New implementation (where is bash?)

  PID TTY           TIME CMD
45408 ttys000    0:00.03 -zsh
%

I send a command which fails, here for example msbuild in a wrong folder (project is missing).

Old implementation returns a red error and stops execution:

Sending command 'msbuild -property:Configuration=Osx-Release -t:Rebuild -m' to MartinsMacMini7
   >Microsoft (R) Build Engine version 16.10.1 for Mono
   >Copyright (C) Microsoft Corporation. All rights reserved.
   >
   >MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
   >1
Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
1
Attempting to get exit code of last command.
Expected Exit Code [0] but was returned [1].
Retrying action (1 of 1)...
Sending command 'msbuild -property:Configuration=Osx-Release -t:Rebuild -m' to MartinsMacMini7
   >Microsoft (R) Build Engine version 16.10.1 for Mono
   >Copyright (C) Microsoft Corporation. All rights reserved.
   >
   >MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
   >1
Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
1
Attempting to get exit code of last command.
Expected Exit Code [0] but was returned [1].

New implementation continues to run:

Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
%

This makes it hard to handle build failures.

Because of zsh a command like

rm -r LatestBuild.OsxClient/*

hangs until timeout because a user confirmation is expected. As workaround I changed to

/bin/rm -r LatestBuild.OsxClient/*

There’s space for improvement.

Regards
Martin

Hi Martin

Make sure you set the shell on the connect action to zsh since that is what the default shell is on Macos. We then use that setting to determine what to do - in this case we switch the shell to bash after connecting. Looking at your output - the % indicates to me that your shell was not set to zsh.

Note, the shell setting on the Connect action does not determine what shell is used, rather we are telling the action what the shell is on the remote end. We did try to automatically detect this, but unfortunately we found this to be unreliable depending on the server implementation.

Hello Vincent,

yes, that’s right, I used bash because I had the impression that it’s always switched to bash now.

With zsh the error codes are detected as expected.

Thanks
Martin