jfrog / jfrog/setup-jfrog-cli

Windows runner pwsh not exiting on invalid jf rt upload command

Open
#113 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
266
Forks
110
Avg merge
3d 15h
Merged PRs (30d)
3

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the workflow on a windows-latest runner with shell: pwsh and JFrog CLI 2.50.4, comparing the invalid jf rt upload command with the invalid standalone PowerShell command. Trace how the setup action exposes or invokes JFrog CLI and how its exit status reaches the pwsh step. Done means an invalid upload command stops the workflow before the following jfrog rt --help command runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, powershell
Domain
ci-cd, cli, devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.