evergreen/services
R. Tyler Croy 4274e887c1
Upgrade to the latest script-security
2018-10-22 10:25:50 -07:00
..
acceptance *Now* the test does test what I wanted it to... 2018-10-12 15:53:04 +02:00
assets Add the latest popper.js 2018-02-05 16:59:54 -08:00
cli Reference the (new) correct URL for the MANIFEST.MF in Artifactory 2018-10-19 12:15:55 -07:00
cli-test Implementing the generate-ingest command 2018-08-10 15:17:02 -07:00
config Instruct sequelize to store seeds information too 2018-09-24 13:59:03 -07:00
initdb.d Supporting dumping the seeded database for integration testing 2018-05-15 13:02:09 -07:00
migrations [JENKINS-53964] Drop uuid<->checksum unique constraint from versions table 2018-10-09 21:09:21 +02:00
public Force the client's `make run` to act as a `docker-cloud` flavor when testing 2018-08-17 09:38:21 -07:00
scripts Add script for uploading an update level 2018-07-12 08:44:24 -07:00
seeders Restructure the updates/channels/instances models to accommodate Update Levels 2018-04-27 06:54:00 -07:00
src [JENKINS-53551] Map log levels sent to Sentry 2018-10-20 16:47:48 +02:00
test [JENKINS-53551] Map log levels sent to Sentry 2018-10-20 16:47:48 +02:00
views Incorporate the backend into the container and expose on the dashboard 2018-09-11 09:06:42 -07:00
.dockerignore Add the necessary code to run some migrations and stand up Feathers with PostgreSQL 2018-03-20 13:03:59 -07:00
.editorconfig Add a generated feathers application 2018-03-20 13:01:36 -07:00
.eslintrc.json Enable prefer-template ESlint rule 2018-09-11 10:32:44 +02:00
.gitignore Updated plugins from experimental UC. 2018-10-08 15:25:56 -04:00
.rspec Move updatesrv to services in order to expand things a bit 2018-01-26 08:57:27 -08:00
.sequelizerc Configure the sequelize CLI based off the existing JSON configuration files 2018-07-18 10:07:20 -07:00
.yamllint Add more linting to various yaml or json files 2018-07-25 14:33:55 +02:00
.yardopts Move updatesrv to services in order to expand things a bit 2018-01-26 08:57:27 -08:00
Dockerfile Incorporate the backend into the container and expose on the dashboard 2018-09-11 09:06:42 -07:00
Dockerfile.migrations Incorporate the sequelizerc file into the migrations container 2018-07-19 08:25:42 -07:00
Makefile Add make target for debugging the test db 2018-10-12 15:53:04 +02:00
README.adoc Slight update to README.adoc to bounce the update level 2018-09-16 19:58:53 -07:00
docker-compose.yml Configure the sequelize CLI based off the existing JSON configuration files 2018-07-18 10:07:20 -07:00
essentials.yaml Upgrade to the latest script-security 2018-10-22 10:25:50 -07:00
ingest-update-center Bump essentials-plugin to using master branch build 2018-08-13 14:57:33 -07:00
package-lock.json Update package-lock.json files and add tasks for it on top level Makefile 2018-10-17 13:50:26 +02:00
package.json Upgrade feathers and some other key dependencies 2018-09-24 12:36:07 -07:00
prepare-essentials Updated plugins from experimental UC. 2018-10-08 15:25:56 -04:00
wait-for-postgres.sh Avoid waiting for a postgresql which won't exist when this container is deployed 2018-05-15 13:02:09 -07:00

README.adoc

<html lang="en"> <head> </head>

Evergreen Services

This directory contains the numerous microservices which work in concert to provide functionality for the Evergreen distribution system.

Note

This project uses a consistent version of Node for all tasks via a Docker container. To pull Node CLI tools into your path for interactive use, execute make depends && source activate in your shell.

Dashboard

The developer Dashboard is the hub of activity for Jenkins developers to manage the release life-cycle for Evergreen applications.

Pusher

Pusher is responsible for maintaining Server-sent Event connections for all the present evergreen-client instances.

Status

The Status service is responsible for knowing the current status of Jenkins instances in the ecosystem.

This includes:

  1. The SHA1 of essentials.yaml installed on the instance.

  2. Versions of all, essential and other, plugins

  3. When the Jenkins process was last listed as online

  4. Number of Pipelines.

  5. Environment capabilities of the instance (AWS, Azure, Docker, Kubernetes, etc)

Data Model

This is still a work-in-progress for the data model to back the Status service. The goal for this data model is to provide an relatively accurate and up-to-date representation of the fleet.

The model below is obviously, and intentionally, relational. Most of the data which Status requires is relational, and the service must manage various transitions along those relationships. For example, when a new version of the "Evergreen manifest" (essentials.yaml) is created, a new Update record must be created for each Instance to relate to.

Non-relational data is, however, contained in the data model below within the Capabilities and Version record. In both cases, it is expected that the service will be receiving semi-arbitrary blobs of JSON from instances.

                                                +------------------------+
                                                | versions               |
                                                +------------------------+
                                                |  id                    |
                                             +--+ *uuid                  |
                                             |  |  manifest (JSON)       |
                           +------------+    |  |  manifestSchemaVersion |
                           | instances  |    |  |  checksum (unique)     |
                           +------------+    |  |  createdAt             |
                           |  id        |    |  |  updatedAt             |
                           | *uuid      <---++  +------------------------+
                           |  timezone  |   ^^
                           |  flavor    |   ||
  +----------------+   +---+  updateId  |   ||
  | updates        |   |   |  createdAt |   ||
  +----------------+   |   |  updatedAt |   ||
  | id             <---+   +------------+   ||
  | commit         |                        ||
  | channel        |                        ||  +---------------------+
  | manifest (JSON)|                        ||  | capabilities        |
  | tainted        |                        ||  +---------------------+
  | createdAt      |                        ||  |  id                 |
  | updatedAt      |                        |+--+ *uuid               |
  +----------------+                        |   |  capabilities (JSON)|
                                            |   |  createdAt          |
                                            |   |  updatedAt          |
                                            |   +---------------------+
                                            |
                                            |
                                            |
                                            |   +-----------------+
                                            |   | connections     |
                                            |   +-----------------+
                                            |   |  id             |
                                            +---+ *uuid           |
                                                |  lastConnected  |
                                                |  createdAt      |
                                                |  updatedAt      |
                                                +-----------------+

* denotes an index
`id` fields are always considered primary keys

Versions

The versions table should be considered to be much more of an audit trail of versions rather than having a One-to-one relationship with an instance.

For the time being this means that a since instance will have multiple records in versions, and the application must select the most recent createdAt time in order to have an accurate picture of the instance.

Storage Considerations

In the model above it is expected that a single Channel record is going to exist for each channel (alpha, canary, ga). Each change to essentials.yaml should create a new Update record.

Where there is room for non-trivial data growth is with Instance, Connection, Capabilities, and Version which should all have a single record for each Jenkins Evergreen instance.

Models

Migrations for the database can be found in migrations/ and are based on the Sequelize library.

In order to create a new Model, execute the following from this directory:

% source activate
% sequelize model:generate --help

And then follow the help text. The Sequelize Models and Migrations documentation has more information, as does the Variable/Data Types reference.

Telemetry

The Telemetry service is responsible for receiving error and user telemetry from Jenkins instances for processing in the Dashboard by developers.

This includes:

  1. Exception/error reports

    1. Uncaught exceptions

    2. Logged errors

    3. Logged warnings

    4. Agent errors

How to generate a log into Jenkins manually for testing

If you need to force a log to be sent to the backend, a possible hack is to open the /script URL, then paste and run the following code:

java.util.logging.Logger.getLogger('some.logger.name').warning('Warning log for testing');

Environment Variables

Name Description

DB_TRACING

Set with any value to turn on Sequelize database query tracing

EVERGREEN_JWT_SECRET

Set with the secret to use for creating JSON Web Tokens for authentication

Debugging

The best way to debug the services is to use the Chrome Dev Tools in conjunction with Nodes debugger.

  1. Create a unit test in the test/ directory which is going to exercise the functionality you wish to debug.

  2. Add a debugger; statement into your code where you wish to create a breakpoint.

  3. Open Chrome and navigate to about://inspect

  4. In the services/ directory execute: make debug-unit

  5. Select the appropriate Remote Target in the Chrome Dev Tools.

  6. Start debugging!

Database Debugging

Debugging database queries can be done by enabling the Sequelize logging by setting the DB_TRACING environment variable, for example:

DB_TRACING=true make check

In order to poke around in the development database being used for testing, after running make migrate you can inspect the docker-compose db instance with:

make debug-db

This will open up the psql command line client for PostgreSQL and should allow you to inspect and query the tables being used a development instance of the backend services.

</html>