Open AlmiS opened 5 months ago
Thanks for isolating the issue! I was aware of the behaviour "it will always appear to successfully decrypt/encrypt if pointed at a file", but hadn't had time to find out why it happened.
@energinet-digitalisering/substation-data anyone willing to test if this works as expected on v1.4.20? 🙏
Our team has a DevOps session tomorrow where this issue will come up. I will update this issue afterwards.
Ksail now fails when SOPS command fails, which I believe is expected behaviour.
ksail sops huginn-corp-dev --encrypt k8s/clusters/huginn-corp-dev/variables/variables-sensitive.sops.yaml
🔐 Encrypting 'k8s/clusters/huginn-corp-dev/variables/variables-sensitive.sops.yaml'
✕ SOPS encryption failed
Consider propagating the error from the child command.
I wanted to propagate the command to stdout, but the SOPS CLI did not behave like regular CLIs, and it requires a workaround, which I'm not a big fan of. Also, I'm not really sure how to do it with the CLIWrap library I am using to call CLIs from code. The issue was that SOPS CLI did not populate its stderr and stdout. More specifically I do not expect the command to cause an exception, but instead fail gracefully. SOPS causes an exception in CLIWrap, wherein the stderr output is unavailable.
I was in my testing only able to get the output from .NET propagated to stdout, but that really wasn't very informative, and it also gave away stacktrace info, which seemed irrelevant to the user in this context.
What do you think? Would it be valuable to you if I gave it another try?
Generally good error reporting can save the day.
Fortunately I have direct access to the author of this library - If I did not, I would argue for good error reporting :)
Description of the bug
It seems the CLI runner reports an exit code 0, even when the command returns something else:
https://github.com/energinet-digitalisering/ksail/blob/main/src/KSail/CLIWrappers/CLIRunner.cs Line 34.