diff --git a/jobs/templates/swh-pipeline.groovy.j2 b/jobs/templates/swh-pipeline.groovy.j2 index ff20db4..d0e0149 100644 --- a/jobs/templates/swh-pipeline.groovy.j2 +++ b/jobs/templates/swh-pipeline.groovy.j2 @@ -1,151 +1,152 @@ pipeline { {% filter indent(width=2) %} {%- include 'includes/agent-docker.groovy.j2' -%} {% endfilter %} options { // require "Throttle Concurrent Builds" Jenkins plugin throttleJobProperty( categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: {{ max_concurrent }}, maxConcurrentTotal: {{ max_concurrent }}, paramsToUseForLimit: '', throttleEnabled: true, throttleOption: 'project', ) } environment { PHAB_CONDUIT_URL = 'https://forge.softwareheritage.org/api/' } stages { stage('Checkout') { steps { {% filter indent(width=8) %} {%- include 'includes/create-phabricator-artifacts.groovy.j2' -%} {% endfilter %} checkout([ $class: 'GitSCM', branches: [[name: "${params.REVISION}"]], doGenerateSubmoduleConfigurations: false, - extensions: [], + extensions: [[$class: 'CloneOption', honorRefspec: true]], gitTool: 'Default', submoduleCfg: [], userRemoteConfigs: [ - [url: 'https://forge.softwareheritage.org/source/{{repo_name}}.git'], + [url: 'https://forge.softwareheritage.org/source/{{repo_name}}.git', + refspec: '+refs/heads/master:refs/remotes/origin/master'], ], browser: [$class: 'Phabricator', repoUrl: 'https://forge.softwareheritage.org', repo: '{{name}}'] ]) } } {%- if phabricator_diff %} stage('Apply phabricator diff') { steps { {% filter indent(width=8) %} {%- include 'includes/script-apply-phabricator-diff.groovy.j2' -%} {% endfilter %} } } {%- endif %} stage ('flake8') { steps { sh '''python3 -m tox -e flake8''' } } stage ('mypy') { steps { sh '''python3 -m tox -e mypy''' } } stage ('radon') { steps { sh ''' mkdir -p reports python3 -m radon raw --json swh/ > reports/raw_report.json python3 -m radon cc --json swh/ > reports/cc_report.json python3 -m radon mi --json swh/ > reports/mi_report.json python3 -m radon hal --json swh/ > reports/hal_report.json python3 -m radon cc --xml swh/ > reports/cc_report.xml ''' } post { always { // Archive a few report files archiveArtifacts( allowEmptyArchive: true, artifacts: 'reports/*', fingerprint: true, ) // Warnings NG recordIssues( enabledForFailure: true, tools: [ ccm(pattern: '**/reports/cc_report.xml'), ], ) } } } stage('Tests') { options { timeout(time: {{ timeout }}, unit: 'MINUTES') } parallel { {% filter indent(width=8) %} {%- include 'includes/stage-python-tests.groovy.j2' -%} {% endfilter %} {%- if do_cypress %} {% filter indent(width=8) %} {%- include 'includes/stage-cypress-tests.groovy.j2' -%} {% endfilter %} {%- endif %} stage('Sphinx documentation') { {% filter indent(width=10) %} {%- include 'includes/agent-docker-sphinx.groovy.j2' -%} {% endfilter %} steps { sh ''' if tox -a | grep -x sphinx >/dev/null then tox -e sphinx else echo WARNING: no sphinx environment in tox.ini fi ''' } } // sphinx doc } // parallel } // Tests stage } // stages post { always { step([$class: 'PhabricatorNotifier', commentOnSuccess: true, commentWithConsoleLinkOnFailure: true, commentFile: '.phabricator-comment', commentSize: '1000000', preserveFormatting: true, processLint: true, lintFile: '.phabricator-lint', lintFileSize: '1000000', ]) } // always cleanup { cleanWs() } } // post } // pipeline