Bug Fix -- SonarQube Quality Gate GH Action Bug on MacOS Runners

Must-share information (formatted with Markdown):

  • sonarqube-quality-gate-action@master (our server runs SonarQube DE 9.9.0.65466), script check-quality-gate.sh
  • GH action is being run in GH runner MacOS 12.6.7
  • Goal: Fix bug regarding running action on MacOS

Issue

When running sonarqube-quality-gate-action@master’s check-quality-gate.sh on our MacOS GH action, the action fails with the following error:

Run $GITHUB_ACTION_PATH/script/check-quality-gate.sh $GITHUB_REPO/.scannerwork/report-task.txt
  $GITHUB_ACTION_PATH/script/check-quality-gate.sh $GITHUB_REPO/.scannerwork/report-task.txt
  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    SONAR_TOKEN: ***
    SONAR_HOST_URL: ***
usage: sleep seconds
.
Error: Process completed with exit code 1.

After further investigation, this refers to line 42 https://github.com/SonarSource/sonarqube-quality-gate-action/blob/master/script/check-quality-gate.sh, where the command sleep 5s does not work on MacOS. Rather, MacOS expects the format to be sleep 5, where the unit is by default seconds.

Thankfully, on a Ubuntu environment, sleep 5 also works.

I’m proposing simply changing line 42 from sleep 5ssleep 5, which both supports MacOS runners and existing Ubuntu runners

Worth nothing the job still runs the quality gate, but the Action itself fails because of the non-zero exit code.

Hello @cdelahanty ,

Welcome to the community!

Your contribution has been approved and merged, thanks a lot for looking into that.

Best

2 Likes

Of course – thanks so much Jacek!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.