Skip to content
Snippets Groups Projects
Commit 7519c7d1 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

jobs/swh-docs: Add job triggerable by gitlab

Documentation will be fully built when pushing changes to the swh-docs
GitLab repository or when submitting merge requests.
parent 292720ca
No related branches found
No related tags found
No related merge requests found
- defaults:
name: global
gitlab_url: https://gitlab-staging.swh.network
gitlab_connection_name: gitlab-staging
gitlab_project: false
......@@ -6,6 +6,7 @@
- "{name}/publish"
- "{name}/dev"
- "{name}/build-on-diff"
- "{name}/gitlab-builds"
- job-template:
name: "{name}/publish"
......@@ -122,7 +123,7 @@
keep-all: false
includes: "**/*"
- job-template:
- job-template: &doc_build_on_diff
name: "{name}/build-on-diff"
display_name: Phab. diff
project-type: pipeline
......@@ -154,3 +155,22 @@
description: URI of the staging repository
dsl: !include-jinja2: templates/swh-docs-pipeline-diff.groovy.j2
- job-template:
name: "{name}/gitlab-builds"
display_name: GitLab builds
gitlab_project: true
auth-token:
parameters:
properties:
- gitlab:
connection: "{gitlab_connection_name}"
triggers:
- gitlab:
trigger-push: true
trigger-merge-request: true
add-ci-message: true
cancel-pending-builds-on-update: true
# secret jenkins token is generated when executing tox
secret-token: !include-raw: jobs/templates/jenkins-token
<<: *doc_build_on_diff
- job-group:
name: "swh-jobs-{name}"
gitlab_url: https://gitlab-staging.swh.network
gitlab_connection_name: gitlab-staging
gitlab_project_name: "swh/devel/{repo_name}"
jobs:
- "{name}"
......
......@@ -5,7 +5,6 @@
auth-token: "ph4br1cat0r"
incoming_tag_auto_pypi_host: pypi.org
sandbox: true
gitlab_project: false
properties:
- build-discarder:
num-to-keep: 20
......
......@@ -3,25 +3,35 @@ pipeline {
{%- include 'templates/includes/agent-docker.groovy.j2' -%}
{% endfilter %}
{%- if not gitlab_project %}
environment {
PHAB_CONDUIT_URL = 'https://forge.softwareheritage.org/api/'
}
{%- endif %}
stages {
stage('Checkout swh environment') {
steps {
{%- if not gitlab_project %}
{% filter indent(width=8) %}
{%- include 'templates/includes/create-phabricator-artifacts.groovy.j2' -%}
{% endfilter %}
{%- else %}
updateGitlabCommitStatus name: 'jenkins', state: 'running'
{%- endif %}
checkout([
$class: 'GitSCM',
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CloneOption', depth: 1, shallow: true]],
gitTool: 'Default',
submoduleCfg: [],
userRemoteConfigs: [
[url: 'https://forge.softwareheritage.org/source/swh-environment.git'],
],
userRemoteConfigs: [[
{%- if not gitlab_project %}
url: 'https://forge.softwareheritage.org/source/swh-environment.git'
{%- else %}
url: '{{gitlab_url}}/swh/devel/swh-environment.git'
{%- endif %}
]],
])
}
}
......@@ -40,6 +50,7 @@ pipeline {
}
}
{%- if not gitlab_project %}
stage('Apply phabricator diff') {
steps {
dir('swh-docs') {
......@@ -49,11 +60,20 @@ pipeline {
}
}
}
{%- endif %}
stage('Build Software Heritage documentation') {
steps {
dir('swh-docs') {
script {
{%- if gitlab_project %}
if ("${env.gitlabMergeRequestIid}" != "") {
sh "git fetch origin merge-requests/${env.gitlabMergeRequestIid}/head:merge_request && \
git checkout merge_request"
} else {
sh "git checkout ${env.gitlabSourceBranch}"
}
{%- endif %}
sh '''#!/bin/bash
SPHINXOPTS='-W -q --keep-going -w errors.log' SPHINXOPTCOLOR='--no-color' tox -e sphinx-dev
'''
......@@ -64,7 +84,19 @@ pipeline {
}
post {
{%- if gitlab_project %}
failure {
updateGitlabCommitStatus name: 'jenkins', state: 'failed'
}
success {
updateGitlabCommitStatus name: 'jenkins', state: 'success'
}
aborted {
updateGitlabCommitStatus name: 'jenkins', state: 'canceled'
}
{%- endif %}
always {
{%- if not gitlab_project %}
step([$class: 'PhabricatorNotifier',
commentOnSuccess: true,
commentWithConsoleLinkOnFailure: true,
......@@ -75,6 +107,7 @@ pipeline {
lintFile: '.phabricator-lint',
lintFileSize: '1000000',
])
{%- endif %}
archiveArtifacts(
allowEmptyArchive: true,
......
......@@ -10,7 +10,6 @@
sandbox: true
auth-token: "ph4br1cat0r"
phabricator_diff: true
gitlab_project: false
do_cypress: false
timeout: 10
max_concurrent: 0
......
......@@ -16,7 +16,6 @@
days-to-keep: 90
artifact-num-to-keep: 20
phabricator_diff: false
gitlab_project: false
do_cypress: false
timeout: 10
max_concurrent: 0
......
......@@ -5,7 +5,6 @@
include_bdist: true
project-type: pipeline
sandbox: true
gitlab_project: false
properties:
- build-discarder:
artifact-num-to-keep: 10
......
......@@ -3,8 +3,6 @@
project-type: pipeline
description: Update jenkins jobs and setup GitLab webhooks
node: built-in
gitlab_url: https://gitlab-staging.swh.network
gitlab_connection_name: gitlab-staging
gitlab_project_name: swh/infra/ci-cd/swh-jenkins-jobs
properties:
- build-discarder:
......
......@@ -25,6 +25,8 @@ pipeline {
setupGitlabWebhook("swh/infra/ci-cd/swh-jenkins-jobs",
"jenkins-tools/swh-jenkins-jobs-builder",
true, true, false)
setupGitlabWebhook("swh/devel/swh-docs", "DDOC/gitlab-builds",
true, true, false)
projects = readYaml(file: 'jobs/swh-packages.yaml')
for (project in projects) {
......
......@@ -9,7 +9,7 @@
- string:
name: gitlab_url
description: URL of GitLab instance
default: https://gitlab-staging.swh.network
default: "{gitlab_url}"
- string:
name: jenkins_url
description: URL of Jenkins instance
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment