admin管理员组

文章数量:1122846

In installed argo-workflows Kubernetes Helm Chart from
I want to create a workflow which orchestrate some Powershell scripts.
So I created a test workflow like bellow:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  name: powershell-002
  namespace: argo-workflows
spec:
  entrypoint: run-powershell
  templates:
    - name: run-powershell
      script:
        image: mcr.microsoft/powershell:latest
        command: ["pwsh", -c]
        source: |
          Write-Host "Hello, Argo! This is a PowerShell script."
          $date = Get-Date
          Write-Host "The current date and time is: $date"

But the workflow run is failing with this error:

powershell-002: ResourceUnavailable: Program 'script' failed to run: An error occurred trying to start process '/argo/staging/script' with working directory '/'. Exec format errorAt line:1 char:1
powershell-002: + /argo/staging/script
powershell-002: + ~~~~~~~~~~~~~~~~~~~~.
powershell-002: time="2024-11-21T14:16:14 UTC" level=info msg="sub-process exited" argo=true error="<nil>"
powershell-002: Error: exit status 1

I tried to search for some related issues on argo documentation and internet but no clue about this error.
Could you please guide me to fix this error?

In installed argo-workflows Kubernetes Helm Chart from https://github.com/argoproj/argo-helm
I want to create a workflow which orchestrate some Powershell scripts.
So I created a test workflow like bellow:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  name: powershell-002
  namespace: argo-workflows
spec:
  entrypoint: run-powershell
  templates:
    - name: run-powershell
      script:
        image: mcr.microsoft.com/powershell:latest
        command: ["pwsh", -c]
        source: |
          Write-Host "Hello, Argo! This is a PowerShell script."
          $date = Get-Date
          Write-Host "The current date and time is: $date"

But the workflow run is failing with this error:

powershell-002: ResourceUnavailable: Program 'script' failed to run: An error occurred trying to start process '/argo/staging/script' with working directory '/'. Exec format errorAt line:1 char:1
powershell-002: + /argo/staging/script
powershell-002: + ~~~~~~~~~~~~~~~~~~~~.
powershell-002: time="2024-11-21T14:16:14 UTC" level=info msg="sub-process exited" argo=true error="<nil>"
powershell-002: Error: exit status 1

I tried to search for some related issues on argo documentation and internet but no clue about this error.
Could you please guide me to fix this error?

Share Improve this question asked Nov 21, 2024 at 14:24 LionLion 196 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Remove the "-c" in your command:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  name: powershell-002
  namespace: argo-workflows
spec:
  entrypoint: run-powershell
  templates:
    - name: run-powershell
      script:
        image: mcr.microsoft.com/powershell:latest
        command: ["pwsh"] ### <<---- HERE
        source: |
          Write-Host "Hello, Argo! This is a PowerShell script."
          $date = Get-Date
          Write-Host "The current date and time is: $date"

本文标签: linuxKubernetesArgo WorkflowPowershell script errorStack Overflow