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

How to pass temporary file name as command line argument? #358

Open
robertmircea opened this issue Nov 30, 2019 · 1 comment
Open

How to pass temporary file name as command line argument? #358

robertmircea opened this issue Nov 30, 2019 · 1 comment

Comments

@robertmircea
Copy link

I am trying to perform the following scenario:

  • read entire payload
  • save the payload to disk in a temporary file
  • execute a command with temporary file name as argument

How can I pass the temporary file name as command line argument for the command to execute? I've reached this stage, but it doesn't work. Ideally I would not like to use a shell script, but call jq directly.

---
- id: "echo"
  execute-command: "jq"
  command-working-directory: ""
  pass-arguments-to-command:
    - source: string
      name: "."
  pass-file-to-command:
    - source: entire-payload
      name: payload

and the output:

[webhook] 2019/11/30 17:27:55 200 | 129.59µs | localhost:9000 | POST /hooks/echo
[webhook] 2019/11/30 17:27:55 [466d25] writing env HOOK_PAYLOAD file /var/folders/c6/45sj77fj3d74s5qn5sxk44mr0000gn/T/HOOK_PAYLOAD060293216
[webhook] 2019/11/30 17:27:55 [466d25] executing jq (/usr/local/bin/jq) with arguments ["jq" "."] and environment [HOOK_PAYLOAD=/var/folders/c6/45sj77fj3d74s5qn5sxk44mr0000gn/T/HOOK_PAYLOAD060293216] using  as cwd
[webhook] 2019/11/30 17:27:55 [466d25] command output:
[webhook] 2019/11/30 17:27:55 [466d25] removing file /var/folders/c6/45sj77fj3d74s5qn5sxk44mr0000gn/T/HOOK_PAYLOAD060293216
[webhook] 2019/11/30 17:27:55 [466d25] finished handling echo
@moorereason
Copy link
Collaborator

There's currently no way to do what you want without a shell script. pass-file-to-command only provides the filename as an environment variable, and webhook doesn't provide a means of passing that value to pass-arguments-to-command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants