Changeset View
Changeset View
Standalone View
Standalone View
jobs/templates/dependency-incoming-tag.groovy.j2
pipeline { | pipeline { | ||||
agent none | agent none | ||||
stages { | stages { | ||||
stage('Refresh tag list') { | stage('Refresh tag list') { | ||||
agent any | agent any | ||||
steps { | steps { | ||||
{%- if gitlab_project %} | |||||
updateGitlabCommitStatus name: 'jenkins', state: 'running' | |||||
{%- endif %} | |||||
checkout([ | checkout([ | ||||
$class: 'GitSCM', | $class: 'GitSCM', | ||||
{% if not gitlab_project %} | |||||
userRemoteConfigs: [[ | userRemoteConfigs: [[ | ||||
url: 'https://forge.softwareheritage.org/source/{{repo_name}}.git', | url: 'https://forge.softwareheritage.org/source/{{repo_name}}.git', | ||||
]], | ]], | ||||
branches: [[ | branches: [[ | ||||
name: params.GIT_TAG, | name: params.GIT_TAG, | ||||
]], | ]], | ||||
browser: [ | browser: [ | ||||
$class: 'Phabricator', | $class: 'Phabricator', | ||||
repo: '{{repo_name}}', | repo: '{{repo_name}}', | ||||
repoUrl: 'https://forge.softwareheritage.org/', | repoUrl: 'https://forge.softwareheritage.org/', | ||||
], | ], | ||||
{%- else %} | |||||
userRemoteConfigs: [[ | |||||
name:'origin', url: '{{gitlab_url}}/{{gitlab_project_name}}.git', | |||||
refspec: '+refs/tags/*:refs/remotes/origin/tags*' | |||||
]], | |||||
branches: [[ | |||||
name: "${env.gitlabSourceBranch}" | |||||
]], | |||||
browser: [ | |||||
$class: 'GitLab', | |||||
repoUrl: '{{gitlab_url}}/{{gitlab_project_name}}' | |||||
], | |||||
extensions: [[$class: 'CloneOption', honorRefspec: true]], | |||||
{%- endif %} | |||||
]) | ]) | ||||
} | } | ||||
} | } | ||||
stage('Build Debian package') { | stage('Build Debian package') { | ||||
when { | when { | ||||
{%- if not gitlab_project %} | |||||
expression { params.GIT_TAG ==~ /debian\/.*/ } | expression { params.GIT_TAG ==~ /debian\/.*/ } | ||||
expression { !(params.GIT_TAG ==~ /debian\/upstream\/.*/) } | expression { !(params.GIT_TAG ==~ /debian\/upstream\/.*/) } | ||||
expression { jobExists('/debian/deps/{{name}}/gbp-buildpackage') } | expression { jobExists('/debian/deps/{{name}}/gbp-buildpackage') } | ||||
{%- else %} | |||||
expression { "${env.gitlabSourceBranch}" ==~ /refs\/tags\/debian\/.*/ } | |||||
expression { !("${env.gitlabSourceBranch}" ==~ /refs\/tags\/debian\/upstream\/.*/) } | |||||
expression { jobExists('/debian/deps/{{name}}/gitlab-gbp-buildpackage') } | |||||
{%- endif %} | |||||
} | } | ||||
steps { | steps { | ||||
build( | build( | ||||
{%- if not gitlab_project %} | |||||
job: '/debian/deps/{{name}}/gbp-buildpackage', | job: '/debian/deps/{{name}}/gbp-buildpackage', | ||||
parameters: [ | parameters: [ | ||||
string(name: 'GIT_REVISION', value: params.GIT_TAG), | string(name: 'GIT_REVISION', value: params.GIT_TAG), | ||||
booleanParam(name: 'DO_UPLOAD', value: true), | booleanParam(name: 'DO_UPLOAD', value: true), | ||||
], | ], | ||||
wait: false, | {%- else %} | ||||
job: '/debian/deps/{{name}}/gitlab-gbp-buildpackage', | |||||
parameters: [ | |||||
// remove refs/tags/ prefix from source branch | |||||
string(name: 'GIT_REVISION', value: env.gitlabSourceBranch.substring(10)), | |||||
booleanParam(name: 'DO_UPLOAD', value: false), | |||||
], | |||||
{%- endif %} | |||||
wait: true, | |||||
) | ) | ||||
} | } | ||||
} | } | ||||
} | } | ||||
{%- if gitlab_project %} | |||||
post { | |||||
failure { | |||||
updateGitlabCommitStatus name: 'jenkins', state: 'failed' | |||||
} | |||||
success { | |||||
updateGitlabCommitStatus name: 'jenkins', state: 'success' | |||||
} | |||||
aborted { | |||||
updateGitlabCommitStatus name: 'jenkins', state: 'canceled' | |||||
} | |||||
} | |||||
{%- endif %} | |||||
} | } |