Skip to content

make file and dir inputs support relative paths #565

@ikhandamirov

Description

@ikhandamirov

Description

Normally, when OCM users refer to the file system in component-constructor.yaml, they use paths, which are relative to constructor file:

Example 1:

    resources:
      - name: test-resource
        type: blob
        input:
          type: file
          path: ./file.txt

Example 2:

    resources:
      - name: blueprint
        type: landscaper.gardener.cloud/blueprint
        input:
          type: dir
          path: ../landscaper-blueprint
          compress: true
          mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip

At the moment, when the current implementation of the file and dir input methods are called, they are given the input specification as is. But the information about the location of the constructor file is missing, i.e. the referenced files and folders cannot be accessed.

The goal of the task is to correct the problem described above.

Implementation Details

  • Input methods should retrieve the base path from the context (file system config). See also this comment.
  • By default path escapes above the base path should be prohibited. We might introduce a new flag to let the users explicitly allow path escapes. See also this comment.
  • The new file system config option should be made available to both internal and external plug-ins. See also this comment.

Done Criteria

  • Code has been reviewed by other team members
  • Analysis of existing tests (Unit and Integration)
  • Unit Tests created for new code or existing Unit Tests updated
  • Integration Test Suite updated (includes deletion of existing unnecessary Integration Test and/or creation of new ones if required)
  • Enduser Documentation updated (if applicable)
  • Internal technical Documentation created/updated (if applicable)
  • Successful demonstration in Review

Metadata

Metadata

Assignees

Labels

area/ipceiImportant Project of Common European Interestkind/tasksmall task, normally part of feature or epic

Type

No fields configured for Task.

Projects

Status
🍺 Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions