You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2019/12/25 21:19:23 UTC
[incubator-mxnet] branch master updated: [CD] enable s3 publish for
nightly builds in cd (#17112)
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 410165b [CD] enable s3 publish for nightly builds in cd (#17112)
410165b is described below
commit 410165b0a5f903edf500786d4c1b973e389c7b57
Author: Sheng Zha <sz...@users.noreply.github.com>
AuthorDate: Wed Dec 25 13:18:32 2019 -0800
[CD] enable s3 publish for nightly builds in cd (#17112)
* enable s3 publish for nightly builds in cd
* pass credential through env
* confine credential variables to subprocess
---
cd/python/pypi/Jenkins_pipeline.groovy | 3 ++-
cd/python/pypi/pypi_publish.py | 21 ++++++++++-----------
ci/docker/runtime_functions.sh | 9 +++++++++
3 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/cd/python/pypi/Jenkins_pipeline.groovy b/cd/python/pypi/Jenkins_pipeline.groovy
index e9f172a..fa9300d 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 7e09f64..2729068 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 b658f95..e078b2a 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 .