Skip to content

Commit dbe204a

Browse files
StayerIgor Egorov
authored andcommitted
Fix upload to pypi
Signed-off-by: Alexey Rodionov <[email protected]>
1 parent ad8722e commit dbe204a

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

.jenkinsci/linux-build-wheels.groovy

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
def doPythonWheels() {
44
version = sh(script: 'git describe --tags \$(git rev-list --tags --max-count=1) || true', returnStdout: true).trim()
55
checkTag = sh(script: 'git describe --tags --exact-match ${GIT_COMMIT}', returnStatus: true)
6-
repo = "master"
7-
if (!checkTag) {
6+
if (checkTag != 0) {
87
version += ".dev" + env.BUILD_NUMBER
9-
repo = "develop"
108
}
119

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

2018
def publishWheels() {
21-
checkTag = sh(script: 'git describe --tags --exact-match ${GIT_COMMIT}', returnStatus: true)
22-
withCredentials([usernamePassword(credentialsId: 'ci_nexus', passwordVariable: 'CI_NEXUS_PASSWORD', usernameVariable: 'CI_NEXUS_USERNAME')]) {
23-
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}/{} \\;")
24-
sh(script: "cd wheelhouse && find . -type f -name \"iroha*.whl\" -exec echo 'https://nexus.iroha.tech/service/rest/repository/browse/artifacts/iroha-python/${repo}/{} \\;")
19+
repo = "release"
20+
checkTag = sh(script: 'git describe --tags --exact-match ${GIT_COMMIT}', returnStatus: true)
21+
version = sh(script: 'git describe --tags \$(git rev-list --tags --max-count=1) || true', returnStdout: true).trim()
22+
if (checkTag != 0) {
23+
version += ".dev" + env.BUILD_NUMBER
24+
repo = "develop"
2525
}
26-
if (checkTag) {
27-
iC = docker.image('quay.io/pypa/manylinux1_x86_64')
28-
iC.inside("") {
29-
sh(script: '/opt/python/cp35-cp35m/bin/pip install twine', returnStdout: true)
30-
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 \\;")
31-
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"
26+
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')]) {
27+
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}/{} \\;")
28+
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}/{}' \\;")
29+
30+
if (checkTag == 0) {
31+
iC = docker.image('quay.io/pypa/manylinux1_x86_64')
32+
iC.inside("") {
33+
sh(script: '/opt/python/cp35-cp35m/bin/pip install twine', returnStdout: true)
34+
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 \\;")
35+
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' \\;")
36+
sh "/opt/python/cp35-cp35m/bin/twine upload --skip-existing -u ${CI_PYPI_USERNAME} -p ${CI_PYPI_PASSWORD} wheelhouse/iroha*.whl"
37+
}
3238
}
3339
}
3440
}

Jenkinsfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,9 @@ pipeline {
7373
}
7474
}
7575
}
76+
post {
77+
cleanup {
78+
cleanWs()
79+
}
80+
}
7681
}

0 commit comments

Comments
 (0)