diff --git a/jobs/templates/dependency-incoming-tag.groovy.j2 b/jobs/templates/dependency-incoming-tag.groovy.j2 --- a/jobs/templates/dependency-incoming-tag.groovy.j2 +++ b/jobs/templates/dependency-incoming-tag.groovy.j2 @@ -73,15 +73,9 @@ } {%- if gitlab_project %} post { - failure { - updateGitlabCommitStatus name: 'jenkins', state: 'failed' - } - success { - updateGitlabCommitStatus name: 'jenkins', state: 'success' - } - aborted { - updateGitlabCommitStatus name: 'jenkins', state: 'canceled' - } + {% filter indent(width=4) %} + {%- include 'includes/update-gitlab-commit-status.groovy.j2' -%} + {% endfilter %} } {%- endif %} } diff --git a/jobs/templates/includes/update-gitlab-commit-status.groovy.j2 b/jobs/templates/includes/update-gitlab-commit-status.groovy.j2 new file mode 100644 --- /dev/null +++ b/jobs/templates/includes/update-gitlab-commit-status.groovy.j2 @@ -0,0 +1,9 @@ +failure { + updateGitlabCommitStatus name: 'jenkins', state: 'failed' +} +success { + updateGitlabCommitStatus name: 'jenkins', state: 'success' +} +aborted { + updateGitlabCommitStatus name: 'jenkins', state: 'canceled' +} diff --git a/jobs/templates/incoming-tag.groovy.j2 b/jobs/templates/incoming-tag.groovy.j2 --- a/jobs/templates/incoming-tag.groovy.j2 +++ b/jobs/templates/incoming-tag.groovy.j2 @@ -136,15 +136,9 @@ } {%- if gitlab_project %} post { - failure { - updateGitlabCommitStatus name: 'jenkins', state: 'failed' - } - success { - updateGitlabCommitStatus name: 'jenkins', state: 'success' - } - aborted { - updateGitlabCommitStatus name: 'jenkins', state: 'canceled' - } + {% filter indent(width=4) %} + {%- include 'includes/update-gitlab-commit-status.groovy.j2' -%} + {% endfilter %} } {%- endif %} } diff --git a/jobs/templates/swh-build-docker-image.groovy.j2 b/jobs/templates/swh-build-docker-image.groovy.j2 --- a/jobs/templates/swh-build-docker-image.groovy.j2 +++ b/jobs/templates/swh-build-docker-image.groovy.j2 @@ -85,15 +85,9 @@ cleanWs() } {%- if gitlab_project %} - failure { - updateGitlabCommitStatus name: 'jenkins', state: 'failed' - } - success { - updateGitlabCommitStatus name: 'jenkins', state: 'success' - } - aborted { - updateGitlabCommitStatus name: 'jenkins', state: 'canceled' - } + {% filter indent(width=4) %} + {%- include 'jobs/templates/includes/update-gitlab-commit-status.groovy.j2' -%} + {% endfilter %} {%- endif %} } } diff --git a/jobs/templates/swh-docs-pipeline-diff.groovy.j2 b/jobs/templates/swh-docs-pipeline-diff.groovy.j2 --- a/jobs/templates/swh-docs-pipeline-diff.groovy.j2 +++ b/jobs/templates/swh-docs-pipeline-diff.groovy.j2 @@ -85,15 +85,9 @@ post { {%- if gitlab_project %} - failure { - updateGitlabCommitStatus name: 'jenkins', state: 'failed' - } - success { - updateGitlabCommitStatus name: 'jenkins', state: 'success' - } - aborted { - updateGitlabCommitStatus name: 'jenkins', state: 'canceled' - } + {% filter indent(width=4) %} + {%- include 'jobs/templates/includes/update-gitlab-commit-status.groovy.j2' -%} + {% endfilter %} {%- endif %} always { {%- if not gitlab_project %} diff --git a/jobs/templates/swh-mirror-run-tests.groovy.j2 b/jobs/templates/swh-mirror-run-tests.groovy.j2 --- a/jobs/templates/swh-mirror-run-tests.groovy.j2 +++ b/jobs/templates/swh-mirror-run-tests.groovy.j2 @@ -91,15 +91,9 @@ } } {%- if gitlab_project %} - failure { - updateGitlabCommitStatus name: 'jenkins', state: 'failed' - } - success { - updateGitlabCommitStatus name: 'jenkins', state: 'success' - } - aborted { - updateGitlabCommitStatus name: 'jenkins', state: 'canceled' - } + {% filter indent(width=4) %} + {%- include 'jobs/templates/includes/update-gitlab-commit-status.groovy.j2' -%} + {% endfilter %} {%- endif %} } } diff --git a/jobs/templates/swh-pipeline.groovy.j2 b/jobs/templates/swh-pipeline.groovy.j2 --- a/jobs/templates/swh-pipeline.groovy.j2 +++ b/jobs/templates/swh-pipeline.groovy.j2 @@ -160,15 +160,9 @@ post { {%- if gitlab_project %} - failure { - updateGitlabCommitStatus name: 'jenkins', state: 'failed' - } - success { - updateGitlabCommitStatus name: 'jenkins', state: 'success' - } - aborted { - updateGitlabCommitStatus name: 'jenkins', state: 'canceled' - } + {% filter indent(width=4) %} + {%- include 'includes/update-gitlab-commit-status.groovy.j2' -%} + {% endfilter %} {%- else %} always { step([$class: 'PhabricatorNotifier', diff --git a/jobs/tools/jenkins-jobs-builder.groovy.j2 b/jobs/tools/jenkins-jobs-builder.groovy.j2 --- a/jobs/tools/jenkins-jobs-builder.groovy.j2 +++ b/jobs/tools/jenkins-jobs-builder.groovy.j2 @@ -45,14 +45,8 @@ } post { - failure { - updateGitlabCommitStatus name: 'jenkins', state: 'failed' - } - success { - updateGitlabCommitStatus name: 'jenkins', state: 'success' - } - aborted { - updateGitlabCommitStatus name: 'jenkins', state: 'canceled' - } + {% filter indent(width=4) %} + {%- include 'jobs/templates/includes/update-gitlab-commit-status.groovy.j2' -%} + {% endfilter %} } }