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

run-sonar.sh always returns zero exit code by default #95

Open
Gimungagap opened this issue Oct 1, 2015 · 1 comment
Open

run-sonar.sh always returns zero exit code by default #95

Gimungagap opened this issue Oct 1, 2015 · 1 comment

Comments

@Gimungagap
Copy link

Hi there. I had an issue with failing builds on CI when quality gate is violated. I found the reason in using run-sonar.sh script which returns other value then the sonar-runner itself. I looked through the script and found the problem: if -v option is specified then script returns the result of command:

    elif [ "$vflag" = "on" ]; then
                ...
        if [[ $returnValue != 0 && $returnValue != 5 ]] ; then
            stopProgress
            echo "ERROR - Command '$command $@' failed with error code: $returnValue"
            exit $returnValue
        fi

But otherwise it returns the result of the previous operation ($?) instead:

    else
                ...
        if [[ $returnValue != 0 && $returnValue != 5 ]] ; then
            stopProgress
            echo "ERROR - Command '$command $@' failed with error code: $returnValue"
            exit $?

So in default mode the echo return value is used instead of the sonar-runner result and it is usually a zero. Is it a mistake or a feature? Maybe I'm missing something.

@Gimungagap Gimungagap changed the title Why error run-sonar.sh always returns zero by default Oct 1, 2015
@Gimungagap Gimungagap changed the title run-sonar.sh always returns zero by default run-sonar.sh always returns zero exit code by default Oct 1, 2015
@cyrilpicat
Copy link
Contributor

no I see no point, I think it's an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants