diff --git a/examples/use/charts/vaultwardens.yaml b/examples/use/charts/vaultwardens.yaml new file mode 100644 index 0000000..7db7f41 --- /dev/null +++ b/examples/use/charts/vaultwardens.yaml @@ -0,0 +1,54 @@ +- name: vaultwarden + repository: badhouseplants + version: latest + extensions: + - name: Add virtual service to the chartc + target_dir: templates/extensions + source_dir: ./examples/extensions/vaultwarden + patches: + - name: Git patch 1 + git: + path: ./examples/patches/git/patch.diff + - name: Git patch 2 + git: + path: ./examples/patches/git/patch-2.diff + - name: yaml-fmt + custom_command: + commands: + - |- + cat <> .yamlfmt + formatter: + pad_line_comments: 2 + EOT + - yamlfmt values.yaml --conf ./yamlfmt.yaml + - rm -f yamlfmt.yaml + mirrors: + - badhouseplants-git + - custom-command +- name: vaultwarden + repository: badhouseplants + version: latest + extensions: + - name: Add virtual service to the chartc + target_dir: templates/extensions + source_dir: ./examples/extensions/vaultwarden + patches: + - name: Git patch 1 + git: + path: ./examples/patches/git/patch.diff + - name: Git patch 2 + git: + path: ./examples/patches/git/patch-2.diff + - name: yaml-fmt + custom_command: + commands: + - |- + cat <> .yamlfmt + formatter: + pad_line_comments: 2 + EOT + - yamlfmt values.yaml --conf ./yamlfmt.yaml + - rm -f yamlfmt.yaml + mirrors: + - badhouseplants-git + - custom-command diff --git a/helmule.yaml b/helmule.yaml index b2dd0ec..e1d7f2e 100644 --- a/helmule.yaml +++ b/helmule.yaml @@ -1,6 +1,7 @@ # mirror charts include: - Charts: ./examples/use/charts/vaultwarden.yaml + - kind: Charts + path: ./examples/use/charts/vaultwardens.yaml repositories: - name: metrics-server helm: diff --git a/src/config/include.rs b/src/config/include.rs index 09f6354..6029133 100644 --- a/src/config/include.rs +++ b/src/config/include.rs @@ -8,11 +8,17 @@ pub(crate) enum IncludeTypes { Repositories, } +#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +pub(crate) struct Include { + kind: IncludeTypes, + path: String, +} + pub(crate) fn apply_includes(config: &mut super::Config) -> Result<(), Box> { - for (kind, path) in config.include.clone().unwrap() { - match kind { + for include in config.include.clone().unwrap() { + match include.kind { IncludeTypes::Charts => { - let mut charts = include_chart(path)?; + let mut charts = include_chart(include.path)?; let extended_charts = match config.charts.clone() { Some(mut existing_charts) => { existing_charts.append(&mut charts); @@ -23,7 +29,7 @@ pub(crate) fn apply_includes(config: &mut super::Config) -> Result<(), Box { - let mut mirrors = include_mirrors(path)?; + let mut mirrors = include_mirrors(include.path)?; let extended_mirrors = match config.mirrors.clone() { Some(mut existing_mirrors) => { existing_mirrors.append(&mut mirrors); @@ -34,7 +40,7 @@ pub(crate) fn apply_includes(config: &mut super::Config) -> Result<(), Box { - let mut repositories = include_repositories(path)?; + let mut repositories = include_repositories(include.path)?; let extended_repositories = match config.repositories.clone() { Some(mut existing_repositories) => { existing_repositories.append(&mut repositories); diff --git a/src/config/mod.rs b/src/config/mod.rs index 8192d77..53d1ed8 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -8,7 +8,7 @@ pub(crate) mod include; #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] pub(crate) struct Config { - pub(crate) include: Option>, + pub(crate) include: Option>, pub(crate) variables: Option>, pub(crate) repositories: Option>, pub(crate) charts: Option>,