46
FUJITSU Software PGRelief CI Tool Collaboration Jenkins Plugin Manual PGR-0003-E5Z0(00) December 2019

CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

FUJITSU Software PGRelief

CI Tool Collaboration Jenkins Plugin Manual

PGR-0003-E5Z0(00) December 2019

Page 2: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

i

Preface CI (Continuous Integration) Tool Collaboration Jenkins Plugin is plugin to total with CI tool (Jenkins) and to display the analytical result of PGRelief. In CI Tool Collaboration Jenkins plugin, the following Functions are offered.

- It is an execution from the Job of Jenkins as for PGRelief (*1) (*2). - It is a View on Jenkins as for the PGRelief execution result (*2).

(*1) One analytical license of PGRelief is consumed about the one-Job execution of Jenkins. (*2) This plugin cannot execute IPA/SEC-C/C++ check, PGRelief MISRA option and PGRelief CERT

option.

In this book, it explains the usage of CI Tool Collaboration Jenkins plugin. Please refer to the following download site for the system requirements of CI Tool Collaboration Jenkins plugin.

PGRelief C/C++: https://www.fujitsu.com/jp/group/fst/en/services/pgr/download/ PGRelief J : https://www.fujitsu.com/jp/group/fst/en/services/pgr-java/download/

Refer to "Message Indications Manual" (PGRelief C/C++) or "Rule Detail Manual" (PGRelief J) for pointed out message of the program defect that PGRelief outputs. Refer to "Command manual" for the error message and the command option that PGRelief outputs.

Page 3: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

ii

[High Risk Activity]

This Product is designed, developed and manufactured as contemplated for general use, including without limitation, general office use, personal use, household use, and ordinary industrial use, but is not designed, developed and manufactured as contemplated for use accompanying fatal risks or dangers that, unless extremely high safety is secured, could lead directly to death, personal injury, severe physical damage or other loss (hereinafter "High Safety Required Use"), including without limitation, nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system. You shall not use this Product without securing the sufficient safety required for the High Safety Required Use. If you wish to use this Product for High Safety Required Use, please consult with our sales representatives in charge before such use.

Microsoft, Windows, Windows Server are registered trademarks of Microsoft Corporation in the United States and other countries. MISRA and its logo are registered trademarks of MIRA Ltd, held on behalf of the MISRA Consortium. CERT is registered trademark of Carnegie Mellon University in the United States. The names of other products and services referred to in this document are trademarks of their respective developers and manufacturers.

Particular technologies disclosed in this document may be subject to the Foreign Exchange and Foreign Trade Control Law. Export of this document or any part thereof, or supply of this document or any part thereof to a foreign resident, must be undertaken only in compliance with the provisions of the law.

FUJITSU SOFTWARE TECHNOLOGIES LIMITED

Notes

- Transmission or copying of this document in whole or in part is prohibited.

- The content of this document is subject to change without prior notice.

All rights reserved, Copyright(C) 2016-2019 FUJITSU SOFTWARE TECHNOLOGIES LIMITED.

Page 4: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

iii

Contents 1. Running Environment ............................................................................................... 1

1.1 Running OS.............................................................................................................. 1 1.2 JDK / JRE ................................................................................................................. 1 1.3 CI Tool ...................................................................................................................... 1 1.4 PGRelief ................................................................................................................... 1

2. Preparation ................................................................................................................. 2 2.1 Install of PGRelief .................................................................................................... 2 2.2 Install of CI Tool Collaboration Jenkins plugin ......................................................... 2

2.2.1 Configuration of CI Tool Collaboration Jenkins plugin ..................................... 2 2.2.2 Install of PGRelief Maven plugin ...................................................................... 3

2.3 Setting ...................................................................................................................... 7 2.3.1 Configure Jenkins System ................................................................................ 7

3. Execution/Confirmation .......................................................................................... 13 3.1 When you use PGRelief J ...................................................................................... 13

3.1.1 Setting of build ................................................................................................ 13 3.1.2 Jenkins Job ..................................................................................................... 15 3.1.3 Build ................................................................................................................ 21 3.1.4 Confirmation of build result ............................................................................. 22

3.2 When you use PGRelief C/C++ ............................................................................. 25 3.2.1 Setting of build ................................................................................................ 25 3.2.2 Jenkins Job ..................................................................................................... 27 3.2.3 Build ................................................................................................................ 34 3.2.4 Confirmation of build result ............................................................................. 35

4. Error Message .......................................................................................................... 38 5. Appendix .................................................................................................................. 40

5.1 PGRelief J Maven plugin reference ....................................................................... 40 5.1.1 Property .......................................................................................................... 40 5.1.2 Output File ...................................................................................................... 41

5.2 PGRelief C/C++ Maven plugin reference .............................................................. 42 5.2.1 Property .......................................................................................................... 42 5.2.2 Output File ...................................................................................................... 42

Page 5: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

1

1. Running Environment 1.1 Running OS

It runs on Windows and Red Hat Enterprise Linux. Refer to the download site in Preface for more information.

1.2 JDK / JRE

Refer to the download site in Preface for more information. 1.3 CI Tool

It runs on the following CI Tools. - Jenkins

To see the PGRelief results on Jenkins, you need to install the following Jenkins plugin.

- Warnings Next Generation

Moreover, when the Maven project is used with Jenkins, it is necessary to install the following Software in the system.

- Apache Maven

Refer to the download site in Preface for more information. 1.4 PGRelief

The following versions of PGRelief are supported. - PGRelief J floating license version - PGRelief C/C++ floating license version - PGRelief C/C++ Wide-ranging Detective Option

Refer to the download site in Preface for more information.

Page 6: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

2

2. Preparation 2.1 Install of PGRelief

PGRelief is installed according to installation instructions. JDK is necessary for PGRelief J as the operating environment. Please prepare the environment beforehand. Moreover, please set the install Path of JDK to environment variables JAVA_HOME.

2.2 Install of CI Tool Collaboration Jenkins plugin

Only install it if you use Maven to run PGRelief. 2.2.1 Configuration of CI Tool Collaboration Jenkins plugin

Download and install CI Tool Collaboration Jenkins plugin from 'CI Tool Collaboration Jenkins plugin' on the download site described in Preface. Download the self-extracting executable 'pgrelief-jenkins-plugin.exe', copy it to any location, and run it to create a 'pgrelief-jenkins-plugin' folder. The Content of the folder 'pgrelief-jenkins-plugin' is as follows.

Folder name Description PGRelief_MavenPlugin Filing folder of PGRelief Maven plugin

The Content of the folder 'PGRelief_MavenPlugin' is as follows.

File name Description pgreliefj-maven-plugin-1.0.jar Maven plugin of PGRelief J pgreliefc-maven-plugin-1.0.jar Maven plugin of PGRelief C/C++

Page 7: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

3

2.2.2 Install of PGRelief Maven plugin

Please install Maven before installing PGRelief Maven Plugin.

PGRelief J Maven Plugin

(1) Move to the 'PGRelief_MavenPlugin' folder by using the command line. (2) Execute the mvn command.

[In the case of Install in the Maven local repository] The following parameters are specified for the mvn command. Parameter Description install:install-file Goal phrase to install plugin in local repository -Dfile=pgreliefj-maven-plugin-1.0.jar File name of PGRelief J Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief J Maven plugin

-DartifactId=pgreliefj-maven-plugin Name of PGRelief J Maven plugin -Dversion=1.0 Version of PGRelief J Maven plugin -Dpackaging=jar Format of PGRelief J Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief J Maven plugin (version 1.0) in Maven local repository

mvn install:install-file -Dfile=pgreliefj-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefj-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 8: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

4

[In the case of Install in the Maven remote repository] The following parameters are specified for the mvn command. Parameter Description

deploy:deploy-file Goal phrase to install plugin in remote repository

-Durl="Repository URL" URL of remote repository that installs plugin -DrepositoryId="Repository ID" ID of remote repository that installs plugin -Dfile=pgreliefj-maven-plugin-1.0.jar File name of PGRelief J Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief J Maven plugin

-DartifactId=pgreliefj-maven-plugin Name of PGRelief J Maven plugin -Dversion=1.0 Version of PGRelief J Maven plugin -Dpackaging=jar Format of PGRelief J Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief J Maven plugin (version 1.0) in Maven remote repository

mvn deploy:deploy-file -Durl=http://xx.xxx.xxx.xxx/repository -DrepositoryId=my-repository -Dfile=pgreliefj-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefj-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 9: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

5

PGRelief C/C++ Maven Plugin

(1) Move to the 'PGRelief_MavenPlugin' folder by using the command line. (2) Execute the mvn command.

[In the case of Install in the Maven local repository] The following parameters are specified for the mvn command. Parameter Description install:install-file Goal phrase to install plugin in local repository

-Dfile=pgreliefc-maven-plugin-1.0.jar File name of PGRelief C/C++ Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief C/C++ Maven plugin

-DartifactId=pgreliefc-maven-plugin Name of PGRelief C/C++ Maven plugin

-Dversion=1.0 Version of PGRelief C/C++ Maven plugin -Dpackaging=jar Format of PGRelief C/C++ Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief C/C++ Maven plugin (version 1.0) in Maven local repository

mvn install:install-file -Dfile=pgreliefc-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefc-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 10: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

6

[In the case of Install in the Maven remote repository] The following parameters are specified for the mvn command. Parameter Description

deploy:deploy-file Goal phrase to install plugin in remote repository

-Durl="Repository URL" URL of remote repository that installs plugin -DrepositoryId="Repository ID" ID of remote repository that installs plugin -Dfile=pgreliefc-maven-plugin-1.0.jar File name of PGRelief C/C++ Maven plugin

-DgroupId=com.fujitsu.jp.fst.pgrelief.maven

Route package name of PGRelief C/C++ Maven plugin

-DartifactId=pgreliefc-maven-plugin Name of PGRelief C/C++ Maven plugin

-Dversion=1.0 Version of PGRelief C/C++ Maven plugin -Dpackaging=jar Format of PGRelief C/C++ Maven plugin -DgeneratePom=true Setting whether to generate POM

Example : Commands that installs PGRelief C/C++ Maven plugin (version 1.0) in Maven remote repository

mvn deploy:deploy-file -Durl=http://xx.xxx.xxx.xxx/repository -DrepositoryId=my-repository -Dfile=pgreliefc-maven-plugin-1.0.jar -DgroupId=com.fujitsu.jp.fst.pgrelief.maven -DartifactId=pgreliefc-maven-plugin -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Page 11: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

7

2.3 Setting

It explains a setting necessary to use PGRelief with Jenkins. 2.3.1 Configure Jenkins System

Sets the Jenkins settings required for PGRelief's License Server System information, running PGRelief, and displaying results. Moreover, when displaying the result of PGRelief, it is necessary to install Warnings Next Generation in the system.

(1) Click "Manage Jenkins" of a left pane of the dashboard.

(2) Click "Configure System".

Page 12: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

8

(3) Check "Environment variables" of "Global properties".

(4) Click "Add" Button of "List of variables".

Page 13: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

9

(5) Set "Name" and "Value".

- Setting of License Server

name FST_LICENSE_FILE value port@host Specify the license server of PGRelief. - port : Port number

Specify the Port that the license server of PGRelief uses. Port number can be omitted if you do not specify the port number for the license server. Please confirm the port number that you should set to the administrator of the license server.

- host : License management server IP address or host name Always add '@' at the front even when the port number is omitted.

There is a possibility that PGRelief cannot be executed from Jenkins depending on the operating environment when the key is not set.

- Setting to prevent pop-up of license verification from appearing

name FLEXLM_BATCH value 1 The license verification pop-up of PGRelief is prevented from appearing. The pop up of the license attestation is displayed when the key is not set, and there is a possibility that the execution of the job of Jenkins does not progress.

Page 14: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

10

- Setting of environment variables of PGRelief [When you use PGRelief J]

name PGRJ_HOME value PGRelief InstallDirectory¥PGReliefJava

[When you use PGRelief C/C++]

name EPOMDIR value Windows :

PGRelief InstallDirectory¥PGRelief¥Analyze¥EPOM Linux :

PGRelief InstallDirectory/FFSTpgr/FFSTpgr/Analyze/EPOM name PATH (Only Linux) value PGRelief InstallDirectory/FFSTpgr/FFSTpgr/Analyze/EPOM name LD_LIBRARY_PATH (Only Linux) value PGRelief InstallDirectory/FFSTpgr/FFSTpgr/Analyze/EPOM/lib There is a possibility that PGRelief cannot be executed from Jenkins depending on the operating environment when the key is not set.

(6) Set "Parsers" of Groovy Based Warnings Parsers.

Page 15: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

11

- Setting of environment variables of PGRelief [When you use PGRelief J]

Name PGRelief J ID pgrelief_j Regular expression

(.*),(\d+),([^,]*),([^,]*),(.*)

Mapping script

import edu.hm.hafner.analysis.Severity builder.setFileName(matcher.group(1)) .setLineStart(Integer.parseInt(matcher.group(2))) .setCategory(matcher.group(3)) .setType(matcher.group(4)) .setMessage(matcher.group(5)) if(matcher.group(3).startsWith("S") || matcher.group(3).startsWith("!") ){ builder.setSeverity(Severity.WARNING_HIGH) }else if(matcher.group(3).startsWith("W")){ builder.setSeverity(Severity.WARNING_NORMAL) }else{ builder.setSeverity(Severity.WARNING_LOW) } return builder.buildOptional();

Log message

SJIS source file name,line number,group,messageID,message C:¥sampleDir¥sample.java,1,W:Reliability,pgj00000,Sample Message

Page 16: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

12

[When you use PGRelief C/C++] Name PGRelief C ID pgrelief_c Regular expression

\"(.*)\",(\d+),\"(.)\",\"([^,]*)\",\"(.*)\"

Mapping script

import edu.hm.hafner.analysis.Severity builder.setFileName(matcher.group(1)) .setLineStart(Integer.parseInt(matcher.group(2))) .setCategory(matcher.group(3)) .setType(matcher.group(4)) .setMessage(matcher.group(5)) if(matcher.group(3).equals("a") || matcher.group(3).equals("!") ){ builder.setSeverity(Severity.WARNING_HIGH) }else if(matcher.group(3).equals("b") || matcher.group(3).equals("h")){ builder.setSeverity(Severity.WARNING_NORMAL) }else{ builder.setSeverity(Severity.WARNING_LOW) } return builder.buildOptional();

Log message

SJIS "source file name",line number,"group","messageID","message" "C:¥sampleDir¥sample.c",1,"a","pgr0000","Sample Message"

Page 17: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

13

3. Execution/Confirmation 3.1 When you use PGRelief J 3.1.1 Setting of build

Describe the setting necessary for the execution of PGRelief J in Maven or the Windows batch command according to the build environment. The setting example is as follows.

Maven

Describe the setting of PGRelief J in POM File (pom.xml). The following example assumes that the Jenkins workspace is set to "C:¥Jenkins¥Workspace". Details of the PGRelief J Maven Properties are described to 5.1.1 Property.

: <build> <plugins> :

<!-- PGRelief J Maven Plugin --> <plugin> <groupId>com.fujitsu.jp.fst.pgrelief.maven</groupId> <artifactId>pgreliefj-maven-plugin</artifactId> <version>1.0</version> <!-- Add the Property when you use option. --> <configuration> <pgrCheckRuleDefinitionFile>C:/Program Files/PGRelief/PGReliefJava/rule.pgrj</pgrCheckRuleDefinitionFile> <pgrOutputDirectory>C:/Jenkins/Workspace/Report</pgrOutputDirectory> </configuration> <executions> <execution> <!-- Phase of PGRelief J --> <phase>verify</phase> <goals> <!-- Goal of PGRelief J (Requirement) --> <goal>pgreliefj</goal> </goals> </execution> </executions> </plugin> </plugins> </build> :

Page 18: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

14

Windows batch command Describe the setting of PGRelief J in Windows batch file. The following example assumes that the Jenkins workspace is set to "C:¥Jenkins¥Workspace". Describe the pgrjava command. Details of the pgrjava command are described to "Command Manual" of PGRelief J.

"C:¥Program Files¥PGRelief¥PGReliefJava¥pgrjava.bat" "C:¥Jenkins¥Workspace¥ProjectJ¥src" "C:¥Jenkins¥Workspace¥ProjectJ¥bin" "C:¥Jenkins¥Workspace¥Report¥pgreliefj_message.csv"

Page 19: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

15

3.1.2 Jenkins Job

Freestyle project

(1) Click "Add build step" of the Build section.

(2) Click the added build step.

* Select the build Step set by 3.1.1 Setting of build. * "Execute shell" cannot be used for PGRelief J.

Page 20: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

16

1. Invoke top-level Maven targets Specify "Goals".

* Specify either the following for "Goals".

- Phase set to POM file (pom.xml) of 3.1.1 Setting of build - Goal that PGRelief Maven plugin offers (pgreliefj)

2. Execute Windows batch command

Specify "Command".

* Specify the Windows batch file made by 3.1.1 Setting of build by using the call

command.

Page 21: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

17

(3) Click "Add post-build action" of the Post-build Actions section.

(4) Click "Record compiler warning and static analysis result".

Page 22: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

18

(5) Specify "Static Analysis Tools" of the Record compiler warning and static analysis result section.

Name Value Description Tool Groovy Parser Specifies the tool used by the "Record

compiler warning and static analysis result" feature. (fixed value)

Parser PGRelief J Specifies the parser used by the "Record compiler warning and static analysis result" feature. (fixed value) It is necessary to set parser (Groovy Based Warnings Parsers) to Jenkins beforehand. Please refer to 2.3.1 Configure Jenkins System for details.

Report File Pattern

Report/pgreliefj_message.csv Specify the result file of PGRelief J. This value is different according to the build setting. "Report/pgreliefj_message.csv" is specified for the example described in 3.1.1 Setting of build.

Report Encoding

Shift_JIS Specifies the character code of the PGRelief J result file. (fixed value)

Page 23: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

19

Maven project

(1) Specify "Goals and options" of the Build section.

* Specify phase set to POM File (pom.xml) of 3.1.1 Setting of build or goal that PGRelief J

Maven plugin offers. (2) Click "Add post-build action" of the Post-build Actions section.

Page 24: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

20

(3) Click "Record compiler warning and static analysis result".

(4) Specify "Static Analysis Tools" of the Record compiler warning and static analysis

result section.

* This setting is the same as in "Freestyle project".

Page 25: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

21

3.1.3 Build

Execute the build Job of Jenkins. Do either of the following Operations on the dashboard of Jenkins.

- Click the Build execution icon.

- Click "Build Now" of a left pane after clicking the Job of the target.

Page 26: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

22

3.1.4 Confirmation of build result

The build result is displayed on the dashboard of Jenkins. Confirm the build of the Job displayed in "All" view has succeeded, and confirm the execution result of PGRelief.

(1) Display the dashboard of Jenkins.

(2) Click the target Job displayed in "All" view.

Page 27: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

23

(3) The latest build displayed in "Build History" of a left pane is clicked.

(4) Confirm the error message is not output on the dashboard of Jenkins.

Page 28: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

24

(5) Click "PGRelief J Warnings" of a left pane.

(6) Confirm the analytical result of PGRelief is displayed.

Page 29: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

25

3.2 When you use PGRelief C/C++ 3.2.1 Setting of build

Describe the setting necessary for the execution of PGRelief C/C++ in Maven, Windows batch command or the Shell command according to the build environment. The setting example is as follows.

Maven

Describe the setting of PGRelief C/C++ in POM File (pom.xml). The following example assumes that the Jenkins workspace is set to "C:¥Jenkins¥Workspace". Details of the PGRelief C/C++ Maven Properties are described to 5.2.1 Property.

: <build> <plugins> :

<!-- PGRelief C/C++ Maven Plugin --> <plugin> <groupId>com.fujitsu.jp.fst.pgrelief.maven</groupId> <artifactId>pgreliefc-maven-plugin</artifactId> <version>1.0</version> <!-- Add the Property when you use option. --> <configuration> <pgrOutputDirectory>C:/Jenkins/Workspace/Report</pgrOutputDirectory> <pgrOptions> <pgrOption>-Z"C:/Program Files/PGRelief/PGRelief/Analyze/EPOM/MessageInfo/default-pgr.rul"</pgrOption> <!-- Other additional examples <pgrOption>-KMS/VC2010</pgrOption> <pgrOption>-Y"C:/Jenkins/Workspace/ProjectC/stdinc"</pgrOption> <pgrOption>-I"C:/Jenkins/Workspace/ProjectC/priinc"</pgrOption> <pgrOption>-D_DEBUG</pgrOption> <pgrOption>-SSJIS</pgrOption> --> </pgrOptions> </configuration> <executions> <execution> <!-- Phase of PGRelief C/C++ --> <phase>verify</phase> <goals> <!-- Goal of PGRelief C/C++ (Requirement) --> <goal>pgreliefc</goal> </goals> </execution> </executions> </plugin> </plugins> </build> :

Page 30: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

26

Windows batch command Describe the setting of PGRelief C/C++ in Windows batch file. The following example assumes that the Jenkins workspace is set to "C:¥Jenkins¥Workspace". Describe the pgr5 command. It is necessary to specify "--qm". Details of the pgr5 command are described to "Command Manual" of PGRelief C/C++.

shell

Describe the setting of PGRelief C/C++ in the shell script. The following example assumes that the Jenkins workspace is set to "C:¥Jenkins¥Workspace". Describe the pgr5 command. It is necessary to specify "--qm". Details of the pgr5 command are described to "Command Manual" of PGRelief C/C++.

"C:¥Program Files¥PGRelief¥PGRelief¥Analyze¥EPOM¥pgr5.exe" --qm "C:¥Jenkins¥Workspace¥ProjectC¥src¥sample1.c" > "C:¥Jenkins¥Workspace¥Report¥pgreliefc_message.csv"

"/opt/FFSTpgr/FFSTpgr/Analyze/EPOM/pgr5" --qm "/home/Jenkins/Workspace/ProjectC/src/sample1.c" > "/home/Jenkins/Workspace/Report/pgreliefc_message.csv"

Page 31: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

27

3.2.2 Jenkins Job

Freestyle project

(1) Click "Add build step" of the Build section.

(2) Click the added build step.

* Select the build Step set by 3.2.1 Setting of build.

Page 32: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

28

1. Invoke top-level Maven targets Specify "Goals".

* Specify either the following for "Goals".

- Phase set to POM file (pom.xml) of 3.2.1 Setting of build - Goal that PGRelief Maven plugin offers (pgreliefc)

2. Execute Windows batch command Specify "Command".

* Specify the Windows batch file made by 3.2.1 Setting of build by using the call

command.

Page 33: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

29

3. Execute shell Specify "Command".

* Specify the shell script made by 3.2.1 Setting of build by using the sh command.

(3) Click "Add post-build action" of the Post-build Actions section.

Page 34: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

30

(4) Click "Record compiler warning and static analysis result".

(5) Specify "Static Analysis Tools" of the Record compiler warning and static analysis

result section.

Name Value Description Tool Groovy Parser Specifies the tool used by the "Record

compiler warning and static analysis result" feature. (fixed value)

Parser PGRelief C Specifies the parser used by the "Record compiler warning and static analysis result" feature. (fixed value) It is necessary to set parser (Groovy Based Warnings Parsers) to Jenkins beforehand. Please refer to 2.3.1 Configure Jenkins System for details.

Page 35: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

31

Report File Pattern

Report/pgreliefc_message.csv Specify the result file of PGRelief C/C++. This value is different according to the build setting. "Report/pgreliefc_message.csv" is specified for the example described in 3.2.1 Setting of build.

Report Encoding

(Unspecified) Specifies the character code of the PGRelief C/C++ result file. This value is different according to the build setting. It is unspecified for the example described in 3.2.1 Setting of build.

Maven project

(1) Specify "Goals and options" of the Build section.

* Specify phase set to POM File (pom.xml) of 3.2.1 Setting od build or goal that PGRelief

C/C++ Maven plugin offers.

Page 36: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

32

(2) Click "Add post-build action" of the Post-build Actions section.

(3) Click "Record compiler warning and static analysis result".

Page 37: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

33

(4) Specify "Static Analysis Tools" of the Record compiler warning and static analysis result section.

* This setting is the same as in "Freestyle project".

Page 38: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

34

3.2.3 Build

Execute the build Job of Jenkins. Do either of the following Operations on the dashboard of Jenkins.

- Click the Build execution icon.

- Click "Build Now" of a left pane after clicking the Job of the target.

Page 39: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

35

3.2.4 Confirmation of build result

The build result is displayed on the dashboard of Jenkins. Confirm the build of the Job displayed in "All" view has succeeded, and confirm the execution result of PGRelief.

(1) Display the dashboard of Jenkins.

(2) Click the target Job displayed in "All" view.

Page 40: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

36

(3) The latest build displayed in "Build History" of a left pane is clicked.

(4) Confirm the error message is not output on the dashboard of Jenkins.

Page 41: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

37

(5) Click "PGRelief C Warnings" of a left pane.

(6) Confirm the analytical result of PGRelief is displayed.

Page 42: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

38

4. Error Message

Error message related to Maven plugin

Error message format [@1] @2 @3:@4 Explanation of Error message format @1 The error level is displayed. Refer to the following message list for details. @2 The message that Maven outputs is displayed. (This output might be omitted.) @3 Either of "PGRelief J Maven Plugin Error" or "PGRelief C Maven Plugin Error" is

displayed. @4 The error message is displayed. Refer to the following message list for details. Message list Error level

ErrorMessage Description Measure

ERROR Failed to execute PGRelief J. or Failed to execute PGRelief C/C++.

It is an errors of the PGRelief command execution.

Confirm the Content of the PGRelief output file. [PGRelief J output file]

pgreliefj_message.csv or pgreliefj_result.txt

[PGRelief C/C++ output file]

pgreliefc_message.csv or pgreliefc_result.txt

Details of the error message that PGRelief outputs are written in "Command Manual".

ERROR Plugin execute error. It failed in the execution of the PGRelief Maven plugin.

Confirm the Content of the PGRelief output file. [PGRelief J output file]

pgreliefj_message.csv or pgreliefj_result.txt

[PGRelief C/C++ output file]

pgreliefc_message.csv or pgreliefc_result.txt

ERROR Install directory setting error.

The installation directory of PGRelief is not set.

[PGRelief J] Set environment variable

PGRJ_HOME. [PGRelief C/C++]

Set environment variable EPOMDIR.

ERROR Install directory @1 is not exist. @1:Directory

There is a problem in the setting of install the Directory of PGRelief.

[PGRelief J] Set environment variable

PGRJ_HOME correctly. [PGRelief C/C++] Set environment variable EPOMDIR correctly.

ERROR Unsafe command An illegal Character is Do not contain these

Page 43: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

39

line string. included in the command line text. ;|&`()$<>*?{}[]!

Characters in the command line text.

WARNING

Skip non existing source Directory. @1 No sources to analyze. @1:Directory

The File of the analysis object does not exist. For instance, when the source file of the analysis object does not exist, this error message might be displayed in the multimodule project.

Confirm whether there is a specified mistake of the source directory and the source file.

Page 44: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

40

5. Appendix 5.1 PGRelief J Maven plugin reference

The execution result of PGRelief J (pgrjava command) can be output by using the PGRelief J Maven plugin.

Information groupId com.fujitsu.jp.fst.pgrelief.maven artifactId pgreliefj-maven-plugin version 1.0 phase (default) verify goal pgreliefj

5.1.1 Property

The property can be set to POM File (pom.xml) by the <configuration> tag. Set it if necessary. The property where the default value exists need not be set as long as there is no special reason. Name Type Description Default value pgrCheckRuleDefinitionFile

File Specify the inspection point Definition File by the full path. (Correspond to the "-r" of the pgrjava command.)

Check Rule Definition File in the Directory set by environment variables PGRJ_HOME (rule.pgrj)

pgrSrcDirectory

File Specify the Directory where the source files that to be the source directory and to be checked is stored by the full path.

First the Directory of compile source directory list of Maven project (${project.compileSourceRoots})

pgrClassesDirectory

File Specify the Directory where the class files that to be Class the Directory and to be checked is stored by the full path.

Classes the Directory in Target the Directory of Maven project (${project.build.directory}/classes)

pgrClassPathListFile

File Specify the File that describes the Class Path list File and the Class Path list by the full path. (Correspond to the "-af" of the pgrjava command.)

Class Path list of Maven project

pgrOutputDirectory

File Specify presentation the Directory of the PGRelief J execution result file. * "pgreliefj_message.csv" is output to specified the Directory.

The Directory of build target of Maven project (${project.build.directory})

pgrEncoding

Text Specify the code of the Java source to be checked. The setting of the following values can be done. Cp1252 | UTF-8

(Correspond to the "-e" of the pgrjava command.)

Encoding setting of Maven project (${project.build.sourceEncoding}) * Encode to which PGRelief J cannot be recognized might be set. In that case, specify this option.

Page 45: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

41

pgrOptions List Specify the option of the pgrjava command.

There is no specification

5.1.2 Output File

When the execution of PGRelief ends, the following files are output. Name Content Output Directory pgreliefj_message.csv PGRelief J analytical

result The Directory specified by pgrOutputDirectory property of POM File

pgreliefj_result.txt Standard Output of pgrjava command

The Directory specified by pgrOutputDirectory property of POM File

Page 46: CI Tool Collaboration Jenkins Plugin Manual · iii Contents 1. Running Environment ... Moreover, when the Maven project is used with Jenkins, it is necessary to install the following

42

5.2 PGRelief C/C++ Maven plugin reference

The execution result of PGRelief C/C++ (pgr5 command) can be output by using the PGRelief C/C++ Maven plugin. Information groupId com.fujitsu.jp.fst.pgrelief.maven artifactId pgreliefc-maven-plugin version 1.0 phase (default) verify goal pgreliefc

5.2.1 Property

The property can be set to POM File (pom.xml) by the <configuration> tag. Set it if necessary. The property where the default value exists need not be set as long as there is no special reason. Name Type Description Default value pgrSrcDirectory

File Specify the Directory where the source files that to be the source directory and to be checked is stored by the full path.

The Directory of src of Maven project (${project.basedir}/src)

pgrCplusplusExt

List Specify the extension of the C++ source file.

.cc and .cpp

pgrOutputDirectory

File Specify presentation the Directory of the PGRelief C/C++ execution result file. * "pgreliefc_message.csv" is output to specified the Directory.

The Directory of build target of Maven project (${project.build.directory})

pgrOptions List Specify the option of the pgr5 command.

There is no specification

5.2.2 Output File

When the execution of PGRelief ends, the following files are output. Name Content Output Directory pgreliefc_message.csv PGRelief C/C++ analytical

result The Directory specified by pgrOutputDirectory property of POM File

pgreliefc_result.txt Standard Output of pgr5 command

The Directory specified by pgrOutputDirectory property of POM File