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

Windows runner pwsh not exiting on invalid jf rt upload command #113

Open
JackMcTrimble opened this issue Nov 13, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@JackMcTrimble
Copy link

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

@JackMcTrimble JackMcTrimble added the bug Something isn't working label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant