How to effectively sync multiple directories ?
I am trying to sync content from multiple directories from the same repository, however, when I use the following yml configuration, it fetches the repository all over again. Is there a better way to handle this?
# PS: https://carvel.dev/vendir/docs/latest/vendir-spec/
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: docs/modules
contents:
- path: ROOT/partials
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- modules/*
newRootPath: modules/
- path: ROOT/images
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- images/*
newRootPath: images/
- path: ROOT/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- welcome/*
newRootPath: welcome/
- path: _files
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- files/*
newRootPath: files/
- path: architecture/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- architecture/*
newRootPath: architecture/
- path: backup_and_restore/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- backup_and_restore/*
newRootPath: backup_and_restore/
- path: cli/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- cli/*
newRootPath: cli/
- path: configuration/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- configuration/*
newRootPath: configuration/
- path: installing/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- installing/*
newRootPath: installing/
- path: integration/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- integration/*
newRootPath: integration/
- path: operating/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- operating/*
newRootPath: operating/
- path: release_notes/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- release_notes/*
newRootPath: release_notes/
- path: support/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- support/*
newRootPath: support/
- path: upgrading/pages
git:
url: https://github.com/openshift/openshift-docs
ref: rhacs-docs
includePaths:
- upgrading/*
newRootPath: upgrading/
The source repository is at https://github.com/gaurav-nelson/rhacs-docs
@gaurav-nelson we currently did not include any optimization for fetching same repo multiple times. would be ideal but probably requires a bit of writing down how to best achieve it. do we just see that config is the same across multiple directories or do we introduce top level key called source that could be referenced by each directory?
Surely there are multiple ways to handle this, I like the idea of having top level source. So something like:
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
sources:
- name: source1
type: git
url: https://<repository-address>
ref: <branch-name>
- name: source2
type: git
url: https://<repository-address>
ref: <branch-name>
directories:
- path: docs/modules
contents:
- path: ROOT/partials
source: source1
includePaths:
- modules/*
newRootPath: modules/
- path: ROOT/images
source: source1
includePaths:
- images/*
newRootPath: images/
- path: ROOT/partials
source: source2
includePaths:
- modules/*
newRootPath: modules/
- path: ROOT/images
source: source2
includePaths:
- images/*
newRootPath: images/
- Define a top level
sourceskey which users can use to declare all supported sourcesgit,image,http,hgetc. - define a
sourcekey that can be used to link items to the declared sources.
OR
Have a top level source item and process all the directories for that item, then proceed with the next source and so on.
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
source:
name: source1
type: git
url: https://<repository-address>
ref: <branch-name>
directories:
- path: docs/modules
contents:
- path: ROOT/partials
includePaths:
- modules/*
newRootPath: modules/
- path: ROOT/images
includePaths:
- images/*
newRootPath: images/
source:
name: source2
type: git
url: https://<repository-address>
ref: <branch-name>
directories:
- path: docs/modules
contents:
- path: ROOT/partials
includePaths:
- modules/*
newRootPath: modules/
- path: ROOT/images
includePaths:
- images/*
newRootPath: images/
This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.
sources with a top level key seems like a right idea imho, though with slight modifications:
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
sources:
- name: source1
git:
url: https://<repository-address>
ref: <branch-name>
directories:
- path: docs/modules
contents:
- path: ROOT/partials
source: source1
includePaths:
- modules/*
newRootPath: modules/
This would be a good addition