Page MenuHomeSoftware Heritage

D8985.diff
No OneTemporary

D8985.diff

diff --git a/jobs/defaults.yaml b/jobs/defaults.yaml
new file mode 100644
--- /dev/null
+++ b/jobs/defaults.yaml
@@ -0,0 +1,5 @@
+- defaults:
+ name: global
+ gitlab_url: https://gitlab-staging.swh.network
+ gitlab_connection_name: gitlab-staging
+ gitlab_project: false
diff --git a/jobs/swh-docs.yaml b/jobs/swh-docs.yaml
--- a/jobs/swh-docs.yaml
+++ b/jobs/swh-docs.yaml
@@ -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
diff --git a/jobs/swh-packages.yaml b/jobs/swh-packages.yaml
--- a/jobs/swh-packages.yaml
+++ b/jobs/swh-packages.yaml
@@ -1,7 +1,5 @@
- 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}"
diff --git a/jobs/templates/incoming-tag.yaml b/jobs/templates/incoming-tag.yaml
--- a/jobs/templates/incoming-tag.yaml
+++ b/jobs/templates/incoming-tag.yaml
@@ -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
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
@@ -3,25 +3,35 @@
{%- 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 @@
}
}
+ {%- if not gitlab_project %}
stage('Apply phabricator diff') {
steps {
dir('swh-docs') {
@@ -49,11 +60,20 @@
}
}
}
+ {%- 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 @@
}
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 @@
lintFile: '.phabricator-lint',
lintFileSize: '1000000',
])
+ {%- endif %}
archiveArtifacts(
allowEmptyArchive: true,
diff --git a/jobs/templates/swh-pipeline-diff.yaml b/jobs/templates/swh-pipeline-diff.yaml
--- a/jobs/templates/swh-pipeline-diff.yaml
+++ b/jobs/templates/swh-pipeline-diff.yaml
@@ -10,7 +10,6 @@
sandbox: true
auth-token: "ph4br1cat0r"
phabricator_diff: true
- gitlab_project: false
do_cypress: false
timeout: 10
max_concurrent: 0
diff --git a/jobs/templates/swh-pipeline.yaml b/jobs/templates/swh-pipeline.yaml
--- a/jobs/templates/swh-pipeline.yaml
+++ b/jobs/templates/swh-pipeline.yaml
@@ -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
diff --git a/jobs/templates/swh-pypi.yaml b/jobs/templates/swh-pypi.yaml
--- a/jobs/templates/swh-pypi.yaml
+++ b/jobs/templates/swh-pypi.yaml
@@ -5,7 +5,6 @@
include_bdist: true
project-type: pipeline
sandbox: true
- gitlab_project: false
properties:
- build-discarder:
artifact-num-to-keep: 10
diff --git a/jobs/tools/jenkins-jobs-builder.yaml b/jobs/tools/jenkins-jobs-builder.yaml
--- a/jobs/tools/jenkins-jobs-builder.yaml
+++ b/jobs/tools/jenkins-jobs-builder.yaml
@@ -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:
diff --git a/jobs/tools/setup-gitlab-webhooks.groovy.j2 b/jobs/tools/setup-gitlab-webhooks.groovy.j2
--- a/jobs/tools/setup-gitlab-webhooks.groovy.j2
+++ b/jobs/tools/setup-gitlab-webhooks.groovy.j2
@@ -25,6 +25,8 @@
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) {
diff --git a/jobs/tools/setup-gitlab-webhooks.yaml b/jobs/tools/setup-gitlab-webhooks.yaml
--- a/jobs/tools/setup-gitlab-webhooks.yaml
+++ b/jobs/tools/setup-gitlab-webhooks.yaml
@@ -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

File Metadata

Mime Type
text/plain
Expires
Jul 3 2025, 8:10 AM (10 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3214688

Event Timeline