Skip to content

Relative paths and imported configurations #80

@stessaris

Description

@stessaris

This is not a bug report but just a request for the confirmation of the behaviour of mani w.r.t. the relative paths of imported configuration files. The documentation says that relative project paths are resolved w.r.t. to the config file; but in the case that projects are defined in an included configuration file, it's not clear whether they are resolved w.r.t. the path of the included or the including (root) configuration file. Apparently, mani takes the former approach (i.e., path of the included file, see below). I think that it's fine (actually rather useful), but I'd like to ask whether this is the intended behaviour and we can count on that also for future releases. I think that it should be mentioned in the documentation to avoid ambiguities.

The example below demonstrates the behaviour:

Directory structure

❯ tree
.
├── projects
│   ├── mani_projects.yaml
│   ├── project1
│   └── project2
└── tools
    └── mani.yaml

Configuration files

# projects/mani_projects.yaml
projects:
  project1: {}
  project2: {}
# tools/mani.yaml
import:
  - ../projects/mani_projects.yaml

env:
  MANI_WD: $(pwd)

projects:
  root:
    path: .

tasks:
  pwd: |
    target=$(pwd)
    common_part=${MANI_WD}
    back=
    while [ "${target#$common_part}" = "${target}" ]; do
      common_part=$(dirname $common_part)
      back="../${back}"
    done
    echo "project directory: ./${back}${target#$common_part/}"

Showing the directories of the projects

❯ mani -c tools/mani.yaml run pwd -a

TASK [pwd] *********************************************************************************************************

root | project directory: ./tools

TASK [pwd] *********************************************************************************************************

project1 | project directory: ./projects/project1

TASK [pwd] *********************************************************************************************************

project2 | project directory: ./projects/project2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions