add validation to argocd app set -p#309
add validation to argocd app set -p#309JazminElkan-Gonzalez merged 2 commits intoargoproj:masterfrom
Conversation
server/application/application.go
Outdated
There was a problem hiding this comment.
Do we want to extract this into the Utils since it's the same code on server and cli?
There was a problem hiding this comment.
if we put this into CheckValidParam than we have to loop through it for every parameter, I put it here so we would only have to loop through it once per UpdateSpec. rather than once per parameter.
I could make a Util that is "convertToMap" that does the loop as a separate function.
server/application/application.go
Outdated
There was a problem hiding this comment.
-
The error check that used to come immediately after the Applications().Get() request, now comes after this large code block. So its possible to get a nil pointer exception while you are attempting to validate the params (a might be nil).
-
I think this validation logic is large enough that it should be put into a separate function to keep the UpdateSpec more concise.
There was a problem hiding this comment.
- ah good point will reorder.
- ok, makes sense will create a helper function tomorrow.
thanks for the feedback!
cmd/argocd/commands/app.go
Outdated
There was a problem hiding this comment.
I don't see the need to do this client side validation if we are already doing this server side
There was a problem hiding this comment.
mm the thought was to have it fail fast (before it even gets to the server side logic). but given that it's a relatively costly process / to keep things clean, I think it makes sense to omit this.
6c0cc44 to
abd9900
Compare
|
@jessesuen I made the changes we spoke about, here is some example outputs. |
jessesuen
left a comment
There was a problem hiding this comment.
LGTM! please squash commits when merging
abd9900 to
73c27cd
Compare
73c27cd to
162d4b6
Compare
…tion (argoproj#309) Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>

This fixes #195
I rebased to clean up commit history but change was contributed by @dthomson25
Util function checks if a given parameter matches component and name to a parameter in the given application.
server side "updateSpec" function uses util to verify passed override parameters along with all previous override parameters.
client side "app set" function also uses util to verify passed override parameter before calling "updateSpec"
throws error if passed parameter is illegal, warns users if any old overrides are dropped