Commander Commander
Commander
1175 views

Jenkins BIRTReportGenerator doesn't like 'Developer Workbook'

Jump to solution
Fortify SCA
Product Version:
20.2.0
Operating System:
Linux
Area:
sca report generator/na\
Jenkins version is 2.263.3
 
 
I am trying to use BIRTReportGenerator executable in a Jenkins project. But, no matter what I try Jenkins is converting “ to ‘ and the BIRTReportGenerator executable doesn’t recognize the command line argument wrapped in ‘.


Jenkins execute shell code:
BIRTReportGenerator -template "Developer Workbook" -source $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.fpr -format PDF -output $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.DEVELOPERWORKBOOK.pdf -searchQuery "file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/" -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology
Console output from the Jenkins code:
22:07:38 + BIRTReportGenerator -template 'Developer Workbook' -source 'MyProject_Trunk.172.3665.fpr' -output 'MyProject_Trunk.172.3665.DEVELOPERWORKBOOK.pdf'
22:07:41 [2021-02-16T22:07:41 INFO] Log4j2 was configured successfully
22:07:41 Template name parameter is missing. Please use -template <name> to specify report template.
22:07:41 For more information use the "BIRTReportGenerator -help" command.

No matter what I try Jenkins is converting “ to ‘ and the BIRTReportGenerator executable doesn’t seem to recognize the argument wrapped in ‘. How do I make this work?
 
Labels (1)
0 Likes
1 Solution

Accepted Solutions
Captain Captain
Captain

@wmummert @rhelsens @bn_pep the error mentioned from your end is a bug from 20.1.x itself. BIRTReportGenerator works with Windows whereas in Linux it will throw error as "Template parameter missing" 

Please follow below suggestion in Linux to fix the issue

1. Open the file BIRTReportGenerator in edit mode using nano, vi, etc

2. Comment out the following

for param in "$@"
do
if [ "$param" = "$DEBUG" ]; then
PARAMS="${PARAMS} -Dcom.fortify.Debug=true"
fi
PARAMS="${PARAMS} ${param} "
done
PARAMS="${PARAMS:1}

3. At the following line, change "$PARAMS" to "$@"

From :

"${FORTIFY_CORE}/private-bin/awb/eclipse/eclipse" -vm "${JAVA_CMD}" -name "Fortify Report Generation" -noSplash --launcher.suppressErrors -startup "${FORTIFY_CORE}/lib/awb-startup-20.1.0.0158.jar" -productType BIRT- -application com.hp.fortify.birt.report.generator.console.Application "$PARAMS" -consoleLog -vmargs -Dcom.fortify.InstallRoot="${INSTALL_ROOT}" -Xmx1500M

To :

"${FORTIFY_CORE}/private-bin/awb/eclipse/eclipse" -vm "${JAVA_CMD}" -name "Fortify Report Generation" -noSplash --launcher.suppressErrors -startup "${FORTIFY_CORE}/lib/awb-startup-20.1.0.0158.jar" -productType BIRT- -application com.hp.fortify.birt.report.generator.console.Application "$@" -consoleLog -vmargs -Dcom.fortify.InstallRoot="${INSTALL_ROOT}" -Xmx1500M

4. Save the file now and execute the BIRTReportGenerator command and it will work

 

View solution in original post

31 Replies
Vice Admiral Vice Admiral
Vice Admiral

I can feel your pain, when you say you've tried *everything*... have you tried creating "Developer Workbook" as a variable and doing this?

BIRTReportGenerator -template $DEVELOPER_WORKBOOK$ -source $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.fpr -format PDF ..... etc

 

0 Likes
Commander Commander
Commander

So...

https://www.shellhacks.com/jenkins-pipeline-define-variable-jenkins-variables/

In execute shell:

#!/bin/sh
def myVariable = "Developer Workbook"
BIRTReportGenerator -template ${myVariable} -source $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.fpr -format PDF -output $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.DEVELOPERWORKBOOK.pdf -searchQuery \"file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/\" -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology #Compiler version

 

Console Output

07:39:14 [FORTIFY_TRUNK] $ /bin/sh -xe /tmp/jenkins3308106558449884663.sh
07:39:14 + def myVariable = 'Developer Workbook'
07:39:14 /tmp/jenkins3308106558449884663.sh: line 29: def: command not found
07:39:14 Build step 'Execute shell' marked build as failure

 

I'm on a roll @rhelsens 

 

Vice Admiral Vice Admiral
Vice Admiral

I am no shell scripting pro, but is the def command necessary, can you just do this?

#!/bin/sh
myVariable = "Developer Workbook"

0 Likes
Commander Commander
Commander
It doesn't seem to like that either

Build execute shell:
#!/bin/sh
myVariable = "Developer Workbook"
BIRTReportGenerator -template ${myVariable} -source $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.fpr -format PDF -output $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.DEVELOPERWORKBOOK.pdf -searchQuery \"file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/\" -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology #Compiler version

Console output:
08:35:58 [ATD_FORTIFY_TRUNK] $ /bin/sh -xe /tmp/jenkins7648034012798881733.sh
08:35:59 + myVariable = 'Developer Workbook'
08:35:59 /tmp/jenkins7648034012798881733.sh: line 29: myVariable: command not found
0 Likes
Vice Admiral Vice Admiral
Vice Admiral

It may be the spaces around the = , try this. Which will only expose the next problem , LOL


myVariable="Developer Workbook"

 

0 Likes
Commander Commander
Commander

It comes back to the original issue of " being replaced with '

Jenkins Execute Shell:

#!/bin/sh
myVariable="Developer Workbook"
BIRTReportGenerator -template ${myVariable} -source $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.fpr -format PDF -output $FORTIFY_BUILD.$BUILD_NUMBER.${SVN_REVISION}.DEVELOPERWORKBOOK.pdf -searchQuery \"file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/\" -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology #Compiler version

Console Output:

09:03:29 + myVariable='Developer Workbook'
09:03:29 + BIRTReportGenerator -template Developer Workbook -source .283.3676.fpr -format PDF -output .283.3676.DEVELOPERWORKBOOK.pdf -searchQuery '"file:!/.hpp/' AND 'file:!/.ipp/' AND 'file:!/.gen/' AND 'file:!/.cxx/' AND 'file:!/exeternal/' AND 'file:!/sida/"' -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology
09:03:32 [2021-02-22T09:03:32 INFO] Log4j2 was configured successfully
09:03:32 Template name parameter is missing. Please use -template <name> to specify report template.

 

 

0 Likes
Vice Admiral Vice Admiral
Vice Admiral

To go back to where you started, you need to escape those quotes

Maybe,,

BIRTReportGenerator -template \\"Developer Workbook\\"
BIRTReportGenerator -template \\"Developer\\ Workbook\\"

 

There are lots of examples here showing Jenkins idiosyncrasies.

https://gist.github.com/Faheetah/e11bd0315c34ed32e681616e41279ef4

 

0 Likes
Captain Captain
Captain

This is not just a Jenkins issue. We have seen the same behavior using Bash on both Linux and Mac. In some cases, other report templates will work, but the Developer Workbook fails with an error stating an template is required. The command seems to work fine on Windows. 

0 Likes
Commander Commander
Commander

I am going to try scripting this in Python and see if I can side step the Jenkins/bash issue.

0 Likes
Commander Commander
Commander

I tried using a Python script. The Python script is as follows:
import os
os.system("echo trying BIRTReportGenerator -template \"Developer Workbook\" -source scriptfortifyresults.fpr -format PDF -output fortifyscript.DEVELOPERWORKBOOK.pdf -searchQuery \"file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/\" -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology")

os.system("BIRTReportGenerator -template \"Developer Workbook\" -source scriptfortifyresults.fpr -format PDF -output fortifyscript.DEVELOPERWORKBOOK.pdf -searchQuery \"file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/\" -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology")



os.system("echo trying BIRTReportGenerator -template \"DISA STIG\" -source scriptfortifyresults.fpr -format PDF -output fortifyscript.DISASTIG.pdf -searchQuery \"file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/\" -ShowHidden -showSuppressed --Version \"DISA STIG 4.5\" --UseFortifyPriorityOrder")

os.system("BIRTReportGenerator -template \"DISA STIG\" -source scriptfortifyresults.fpr -format PDF -output fortifyscript.DISASTIG.pdf -searchQuery \"file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/\" -ShowHidden -showSuppressed --Version \"DISA STIG 4.5\" --UseFortifyPriorityOrder")

#END SCRIPT


At the console I got:

trying BIRTReportGenerator -template Developer Workbook -source scriptfortifyresults.fpr -format PDF -output fortifyscript.DEVELOPERWORKBOOK.pdf -searchQuery file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/ -ShowHidden -ShowSuppressed --IncludeDescOfKeyTerminology
[2021-02-22T15:26:10 INFO] Log4j2 was configured successfully
Template name parameter is missing. Please use -template <name> to specify report template.
For more information use the "BIRTReportGenerator -help" command.
trying BIRTReportGenerator -template DISA STIG -source scriptfortifyresults.fpr -format PDF -output fortifyscript.DISASTIG.pdf -searchQuery file:!/.hpp/ AND file:!/.ipp/ AND file:!/.gen/ AND file:!/.cxx/ AND file:!/exeternal/ AND file:!/sida/ -ShowHidden -showSuppressed --Version DISA STIG 4.5 --UseFortifyPriorityOrder
[2021-02-22T15:26:12 INFO] Log4j2 was configured successfully
Template name parameter is missing. Please use -template <name> to specify report template.
For more information use the "BIRTReportGenerator -help" command.

 

 

 

I put in a support ticket . @bn_pep  @rhelsens 

0 Likes
Captain Captain
Captain

That's the same error we see on the Mac and Linux. Single or double quotes around "Developer Workbook", or no quotes gives the same result. 

Thank you for submitting the bug report! Hopefully it will be fixed soon.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.