From 498f6951a32af9fe95b92fc1c199f987d81b5fa7 Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Thu, 25 Oct 2018 14:31:26 +0200 Subject: [PATCH] Use Aki's solution --- .travis.yml | 21 ++++++++++++++----- .../integration/test_integration_script.py | 11 ++++++++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0928648..952ecf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ sudo: required # Needed to install a recent version of OpenJDK as well as Python 3.7 +dist: xenial -language: java +language: python + +env: + JAVA_HOME=/usr/lib/jvm/java-8-oracle matrix: fast_finish: true @@ -8,13 +12,20 @@ matrix: - python: 3.6 env: TOXENV=py36 - jdk: openjdk7 - python: 3.7 - dist: xenial # from https://github.com/travis-ci/travis-ci/issues/9815#issuecomment-401756442 - group: edge # see https://github.com/travis-ci/travis-ci/issues/10212#issuecomment-429422646 env: TOXENV=py37 - jdk: openjdk8 + + +before_install: + # Install oracle java 8, because jarsigner in openjdk 11.0.1+13 breaks + # integration tests. + # https://github.com/mozilla-releng/signingscript/issues/80 + - sudo add-apt-repository -y ppa:webupd8team/java + - sudo apt-get update + - echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections + - echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections + - sudo apt-get install oracle-java8-installer install: - travis_retry pip install tox diff --git a/pushapkscript/test/integration/test_integration_script.py b/pushapkscript/test/integration/test_integration_script.py index 104b977..4bec0a0 100644 --- a/pushapkscript/test/integration/test_integration_script.py +++ b/pushapkscript/test/integration/test_integration_script.py @@ -15,6 +15,12 @@ test_data_dir = os.path.join(this_dir, '..', 'data') +def _get_java_path(tool_name): + if os.environ.get('JAVA_HOME'): + return os.path.join(os.environ['JAVA_HOME'], 'bin', tool_name) + return tool_name + + class KeystoreManager(object): def __init__(self, test_data_dir, certificate_alias='nightly', keystore_password='12345678'): self.keystore_path = os.path.join(test_data_dir, 'keystore') @@ -23,7 +29,7 @@ def __init__(self, test_data_dir, certificate_alias='nightly', keystore_password def add_certificate(self, certificate_path): subprocess.run([ - 'keytool', '-import', '-noprompt', + _get_java_path('keytool'), '-import', '-noprompt', '-keystore', self.keystore_path, '-storepass', self.keystore_password, '-file', certificate_path, '-alias', self.certificate_alias ]) @@ -49,6 +55,7 @@ def _generate_json(self): "schema_file": "{project_data_dir}/pushapk_task_schema.json", "verbose": true, + "jarsigner_binary": "{binary}", "jarsigner_key_store": "{keystore_path}", "jarsigner_certificate_alias": "{certificate_alias}", "google_play_accounts": {{ @@ -60,7 +67,7 @@ def _generate_json(self): "taskcluster_scope_prefix": "project:releng:googleplay:" }}'''.format( work_dir=self.work_dir, test_data_dir=self.test_data_dir, project_data_dir=project_data_dir, - keystore_path=self.keystore_manager.keystore_path, + binary=_get_java_path('jarsigner'), keystore_path=self.keystore_manager.keystore_path, certificate_alias=self.keystore_manager.certificate_alias ))