Skip to content

Latest commit

 

History

History
78 lines (49 loc) · 3.74 KB

CONTRIBUTING.md

File metadata and controls

78 lines (49 loc) · 3.74 KB

Contributing to the Platform Labeler plugin

Plugin source code is hosted on GitHub. New feature proposals and bug fix proposals should be submitted as GitHub pull requests. Your pull request will be evaluated by the Jenkins job.

Before submitting your change, please assure that you've added tests that verify the change.

Code formatting

Source code and pom file formatting is maintained by the spotless maven plugin. Before submitting a pull request, confirm the formatting is correct with:

  • mvn spotless:apply

Spotbugs checks

Please don't introduce new spotbugs output.

  • mvn spotbugs:check analyzes the project using Spotbugs
  • mvn spotbugs:gui displays the spotbugs report using GUI

Code coverage

Code coverage reporting is available as a maven target. Please try to improve code coverage with tests when you submit pull requests.

  • mvn -P enable-jacoco clean install jacoco:report reports code coverage

Reviewing code coverage

The code coverage report is a set of HTML files that show methods and lines executed. The following commands will open the index.html file in the browser.

  • Windows - start target\site\jacoco\index.html
  • Linux - xdg-open target/site/jacoco/index.html
  • Gitpod - cd target/site/jacoco && python -m http.server 8000

The file will have a list of package names. Click on them to find a list of class names.

The lines of the code will be covered in three different colors, red, green, and orange. Red lines are not covered in the tests. Green lines are covered with tests.

OpenClover code coverage

OpenClover code coverage reporting is available as a maven target and can be displayed by the Jenkins clover plugin.

  • mvn clover:setup clover:instrument test clover:clover to report code coverage with OpenClover.

Mutation Testing

PIT mutation testing is available as a maven target.

  • mvn clean -DskipTests verify && mvn org.pitest:pitest-maven:mutationCoverage -DargLine="-Xms1G -Xmx2G -XX:+HeapDumpOnOutOfMemoryError -XX:+TieredCompilation -XX:TieredStopAtLevel=1" to perform mutation testing and generate a report

Maintaining automated tests

Automated tests are run as part of the verify phase. Automated tests in the continuous-integration profile are run with multiple Java virtual machines, depending on the number of available processor cores. Run automated tests with multiple Java virtual machines in a development with the command:

  • mvn clean -DforkCount=1C verify

Test data for automated tests is extracted from Docker images defined in subdirectories of src/test/resources/org/jvnet/hudson/plugins/platformlabeler. The subdirectory name is used as an index into a map that defines the expected value of the operating system name.

The contents of /etc/os-release and the output of lsb_release -a are stored in the same subdirectory as the defining Dockerfile. The data files are generated by the shell scripts in the src/test/resources/org/jvnet/hudson/plugins/platformlabeler directory. A maintainer runs those shell scripts periodically and decides which data files should be updated with the latest information.

The Dockerfile base tags are tracked by dependabot in hopes that Docker image updates will result in automated pull requests for the Docker image tags.

Reporting Issues

Report issues in the Jenkins issue tracker. Please use the link:https://www.jenkins.io/participate/report-issue/["How to Report an Issue"] guidelines when reporting issues.