diff --git a/gitlab/deploy.sh b/gitlab/deploy.sh index 7be644b3cb937c3eedbf169048d9c4e202bd993c..b8fe6bf0eaa58daf7552c2e6d22bf23436821e10 100755 --- a/gitlab/deploy.sh +++ b/gitlab/deploy.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Thu 22 Sep 2016 13:59:03 CEST +# Wed 11 Oct 2017 15:00:21 CEST source $(dirname ${0})/functions.sh @@ -15,12 +15,9 @@ if [ "${VISIBILITY}" != "public" ]; then exit 0 fi -lock_pypirc - log_info "Uploading package to ${PYPISERVER} on behalf of ${PYPIUSER}..." -setup_deploy check sdist --formats zip upload --repository production - -unlock_pypirc +twine register --username ${PYPIUSER} --password ${PYPIPASS} dist/*.zip +twine upload --username ${PYPIUSER} --password ${PYPIPASS} dist/*.zip condaforge_packages=("bob" \ "bob.buildout" \ diff --git a/gitlab/functions.sh b/gitlab/functions.sh index 99c31df2efe6e118191115b0bf987484e0757ec1..3fb8a039ab3ece58a8d811af6c767bedbcfd6b9f 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -119,89 +119,6 @@ run_cmd() { } -# Prepares ~/.pypirc -lock_pypirc() { - local lockfile=/var/tmp/pypirc_lock - local rc=${HOME}/.pypirc - local maxtries=10 - local try=0 - local sleeptime=30 #seconds - - while true; do - if [[ ${try} -lt ${maxtries} ]]; then - ((try++)) - if ( set -o noclobber; echo "$$" > "${lockfile}") 2> /dev/null; then - log_info "Successfully acquired ${lockfile}" - echo $$ > ${lockfile} - log_info "trapping on ${lockfile}..." - trap 'rm -f "${lockfile}"; exit $?' INT TERM EXIT - - # start: protected code - log_info "Creating ${rc}..." - if [ -e ${rc} ]; then - run_cmd rm -f ${rc} - fi - cat <<EOT >> ${rc} -[distutils] -index-servers = - production - staging - -[production] -username: ${PYPIUSER} -password: ${PYPIPASS} - -[staging] -repository: ${TESTSERVER} -username: ${PYPIUSER} -password: ${PYPIPASS} -EOT - run_cmd chmod 600 ${rc} - # end: protected code - break - else - log_warn "${lockfile} exists, owned by process $(cat $lockfile)" - log_info "Will retry after a ${sleeptime} seconds sleep (${try}/${maxtries})" - run_cmd sleep ${sleeptime} - fi - else - log_error "I already retried deploying ${try} times. Aborting..." - log_error "You can retry this step when less packages are building." - exit 1 - fi - done -} - - -# Cleans ~/.pypirc, if the lock file belongs to us -unlock_pypirc() { - local lockfile=/var/tmp/pypirc_lock - local rc=${HOME}/.pypirc - - # untrap if lock belongs to the running process - if [[ $(cat ${lockfile}) == $$ ]]; then - run_cmd rm -r ${lockfile} - run_cmd rm -rf ${rc} - log_info "$ trap - INT TERM EXIT" - trap - INT TERM EXIT - fi -} - - -# Runs setup.py in a deployment context. If fails, tries to unlock -# the ${HOME}/.pypirc file lock -setup_deploy() { - log_info "$ ${@}" - ${PREFIX}/bin/python setup.py ${@} - local status=$? - if [ ${status} != 0 ]; then - log_error "Command Failed \"${@}\"" - unlock_pypirc #just tries - exit ${status} - fi -} - - # Uploads a file to our intranet location via curl # $1: Path to the file to upload (e.g. dist/myfile.whl) # $2: Path on the server to upload to (e.g. private-upload/wheels/gitlab/) @@ -414,8 +331,6 @@ if [ -z "${PREFIX}" ]; then PREFIX=${CI_PROJECT_DIR}/build-prefix fi -TESTSERVER=https://testpypi.python.org/legacy/ - check_env OSNAME check_env VISIBILITY check_env IS_MASTER @@ -423,7 +338,6 @@ check_env PYVER check_env PREFIX export_env PREFIX check_env DOCSERVER -check_env TESTSERVER check_env CONDA_FOLDER check_env CONDA_ENV export_env BOB_PREFIX_PATH