Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple manifest into one single file #1457

Merged
merged 4 commits into from
Aug 10, 2023

Conversation

olblak
Copy link
Member

@olblak olblak commented Aug 9, 2023

This pullrequest adds support for multiple Updatecli manifest into one YAML file.
Combined with the templating engine, this open the door to very advanced scenario but this also means complex manifest without jsonschema validation...

ps: worth mentioning by default if no pipelineid are defined, then they all share the same one

Fix #961

Test

To test this pull request, you can run the following commands:

cd pkg/core/config/
go test

Additional Information

Tradeoff

This feature allows to leverage the Golang templating with things like range such as in the following example

Simple manifest

values.yaml

names:
  - "Manifest 1"
  - "Manifest 2"

updatecli.yaml

{{- range $name := .names }}
---
name: {{ $name }}

sources:
  default:
    kind: shell
    spec:
      command: "echo 'Executing manifest {{ $name }}'"
{{- end }}

which shows

output
++++++++++++++++++
+ AUTO DISCOVERY +
++++++++++++++++++



++++++++++++
+ PIPELINE +
++++++++++++



##############
# MANIFEST 1 #
##############


SOURCES
=======

default
-------
The shell 🐚 command "/bin/sh /tmp/updatecli/bin/99aa0860859530c73d7b46e96b6a743321479b6f704e5ab92d961359e87fb0dd.sh" ran successfully with the following output:
----
Executing manifest Manifest 1
----
✔ shell command executed successfully


##############
# MANIFEST 2 #
##############


SOURCES
=======

default
-------
The shell 🐚 command "/bin/sh /tmp/updatecli/bin/2e064305c4cb4d9e1c4752a51558e7ff6338057f693aaf58b8bbc760e7050cfd.sh" ran successfully with the following output:
----
Executing manifest Manifest 2
----
✔ shell command executed successfully

=============================

REPORTS:



- Manifest 1:
	Source:
		✔ [default] 

- Manifest 2:
	Source:
		✔ [default] 

Run Summary
===========
Pipeline(s) run:
  * Changed:	0
  * Failed:	0
  * Skipped:	2
  * Succeeded:	0
  * Total:	2

Potential improvement

While looking into this I spotted the following improvement which would be useful:

  • Allowing to load manifest from http/https endpoint, we already have the code in Updatecli...
    • After having a quick look this would slightly complicate the code while bringing little benefits so I am going to skip on this one
  • Allowing to use json syntax, considering json is a subset of YAML. I did some early tests and everything seems to work as expected
  • the command updatecli manifest upgrade don't work with multiple manifest into the same file. I am not considering add the support in this pullrequest because I think this command should be rework anyway.

Signed-off-by: Olblak <me@olblak.com>
@olblak olblak added the enhancement New feature or request label Aug 9, 2023
@olblak olblak added this to the 0.57.0 milestone Aug 9, 2023
olblak and others added 2 commits August 9, 2023 18:42
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak merged commit 0994191 into updatecli:main Aug 10, 2023
6 checks passed
@olblak olblak deleted the issue/961/1 branch August 10, 2023 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: multiple/reusable configuration files
1 participant