When your build failed in automated process - unix

I have a script that does the 'build' in several servers once I run it. I am now trying to figure out how to know if build failed. For example, the script will run the 3 commands(shown below), how would I know if my pre-build failed?
During the build process I have to run the following commands:
./ant pre-build
./ant install1
./ant post-build
I can use ssh, puppet etc. in my Redhat machine, and don't have anything more than that. Is there an application or a management tool that will let me monitor my build process in UI?

You can check the return code of the ant executable as mentioned in the Running Apache Ant:
the ant start up scripts (in their Windows and Unix version) return the return code of the java program. So a successful build returns 0, failed builds return other values.

Related

dotnet publish results include different set of libraries when run in linux/windows

While configuring some of our gitlab runners - some Windows, others Linux - I noticed something I find curious. The artifacts created by Linux runners include some libraries that are not included in the artifacts created by Windows runners.
The files in question are:
System.Collections.Immutable.dll
System.ComponentModel.Annotations.dll
System.Diagnostics.DiagnosticSource.dll
This happens no matter if a target runtime has been specified or not, e.g.
dotnet publish ./Project/Project.csproj -c Release
will include the three files mentioned above when run under Linux, but not when run under Windows (SDK 3.1.300). The project runs just fine without these.
Can anyone explain what's happening here? I was under the impression the result of a dotnet publish command is always the same regardless of the OS.

The dotnet sonarscanner is running a node command for some reason and throwing "Failure during analysis, Node.js command to start eslint-bridge"

I'm getting a non fatal exception while running the dotnet sonarscanner utility to send data to our sonarqube instance.
During "dotnet sonarscanner end" command an exception is being thrown of "Failure during analysis, Node.js command to start eslint-bridge was: /usr/bin/node /builds/app-namespace/app-name/.sonarqube/out/.sonar/.sonartmp/eslint-bridge-bundle/node_modules/eslint-bridge/bin/server 44002
java.lang.IllegalStateException: Failed to start server (10s timeout)"
Im currently running the command in an alpine docker container with
node : v10.14.2
dotnetcore: 2.2.3
The node and npm commands are available from the path and I have also specified the sonar.nodejs.executable in the sonarqube xml config.
Additionally what is the node package used for relating to a dotnet project?
The content is still being deployed to our sonarqube instance but I would like to understand the cause of the exception.
For C#/VB.NET code, the code analysis takes place in the build step because the SonarC#/VB.NET rules are written as Roslyn rules.
However, for most other languages analysed by SonarQube/Cloud, the analysis takes place in the scanner end step. The scanner downloads the language plugins from the SonarQube/Cloud server and calls each one to give it the chance to analyse any files it can handle.
The SonarJS plugin works with ESLint which uses NodeJS i.e. the node package is being used to analyse JavaScript files.

Why does dotnet run launch 2 processes?

When I run my dotnet core 2 app from my PowerShell I always see 2 processes launched.
This is annoying as in Visual Studio 2017 I cannot "reattach" a debugger as there are always 2 processes with the same name "dotnet".
Any way to change this?
dotnet run is a development command that builds the project and queries the project for the actual command to run. It then launches the program described in the program - which may be a dotnet some.dll or someapp.exe depending on the program type.
To work around your issue, run a command like
dotnet bin\Debug\netcoreapp2.0\mapp.dll
directly to avoid process noise.
You can also chain a build command before it so you can rebuild the project on changes and still have the process that runs msbuild terminate:
dotnet build; dotnet bin\Debug\netcoreapp2.0\mapp.dll

allure reports without running a build

I am running automation tests in my local workspace. The test project hasn't been added to a build integration process yet. So I'd like to generate allure reports without running a build.
The necessary dependencies were added to Ivy.xml according to instructions (see https://github.com/allure-framework/allure-core/wiki/TestNG -> Ant), but I don't have a build.xml file, so I have no idea of what the next step is about.
Could you please provide instructions for generating allure xml reports after running the tests, but without running a build?
Thanks in advance
Generally speaking you should AllureTestListener to your tests classpath so TestNG can automatically use this listener. This is done by adding the following dependency to ivy.xml:
<dependency org="ru.yandex.qatools.allure" name="allure-testng-adaptor" rev="1.4.11"/>
Then you need to run your tests in any way you want (e.g. by using your IDE runner). After running tests you should have a set of XML files generated by default in target/allure-results.
After getting these files just use a command line report generator:
$ allure generate -v 1.4.11 target/allure-results

Call the build script present on another machine

We have a build script present on our build machine.
How will I run this build script from my machine using ant?
Both machines are in same network.
Is there any free tool to call build script on remote machine which supports command line support?
Please Note: Build script cannot be called manually.
Please ask for any more details are required.
The sshexec task can do the work. Obviously Ant should be installed on the build machine. But you have to install a ssh server on the build machine too.
Here a piece of build.xml for your local machine:
<sshexec host="buildmachine"
username="builduser"
password="somepassword"
command="ant -f /path/to/the/build.xml" />

Resources