Skip to content

Latest commit

 

History

History

ns-list

ns-list

List a namespace containing many viash config files.

Usage

This action will run viash ns list. See the reference documentation on ns list for more info on each of the arguments.

We recommend using a Linux or MacOS runner if possible.

Inputs

  • query: - optional. Filter which components get selected by component and namespace name. Can be a regex. Example: “^mynamespace/component1$”.
  • query_namespace: - optional. Filter which namespaces get selected by namespace name. Can be a regex. Example: “^mynamespace$”.
  • query_name: - optional. Filter which components get selected by component name. Can be a regex. Example: “^component1”.
  • config: - optional. Filter which component get selected by specifying the config path.
  • src: - optional. A source directory containing viash config files, possibly structured in a hierarchical folder structure. Default: src/.
  • platform: - optional. (viash < 0.9.0) Use –runner and –engine instead. Acts as a regular expression to filter the platform ids specified in the found config files. If this is not provided, all platforms will be used. If no platforms are defined in a config, the native platform will be used. In addition, the path to a platform yaml file can also be specified.
  • runner: - optional. (viash >= 0.9.0) Acts as a regular expression to filter the runner ids specified in the found config files. If this is not provided, all runners will be used. If no runners are defined in a config, the executable runner will be used.
  • engine: - optional. (viash >= 0.9.0) Acts as a regular expression to filter the engine ids specified in the found config files. If this is not provided, all engines will be used. If no engines are defined in a config, the native engine will be used.
  • config_mod: - optional. Modify a viash config at runtime using config_mod.
  • colorize: - optional. Specify whether the console output should be colorized. If not specified, we attempt to detect this automatically. Possible values are: “true”, “false”, “auto”.
  • loglevel: - optional. Specify the log level in us. Possible values are: “error”, “warn”, “info”, “debug”, “trace”.
  • format: - optional. Which output format to use. Possible values are: “yaml”, “json”.
  • parse_argument_groups: - optional. DEPRECATED. This is now always enabled. Whether or not to postprocess each component’s argument_groups.
  • project_directory: - optional. Path to the project directory. This is the directory where the project’s _viash.yaml file is located. If not provided, the current working directory is used.
  • output_file: - optional. Path of a file to which the output will be written. If not set, this action will create a file with a random name in RUNNER_TEMP.

Outputs

  • output: The output of the ‘viash ns list’ command, which is a list of all of the components found. By default this will be a yaml, unless the format argument was set to ‘json’.
  • output_file: Path of a file to which the output was written (same as `inputs.output_file``). We recommend using this property for capturing the action’s output because there is a limit in the object size that github actions can manage. Additionally, if you use this property instead of a static file path, changing the location of the output file will not require you to adjust settings for downstream actions as well.
  • output_matrix: A simplified version of the output, which is a list of components with fields ‘name’, ‘namespace’, ‘full_name’, ‘config’, and ‘dir’.

Usage

name: Demo of ns-list

on:
  push:

jobs:
  nslist:
    runs-on: ubuntu-latest

    outputs:
      output_file: ${{ steps.ns_list.outputs.output_file }}
      output_matrix: ${{ steps.ns_list.outputs.output_matrix }}
    
    steps:
      - name: Install Viash
        uses: viash-io/viash-actions/setup@v6

      - name: Check out repository
        uses: actions/checkout@v3

      - name: viash ns list
        uses: viash-io/viash-actions/ns-list@v6

      - name: View output
        run: |
          cat "${{steps.ns_list.outputs.output_file}}"
  
  use_matrix:
    runs-on: ubuntu-latest
    needs: nslist
    
    strategy:
      matrix:
        component: ${{fromJson(needs.nslist.outputs.output_matrix)}}

    steps:
      - name: Do something for every component
        run: |
          echo "Name: ${{ matrix.component.name }}"
          echo "Namespace: ${{ matrix.component.namespace }}"
          echo "Runner: ${{ matrix.component.runner }}"
          echo "Engine: ${{ matrix.component.engine }}"
          echo "Config: ${{ matrix.component.config }}"
          echo "Executable: ${{ matrix.component.executable }}"
          echo "Src dir: ${{ matrix.component.src_dir }}"
          echo "Target dir: ${{ matrix.component.target_dir }}"
          echo "Full name: ${{ matrix.component.full_name }}"