Creating a JSON file listing the Integration Build's Components
Using the list of agents currently active in a specific environment
The script below retrieves the list of all the active instances of your application’s components from a specific environment and creates from it an Integration Build on Sealights Dashboard.
It provides a “picture” of the testing environment (Lab) at this given point in time.
This solution is aimed to illustrate the concept and is based on the following assumptions:
All the components are currently live in the specific environment, up and running as well as appearing in the Cockpit Agent Monitor page
No component is designed with a “lazy loading” mechanism bringing it when necessary (on-demand). This restriction applies to front-end components as well (since they’re actively reporting only when the application is opened on the client-side browser).
If one of the assumptions above is not valid in your configuration, it may end up with incorrect data.
Sample script for a Jenkins Pipeline job
Jenkins Pipeline scripts support readJSON
and writeJSON
and the sample code below allows you to create a JSON file for integration build declaration.
Plugin Pipeline Utility Steps Plugin needs to be installed on your Jenkins instance
The sample code above is OS agnostic and should work for Jenkins instances installed on Windows or Linux servers.