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

Show templating debug in updatecli manifest show --debug #1470

Merged
merged 4 commits into from
Aug 18, 2023

Conversation

olblak
Copy link
Member

@olblak olblak commented Aug 16, 2023

Fix #954

This pullrequest shows a diff between the raw manifest and the templated manifest when running

updatecli manifest show --debug

Test

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

go build -o bin/updatecli
./bin/updatecli manifest show --debug
Successful templating
 ~/Pr/Updatecli/updatecli │ on @a20269f7 *141 !3  ./bin/updatecli manifest show --config /tmp/updatecli.yaml --values /tmp/scm.yaml --debug


+++++++++++
+ PREPARE +
+++++++++++

Loading Pipeline "/tmp/updatecli.yaml"
DEBUG: Golang templating change detected:
- - - raw manifest
+++ templated manifest

@@ -1,3 +1,8 @@
 scms:
   default:
-{{ .scms.default | toYaml | indent 4}}
+    kind: github
+    spec:
+        owner: updatecli
+        repository: updatecli
+        token: xxx
+        username: yyy


---

SCM repository retrieved: 1
DEBUG: stage: git-clone
...
On purpose failing templating
+++++++++++
+ PREPARE +
+++++++++++

Loading Pipeline "/tmp/updatecli.yaml"
DEBUG: Golang templating change detected:
--- raw manifest
+++ templated manifest
@@ -1,3 +1,8 @@
 scms:
   default:
-    {{ .scms.default | toYaml | indent 4}}
+        kind: github
+    spec:
+        owner: updatecli
+        repository: updatecli
+        token: xxx
+        username: yyy


---
ERROR: failed loading pipeline(s)
	* "/tmp/updatecli.yaml" - yaml: line 1: did not find expected key

0 pipeline(s) successfully loaded

Additional Information

Tradeoff

While thinking about this issue, I was concerned showing too much information like:

  1. Raw manifest content
  2. Post templating
  3. Post YAML parser

The purpose of the command updatecli manifest show sounds the perfect fit to debug the manifest

My second concern was leaking credentials from a CI environment, and it is unlikely that we run updatecli manifest show from a CI

Potential improvement

Maybe the debug flag shouldn't be needed when running updatecli manifest show

Signed-off-by: Olblak <me@olblak.com>
@olblak olblak added the ux label Aug 16, 2023
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak changed the title Show templating diff when running manifest show Show templating diff from updatecli manifest show --debug Aug 16, 2023
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak merged commit b15e5d1 into updatecli:main Aug 18, 2023
6 checks passed
@olblak olblak added the enhancement New feature or request label Aug 20, 2023
@olblak olblak changed the title Show templating diff from updatecli manifest show --debug Show templating debug in updatecli manifest show --debug Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Improve templating system observability
1 participant