github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/e0199.yml (about)

     1  notes: |
     2    ### Run the example
     3  
     4    up ngo -p entry_task -d ./tests/functests -t e0199.yml --configdir=./tests/functests
     5  
     6    ### What do we want to achieve?
     7  
     8    Most of time, the execution profile is good enough for a pipeline entry, which linked to a default taskname to start. However there are times that the execution context, such as those env vars are used for the same pipeline but in different stages. In this case, we eventually just use the same eprofile but different env vars
     9  
    10    To solve this issue, we introduce to use an env var named: UP_ENTRY_TASK. If you set this env var in your pipeline and execute up cmd with the exec profile, then up cmd will use the entry task dicated from UP_ENTRY_TASK instead of the default one using taskname
    11  
    12    ### Demo to call the default task
    13  
    14    ```
    15      Ξ /up-project/up git:(master) ▶ goup ngo -p entry_task -d ./tests/functests -t e0199.yml --configdir=./tests/functests -v vvv
    16    loading [Config]:  ./tests/functests/upconfig.yml
    17    Main config:
    18      Version -> 1.0.0
    19      RefDir -> ./tests/functests
    20      WorkDir -> cwd
    21      AbsWorkDir -> /up-project/up
    22      TaskFile -> e0199.yml
    23      Verbose -> vvv
    24      ModuleName -> self
    25      ShellType -> /bin/sh
    26      MaxCallLayers -> 8
    27      Timeout -> 3600000
    28      MaxModuelCallLayers -> 256
    29      EntryTask -> Main
    30    work dir: /up-project/up
    31    -exec task: Main
    32    loading [Task]:  ./tests/functests/e0199.yml
    33    module: [self], instance id: [nonamed], exec profile: [pure-env-vars]
    34    entry task: alterative_entry_task
    35      -set pure env context done.
    36    profile - pure-env-vars envVars:
    37    Task1: [default_entry_task ==> default_entry_task:  ]
    38    cmd( 1):
    39      echo "default task"
    40    -
    41      default task
    42  
    43    -
    44      .. ok
    45      . ok
    46  
    47    ```
    48  
    49    ### Demo to call the alternative task using env var UP_ENTRY_TASK
    50  
    51    ```
    52    Ξ /up-project/up git:(master) ▶ export UP_ENTRY_TASK=alterative_entry_task
    53  
    54    Ξ /up-project/up git:(master) ▶ goup ngo -p entry_task -d ./tests/functests -t e0199.yml --configdir=./tests/functests
    55    loading [Config]:  ./tests/functests/upconfig.yml
    56    Main config:
    57      Version -> 1.0.0
    58      RefDir -> ./tests/functests
    59      WorkDir -> cwd
    60      AbsWorkDir -> /up-project/up
    61      TaskFile -> e0199.yml
    62      Verbose -> v
    63      ModuleName -> self
    64      ShellType -> /bin/sh
    65      MaxCallLayers -> 8
    66      Timeout -> 3600000
    67      MaxModuelCallLayers -> 256
    68      EntryTask -> Main
    69    work dir: /up-project/up
    70    -exec task: Main
    71    loading [Task]:  ./tests/functests/e0199.yml
    72    module: [self], instance id: [nonamed], exec profile: [entry_task]
    73    entry task: alterative_entry_task
    74    Task2: [alterative_entry_task ==> alterative_entry_task:  ]
    75    -Step1:
    76    cmd( 1):
    77      -
    78      alternative task
    79  
    80    -
    81      .. ok
    82      . ok
    83    ```
    84  
    85  
    86  eprofiles:
    87    - name: entry_task
    88      taskname: default_entry_task
    89  
    90  tasks:
    91  
    92    -
    93      name: default_entry_task
    94      task:
    95        -
    96          func: shell
    97          do: |
    98            echo "default task"
    99  
   100    -
   101      name: alterative_entry_task
   102      task:
   103        -
   104          func: shell
   105          do: |
   106            echo "alternative task"