jfrog/setup-jfrog-cli

Windows runner pwsh not exiting on invalid jf rt upload command

Opened this issue · 0 comments

Describe the bug

The JFrog CLI when run under shell: pwsh should fail and exit when given an invalid jf rt upload ... command

For example:

on:
  push:
    branches:
      - main

jobs:
  test-exits-windows-normal-invalid-command:
    runs-on: windows-latest
    steps:
      - name: setup jfrog cli
        uses: jfrog/setup-jfrog-cli@v3

      - name: powershell actually exits on normal invalid command
        if: always()
        shell: pwsh
        run: |
          $ErrorActionPreference = 'Stop'
          someInvalidCommand
          jfrog rt --help


  test-exits-windows:
    runs-on: windows-latest
    steps:
      - name: setup jfrog cli
        uses: jfrog/setup-jfrog-cli@v3

      - name: powershell should also exit on invalid jfrog command
        if: always()
        shell: pwsh
        run: |
          $ErrorActionPreference = 'Stop'
          jfrog rt upload invalidcommand
          jfrog rt --help
  
  test-exits-linux:
    runs-on: ubuntu-latest
    steps:
      - name: setup jfrog cli
        uses: jfrog/setup-jfrog-cli@v3

      - name: Bash is fine and works correctly
        shell: bash
        run: |
          jfrog rt upload invalidcommand
          jfrog rt --help

results in
image

Notably, the passing step (which should be failing!) will correctly fail if the final line in the pwsh block is an invalid jfrog CLI command.

I believe that running a passing JFrog command (or any command?) after the failed command will cause the overall step to register as a pass.

Current behavior

invalid or incorrectly formatted jf rt upload ... commands, when run under shell: pwsh on windows runners do not exit.

Reproduction steps

run the workflow above

Expected behavior

invalid or incorrectly formatted jf rt upload ... commands, when run under shell: pwsh on windows runners should prevent the pwsh block from progressing.

Setup JFrog CLI version

uses: jfrog/setup-jfrog-cli@v3

JFrog CLI version

version: 2.50.4

Workflow operating system type and version

windows-latest

JFrog Artifactory version (if relevant)

No response

JFrog Xray version (if relevant)

No response