Changeset View
Changeset View
Standalone View
Standalone View
jobs/templates/swh-pipeline.yaml
Show All 12 Lines | parameters: | ||||
- git-parameter: | - git-parameter: | ||||
name: REVISION | name: REVISION | ||||
type: PT_REVISION | type: PT_REVISION | ||||
defaultValue: master | defaultValue: master | ||||
description: Git revision to build. | description: Git revision to build. | ||||
- string: | - string: | ||||
name: PHID | name: PHID | ||||
description: PHID of the Phabricator target object on which results will be reported. | description: PHID of the Phabricator target object on which results will be reported. | ||||
- string: | |||||
name: PYPI | |||||
description: | | |||||
PYPI registry to publish to when built revision is a tag. There | |||||
must exists a usernamePassword credential object with that name. | |||||
The pypi JSON API endpoint is built as https://$PYPI/project/<name>/json | |||||
default: test.pypi.org | |||||
- string: | |||||
name: PYPI_UPLOAD | |||||
description: | | |||||
PYPI upload base host. If unset, defaults to $PYPI. The upload endpoint is built as | |||||
https://$PYPI_UPLOAD/legagy/ | |||||
- bool: | |||||
name: FORCE_UPLOAD | |||||
default: false | |||||
description: | | |||||
Force uploading python packages on the chosen PYPI registry. | |||||
dsl: | | dsl: | | ||||
pipeline {{ | pipeline {{ | ||||
agent {{ label 'swh-tox' }} | agent {{ label 'swh-tox' }} | ||||
environment {{ | environment {{ | ||||
PHAB_CONDUIT_URL = 'https://forge.softwareheritage.org/api/' | PHAB_CONDUIT_URL = 'https://forge.softwareheritage.org/api/' | ||||
}} | }} | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | dsl: | | ||||
testResults: 'test-results.xml' | testResults: 'test-results.xml' | ||||
// disabled for now, requires the plugin Warning v5 (still in RC) | // disabled for now, requires the plugin Warning v5 (still in RC) | ||||
//recordIssues enabledForFailure: true, | //recordIssues enabledForFailure: true, | ||||
// tools: [[pattern: '**/reports/cc_report.xml', tool: [$class: 'Ccm']]] | // tools: [[pattern: '**/reports/cc_report.xml', tool: [$class: 'Ccm']]] | ||||
}} | }} | ||||
}} // post | }} // post | ||||
}} // unit tests | }} // unit tests | ||||
stage('Build') {{ | |||||
steps {{ | |||||
sh 'python3 setup.py sdist bdist_wheel' | |||||
}} | |||||
}} | |||||
stage('Publish') {{ | |||||
when {{ anyOf {{ | |||||
expression {{ return params.FORCE_UPLOAD }} | |||||
expression {{ | |||||
GITTAG=sh(returnStdout: true, | |||||
script:'git describe --exact-match 2>/dev/null || true').trim() | |||||
LASTV=sh(returnStdout: true, | |||||
script:'curl -s https://${{PYPI}}/pypi/`python setup.py --name`/json | jq -r .info.version || true').trim() | |||||
return ! (GITTAG in ['', 'v'+LASTV]) | |||||
}} | |||||
}} | |||||
}} | |||||
steps {{ | |||||
withCredentials([ | |||||
usernamePassword(credentialsId: "${{params.PYPI}}", | |||||
usernameVariable: 'TWINE_USERNAME', | |||||
passwordVariable: 'TWINE_PASSWORD')]) {{ | |||||
sh ''' | |||||
if [ -z "$PYPI_UPLOAD" ]; then PYPI_UPLOAD=$PYPI; fi | |||||
python3 -m twine upload --repository-url https://${{PYPI_UPLOAD}}/legacy/ dist/* | |||||
''' | |||||
}} | |||||
}} | |||||
}} | |||||
}} // stages | }} // stages | ||||
post {{ | post {{ | ||||
always {{ | always {{ | ||||
// Archive a few report files | // Archive a few report files | ||||
archiveArtifacts allowEmptyArchive: true, | archiveArtifacts allowEmptyArchive: true, | ||||
artifacts: 'reports/*,*.xml,tox*.ini', | artifacts: 'reports/*,*.xml,tox*.ini', | ||||
fingerprint: true | fingerprint: true | ||||
Show All 20 Lines |