diff --git a/cd/python/pypi/Jenkins_pipeline.groovy b/cd/python/pypi/Jenkins_pipeline.groovy index e9f172a570fe..fa9300db3ca0 100644 --- a/cd/python/pypi/Jenkins_pipeline.groovy +++ b/cd/python/pypi/Jenkins_pipeline.groovy @@ -27,7 +27,7 @@ // This is a temporary solution until we are confident with the packages generated by CI // This should be removed in the not too distant future. // We only skip the publish step so we can still QA the other variants. -pypi_releases = ["cu92", "cu92mkl"] +pypi_releases = [] def get_pipeline(mxnet_variant) { def node_type = mxnet_variant.startsWith('cu') ? NODE_LINUX_GPU : NODE_LINUX_CPU @@ -72,6 +72,7 @@ def push(mxnet_variant) { } else { echo "Temporarily skipping publishing PyPI package for '${mxnet_variant}'." } + sh "./ci/docker/runtime_functions.sh cd_s3_publish" } } diff --git a/cd/python/pypi/pypi_publish.py b/cd/python/pypi/pypi_publish.py index 7e09f644c734..2729068dd503 100755 --- a/cd/python/pypi/pypi_publish.py +++ b/cd/python/pypi/pypi_publish.py @@ -35,10 +35,8 @@ def post_wheel(path): logging.info('Posting {} to PyPI'.format(path)) pypi_credentials = get_secret() - cmd = 'python3 -m twine upload --username {} --password {} {}'.format( - pypi_credentials['username'], - pypi_credentials['password'], - path) + cmd = 'python3 -m twine upload {}'.format(path) + version = os.path.basename(path).split('-')[1] # The PyPI credentials for DEV has username set to 'skipPublish' # This way we do not attempt to publish the PyPI package @@ -47,14 +45,15 @@ def post_wheel(path): print('In DEV account, skipping publish') print('Would have run: {}'.format(cmd)) return 0 - else: + elif any(test_version_mark in version for test_version_mark in ['a', 'b', 'dev']): print('Skipping publishing nightly builds to Pypi.') print('See https://github.com/pypa/pypi-support/issues/50 for details') return 0 - - # DO NOT PRINT CMD IN THIS BLOCK, includes password - p = subprocess.run(cmd.split(' '), - stdout=subprocess.PIPE) + else: + env = os.environ.copy() + env['TWINE_USERNAME'] = pypi_credentials['username'] + env['TWINE_PASSWORD'] = pypi_credentials['password'] + p = subprocess.run(cmd.split(' '), stdout=subprocess.PIPE, env=env) logging.info(p.stdout) return p.returncode @@ -85,7 +84,7 @@ def get_secret(): raise e else: return json.loads(get_secret_value_response['SecretString']) - - + + if __name__ == '__main__': sys.exit(post_wheel(sys.argv[1])) diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index b658f953a78a..e078b2a8f89c 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -2065,6 +2065,15 @@ cd_pypi_publish() { ./cd/python/pypi/pypi_publish.py `readlink -f wheel_build/dist/*.whl` } +cd_s3_publish() { + set -ex + pip3 install --user awscli + filepath=$(readlink -f wheel_build/dist/*.whl) + filename=$(basename $file_path) + variant=$(echo $filename | cut -d'-' -f1 | cut -d'_' -f2 -s) + aws s3 cp --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers,full=id=43f628fab72838a4f0b929d7f1993b14411f4b0294b011261bc6bd3e950a6822 s3://apache-mxnet/dist/${variant}/${filename} +} + build_static_scala_mkl() { set -ex pushd .