Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

glab ci lint provides 0 exit code #985

Open
bryant-finney opened this issue Apr 4, 2022 · 2 comments
Open

glab ci lint provides 0 exit code #985

bryant-finney opened this issue Apr 4, 2022 · 2 comments
Labels
bug Something isn't working stale

Comments

@bryant-finney
Copy link

bryant-finney commented Apr 4, 2022

Description

When using glab client to lint my CI configuration, I expect the command's exit code to reflect the linting results. However, the command returns a 0 exit code, even on linting failure.

Expected Behavior vs Actual Behavior and Steps to Reproduce

$ echo "gibberish" >junk.yml && glab ci lint junk.yml
Getting contents in junk.yml
Validating...
junk.yml is invalid
1 Invalid configuration format

$ echo $?        # expected result != 0
0

Related issue: #911

Possible Fix

curl and httpie both provide flags to return a non-zero exit code based on the HTTP status: --fail and --check-status, respectively. Because this would maintain backwards compatibility, implementing a similar optional argument might make the most sense.

Environment

$ glab --version
glab version 1.21.1 (2021-09-29)

$ cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.15.2
PRETTY_NAME="Alpine Linux v3.15"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

# same behavior on host
$ glab --version
glab version 1.22.0 (2022-01-10)

$ sw_vers && uname -rmv
ProductName:    macOS
ProductVersion: 12.3
BuildVersion:   21E230
21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000 arm64
@bryant-finney bryant-finney added the bug Something isn't working label Apr 4, 2022
@bryant-finney bryant-finney changed the title Add --fail flag for POST requests glab ci lint provides 0 exit code Apr 4, 2022
@clemsbot
Copy link
Collaborator

clemsbot commented May 4, 2022

This issue has been automatically marked as stale because it has not had recent activity. We haven't had the time to address it yet, but we want to keep it open. This message is just a reminder for us to help triage issues.

@clemsbot clemsbot added the stale label May 4, 2022
@johnmarcou
Copy link

Same issue here.
Workaround:

glab ci lint | grep Valid! && echo continue-with-other-commands

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants