Skip to content

Conversation

crenshaw-dev
Copy link
Member

Fixes #20408

The output is much nicer:

> argocd app actions run blue-green oops --kind Rollout --group argoproj.io  --all --grpc-web
FATA[0000] rpc error: code = Unknown desc = error getting Lua resource action: built-in script "argoproj.io/Rollout/actions/oops" does not exist

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
@crenshaw-dev crenshaw-dev requested a review from a team as a code owner October 16, 2024 20:11
Copy link

bunnyshell bot commented Oct 16, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@@ -24,13 +24,22 @@ import (

const (
incorrectReturnType = "expect %s output from Lua script, not %s"
incorrectInnerType = "expect %s inner type from Lua script, not %s"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field isn't used anymore, just deleted it while I was in here.

@@ -266,7 +266,7 @@ func TestGetHealthScriptNoPredefined(t *testing.T) {
vm := VM{}
script, useOpenLibs, err := vm.GetHealthScript(testObj)
require.NoError(t, err)
assert.True(t, useOpenLibs)
assert.False(t, useOpenLibs)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning false is fine, this return value won't be used when the returned script is "".

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.

Project coverage is 56.05%. Comparing base (cc98925) to head (80fe39f).
Report is 376 commits behind head on master.

Files with missing lines Patch % Lines
util/lua/lua.go 63.63% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20409      +/-   ##
==========================================
+ Coverage   56.02%   56.05%   +0.03%     
==========================================
  Files         322      322              
  Lines       44802    44810       +8     
==========================================
+ Hits        25099    25119      +20     
+ Misses      17104    17096       -8     
+ Partials     2599     2595       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
var doesNotExist *ScriptDoesNotExistError
if errors.As(err, &doesNotExist) {
// It's okay if no built-in health script exists. Just return an empty string and let the caller handle it.
return "", false, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "", false, nil
return "", false, nil

why are we returning error as nil here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the comment "It's okay if no built-in health script exists. Just return an empty string and let the caller handle it."

Absence of a health check isn't a problem in the context of this function. We just skip health checks for that resource.

Copy link
Member

@nitishfy nitishfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@crenshaw-dev crenshaw-dev merged commit c216ece into argoproj:master Oct 17, 2024
27 checks passed
4ch3los pushed a commit to 4ch3los/argo-cd that referenced this pull request Oct 17, 2024
… (argoproj#20409)

* chore(server): better error message for missing action

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Update util/lua/lua_test.go

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
… (argoproj#20409)

* chore(server): better error message for missing action

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Update util/lua/lua_test.go

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Adrian Aneci <aneci@adobe.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

argocd app actions run with invalid action name returns poor error message
3 participants