GithubHelp home page GithubHelp logo

lorquas / cp-test Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 54.93 MB

License: GNU General Public License v2.0

Ruby 11.10% Shell 0.76% Groovy 0.09% Java 82.40% HTML 0.07% Python 1.60% Dockerfile 0.03% Puppet 0.02% JavaScript 3.03% CSS 0.90%

cp-test's Introduction

Custom Build Tasks

Unless otherwise noted, these tasks are all recursive: they will run on the project you are in and all subprojects contained within.

Building with Gradle

Candlepin uses gradle & gradle wrapper for building & running unit tests. To build Candlepin run ./gradlew war from the root of the project.

Custom Build Properties

A number of build flags can be passed to Gradle in order to rurn on or off certain features. The available flags are as follows:

  • -Pdatabase_server=(mariadb|postgres) Specify Mariadb or postgres as the database server to target. This defaults to postgres.
  • -Pdb_host="hostname" Specify the hostname for the databse server. This defaults to localhost
  • -Papp_db_name="db_name" Specify the name of the db schema to use. This defaults to candlepin
  • -Plogdriver=true Enable Logdriver support in config file generation & the generated war file.
  • -Pqpid=true Enable qpid configuration when generating a config file
  • -Phostedtest=true Enable the hosted test suite

Internationalization

  • ./gradlew gettext runs xgettext to extract strings from source files.
  • ./gradlew msgmerge runs msgmerge to merge translation updates back into the primary keys.pot file.
  • ./gradlew msgfmt runs msgfmt to convert the keys .po & .pot files into the generated java source files for compilation into the build. This task is run as a prerequisite of the compileJava task so it is run automatically every time compilation is done.

Check for Dependencies with CVEs

  • buildr dependency:check

The dependency:check task will check a project (and all sub-projects) using the OWASP Dependency Check to see if any dependencies have CVEs reported against them. The maximum allowable CVSS score can be modified by setting the max_allowed_cvss to a float value between 1.0 and 10.0. Any CVEs above the maximum allowed CVSS score will cause the build to fail.

Checkstyle

  • ./gradlew checkstyleMain

Buildr provides a Checkstyle task, but we have our own that reads from the Eclipse Checkstyle Plugin configuration. The Eclipse configuration defines several variables that are then passed in to the project_conf/checks.xml (which is the actual Checkstyle configuration). This practice allows us to have slightly different style requirements for tests versus production code. The Eclipse Checkstyle Plugin defaults to reading from a file named .checkstyle in the root of the Eclipse project and that file points to the location of checks.xml. Unfortunately, checks.xml isn't in the Eclipse project root and the plugin doesn't know how to look outside of the Eclipse project directory except by using an absolute path.

To solve this problem, we generate the .checkstyle file programmatically when running the buildr eclipse task. The template is located at project_conf/.checkstyle and uses an XML entity to represent the location of checks.xml. When you run buildr eclipse, we set the value of the conf_dir entity in project_conf/eclipse-checkstyle.xml to the absolute path to checks.xml and drop the result into .checkstyle in your Eclipse project directory.

Unit Tests

  • ./gradlew tasks runs Unit tests

Spec Tests

  • ./gradlew rspec runs RSpec tests serially
  • ./gradlew rspec --spec my_file_name --test 'my test name' runs my test name in the my_file_name_spec.rb file (note that the _spec.rb suffix must be excluded).

Liquibase

  • buildr "changeset:my changeset name" Much like the rspec task, the changeset task is followed by a colon and an argument. In this case the argument is a brief description of the nature of the changeset. Be sure to quote the task name to prevent the shell from interpreting the spaces.

Swagger

  • buildr swagger connects to a Candlepin deployment defined in buildfile and downloads the swagger.json file. It then sends this JSON file to swagger-codegen to automatically generate client bindings. The task can be subdivided with buildr swagger:json and buildr swagger:client.

JSS

Our crypto functions are provided by JSS which is not available in the normal Maven repositories. I put it in a Maven repository we control on fedorapeople.org, but here is the process I use in case anyone needs to replicate it. The example commands use version 4.5.0 and Fedora 28. Change those values as appropriate.

  • Download the latest SRPM from Fedora.
  • Build the SRPM in mock for that version of Fedora.
    mock -r fedora-28-x86_64 jss-4.5.0-1.fc28.src.rpm
    
  • Copy the rebuilt RPM from /var/lib/mock/fedora-28-x86_64/result (where Mock drops the results of its build)
  • Explode the RPM using rpm2cpio.
    rpm2cpio jss-4.5.0-1.fc28.src.rpm | cpio -idmv
    
  • Install the JAR file from the exploded RPM into your Maven repository. Make sure the version and path are correct.
    mvn install:install-file -Dpackaging=jar -DgroupId=org.mozilla
    -Dversion=4.5.0 -DartifactId=jss -Dfile=/tmp/jss/usr/lib/java/jss4.jar
    
  • Explode the SRPM into /tmp/jss. This will give you a source tarball.
    rpm2cpio jss-4.5.0-1.fc28.src.rpm |  cpio -idmv
    
  • Extract the source tarball.
    tar xzvf jss-4.5.0.tar.gz
    
  • Go into the source directory and create a source jar.
    cd jss-4.5.0 && jar cvf jss-4.5.0-sources.jar org
    
  • Install the sources jar
    mvn install:install-file -Dpackaging=jar -DgroupId=org.mozilla -Dversion=4.5.0 -DartifactId=jss -Dfile=jss-4.5.0-sources.jar -Dclassifier=sources
    
  • Now rsync everything under ~/.m2/repository/org/mozilla/jss to the Maven repository.
    rsync -avz ~/.m2/repository/org/mozilla/jss/ fedorapeople.org:public_html/ivy/candlepin/org/mozilla/jss
    

Miscellaneous

  • buildr pom creates a pom.xml file with the project dependencies in it
  • buildr rpmlint runs rpmlint on all *.spec files

cp-test's People

Contributors

dgoodwin avatar jmrodri avatar awood avatar ceiu avatar wottop avatar mstead avatar bkearney avatar alikins avatar nikosmoum avatar vritant avatar barnabycourt avatar kahowell avatar beav avatar calfonso avatar cnsnyder avatar minicuts avatar candlepin-bot avatar jirihnidek avatar wolfdale avatar sonalidhome avatar lorquas avatar dmitri-d avatar dcrissman avatar jbowes avatar cjschevi avatar abhiskum avatar brenton avatar pjonastik avatar weshayutin avatar morazi avatar

Watchers

 avatar James Cloos avatar

Forkers

brandu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.