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

resource template output parameter valueFrom.jqFilter results in error in v3.4.0 #9654

Closed
2 of 3 tasks
hype-eater opened this issue Sep 21, 2022 · 1 comment · Fixed by #9679
Closed
2 of 3 tasks
Labels
area/executor area/templates/resource P3 Low priority solution/suggested A solution to the bug has been suggested. Someone needs to implement it. type/bug

Comments

@hype-eater
Copy link

hype-eater commented Sep 21, 2022

Pre-requisites

  • I have double-checked my configuration
  • I can confirm the issues exists when I tested with :latest
  • I'd like to contribute the fix myself (see contributing guide)

What happened/what you expected to happen?

What happened: Defining an output parameter for a resource template using valueFrom.jqFilter results failed Workflow with message Error (exit code 1): exec: "sh": executable file not found in $PATH. The node's main container (argoexec) is the source of the error: "exec: \"sh\": executable file not found in $PATH".

What I expect: No error

The code appears to specify a container command that will not work because the (freshly slimmed down) argoexec image no longer has sh:

cmdStr := fmt.Sprintf("kubectl get %s -o json | jq -rc '%s'", strings.Join(resArgs, " "), param.ValueFrom.JQFilter)
cmd = exec.Command("sh", "-c", cmdStr)

Version

v3.4.0

Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: resource-jq-
spec:
  serviceAccountName: argo
  entrypoint: main
  templates:
  - name: main
    resource:
      action: get
      manifest: |
        apiVersion: v1
        kind: ConfigMap
        metadata:
          name: workflow-controller-configmap
    outputs:
      parameters:
      - name: data
        valueFrom:
          jqFilter: '.'

Logs from the workflow controller

$ kubectl logs -n argo deploy/workflow-controller | grep ${workflow}
time="2022-09-21T22:19:20.722Z" level=info msg="Processing workflow" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:20.725Z" level=info msg="Updated phase  -> Running" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:20.725Z" level=info msg="Pod node resource-jq-7dbdd initialized Pending" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:20.738Z" level=info msg="Created pod: resource-jq-7dbdd (resource-jq-7dbdd)" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:20.738Z" level=info msg="TaskSet Reconciliation" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:20.738Z" level=info msg=reconcileAgentPod namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:20.747Z" level=info msg="Workflow update successful" namespace=argo phase=Running resourceVersion=1226 workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.723Z" level=info msg="Processing workflow" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.723Z" level=info msg="Task-result reconciliation" namespace=argo numObjs=0 workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.724Z" level=info msg="node changed" namespace=argo new.message="Error (exit code 1): exec: \"sh\": executable file not found in $PATH" new.phase=Failed new.progress=0/1 nodeID=resource-jq-7dbdd old.message= old.phase=Pending old.progress=0/1 workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.724Z" level=info msg="TaskSet Reconciliation" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.724Z" level=info msg=reconcileAgentPod namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.725Z" level=info msg="Updated phase Running -> Failed" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.725Z" level=info msg="Updated message  -> Error (exit code 1): exec: \"sh\": executable file not found in $PATH" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.725Z" level=info msg="Marking workflow completed" namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.725Z" level=info msg="Checking daemoned children of " namespace=argo workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.732Z" level=info msg="cleaning up pod" action=deletePod key=argo/resource-jq-7dbdd-1340600742-agent/deletePod
time="2022-09-21T22:19:30.737Z" level=info msg="Workflow update successful" namespace=argo phase=Failed resourceVersion=1255 workflow=resource-jq-7dbdd
time="2022-09-21T22:19:30.749Z" level=info msg="cleaning up pod" action=labelPodCompleted key=argo/resource-jq-7dbdd/labelPodCompleted

Logs from in your workflow's wait container

main container logs (not the wait container logs) as this is a resource type template

$ kubectl logs -l workflows.argoproj.io/workflow=${workflow},workflow.argoproj.io/phase!=Succeeded -n argo
time="2022-09-21T22:19:22.145Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=argo podName=resource-jq-7dbdd template="{\"name\":\"main\",\"inputs\":{},\"outputs\":{\"parameters\":[{\"name\":\"data\",\"valueFrom\":{\"jqFilter\":\".\"}}]},\"metadata\":{},\"resource\":{\"action\":\"get\",\"manifest\":\"apiVersion: v1\\nkind: ConfigMap\\nmetadata:\\n  name: workflow-controller-configmap\\n\"},\"archiveLocation\":{\"archiveLogs\":true,\"s3\":{\"endpoint\":\"minio:9000\",\"bucket\":\"my-bucket\",\"insecure\":true,\"accessKeySecret\":{\"name\":\"my-minio-cred\",\"key\":\"accesskey\"},\"secretKeySecret\":{\"name\":\"my-minio-cred\",\"key\":\"secretkey\"},\"key\":\"resource-jq-7dbdd/resource-jq-7dbdd\"}}}" version="&Version{Version:v3.4.0,BuildDate:2022-09-19T03:47:58Z,GitCommit:047952afd539d06cae2fd6ba0b608b19c1194bba,GitTag:v3.4.0,GitTreeState:clean,GoVersion:go1.18.6,Compiler:gc,Platform:linux/amd64,}"
time="2022-09-21T22:19:22.145Z" level=info msg="Loading manifest to /tmp/manifest.yaml"
time="2022-09-21T22:19:22.145Z" level=info msg="kubectl get -f /tmp/manifest.yaml -o json"
time="2022-09-21T22:19:22.208Z" level=info msg="Resource: argo/configmap./workflow-controller-configmap. SelfLink: api/v1/namespaces/argo/configmaps/workflow-controller-configmap"
time="2022-09-21T22:19:22.208Z" level=info msg="Saving resource output parameters"
time="2022-09-21T22:19:22.208Z" level=info msg="[sh -c kubectl get configmap./workflow-controller-configmap -n argo -o json | jq -rc '.']"
time="2022-09-21T22:19:22.208Z" level=error msg="executor error: exec: \"sh\": executable file not found in $PATH"
time="2022-09-21T22:19:22.208Z" level=fatal msg="exec: \"sh\": executable file not found in $PATH"
time="2022-09-21T22:19:23.103Z" level=info msg="sub-process exited" argo=true error="<nil>"
Error: exit status 1
@sarabala1979
Copy link
Member

@hype-eater Do you like to submit the PR for this issue?

terrytangyuan added a commit that referenced this issue Sep 25, 2022
…#9654 (#9679)

fix: sh not available in scratch container but used in argoexec

Signed-off-by: Rohan Kumar <[email protected]>

Signed-off-by: Rohan Kumar <[email protected]>
Co-authored-by: Yuan Tang <[email protected]>
chenyangxueHDU pushed a commit to chenyangxueHDU/argo that referenced this issue Sep 29, 2022
…argoproj#9654 (argoproj#9679)

fix: sh not available in scratch container but used in argoexec

Signed-off-by: Rohan Kumar <[email protected]>

Signed-off-by: Rohan Kumar <[email protected]>
Co-authored-by: Yuan Tang <[email protected]>
Signed-off-by: yangxue.chen <[email protected]>
juchaosong pushed a commit to juchaosong/argo-workflows that referenced this issue Nov 3, 2022
…argoproj#9654 (argoproj#9679)

fix: sh not available in scratch container but used in argoexec

Signed-off-by: Rohan Kumar <[email protected]>

Signed-off-by: Rohan Kumar <[email protected]>
Co-authored-by: Yuan Tang <[email protected]>
Signed-off-by: juchao <[email protected]>
@agilgur5 agilgur5 changed the title resource template output parameter valueFrom.jqFilter results in error in v3.4.0 resource template output parameter valueFrom.jqFilter results in error in v3.4.0 Apr 26, 2024
@agilgur5 agilgur5 added area/templates/resource solution/suggested A solution to the bug has been suggested. Someone needs to implement it. labels Apr 26, 2024
@argoproj argoproj locked as resolved and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/executor area/templates/resource P3 Low priority solution/suggested A solution to the bug has been suggested. Someone needs to implement it. type/bug
Projects
None yet
3 participants