Updating Models

This document describes the process of updating models, such as adding new fields, etc.

Updating the Model

  1. First, update the proto definition found in services/model-service/proto.

  2. Then run $ make build.proto.

  3. Now go to services/model-service/models and add the new field to the database model

  4. Next, locate the services/model-service/dto package, and add your new fields here.

  5. Now we've added the new fields, we need to update the build-bot service to utilise these changes:

    1. Push any changes you've made to services/model-service, or get your PR merged into main.

    2. Go to services/build-bot-service and run $ go get -u ./... to pull the latest version of the model-service.

    3. Now the build-bot has the latest version of its model-service dependency, push/deploy these version updates.

  6. Now we need to update the rest gateway, to expose the new field to the web:

    1. Add the new field to services/rest-service-gateway/swagger.yml, then run $ go generate ./....

    2. Find the code that forwards the request to the model-service in services/rest-gateway-service/services/models.go

    3. Add the new field to the request, and update the response to include the new field.

  7. Push your changes to the rest gateway, or get your PR merged into main for this change also.

Updating the Config

  1. Find the mm-models repo

  2. Add the new field to each of the models

  3. Run $ cd models to go to the models directory

  4. Now run $ python ./sync-models.py, which is a script that will deploy changes to all of the models

Last updated