Best Practices

Last updated: oct.11, 2016 - 14:58:45

Overview

In this section you will find some right ways to use Hesperides and some very useful tips that can help you to go faster.

Best practices

Module and techno

If you have several modules with common templates, it is recommended to create a techno that contains thoses templates, and to inherits techno in each module.

For example, instead of creating three modules that contain two identical templates, create rather a techno that will be inherited on all three modules.

Templates

Hesperides is not made for storing large files, particularly for static files (without mustache inside).

Be careful !

As Hesperides replays events, if you store a template with a lot of data, it can increase the response time dangerously.

User settings

You can customize settings that can make you the most suitable use by clicking on the icon top right of the screen :

  1. Your preferred mode will be open by default
  2. Your preferred language will be open by default
  3. When you upgrade a module version in your platform, your default choice will be this one
  4. You can activate color code for platform tags when you edit an application (the library considers the the first three letters and generate a color code from a RVB base code)
  5. You can modify the level of RVB
  6. You can note what your RVB base code would change the color of the platform tags
  7. You can search application you want to appear on the welcome screen to have quick access to edit them
  8. Don't forget to add the application by clicking on the "+" button

Change language instantly

At any moment you can choose english or french language with the top right icons

Ecosystem

Command Line Interface

hesperides-cli is written in Python, comes up with a few usage examples as a Docker entrypoint or in a Gitlab CD/CI pipeline, and is as easy to install as:

pip install hesperides-cli

Here is a glimpse of its feature set:

Commands:
  create-application-platform
  create-module
  create-module-release
  create-module-workingcopy-template
  create-techno
  create-techno-workingcopy
  delete-application-platform
  delete-module-release
  delete-module-workingcopy
  delete-module-workingcopy-template
  delete-profile
  delete-techno-release
  delete-techno-workingcopy
  delete-templates-packages-cache
  get-application
  get-application-platform
  get-applications-using-module
  get-conf
  get-events
  get-files
  get-global-properties
  get-global-properties-usage
  get-module
  get-module-release
  get-module-release-template
  get-module-release-templates
  get-module-workingcopy
  get-module-workingcopy-template
  get-module-workingcopy-templates
  get-modules
  get-profile
  get-properties
  get-properties-instance-model
  get-techno-release
  get-techno-release-model
  get-techno-workingcopy
  get-techno-workingcopy-model
  get-technos-release
  get-technos-workingcopy
  get-user
  get-versions
  local-generate-files
  local-validate-files
  perform-search-application-platforms
  perform-search-applications
  perform-search-modules
  perform-search-technos
  search-module
  set-conf
  update-application-platform
  update-module
  update-module-workingcopy-template
  update-techno-workingcopy
  upsert-module-workingcopy-template
  use-profile
  write-files

Jenkins pipelines

If you need to instrument Hesperides from Jenkins pipelines, a Groovy shared libray is available for you on Github: voyages-sncf-technologies/hesperides-jenkins-lib.

Logo hesperides-jenkins-lib

Here is an example of Jenkinsfile that uses it:

API_ROOT_URL = 'https://hesperides.mycompany.com'

node {

    withCredentials([[$class: 'UsernamePasswordBinding',
                      credentialsId: 'HesperidesCredentials',
                      variable: 'auth']]) {

        stage('Releasing module demoKatana-war') {
            hesperides.releaseModule(apiRootUrl: API_ROOT_URL,
                                     auth: auth,
                                     moduleName: 'demoKatana-war',
                                     workingcopyVersion: '1.0.0',
                                     releaseVersion: '1.0.0')
        }

        stage('Setting modules version on platform USN1') {
            hesperides.setPlatformModulesVersion(apiRootUrl: API_ROOT_URL,
                                                 auth: auth,
                                                 app:'KTN',
                                                 platform:'USN1',
                                                 currentVersion:'1.0.0',
                                                 newVersion:'1.0.0')
        }

        stage('Updating properties of platform USN1 from a JSON file') {
            hesperides.updateProperties(apiRootUrl: API_ROOT_URL,
                                        auth: auth,
                                        app: 'KTN',
                                        platform: 'USN1',
                                        jsonPropertyUpdates: 'http://gitlab.mycompany.com/KTN-USN1.json',
                                        commitMsg: 'vsct-hesperides-api tests from Jenkinsfile')
        }
    }
}

Tips

Autocomplete

Autocomplete is used in several parts of Hesperides. It has a classic usage, a.k.a it gives users the option of completing words or forms by a shorthand method on the basis of what has been typed before.

Specially for modules

You can then type a part of module name and a part of the module version (separated by a blank)

For example if we have created those three modules :

  • myfoo1 - version 1.0
  • myfoo1 - version 2.0
  • myfoo2 - version 1.0
Name starting with "myf" Exact name of module Name sarting with "myf" and version starting with "2"

Tip of tip !

You can use "*" : for example m*1 to return myfoo1

Surf on tree

Tree mode when you edit platform is very useful because it allows you to surf your platform

Tip Operation Result
Quick extend
Filter

Filtering rules :

The filtering string will be apply on every stage of your tree : logic group, module name, instance name

Platforms using module

  1. The "List of platform using this module" section lists every platform using your module in this version
  2. You can click on the platform to edit it

Alert non existing module

Hesperides will alert you in two ways if your platform uses a module that does not exists.

  • The module and logic groups containing module will appear in red
  • A message will appear below the title "Logic representation of XXX" :