fix: add warning messages when required secrets are not set #2248
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Currently, when required secrets (configured with secretspec) are missing, running
devenv shellfails to build the environment.It leads to a strange developer experience because adding a secret is not easy. Indeed the
secretspec checkcommand is accessible in the environment but the environment is not built.It also give clunky developer experience during onboarding (ie. When the secrets are not yet been set)
Proposed solution
I understand that we probably don't want to have a shell that has been built without
requiredsecrets. Because the shell won't completely be working.However it's a Chicken-Egg problem that need to be solved to ease the process of adding new secrets and onboard new developers.
My current implementation add a "Status concept" in the devenv structure. This status is updated when we assemble the environment. If we find "missing secrets", rather than bailing out, we change the status to
MissingSecretsand the rest of the process of "assembling the environment" continue.When we exec inside the shell, we can actually read the status and print a warning message to the user with some hints to fix the problem.
Before
After
Testing
To test this change:
devenv shellsecretspec checkinside the shell and configure secretsdevenv shellFuture works (if we want to)
devenv statusordevenv doctordevenv healthcheckResources
Let me know what I could change or if you have a better idea - I might have missed some side effects (I'm just ramping up on the code base :D)