Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[CD] enable s3 publish for nightly builds in cd #17112

Merged
merged 3 commits into from
Dec 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cd/python/pypi/Jenkins_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
}
}

Expand Down
21 changes: 10 additions & 11 deletions cd/python/pypi/pypi_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']):
leezu marked this conversation as resolved.
Show resolved Hide resolved
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

Expand Down Expand Up @@ -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]))
9 changes: 9 additions & 0 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down