kestra-io / plugin-scripts

https://kestra.io/plugins/
Apache License 2.0
9 stars 9 forks source link

Powershell Commands flow example failing to run #104

Closed shrutimantri closed 6 months ago

shrutimantri commented 9 months ago

Expected Behavior

The flow example should run successfully.

Actual Behaviour

Flow example execution fails with the following error: Object reference not set to an instance of an object.

2024-01-27 13:37:32,901 INFO  jdbc-queue_2 flow.powershell-command [namespace: dev] [flow: powershell-command] [execution: cIfkERVTtKcp2ucVFHDi2] Flow started
2024-01-27 13:37:32,967 INFO  worker_1     f.p.powershell_script [namespace: dev] [flow: powershell-command] [task: powershell_script] [execution: cIfkERVTtKcp2ucVFHDi2] [taskrun: 6TAlnOOMgqGEFb1gzhyBEi] [value: null] Type Commands started
2024-01-27 13:37:32,972 INFO  WorkerThread f.p.c.6TAlnOOMgqGEFb1gzhyBEi Provided 1 input(s).
2024-01-27 13:37:36,173 WARN  docker-java-stream--958154225 f.p.c.6TAlnOOMgqGEFb1gzhyBEi One or more errors occurred. (Object reference not set to an instance of an object.)
2024-01-27 13:37:37,864 WARN  docker-java-stream--958154225 f.p.c.6TAlnOOMgqGEFb1gzhyBEi Object reference not set to an instance of an object.
2024-01-27 13:37:38,016 WARN  docker-java-stream--958154225 f.p.c.6TAlnOOMgqGEFb1gzhyBEi 

2024-01-27 13:37:38,094 ERROR WorkerThread f.p.c.6TAlnOOMgqGEFb1gzhyBEi Command failed with code 1
io.kestra.plugin.scripts.exec.scripts.runners.ScriptException: Command failed with code 1
    at io.kestra.plugin.scripts.exec.scripts.runners.DockerScriptRunner.run(DockerScriptRunner.java:171)
    at io.kestra.plugin.scripts.exec.scripts.runners.CommandsWrapper.run(CommandsWrapper.java:159)
    at io.kestra.plugin.scripts.powershell.Commands.run(Commands.java:95)
    at io.kestra.plugin.scripts.powershell.Commands.run(Commands.java:20)
    at io.kestra.core.runners.Worker$WorkerThread.run(Worker.java:684)

Steps To Reproduce

Create a flow with the example given on this page and execute it.

Environment Information

Example flow

id: powershell
namespace: dev
tasks:
  - id: powershell_script
    type: io.kestra.plugin.scripts.powershell.Commands
    inputFiles:
      main.ps1: |
        Get-ChildItem | Format-List
    commands:
      - pwsh main.ps1
anna-geller commented 9 months ago

thx for the issue, the interpreter seems to be wrong

just doing:

id: powershell
namespace: dev
tasks:
  - id: powershell_script
    type: io.kestra.plugin.scripts.powershell.Commands
    commands:
      - pwd

will work but running scripts will not

loicmathieu commented 6 months ago

The interpreter of the Commands task was wrong, this has been fixed in the previous milestone: https://github.com/kestra-io/plugin-scripts/pull/126