diff options
author | Jack Lloyd <[email protected]> | 2017-09-01 08:53:53 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-01 08:53:53 -0400 |
commit | b4f4053e15e8bf2b11edaa5bce0a004a93ecefb7 (patch) | |
tree | 554e11dd44f968e10590891cdb0356f7bc319f0a /src/scripts | |
parent | c53cfda7b5e2f57927041c67be9db10b18b2ba8a (diff) |
Just skip Sonar build if SONAR_TOKEN is not set
This is the case for a PR coming from an external repo
[ci skip]
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/ci_build.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/scripts/ci_build.py b/src/scripts/ci_build.py index 182799145..bbb2b6c06 100755 --- a/src/scripts/ci_build.py +++ b/src/scripts/ci_build.py @@ -25,15 +25,6 @@ def get_concurrency(): except ImportError: return def_concurrency -def getenv_or_die(var): - """ - Like it says... - """ - val = os.getenv(var) - if val is None: - raise Exception('Required variable %s not set in environment' % (var)) - return val - def determine_flags(target, target_os, target_cc, cc_bin, use_ccache, root_dir): # pylint: disable=too-many-branches,too-many-statements,too-many-arguments @@ -110,7 +101,7 @@ def determine_flags(target, target_os, target_cc, cc_bin, use_ccache, root_dir): '--out-dir', 'bw-outputs'] test_cmd = ['sonar-scanner', '-Dproject.settings=%s' % (os.path.join(root_dir, 'src', 'build-data', 'sonar-project.properties')), - '-Dsonar.login=%s' % (getenv_or_die('SONAR_TOKEN'))] + '-Dsonar.login=%s' % (os.getenv('SONAR_TOKEN'))] if is_cross_target: if target_os == 'ios': @@ -283,6 +274,10 @@ def main(args=None): target = args[1] + if target == 'sonar' and os.getenv('SONAR_TOKEN') is None: + print('Skipping Sonar scan due to missing SONAR_TOKEN env variable') + return 0 + root_dir = options.root_dir if os.access(root_dir, os.R_OK) != True: |