Reducing overly nested Vendir paths

I've recently been using the pattern I described to combine Renovate and Vendir to sync files in a number of repos, as a means to track OpenAPI spec dependencies.

However, one thing I've found a bit painful is that when using Vendir to track these dependencies, the directory structure gets very nested.

For instance, with config such as:

# via https://github.com/rootlyhq/rootly-go/blob/61c86b8660b6f25d1e8d8638417de173350dfb61/vendir.yml
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: .vendored
    contents:
      - path: rootly-api
        http:
          url: https://rootly-heroku.s3.amazonaws.com/swagger/v1/swagger.json

This leads to .vendored/rootly-api/swagger.json being the full OpenAPI spec path.

Getting rather frustrated about this - while working on ecosystems-go - I sought some help from Claude Sonnet 4.5 after digging through GitHub Issues to no avail, and noticed a config option newRootPath that I'd missed before.

With this config, we can replace the above with:

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: .vendored
    contents:
      - path: rootly-api.json
        newRootPath: swagger.json
        http:
          url: https://rootly-heroku.s3.amazonaws.com/swagger/v1/swagger.json

This will now download the spec as .vendored/rootly-api.json which is a bit more reasonable.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation.

πŸ€– Content in this blog post (prose or code snippets) includes code derived from the following LLMs:

  • claude:sonnet-4.5

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.