Project

General

Profile

Actions

Feature #2045

closed

Make IdMTool return POSIX.1-correct return codes

Added by Petr Fišer about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Radek Tomiška
Category:
Continuous development
Target version:
Start date:
02/10/2020
Due date:
% Done:

100%

Estimated time:
Owner:

Description

When building with IdMtool, it is not easy to determine if the build failed - the tool always returns 0 return code upon exit regardless the action being successful or not. This is clunky when used inside an automated workflow.

Please enhance the tool that:
  • 0 = everything successful
  • non-zero (1-255 range) = failure
  • AFAIK when printing the help, the return codes vary per binary... but I think the suitable is:
    • when specifically asking for --help or similar, return code should be 0
    • when printing the help as a result of bad params/other failure, return code should be non-zero

As far as non-zero codes go, it is totally up to you... I would use 1,2,... low integers.

Example:

[root@czechidm tool]# java -jar idm-tool.jar -p --build
2020-02-10 12:52:28.827  INFO   --- [           main] eu.bcvsolutions.idm.tool.ConsoleRunner   : Running tool with arguments [project, build].
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : /idmbuild/maven/current/bin/mvn: line 93: which: command not found
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : The JAVA_HOME environment variable is not defined correctly
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : This environment variable is needed to run this program
2020-02-10 12:52:29.353 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : NB: JAVA_HOME should point to a JDK not a JRE
2020-02-10 12:52:29.359 ERROR   --- [           main] e.b.idm.tool.service.impl.MavenManager   : Execute maven command failed [exit code: 1].
2020-02-10 12:52:29.428 ERROR   --- [           main] eu.bcvsolutions.idm.tool.ConsoleRunner   : Build failed [Execute maven command failed [exit code: 1].]
[root@czechidm tool]# echo $?
0


Related issues

Related to IdStory Identity Manager - Task #1504: Create new application for release (IdmTool) ClosedVít Švanda02/14/2019

Actions
Actions #1

Updated by Petr Fišer about 4 years ago

  • Related to Task #1504: Create new application for release (IdmTool) added
Actions #2

Updated by Radek Tomiška about 4 years ago

  • Category set to Continuous development
  • Status changed from New to In Progress
  • Target version set to 10.1.0
Actions #3

Updated by Radek Tomiška about 4 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Radek Tomiška to Vít Švanda
  • % Done changed from 0 to 90
Actions #4

Updated by Vít Švanda about 4 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Vít Švanda to Radek Tomiška
  • % Done changed from 90 to 100

I did test and review. Tool returns correctly code for bad parameter (2) or for build failed (3). Thanks for that.

Actions #5

Updated by Radek Tomiška about 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF