I’m trying to get code coverage on sonar for iOS, im following steps mentioned in this URL,
[Coverage & Test Data] Generate Reports for Swift
The below task in the pipeline is failing, before this task Xcode build is happening and .xcresult file is getting generated
task: Bash@3
inputs:
targetType: ‘inline’
script: |
brew install bash
bash $(build.Repository.LocalPath)/xccov-to-sonarqube-generic.sh $(build.Repository.LocalPath)/BCM/Build/Logs/Test/*.xcresult > $(build.Repository.LocalPath)/output.xml
the above task is failing with this below error,
/Users/runner/work/1/s/xccov-to-sonarqube-generic.sh: line 2: set: pipefail
: invalid option name
Ran the script in local, still giving the same error. Kindly let me know how to fix this issue with the script xccov-to-sonarqube-generic.sh
xcode verision 14.2
Sonar version 7.2
Hey there.
Are you using the
very latest version of the script
?
And, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:
7.2 → 7.9.6 → 8.9.10 → 9.9
You may find the
Upgrade Guide
and the
LTS-to-LTS Upgrade Notes for 7.9 to 8.9
, as well as the
LTS to LTS release upgrade notes for 8.9 to 9.9
helpful. If you have questions about upgrading, feel free to open a new thread for that
here
.
Hi Colin,
Sonar is hosted and maintained by a separate team and upgrade is not in our control.
And the script im using is
sonar-scanning-examples/xccov-to-sonarqube-generic.sh at master · SonarSource/sonar-scanning-examples · GitHub
please let me know if i need to use some other script.
Thanks!!!
Sure Colin,
But could you please guide us with the current issue, script is giving an error, even if we remove the first line “set -euo pipefail” from the script, we’re getting different error as below,
/Users/runner/work/1/s/xccov-to-sonarqube-generic.sh: line 2: $‘\r’: command not found
/Users/runner/work/1/s/xccov-to-sonarqube-generic.sh: line 3: $‘\r’: command not found
/Users/runner/work/1/s/xccov-to-sonarqube-generic.sh: line 4: syntax error near unexpected token `$‘{\r’’
/Users/runner/work/1/s/xccov-to-sonarqube-generic.sh: line 4: `function convert_xccov_to_xml {
Do let us know how this can be overcome. Thanks