Actions
Feature #2045
closedMake IdMTool return POSIX.1-correct return codes
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
Updated by Petr Fišer almost 5 years ago
- Related to Task #1504: Create new application for release (IdmTool) added
Updated by Radek Tomiška almost 5 years ago
- Category set to Continuous development
- Status changed from New to In Progress
- Target version set to 10.1.0
Updated by Radek Tomiška almost 5 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
I've added simple result codes, commit:
https://github.com/bcvsolutions/CzechIdMng/commit/5f18aa178cec6bc5c9061235458935a6a65e3650
Could you provide me a feedback, please?
Updated by Vít Švanda almost 5 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.
Updated by Radek Tomiška almost 5 years ago
- Status changed from Resolved to Closed
Actions