contiguous json pointer in command returns error #9

Closed
opened 2021-11-05 10:32:25 +01:00 by suchademon · 2 comments

What do you want to achieve (expected behaviour)?

Having two/or more times jason pointers contiguose in the command which are getting then fetched by webhookey from the json body and replaced by the value from the pointer and turn into a full command for execution.

What is the result?

Webhookey posts the following error in the logs:

webhookey[97649]: [2021-11-05T09:08:13Z ERROR webhookey] Could not get string from: Object({"action": String("closed"), "number": Number(64)..<the full body of the webhook>...
webhookey[97649]: thread '<unnamed>' panicked at 'not implemented', src/main.rs:418:13

Steps to reproduce the problem

  1. modify config.yaml e.g. add a new hook like this:
command_two_pointers:
  command: /usr/bin/echo {{ /repository/full_name }} {{ /pull_request/base/ref }}
  signature: X-Gitea-Signature
  secrets:
    - <YOUR SEKRET>
  filter:
      json:
        pointer: /action
        regex: 'closed'
  1. Restart webhookey
  2. perform action in gitea to trigger webhook (config above matches PRs when they get closed)

Additional information

If you add something like --param1 and --param2 before the pointers in the command it works without any issues

Further information

  • Version and commit id: 0.1.0

System information

  • Operating system: Debian 10
# What do you want to achieve (expected behaviour)? Having two/or more times jason pointers contiguose in the command which are getting then fetched by webhookey from the json body and replaced by the value from the pointer and turn into a full command for execution. # What is the result? Webhookey posts the following error in the logs: ``` webhookey[97649]: [2021-11-05T09:08:13Z ERROR webhookey] Could not get string from: Object({"action": String("closed"), "number": Number(64)..<the full body of the webhook>... webhookey[97649]: thread '<unnamed>' panicked at 'not implemented', src/main.rs:418:13 ``` # Steps to reproduce the problem 1. modify config.yaml e.g. add a new hook like this: ```yaml command_two_pointers: command: /usr/bin/echo {{ /repository/full_name }} {{ /pull_request/base/ref }} signature: X-Gitea-Signature secrets: - <YOUR SEKRET> filter: json: pointer: /action regex: 'closed' ``` 2. Restart webhookey 3. perform action in gitea to trigger webhook (config above matches PRs when they get closed) # Additional information If you add something like `--param1` and `--param2` before the pointers in the command it works without any issues # Further information - Version and commit id: 0.1.0 # System information - Operating system: Debian 10
suchademon added the
bug
label 2021-11-05 10:32:25 +01:00
Owner

Nice catch, looking into it.

Nice catch, looking into it.
finga closed this issue 2021-11-06 11:10:27 +01:00
finga reopened this issue 2021-11-16 12:37:21 +01:00
Owner

Now following command

/usr/local/scripts/gitea/pullrequest_lint_and_validate.sh --org {{ /pull_request/head/repo/owner/login }} --repo {{ /pull_request/head/repo/name }} --prid {{ /pull_request/number }} --targetbr {{ /pull_request/base/sha }} --sourcebr {{ /pull_request/head/sha }}

results in another error:

Nov 15 12:52:42 gitea01 webhookey[57281]: [2021-11-15T12:52:42Z ERROR webhookey] Could not parse command: error Many0 at: {{ /pull_request/number }} --targetbr {{ /pull_request/base/sha }} --sourcebr {{ /pull_request/head/sha }}
Now following `command` ``` /usr/local/scripts/gitea/pullrequest_lint_and_validate.sh --org {{ /pull_request/head/repo/owner/login }} --repo {{ /pull_request/head/repo/name }} --prid {{ /pull_request/number }} --targetbr {{ /pull_request/base/sha }} --sourcebr {{ /pull_request/head/sha }} ``` results in another error: ``` Nov 15 12:52:42 gitea01 webhookey[57281]: [2021-11-15T12:52:42Z ERROR webhookey] Could not parse command: error Many0 at: {{ /pull_request/number }} --targetbr {{ /pull_request/base/sha }} --sourcebr {{ /pull_request/head/sha }} ```
finga closed this issue 2021-11-17 13:28:21 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: finga/webhookey#9
No description provided.