diff --git a/.jenkinsci/linux-build-wheels.groovy b/.jenkinsci/linux-build-wheels.groovy index 88112763..56e457c3 100644 --- a/.jenkinsci/linux-build-wheels.groovy +++ b/.jenkinsci/linux-build-wheels.groovy @@ -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;") @@ -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" + } } } } diff --git a/Jenkinsfile b/Jenkinsfile index 674c5a20..c670fccd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,4 +73,9 @@ pipeline { } } } + post { + cleanup { + cleanWs() + } + } }