

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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?
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
@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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I am no shell scripting pro, but is the def command necessary, can you just do this?
#!/bin/sh
myVariable = "Developer Workbook"


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
It may be the spaces around the = , try this. Which will only expose the next problem , LOL
myVariable="Developer Workbook"


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I am going to try scripting this in Python and see if I can side step the Jenkins/bash issue.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.