The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.
For a list of other such plugins, see the Pipeline Steps Reference page.
step([$class: 'PolyspacePostBuildActions'])
: Polyspace NotificationfileToAttach
(optional)
String
mailBody
(optional)
String
mailBodyBaseName
(optional)
String
mailSubject
(optional)
String
mailSubjectBaseName
(optional)
String
queryBaseName
(optional)
String
recipients
(optional)
String
sendToOwners
(optional)
Send a different e-mail notification to each recipient with filtered results in attachment. For instance, if you use $ps_helper -report-filter
in the Build section of this project to filter results for a file owner, you can send the filtered report to that file owner. Each time you use $ps_helper -report-filter
with an owner name, the name is appended to a list of owners. You can send an individual e-mail to all owners in this list.
Specify a base name for file attachments and files containing mail subject and mail body. The recipient name (or owner name) is appended to this base name to create a personalized e-mail for each recipient. The recipient name also determines the e-mail address where this personalized e-mail is sent.
For instance, suppose you specify the following:
If the list of recipients contains the names userA
and userB
:
userA@emailExtension.com
. The email contains the file report_userA.tsv
in attachment. The mail subject comes from subject_userA.txt
and the mail body comes from body_userA.txt
.userB@emailExtension.com
. The email contains the file report_userB.tsv
in attachment. The mail subject comes from subject_userB.txt
and the mail body comes from body_userB.txt
.The full e-mail address is determined from the server specified in the E-mail Notification section on the Configure System page. You can create files for attachments and e-mail content through scripts in the Build section of this project. For instance, you can calculate the number of new findings for each owner and use the number in the mail subject for the owner.
To test this personalized e-mail notification, enter an e-mail username (or e-mail address) in the field Unique recipients - Debug only. Instead of separate e-mail notifications to individual recipients, all e-mails are sent to this address. After checking the e-mail content in the notifications, clear this field for later builds.
boolean
sendToRecipients
(optional)
Send a common e-mail notification to multiple users. Specify a comma-separated list of e-mail usernames (or full e-mail addresses). If e-mail usernames are provided, the full e-mail address is determined from the server specified in the E-mail Notification section on the Configure System page.
By default, the e-mail contains the status of the Jenkins build and has no attachment. You can customize the mail subject and body and send a Polyspace report (.tsv
file) or another file in attachment. Specify the custom subject and body in text files. You can create files for attachments and e-mail content through scripts in the Build section of this project.
For instance, you can enter this specification:
johndoe, janedoe
Results_All.tsv
mailsubject_common.txt
mailbody_common.txt
boolean
uniqueRecipients
(optional)
String
wrap([$class: 'PolyspaceBuildWrapper'])
: Select Polyspace installation settingsbinConfig
(optional)
Choose the Polyspace installation folder to be used in this project, as defined on the Configure System page.
You can then use Polyspace commands such as polyspace-configure
, polyspace-bug-finder-server
and polyspace-code-prover-server
directly in scripts without specifying the installation folder.
You can also use the helper utility ps_helper
in scripts in the Build section of this project to filter results, report a pass/fail status and obtain other project information. For instance, in a Shell script, use the utility with the syntax $ps_helper
. In a Windows batch file, use the syntax %ps_helper%
. In the syntax descriptions below, report
refers to the results file obtained using the command polyspace-access -export
or polyspace-report-generator -generate-results-list-file
.
$ps_helper -report-filter report filtered_report [owner] [title1 value1] [title2 value2] ...
Filters report
for results with title1
set to value1
, etc. and saves to filtered_report
(with name suffix _owner
). The name owner is added to a list of owners for personalized e-mail notification later.
For instance:
$ps_helper -report-filter Results_List.tsv Results_Users.tsv userA Group Programming Function "get()"
Results_List.tsv
for results with Group
set to Programming
and Function
set to get()
.Results_Users_userA.tsv
. You can later use the base name Results_Users
to e-mail filtered reports to multiple users as a post-build action. For instance, you can send file Results_Users_userA.tsv
to userA@emailExtension.com
, file Results_Users_userB.tsv
to userB@emailExtension.com
, etc.$ps_helper -report-count-findings report
Stores the number of findings in report
(original or filtered).
For instance:
NB_FINDINGS_USERA=$($ps_helper -report-count-findings Results_Users_userA.tsv)
Returns the number of findings in Results_Users_userA.tsv
to the variable NB_FINDINGS_USERA
.
$ps_helper -report-status report max
Prints an analysis status based on number of findings in report
. If the number is greater than max
, the build status is UNSTABLE
. Otherwise, the status is SUCCESS
.
For instance:
BUILD_STATUS=$($ps_helper -report-status Results_All.tsv 10)
Returns UNSTABLE
to BUILD_STATUS
if the number of findings in Results_All.tsv
is greater than 10.
$ps_helper -print-runid upload_out
$ps_helper -print-projectid upload_out
$ps_helper -print-projecturl upload_out
Obtains a project id, run id and project URL in Polyspace Access for the current upload. The file upload_out
is obtained when uploading a result with the command:
polyspace-access -o upload_out -upload ...
For instance:
PROJECT_ID=$($ps_helper -print-projectid upload_out)
Returns the ID of the project for the current upload to PROJECT_ID
.
PROJECT_URL=$($ps_helper -print-projecturl upload_out $POLYSPACE_ACCESS_URL)
Returns the URL of the project for the current upload to PROJECT_URL
. The variable $POLYSPACE_ACCESS_URL
represents the URL of the Polyspace Access interface (created from specified server settings).
You can use the helper utility only when no Jenkins slave is used as the helper libraries are part of the Polyspace Jenkins plugin.
String
metricsConfig
(optional)
Choose the Polyspace Metrics server to be used in this project, as defined on the Configure System page.
You can then use these variables in scripts in the Build section of this project. For instance, in a Shell script, use these variables with the syntax $VAR
. In a Windows batch file, use the syntax %VAR%
.
POLYSPACE_METRICS_HOST
is the hostname of the Polyspace Metrics server.POLYSPACE_METRICS_PORT
is the port number of the Polyspace Metrics server.POLYSPACE_METRICS_URL
is the URL of the Polyspace Metrics server.ps_helper_metrics_upload
is a helper utlity to upload Polyspace results to the specified server. Syntax (shell scripts): $ps_helper_metrics_upload ResultsDirwhere
ResultsDir
is a folder containing Polyspace results.String
polyspaceAccessCredentialId
(optional)
Select an username and encrypted password used to log on to Polyspace Access. You can also add a username and password. To update, delete or otherwise manage login credentials, go to the Configure Credentials page.
To obtain an encrypted password, at the command line, enter:.
Provide an LDAP login and password.polyspace-access -host hostname -port portnumber -encrypt-password
String
serverConfig
(optional)
Choose the Polyspace Access server to be used in this project, as defined in the Configure System page.
You can then use these variables in scripts in the Build section of this project. For instance, in a Shell script, use these variables with the syntax $VAR
. In a Windows batch file, use the syntax %VAR%
.
POLYSPACE_ACCESS_HOST
is the hostname of the Polyspace Access server.POLYSPACE_ACCESS_PROTOCOL
is the protocol (http or https) of the Polyspace Access server.POLYSPACE_ACCESS_PORT
is the port number of the Polyspace Access server.POLYSPACE_ACCESS_URL
is the URL of the Polyspace Access server.ps_helper_access
is a helper utlity to interact with the specified Polyspace Access server. Syntax (shell scripts): $ps_helper_access -upload ResultsDirwhere
ResultsDir
is a folder containing Polyspace results. The helper utility expands to: polyspace-access -host hostname -port portnumber -login username -encrpyted-password pwdwhere the specified server settings and login credentials are used.
String
Please submit your feedback about this page through this quick form.
Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?
See existing feedback here.