Skip to content

Commit

Permalink
Fix upload to pypi
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Rodionov <rodionov12@gmail.com>
  • Loading branch information
Stayer authored and Igor Egorov committed Apr 19, 2019
1 parent ad8722e commit dbe204a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .jenkinsci/linux-build-wheels.groovy
Expand Up @@ -3,10 +3,8 @@
def doPythonWheels() {
version = sh(script: 'git describe --tags \$(git rev-list --tags --max-count=1) || true', returnStdout: true).trim()
checkTag = sh(script: 'git describe --tags --exact-match ${GIT_COMMIT}', returnStatus: true)
repo = "master"
if (!checkTag) {
if (checkTag != 0) {
version += ".dev" + env.BUILD_NUMBER
repo = "develop"
}

sh(script: "sed -i.bak 's/{{ PYPI_VERSION }}/${version}/g' setup.py;")
Expand All @@ -18,17 +16,25 @@ def doPythonWheels() {
}

def publishWheels() {
checkTag = sh(script: 'git describe --tags --exact-match ${GIT_COMMIT}', returnStatus: true)
withCredentials([usernamePassword(credentialsId: 'ci_nexus', passwordVariable: 'CI_NEXUS_PASSWORD', usernameVariable: 'CI_NEXUS_USERNAME')]) {
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec curl -u ${CI_NEXUS_USERNAME}:${CI_NEXUS_PASSWORD} --upload-file {} https://nexus.iroha.tech/repository/artifacts/iroha-python/${repo}/{} \\;")
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec echo 'https://nexus.iroha.tech/service/rest/repository/browse/artifacts/iroha-python/${repo}/{} \\;")
repo = "release"
checkTag = sh(script: 'git describe --tags --exact-match ${GIT_COMMIT}', returnStatus: true)
version = sh(script: 'git describe --tags \$(git rev-list --tags --max-count=1) || true', returnStdout: true).trim()
if (checkTag != 0) {
version += ".dev" + env.BUILD_NUMBER
repo = "develop"
}
if (checkTag) {
iC = docker.image('quay.io/pypa/manylinux1_x86_64')
iC.inside("") {
sh(script: '/opt/python/cp35-cp35m/bin/pip install twine', returnStdout: true)
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec echo 'https://nexus.iroha.tech/service/rest/repository/browse/artifacts/iroha-python/latest.whl \\;")
sh "/opt/python/cp35-cp35m/bin/twine upload --skip-existing -u ${ci_pypi_username} -p ${ci_pypi_password} --repository-url https://test.pypi.org/legacy/ wheelhouse/iroha*.whl"
withCredentials([usernamePassword(credentialsId: 'ci_nexus', passwordVariable: 'CI_NEXUS_PASSWORD', usernameVariable: 'CI_NEXUS_USERNAME'), usernamePassword(credentialsId: 'ci_iroha_pypi', passwordVariable: 'CI_PYPI_PASSWORD', usernameVariable: 'CI_PYPI_USERNAME')]) {
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec curl -u ${CI_NEXUS_USERNAME}:${CI_NEXUS_PASSWORD} --upload-file {} https://nexus.iroha.tech/repository/artifacts/iroha-python/${repo}/{} \\;")
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec echo 'Wheel available at https://nexus.iroha.tech/service/rest/repository/browse/artifacts/iroha-python/${repo}/{}' \\;")

if (checkTag == 0) {
iC = docker.image('quay.io/pypa/manylinux1_x86_64')
iC.inside("") {
sh(script: '/opt/python/cp35-cp35m/bin/pip install twine', returnStdout: true)
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec curl -u ${CI_NEXUS_USERNAME}:${CI_NEXUS_PASSWORD} --upload-file {} https://nexus.iroha.tech/repository/artifacts/iroha-python/latest.whl \\;")
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec echo 'Latest release available at https://nexus.iroha.tech/service/rest/repository/browse/artifacts/iroha-python/latest.whl' \\;")
sh "/opt/python/cp35-cp35m/bin/twine upload --skip-existing -u ${CI_PYPI_USERNAME} -p ${CI_PYPI_PASSWORD} wheelhouse/iroha*.whl"
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions Jenkinsfile
Expand Up @@ -73,4 +73,9 @@ pipeline {
}
}
}
post {
cleanup {
cleanWs()
}
}
}

0 comments on commit dbe204a

Please sign in to comment.