GE Predix

GE’s Predix Cloud is an Internet of Things platform that offers powerful data analysis and machine learning services that make it easy to build sophisticated software infrastructure around machinery and IoT devices.

Solano CI integrates smoothly with Predix to give application developers a reliable, high-performance continuous delivery pipeline starting from any Git or Mercurial repo, using the Predix CloudFoundry environment for accurate integration testing, and then deploying into staging or production.

Contents of this guide:

Example Workflow

We’ve built an example around the Predix RMD Reference App with the following workflow:

  1. Compile and run functional tests
  2. Deploy to isolated CloudFoundry apps to prepare for integration testing
  3. Run integration tests and environment validation smoke tests, in parallel
  4. If integration tests and environment validation pass, deploy to production

You can also interact with a live, public build.

../../_images/predix-cd-workflow-in-progress.png

Sample Repo

You can see a working example in this GitHub repo:

https://github.com/semipermeable/predix-rmd-ref-app/tree/solano

It is built around tooling supplied by the reference app and the standard mvn and npm builders and test runners.

  1. A solano.yml configuration file defining the CD pipeline and the commands to run at each step.
  2. Setup scripting in bin/pre_setup.
  3. A simple ruby script bin/generate_properties to generate Java properties files that will configure integration tests to use the live-deployed integration testing apps and services. At the moment, the integration tests only run against the rmd-datasource component of the reference app, and the property-generator is limited to that component.
  4. A Selenium-based integration test for the main RMD reference app

You’ll notice that the setup scripting omits any sensitive information, such as CloudFoundry auth tokens, passwords, and Artifactory credentials. These values are stored securely in the Solano CI system using config variables.

For this example, we are using the following repo scoped environment variables:

  1. MV_SETTINGS holds the complete Maven settings XML file containing Artifactory keys (generated by following the Predix Reference App tutorial). It should also be possible to inject only the keys themselves, and leave a template settings XML file in the repo using Maven’s environment variable substitution. We’ll add that refinement in a future revision of our sample repo.
  2. CF_AUTH_CONFIG holds a complete CloudFoundry config.json with credentials to allow the build to communicate with CF. This file was generated by running cf login.

Pipeline Workflow Details

This workflow uses Solano CI’s build pipeline functionality. Each step (node in the pipeline graph) uses a single Solano CI Build Profile to define the commands run in that step. You can follow along with this configuration in the solano.yml file in the sample repo.

The pipeline definition itself is this snippet at the top of the config file:

pipeline:
  functional:
    deploy-integrate:
      - validate: deploy-production
      - integrate
edges:
  - integrate: deploy-production

First step: functional

Component-by-component functional testing. Each component’s functional tests are automatically executed in parallel in isolated Solano CI worker containers.

  • Runs npm test for the RMD UI NodeJS app
  • Runs a subset of the Junit tests that can run isolated in a CI worker. These do not depend on set of deployed apps and services in CloudFoundry.

Second step: deploy-integrate

Prepare an integration testing environment in CloudFoundry by using the installRefApp.py script that comes with the referece app to deploy all of its components with a special prefix used only by this test workflow.

Third steps: validate and integrate (run by Solano CI in parallel)

The validate step uses the installRefApp.py script’s “validate-only” mode to run its smoke-tests of the integration testing environment.

The integrate step configures the rmd-datasource component to communicate with the deployed reference app (using the bin/generate_properties script) and runs its integration tests. It also runs newly written Selenium-based integration tests against the test app instance. With Solano CI you can now run Selenium browser tests in parallel against your Predix application.

Final step: deploy-production

If the tests passed against the integration environment, deploy the app to production.

Using This Workflow For Your Own Apps

It’s easy to use this workflow for your own apps, and to customize it to suit your team’s needs.

  1. Copy in the solano.yml, bin/pre_setup and bin/generate_properties scripts
  2. Edit solano.yml to replace the sample app’s commands with the commands that you use to compile and test your app. Pay specific attention to the profiles, hooks and tests sections.

You can also add or remove steps by editing the pipeline and edges sections - make sure that you add a corresponding entry under profiles if you add to the pipeline graph.