module validation

Showcase the validation rules apply

source

rules

  1. no duplicated name of module, eg alias has to be unique

example

Ξ up-project/up-gitlab git:(v2) ▶  up mod list -d ./tests/modtests/$1 -i dev --configdir=./tests/modtests/$1 -w refdir 0009
loading [Config]:  ./tests/modtests/0009/upconfig.yml
Main config:
  Version -> 1.0.0
  RefDir -> ./tests/modtests/0009
  WorkDir -> refdir
  TaskFile -> up.yml
  Verbose -> vvv
  ModuleName -> silly_pare9
  MaxCallLayers -> 8
work dir:
loading [Task]:  ./up.yml
module: [silly_pare9] instance id: [dev]
-list all modules:
  +-----+-------------------------------+----------------------------+-------------------------------------------+---------+------------+------------+--------+
  | IDX |             ALIAS             |            DIR             |                   REPO                    | VERSION | PULLPOLICY | INSTANCEID | SUBDIR |
  +-----+-------------------------------+----------------------------+-------------------------------------------+---------+------------+------------+--------+
  |   1 | hello-module                  | .upmodules/hello-module    | https://github.com/upcmd/hello-module.git | master  | skip       | nonamed    |        |
  |   2 | module-a                      | .upmodules/module-a        | https://github.com/upcmd/module-a.git     | master  | always     | nonamed    |        |
  |   3 | himodule                      | himodule                   | https://github.com/upcmd/hello-module.git | master  | skip       | nonamed    |        |
  |   4 | module-b-subdir               | .upmodules/module-b-subdir | https://github.com/upcmd/module-b.git     | master  | skip       | nonamed    | a/b    |
  |   5 | module-c                      | .upmodules/module-c        | https://github.com/upcmd/module-c.git     | 1.0.0   | skip       | nonamed    |        |
  |   6 | hi                            | .upmodules/hi              | https://github.com/upcmd/hello-module.git | master  | skip       | nonamed    |        |
  |   7 | sayhello                      | .upmodules/sayhello        | https://github.com/up/sayhello.git        | abc123e | skip       | nonamed    |        |
  |   8 | a_relative_dir_module         | c/d                        |                                           |         |            | nonamed    |        |
  |   9 | himod                         | c/d                        |                                           |         |            | nonamed    |        |
  |  10 | absolute_path_module          | /etc/c/d                   |                                           |         |            | nonamed    |        |
  |  11 | absolute_path_with_iid_module | /etc/c/d                   |                                           |         |            | dev        |        |
  +-----+-------------------------------+----------------------------+-------------------------------------------+---------+------------+------------+--------+
-validate all modules:

config file - upconfig.yml

    
    version: 1.0.0
    Verbose: vvv
    MaxCallLayers: 8
    RefDir: .
    TaskFile: up.yml
    ConfigDir: .
    ConfigFile: upconfig.yml
    
    Modules:
      #clone the repo, repo name will be the module name
      #version==empty, then it will use master
      #dir==empty, it will use cloned git repo root dir
      #dir==empty, then mod.dir will be auto mapped to repo name
      - repo: https://github.com/upcmd/hello-module.git
        _dir: sayhi
        _alias: sayhi
        _version: master
        _iid: noname
    
        #allowed: manual | always | skip
        #skip: if repo exist already, then skip it and do not pull, this is the default if it is not configured
        #manual: if repo exist already, then stop processing and fails straight away
        #always: if repo exist already, then delete it and repull from remote again
      - repo: https://github.com/upcmd/module-a.git
        pullpolicy: always
    
        #if both repo and dir exist, then the repo will be cloned to be named to dir name
      - repo: https://github.com/upcmd/hello-module.git
        dir: himodule
        alias: himodule
        _version: master
        _iid: noname
    
        #this is to use sub directory ./sayhi/a/b as the module location instead of root repo dir
      - repo: https://github.com/upcmd/module-b.git
        subdir: a/b
        alias: module-b-subdir
        _dir: sayhi
        :>alias: require setup to make it clear what the module name is
        _version: master
        _iid: noname
    
        #use version value as tag name to check it out
      - repo: https://github.com/upcmd/module-c.git
        version: 1.0.0
        _dir: sayhi
        _alias: sayhi
        _iid: noname
    
        #the alias will be a translated name to be uesd in caller's code base
        #eg, call: hi.SayHiTask, without alias, you will have to use sayhi.SayHiTask
        #this is to just to avoid duplicated repo name, eg: https://github.com/somethingeles/sayhi.git
      - repo: https://github.com/upcmd/hello-module.git
        alias: hi
        _version: master
        _dir: sayhi
        _iid: noname
    
        #sha value is a specific value to checkout if it presents as version
      - repo: https://github.com/up/sayhello.git
        version: abc123e
        _alias: sayhello
        _dir: sayhello
        _iid: noname
    
      - #if there is no repo, then it will use the dir as module and incorporate as module
        #if
        dir: c/d
        alias: a_relative_dir_module
        :>alias: require setup to make it clear what the module name is
        _iid: noname
    
      - #if there is no repo, then it will use the dir as module and incorporate as module
        dir: c/d
        alias: himod
        _iid: noname
    
        #you can use absolute path for dir to be the location of a module
      - dir: /etc/c/d
        :>alias: require setup to make it clear what the module name is
        alias: absolute_path_module
        _iid: noname
    
        #iid is the instance id, which could be used in module, if it is empty then use default nonamed
      - dir: /etc/c/d
        :>alias: require setup to make it clear what the module name is
        alias: absolute_path_with_iid_module
        iid: dev
    
    
Main log file
    loading [Config]:  ./tests/modtests/0009/upconfig.yml
    Main config:
                 Version -> 1.0.0
                  RefDir -> ./tests/modtests/0009
                 WorkDir -> refdir
              AbsWorkDir -> /up_project/up/tests/modtests/0009
                TaskFile -> up.yml
                 Verbose -> v
              ModuleName -> self
               ShellType -> /bin/sh
           MaxCallLayers -> 8
                 Timeout -> 3600000
     MaxModuelCallLayers -> 256
               EntryTask -> Main
      ModRepoUsernameRef -> 
      ModRepoPasswordRef -> 
    work dir: /up_project/up/tests/modtests/0009
    -exec task: Main
    loading [Task]:  ./up.yml
    module: [self], instance id: [dev], exec profile: []
    Task1: [Main ==> Main: main entry ]
    
Logs with different verbose level
Raw logs with different verbose level