# defaults and macros

- defaults:
    name: global

    properties:
        - &build_discarder_property
          build-discarder:
            days-to-keep: 180
            num-to-keep: 10
            artifact-days-to-keep: -1
            artifact-num-to-keep: 1
        - &copyartifact_property
          copyartifact:
            projects: '*'
    properties_with_throttle: &properties_with_throttle
        - *build_discarder_property
        - *copyartifact_property
        - throttle:
            option: category
            categories: [ test-and-snapshot ]
            matrix-builds: false
            matrix-configs: true

    wrappers:
        - timestamps
    dist-filter: 'true'
    arch-filter: 'true'
    # distribution/architecture combinations:
    # amd64 on all dists
    # arm64/ppc64el/s390x on all dists except non-LTS Ubuntu
    filter: &filter |
      architecture=="amd64" ||
      distribution=="sid" ||
      (architecture in ["arm64", "ppc64el", "s390x"] && !(distribution in ["oracular"]))
    filter_pattern: &filter_pattern |
      ({arch-filter}) &&
      ({dist-filter}) &&
      ({filter})
    # lts_dist_filter: build older PostgreSQL server versions on all LTS releases
    lts_dist_filter: &lts_dist_filter '!(distribution in ["oracular"])'
    git-branch: master
    upstream-branch: master
    reference-repo: ''
    generate-source-args: ''
    backports: ''
    backports_runtime: ''
    disable_submodules: false
    shallow-clone: 'true'
    pg-supported-versions: 'pgdg'
    pg-supported-versions-beta: '17'
    #beta-cron: 'H H H * *'
    beta-cron: ''
    snapshot-cron: ''

- yamltemplates:
    name: yamltemplates

    revision_string: &revision_string
        name: revision
        default: '1'
        description: Revision number to use on generated source package (number in .pgdg+N suffix)

    git_branch: &git_branch
        name: branch
        description: Git branch, tag, or commit to build
    git_branch_template: &git_branch_template
        <<: *git_branch
        default: '{git-branch}'
    upstream_branch_template: &upstream_branch_template
        name: upstream_branch
        default: '{upstream-branch}'
        description: Upstream repository Git branch, tag, or commit to build

    queue_choice: &queue_choice
            name: queue
            choices:
                    - incoming
                    - snapshot
                    - private
                    - discard
            description: 'Incoming queue to use: incoming uploads to reprepro, snapshot uploads to *-snapshot distributions, private stages the upload in a directory, discard throws the upload away.'

    queue_choice_snapshot: &queue_choice_snapshot
            name: queue
            choices:
                    - snapshot
                    - private
                    - discard
            description: 'Incoming queue to use: incoming uploads to reprepro, snapshot uploads to *-snapshot distributions, private stages the upload in a directory, discard throws the upload away.'

    upload_choice: &upload_choice
            name: upload
            choices:
                    - all
                    - extension-only
            description: 'all: upload all .deb files built, extension-only: upload PostgreSQL-version-specific .deb files only'
    upload_choice_extension_only: &upload_choice_extension_only
            <<: *upload_choice
            choices:
                    - extension-only
                    - all

    slaves_axis: &slaves_axis
            type: slave
            name: slave
            values:
              - master
              - arm64-1
              - ppc64el-1
              - s390x-1
              - x86-1
    x86_slaves_axis: &x86_slaves_axis
            type: slave
            name: slave
            values:
              - x86-1
    arm64_slaves_axis: &arm64_slaves_axis
            type: slave
            name: slave
            values:
              - arm64-1
    ppc64el_slaves_axis: &ppc64el_slaves_axis
            type: slave
            name: slave
            values:
              - ppc64el-1
    s390x_slaves_axis: &s390x_slaves_axis
            type: slave
            name: slave
            values:
              - s390x-1

    arch_axis: &arch_axis
            type: slave
            name: architecture
            values: &arch_list
                    - amd64
                    - arm64
                    - ppc64el
                    - s390x
    arch_axis_pg_devel: &arch_axis_pg_devel
            type: slave
            name: architecture
            values: [amd64]
    arch_axis_userdefined: &arch_axis_userdefined
            <<: *arch_axis
            type: user-defined

    dist_axis: &dist_axis
            type: user-defined
            name: distribution
            values: &dist_list
                    - sid
                    - trixie
                    - bookworm
                    - bullseye
                    - oracular
                    - noble
                    - jammy
                    - focal

    distribution_parameter: &distribution_parameter
            name: distribution
            choices: *dist_list
            description: 'Distribution to build for'

    matrix_combination_parameter: &matrix_combination_parameter
            name: matrix
            description: Distribution/architecture combinations to build

    supported_versions_param: &supported_versions_param
            name: PG_SUPPORTED_VERSIONS
            default: '{pg-supported-versions}'
            description: 'PostgreSQL versions to target'
    supported_versions_param_beta: &supported_versions_param_beta
            name: PG_SUPPORTED_VERSIONS
            default: '{pg-supported-versions-beta}'
            description: 'PostgreSQL versions to target'

    deb_build_options_param: &deb_build_options_param
            name: DEB_BUILD_OPTIONS
            default: ''
            description: 'Extra build options for dpkg-buildpackage'

    binnmu_reason_param: &binnmu_reason_param
            name: binnmu_reason
            description: 'binNMU changelog text'
    binnmu_version_param: &binnmu_version_param
            name: binnmu_version
            description: 'binNMU version (single integer)'

    autopkgtest_choice: &autopkgtest_choice
            name: autopkgtest
            choices:
                    - run
                    - skip
            description: 'Run autopkgtest at build time'

    ircbot_only_configs: &only_configs
            strategy: any-failure
            message-type: summary
            matrix-notifier: only-configurations

# pipeline template

- job-template: &build_pipeline
        name: '{name}'
        id: 'build-pipeline'
        description: 'Build source and binaries for {name}, and upload them'
        project-type: pipeline
        parameters:
                - string: *revision_string
                - string: *git_branch_template
                - string: *supported_versions_param
                - string: *deb_build_options_param
                - choice: *autopkgtest_choice
                - choice: *queue_choice
        dsl: |
                pipeline {{
                    agent {{ label 'master' }}
                    stages {{
                        stage('source') {{
                            steps {{
                                build(job: '{name}-source',
                                    parameters: [
                                        string(name: 'revision', value: revision),
                                        string(name: 'branch', value: branch),
                                        string(name: 'PG_SUPPORTED_VERSIONS', value: PG_SUPPORTED_VERSIONS),
                                    ]
                                )
                            }}
                        }}
                        stage('binaries') {{
                            steps {{
                                build(job: '{name}-binaries',
                                    parameters: [
                                        string(name: 'PG_SUPPORTED_VERSIONS', value: PG_SUPPORTED_VERSIONS),
                                        string(name: 'DEB_BUILD_OPTIONS', value: DEB_BUILD_OPTIONS),
                                        string(name: 'autopkgtest', value: autopkgtest),
                                        string(name: 'queue', value: queue),
                                        string(name: 'upload', value: 'all'),
                                    ]
                                )
                            }}
                        }}
                    }}
                }}

- job-template:
        <<: *build_pipeline
        name: '{name}'
        id: 'build-pipeline-with-beta'
        description: 'Build source and binaries for {name}, and upload them, including PostgreSQL beta'
        dsl: |
                pipeline {{
                    agent {{ label 'master' }}
                    stages {{
                        stage('source') {{
                            steps {{
                                build(job: '{name}-source',
                                    parameters: [
                                        string(name: 'revision', value: revision),
                                        string(name: 'branch', value: branch),
                                        string(name: 'PG_SUPPORTED_VERSIONS', value: PG_SUPPORTED_VERSIONS),
                                    ]
                                )
                            }}
                        }}
                        stage('binaries') {{
                            steps {{
                                build(job: '{name}-binaries',
                                    parameters: [
                                        string(name: 'PG_SUPPORTED_VERSIONS', value: PG_SUPPORTED_VERSIONS),
                                        string(name: 'DEB_BUILD_OPTIONS', value: DEB_BUILD_OPTIONS),
                                        string(name: 'autopkgtest', value: autopkgtest),
                                        string(name: 'queue', value: queue),
                                        string(name: 'upload', value: 'all'),
                                    ]
                                )
                            }}
                        }}
                        /*
                        stage('binaries-beta') {{
                            steps {{
                                build(job: '{name}-binaries-beta',
                                    parameters: [
                                        string(name: 'PG_SUPPORTED_VERSIONS', value: '{pg-supported-versions-beta}'),
                                        string(name: 'autopkgtest', value: autopkgtest),
                                        string(name: 'queue', value: queue),
                                        string(name: 'upload', value: 'extension-only'),
                                    ]
                                )
                            }}
                        }}
                        */
                    }}
                }}

# apt template

- job-template: &apt_source_template
        name: '{name}-source'
        id: 'source-apt'
        description: 'Build Debian source package of {name} from "apt-get source"'
        project-type: matrix
        child-workspace: .
        parameters:
                - string: *revision_string
                - string:
                        name: apt_suite
                        default: '{apt-suite}'
                        description: Debian release to "apt-get source" from
                - string: &PG_SUPPORTED_VERSIONS
                        name: PG_SUPPORTED_VERSIONS
                        default: '{pg-supported-versions}'
                        description: PostgreSQL version to target
                - matrix-combinations: *matrix_combination_parameter
        execution-strategy:
                sequential: true
                combination-filter: '{dist-filter}'
                touchstone:
                        expr: 'distribution=="sid"'
        axes:
                - axis: *dist_axis
        builders:
                - shell: '{generate-source-args}$HOME/apt.postgresql.org/jenkins/generate-pgdg-source'
                - build-name-setter: &build_name_setter
                        template: '#${{BUILD_NUMBER}} '
                        macro: true
                        macro-first: true
                        name: version.txt
                        file: true
        publishers:
                - archive:
                        artifacts: 'result/*'
                        latest-only: true
                - ircbot:
                        matrix-notifier: only-parent

# git template

- job-template: &git_source_template
        <<: *apt_source_template
        name: '{name}-source'
        id: 'source-git'
        description: 'Build Debian source package of {name} from git'
        parameters:
                - string: *git_branch_template
                - string: *revision_string
                - string: *PG_SUPPORTED_VERSIONS
                - matrix-combinations: *matrix_combination_parameter
        scm:
                - git: &scm_git
                        url: '{git-url}'
                        branches:
                                - '$branch'
                        shallow-clone: '{shallow-clone}'
                        basedir: source
                        wipe-workspace: false
                        submodule:
                                disable: '{disable_submodules}'
                                recursive: true
                        clean:
                                before: true

- job-template:
        <<: *git_source_template
        name: '{name}-source-snapshot'
        id: 'source-debian-snapshot'
        description: 'Build Debian source package of {name} from Debian git snapshot'
        triggers:
                - pollscm:
                        cron: '{snapshot-cron}'
        publishers: &source_snapshot_publishers
                - archive:
                        artifacts: 'result/*'
                        latest-only: true
                - ircbot:
                        matrix-notifier: only-parent
                - trigger-parameterized-builds:
                        - project: '{name}-binaries-snapshot'
                          condition: SUCCESS
                          predefined-parameters: ''

- job-template:
        <<: *git_source_template
        name: '{name}-source-snapshot'
        id: 'source-upstream-snapshot'
        description: 'Build Debian source package of {name} from Debian and upstream git snapshot'
        parameters:
                - string: *git_branch_template
                - string: *upstream_branch_template
                - string: *revision_string
                - string: *PG_SUPPORTED_VERSIONS
                - matrix-combinations: *matrix_combination_parameter
        scm:
                # upstream repo first so reference-repo works
                - git:
                        <<: *scm_git
                        name: upstream
                        url: '{upstream-url}'
                        reference-repo: '{reference-repo}'
                        branches:
                                - '$upstream_branch'
                - git: *scm_git
        triggers:
                - pollscm:
                        cron: '{snapshot-cron}'
        publishers: *source_snapshot_publishers

# binaries template

- job-template: &binaries_template
        name: '{name}-binaries'
        id: 'binaries'
        description: 'Build Debian binary packages of {name}'
        project-type: matrix
        execution-strategy: &binaries_execution_strategy
                combination-filter: *filter_pattern
                touchstone:
                        expr: '(distribution=="sid") && (architecture=="amd64")'
        axes:
                - axis: *arch_axis
                - axis: *dist_axis
        parameters:
                - string: *supported_versions_param
                - string: *deb_build_options_param
                - string: *binnmu_reason_param
                - string: *binnmu_version_param
                - choice: *autopkgtest_choice
                - choice: *queue_choice
                - choice: *upload_choice
                - matrix-combinations: *matrix_combination_parameter
        builders:
                - shell: 'rm -rf *'
                - copyartifact: &copysource
                        project: '{name}-source/distribution=$distribution'
                        filter: 'result/*'
                        flatten: true
                        which-build: upstream-build
                        fallback-to-last-successful: true
                        do-not-fingerprint: true
                - shell: &build_name_getter 'version=$(echo *.dsc); version=${{version#*_}}; echo ${{version%.*}} > version.txt'
                - build-name-setter: *build_name_setter
                - shell: '{backports}$HOME/apt.postgresql.org/jenkins/sbuild-package'
        publishers:
                - text-finder: &text_finder_not_built
                        regexp: '### NOT BUILT ###'
                        also-check-console-output: true
                        not-built-if-found: true
                - archive: &binaries_archive
                        artifacts: '*.gz,*.bz2,*.xz,*.asc,*.deb,*.dsc,*.changes,*.buildinfo'
                        latest-only: true
                - junit:
                        results: autopkgtest.xml
                - ircbot: *only_configs
                - workspace-cleanup
                - trigger-parameterized-builds:
                        - project: 'dput'
                          condition: SUCCESS
                          predefined-parameters: |
                                binaries=$JOB_NAME
                                queue=$queue
                                upload=$upload

# binaries for building modules for PostgreSQL beta
- job-template:
        <<: *binaries_template
        name: '{name}-binaries-beta'
        id: 'binaries-beta'
        parameters:
                - string: *supported_versions_param_beta
                - string: *deb_build_options_param
                - string: *binnmu_reason_param
                - string: *binnmu_version_param
                - choice: *autopkgtest_choice
                - choice: *queue_choice
                - choice: *upload_choice_extension_only
                - matrix-combinations: *matrix_combination_parameter

# binaries for building modules for git snapshots
- job-template:
        <<: *binaries_template
        name: '{name}-binaries-snapshot'
        id: 'binaries-snapshot'
        properties: *properties_with_throttle
        parameters:
                - string: *supported_versions_param
                - string: *deb_build_options_param
                - string: *binnmu_reason_param
                - string: *binnmu_version_param
                - choice: *autopkgtest_choice
                - choice: *queue_choice_snapshot
                - choice: *upload_choice
                - matrix-combinations: *matrix_combination_parameter
        builders:
                - shell: 'rm -rf *'
                - copyartifact:
                        <<: *copysource
                        project: '{name}-source-snapshot/distribution=$distribution'
                - shell: *build_name_getter
                - build-name-setter: *build_name_setter
                - shell: '{backports}$HOME/apt.postgresql.org/jenkins/sbuild-package'

# autopkgtest template

- job-template: &autopkgtest_template
        name: '{name}-autopkgtest'
        id: 'autopkgtest'
        description: 'Run autopkgtest on {name}'
        project-type: matrix
        properties: *properties_with_throttle
        execution-strategy:
                combination-filter: *filter_pattern
                touchstone:
                        expr: '(distribution=="sid") && (architecture=="amd64")'
        parameters:
                - matrix-combinations: *matrix_combination_parameter
        axes:
                - axis: *arch_axis
                - axis: *dist_axis
        child-workspace: .
        triggers:
                - timed: "H H H * *"
        builders:
                - shell: '{backports_runtime}$HOME/apt.postgresql.org/jenkins/pgdg-autopkgtest {name}'
        publishers:
                # disabled until https://issues.jenkins.io/browse/JENKINS-59730 is fixed
                #- text-finder: *text_finder_not_built
                - ircbot: *only_configs

- job-template:
        <<: *autopkgtest_template
        name: '{name}-autopkgtest-beta'
        id: 'autopkgtest-beta'
        pg-supported-versions: '{pg-supported-versions-beta}'
        parameters:
                - string: *PG_SUPPORTED_VERSIONS
                - matrix-combinations: *matrix_combination_parameter
        triggers:
                 - timed: '{beta-cron}'

# upgrade test template

- job-template: &upgrade_template
        name: 'upgrade-{oldversion}-{newversion}'
        id: 'upgrade'
        description: 'Test upgrades from PostgreSQL {oldversion} to {newversion}'
        project-type: matrix
        properties: *properties_with_throttle
        parameters:
                - matrix-combinations: *matrix_combination_parameter
        execution-strategy:
                combination-filter: *filter_pattern
                touchstone:
                        expr: '(distribution=="sid") && (architecture=="amd64")'
        axes:
                - axis: *arch_axis
                - axis: *dist_axis
        triggers:
                - timed: "H H H * *"
        builders:
                - shell: '$HOME/apt.postgresql.org/jenkins/postgresql-testsuite {oldversion} {newversion}'
        publishers:
                - ircbot: *only_configs
                - workspace-cleanup

# job groups

- job-group:
        name: apt-packages
        jobs:
                - 'build-pipeline'
                - 'source-apt'
                - 'binaries'
                - 'autopkgtest'
                - 'autopkgtest-beta'

- job-group:
        name: apt-packages-with-beta
        jobs:
                - 'build-pipeline-with-beta'
                - 'source-apt'
                - 'binaries'
                - 'binaries-beta'
                - 'autopkgtest'
                - 'autopkgtest-beta'

# by default, run autopkgtest also including PostgreSQL beta
- job-group:
        name: git-packages
        jobs:
                - 'build-pipeline'
                - 'source-git'
                - 'source-debian-snapshot'
                - 'binaries'
                - 'binaries-snapshot'
                - 'autopkgtest'
                - 'autopkgtest-beta'

# skip extra test with PostgreSQL beta
- job-group:
        name: git-packages-only
        jobs:
                - 'build-pipeline'
                - 'source-git'
                - 'source-debian-snapshot'
                - 'binaries'
                - 'binaries-snapshot'
                - 'autopkgtest'

- job-group:
        name: git+upstream-snapshot
        jobs:
                - 'build-pipeline'
                - 'source-git'
                - 'source-upstream-snapshot'
                - 'binaries'
                - 'binaries-snapshot'
                - 'autopkgtest'
                - 'autopkgtest-beta'

- job-group:
        name: postgresql-server-jobs
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        upstream-url: https://git.postgresql.org/git/postgresql.git
        reference-repo: '$HOME/gitcache.buexcl/postgresql'
        jobs:
                - 'build-pipeline'
                - 'source-git'
                - 'source-upstream-snapshot'
                - 'binaries'
                - 'binaries-snapshot'
                - 'autopkgtest'

- job-group:
        name: git-packages-with-beta
        jobs:
                - 'build-pipeline-with-beta'
                - 'source-git'
                - 'source-debian-snapshot'
                - 'binaries'
                - 'binaries-beta'
                - 'binaries-snapshot'
                - 'autopkgtest'
                - 'autopkgtest-beta'

- job-group:
        name: git+beta+upstream-snapshot
        jobs:
                - 'build-pipeline-with-beta'
                - 'source-git'
                - 'source-upstream-snapshot'
                - 'binaries'
                - 'binaries-beta'
                - 'binaries-snapshot'
                - 'autopkgtest'
                - 'autopkgtest-beta'

# simple jobs

- job:
        name: apt.postgresql.org
        description: 'Update apt.postgresql.org (pgapt.git) checkout on build hosts'
        project-type: matrix
        workspace: '$HOME/apt.postgresql.org'
        child-workspace: .
        axes:
                - axis: *slaves_axis
        scm: &scm_pgapt
                - git:
                        url: https://git.postgresql.org/git/pgapt.git
                        branches:
                                - master
                        shallow-clone: true
                        wipe-workspace: false
        builders:
                - shell: 'chmod go+rX -R .' # make directory readable for other workers
                - shell: 'make install' # install /etc/schroot/chroot.d/sbuild.conf
        publishers:
                - trigger:
                        project: apt.postgresql.org-jobs
                - ircbot:
                        strategy: any-failure
                        matrix-notifier: only-parent

- job:
        name: apt.postgresql.org-jobs
        description: 'Update Jenkins config from pgapt-jobs.yaml using jenkins-job-builder'
        scm: *scm_pgapt
        builders:
                - shell: 'cd jenkins && make && make update'
        publishers:
                - ircbot

- job: &debcheck
        name: 'debcheck'
        description: 'Run dose-debcheck on all distributions'
        project-type: matrix
        child-workspace: .
        triggers:
                - timed: "33 5 * * *"
        parameters:
                - matrix-combinations: *matrix_combination_parameter
        execution-strategy:
                combination-filter: *filter
        axes:
                - axis: *dist_axis
                - axis: *arch_axis
                - axis:
                        type: user-defined
                        name: stage
                        values:
                                - production
                                - testing
        builders:
                - shell: '$HOME/apt.postgresql.org/jenkins/debcheck-pgapt'
        publishers:
                - ircbot:
                        strategy: any-failure
                        message-type: summary
                        matrix-notifier: only-configurations

- job:
        <<: *debcheck
        name: 'builddebcheck'
        description: 'Run dose-builddebcheck on all distributions'
        builders:
                - shell: '$HOME/apt.postgresql.org/jenkins/builddebcheck-pgapt'

- job: &sbuild_update_x86
        name: 'sbuild-update-x86'
        description: 'Update sbuild chroots'
        project-type: matrix
        child-workspace: .
        parameters:
                - matrix-combinations: *matrix_combination_parameter
                - bool:
                    name: force_update
                    default: 'false'
                    description: 'Force update instead of skipping when chroot is busy'
        execution-strategy:
                sequential: true
                combination-filter: *filter
        axes:
                - axis: *x86_slaves_axis
                - axis: *dist_axis
                - axis:
                    type: user-defined
                    name: architecture
                    values:
                      - amd64
        triggers:
                - timed: "H */6 * * *"
        builders:
                - shell: '$HOME/apt.postgresql.org/jenkins/sbuild-update.sh'
        publishers:
                - ircbot: *only_configs

- job:
        <<: *sbuild_update_x86
        name: 'sbuild-update-arm64'
        axes:
                - axis: *arm64_slaves_axis
                - axis:
                    type: user-defined
                    name: architecture
                    values:
                      - arm64
                - axis: *dist_axis

- job:
        <<: *sbuild_update_x86
        name: 'sbuild-update-ppc64el'
        axes:
                - axis: *ppc64el_slaves_axis
                - axis:
                    type: user-defined
                    name: architecture
                    values:
                      - ppc64el
                - axis: *dist_axis

- job:
        <<: *sbuild_update_x86
        name: 'sbuild-update-s390x'
        axes:
                - axis: *s390x_slaves_axis
                - axis:
                    type: user-defined
                    name: architecture
                    values:
                      - s390x
                - axis: *dist_axis

- job: &dput
        name: dput
        description: 'Push packages to the repository'
        parameters:
                - string:
                        name: binaries
                        description: Name of binaries job to copy artifacts from (including -binaries suffix)
                - choice: *queue_choice
                - choice: *upload_choice
        builders:
                - shell: 'rm -rf *'
                - copyartifact:
                        project: '$binaries'
                        filter: '*.gz,*.bz2,*.xz,*.asc,*.deb,*.dsc,*.changes,*.buildinfo'
                        flatten: true
                        which-build: upstream-build
                        fallback-to-last-successful: true
                        do-not-fingerprint: true
                - shell: 'c=$(ls */*.changes | head -1); echo "${c##*/} ($queue, $upload)" > version.txt'
                - build-name-setter: &build_name_setter_plain
                        <<: *build_name_setter
                        template: '#${BUILD_NUMBER} '
                - shell: '$HOME/apt.postgresql.org/jenkins/dput-pgdg $queue'
        publishers:
                - ircbot:
                        matrix-notifier: all
                        message-type: summary
                - workspace-cleanup

# variant of dput that handles each configuration separately
# (needed after using matrixreloaded on build jobs)
- job:
        <<: *dput
        name: dput-matrixreloaded
        project-type: matrix
        child-workspace: .
        parameters:
                - string:
                        name: binaries
                        description: Name of binaries job to copy artifacts from (including -binaries suffix)
                - choice: *queue_choice
                - choice: *upload_choice
                - matrix-combinations: *matrix_combination_parameter
        execution-strategy:
                sequential: true
                combination-filter: *filter
                touchstone:
                        expr: '(distribution=="sid") && (architecture=="amd64")'
        axes:
                - axis: *arch_axis_userdefined
                - axis: *dist_axis
        builders:
                - shell: 'rm -rf *'
                - copyartifact:
                        project: '$binaries/architecture=$architecture,distribution=$distribution'
                        filter: '*.gz,*.bz2,*.xz,*.asc,*.deb,*.dsc,*.changes,*.buildinfo'
                        flatten: true
                        which-build: upstream-build
                        fallback-to-last-successful: true
                        do-not-fingerprint: true
                - shell: 'echo "$(ls *.changes | head -1) ($queue, $upload)" > version.txt'
                - build-name-setter: *build_name_setter_plain
                - shell: '$HOME/apt.postgresql.org/jenkins/dput-pgdg $queue'
        publishers:
                - ircbot:
                        matrix-notifier: only-parent
                        message-type: summary
                - workspace-cleanup

- job:
        name: 'stale-schroot-sessions'
        description: 'Terminate state schroot sessions'
        project-type: matrix
        child-workspace: .
        axes:
                - axis: *slaves_axis
        triggers:
                - timed: "H 3 * * *"
        builders:
                - shell: |
                        cd /run/schroot/mount || exit 0
                        ls -al
                        for session in $(find . -mindepth 1 -maxdepth 1 -mtime +1); do
                          sudo schroot -c $(basename $session) -e
                          rc=1
                        done
                        exit ${rc:-0}
        publishers:
                - ircbot:
                        strategy: any-failure
                        message-type: summary

- job:
        name: hardlink-jenkins-files
        description: 'Save some space in ~jenkins by hardlinking and compressing files'
        triggers:
                - timed: "H H * * *"
        builders:
                - shell: |
                    cd $JENKINS_HOME
                    hardlink -vfot -i '\.tar\.' -i '\.dsc$' -i '\.deb$' jobs* workspace*
                    # only compress matrix job logs; pipeline logs won't display if compressed (2020-04)
                    find jobs/*/configurations -name log -mtime +0 | xargs -r gzip -9v
        publishers:
                - ircbot:
                        strategy: any-failure
                        message-type: summary

- job:
        name: gitcache-postgresql
        description: Reference repository postgresql source jobs
        workspace: '$HOME/gitcache.buexcl/postgresql'
        scm:
                - git:
                        url: https://git.postgresql.org/git/postgresql.git
                        branches:
                                - master
                        sparse-checkout:
                                paths:
                                        - HISTORY
                        wipe-workspace: false
        triggers:
                - pollscm:
                        cron: "H */6 * * *"

- job:
        name: list-upgradable-packages
        description: Alert about pending apt upgrades
        project-type: matrix
        child-workspace: .
        axes:
                - axis: *slaves_axis
        triggers:
                - timed: "0 11 * * *"
        builders:
                - shell: |
                        sudo apt-get update
                        apt list --upgradable 2>/dev/null | grep -v "^Listing" > upgradable || :
                        cat upgradable
                        ! test -s upgradable
        publishers:
                - ircbot:
                        strategy: any-failure
                        message-type: summary

- job: &ping
        name: ping-ppc64el
        description: Check if the ppc64el build host is up
        workspace: '$JENKINS_HOME'
        node: master
        triggers:
                - timed: "H */4 * * *"
        builders:
                - shell: 'ping -c3 10.3.22.22'
        publishers:
                - ircbot:
                        strategy: any-failure
                        message-type: summary

- job:
        <<: *ping
        name: jenkins-plugin-updates
        description: Reports pending Jenkins plugin updates
        triggers:
                - timed: "59 10 * * *"
        builders:
                - shell: |
                    : https://pgdgbuild.dus.dg-i.net/pluginManager/
                    # this broke in mid-March 2020, ignore errors for now
                    curl -f --netrc -X POST --header 'Referer: https://pgdgbuild.dus.dg-i.net/pluginManager/checkUpdatesServer' https://pgdgbuild.dus.dg-i.net/pluginManager/checkUpdatesServer || :
                    ssh -i ~/.ssh/slave -p 2222 jenkins@localhost list-plugins > plugins.txt
                    cat plugins.txt
                    if grep ')$' plugins.txt; then
                      : There are pending Jenkins plugin updates
                      : https://pgdgbuild.dus.dg-i.net/pluginManager/
                      exit 1
                    fi

- job:
        <<: *ping
        name: scm-sync-status
        description: Reports SCM Sync errors
        triggers:
                - timed: "59 10 * * *"
        builders:
                - shell: |
                    ls -l scm-sync-configuration.*
                    if test -f scm-sync-configuration.fail.log; then
                      cat scm-sync-configuration.fail.log
                      test scm-sync-configuration.success.log -nt scm-sync-configuration.fail.log
                    fi

- job:
        <<: *ping
        name: apache2-running
        description: Check if apache2 is running
        builders:
                - shell: 'systemctl status apache2'

# project jobs

- project:
        name: apgdiff
        git-url: https://salsa.debian.org/postgresql/apgdiff.git
        jobs:
                - git-packages

- project:
        name: bucardo
        git-url: https://salsa.debian.org/postgresql/bucardo.git
        jobs:
                - git-packages

- project:
        name: barman
        git-url: https://salsa.debian.org/postgresql/barman.git
        jobs:
                - git-packages

- project:
        name: bgw-replstatus
        git-url: https://github.com/mhagander/bgw_replstatus.git
        jobs:
                - git-packages-with-beta

- project:
        name: check-patroni
        git-url: https://salsa.debian.org/debian/check-patroni.git
        git-branch: debian/latest
        # bullseye, buster, jammy, focal: pybuild-plugin-pyproject missing/too old
        dist-filter: '!(distribution in ["buster", "bullseye", "focal", "jammy"])'
        jobs:
                - git-packages

- project:
        name: check-pgactivity
        git-url: https://salsa.debian.org/postgresql/check-pgactivity.git
        jobs:
                - git-packages

- project:
        name: check-pgbackrest
        git-url: https://salsa.debian.org/postgresql/check-pgbackrest.git
        jobs:
                - git-packages

- project:
        name: check-postgres
        git-url: https://salsa.debian.org/postgresql/check-postgres.git
        jobs:
                - git-packages

- project:
        name: credcheck
        git-url: https://salsa.debian.org/postgresql/credcheck.git
        jobs:
                - git-packages-with-beta

- project:
        name: elephant-shed
        git-url: https://github.com/credativ/elephant-shed.git
        git-branch: rel1_3
        jobs:
                - git-packages

- project:
        name: extra-window-functions
        git-url: https://salsa.debian.org/postgresql/extra-window-functions.git
        jobs:
                - git-packages-with-beta

- project:
        name: first-last-agg
        git-url: https://salsa.debian.org/postgresql/first-last-agg.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: h3-pg
        git-url: https://salsa.debian.org/postgresql/h3-pg.git
        # buster, focal: cmake too old
        dist-filter: '!(distribution in ["buster", "focal"])'
        backports: 'BACKPORTS=yes ' # bullseye: cmake >= 3.20
        backports_runtime: 'BACKPORTS=yes ' # actually test-time; bullseye: cmake >= 3.20
        jobs:
                - git-packages-with-beta

- project:
        name: hypopg
        git-url: https://salsa.debian.org/postgresql/hypopg.git
        jobs:
                - git-packages-with-beta

- project:
        name: icu-ext
        git-url: https://salsa.debian.org/postgresql/icu-ext.git
        jobs:
                - git-packages-with-beta

- project:
        name: ip4r
        git-url: https://salsa.debian.org/postgresql/ip4r.git
        jobs:
                - git-packages-with-beta

- project:
        name: jsquery
        git-url: https://salsa.debian.org/postgresql/jsquery.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: libdbd-pg-perl
        git-url: https://salsa.debian.org/perl-team/modules/packages/libdbd-pg-perl.git
        jobs:
                - git-packages

- project:
        name: libh3
        git-url: https://salsa.debian.org/postgresql/libh3.git
        # buster, focal: cmake too old
        dist-filter: '!(distribution in ["buster", "focal"])'
        backports: 'BACKPORTS=yes ' # bullseye: cmake >= 3.20
        jobs:
                - git-packages

- project:
        name: libtap-parser-sourcehandler-pgtap-perl
        git-url: https://salsa.debian.org/perl-team/modules/packages/libtap-parser-sourcehandler-pgtap-perl.git
        jobs:
                - git-packages

- project:
        name: libpgjava
        git-url: https://salsa.debian.org/java-team/libpostgresql-jdbc-java.git
        jobs:
                - git-packages

- project:
        name: libpg-perl
        git-url: https://salsa.debian.org/postgresql/libpg-perl.git
        jobs:
                - git-packages

- project:
        name: libpg-query
        git-url: https://salsa.debian.org/postgresql/libpg-query.git
        jobs:
                - git-packages

- project:
        name: libpqtypes
        git-url: https://salsa.debian.org/postgresql/libpqtypes.git
        jobs:
                - git-packages

- project:
        name: libscram-java
        git-url: https://salsa.debian.org/java-team/libscram-java.git
        jobs:
                - git-packages

- project:
        name: libstringprep-java
        git-url: https://salsa.debian.org/java-team/libstringprep-java.git
        # requirement of libscram-java
        jobs:
                - git-packages

- project:
        name: mimeo
        git-url: https://salsa.debian.org/postgresql/mimeo.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: mobilitydb
        git-url: https://salsa.debian.org/postgresql/mobilitydb.git
        git-branch: main
        upstream-url: https://github.com/MobilityDB/MobilityDB.git
        upstream-branch: develop
        arch-filter: 'architecture in ["amd64", "arm64", "ppc64el"]'
        jobs:
                - git+upstream-snapshot

- project:
        name: omdb-postgresql
        git-url: https://github.com/df7cb/omdb-postgresql.git
        jobs:
                - git-packages

- project:
        name: omnidb
        git-url: https://salsa.debian.org/postgresql/omnidb.git
        jobs:
                - git-packages

- project:
        name: omnidb-plpgsql-debugger
        git-url: https://salsa.debian.org/postgresql/omnidb-plpgsql-debugger.git
        jobs:
                - git-packages-with-beta

- project:
        name: ora2pg
        git-url: https://salsa.debian.org/postgresql/ora2pg.git
        jobs:
                - git-packages

- project:
        name: oracle-fdw
        git-url: https://salsa.debian.org/postgresql/oracle-fdw.git
        arch-filter: 'architecture in ["amd64", "arm64", "s390x"]'
        jobs:
                - git-packages-with-beta

- project:
        name: oracle-libs
        git-url: https://salsa.debian.org/postgresql/oracle-libs.git
        # architectures supported by instant client
        arch-filter: 'architecture in ["amd64", "arm64", "s390x"]'
        jobs:
                - git-packages

- project:
        name: orafce
        git-url: https://salsa.debian.org/postgresql/orafce.git
        jobs:
                - git-packages-with-beta

- project:
        name: resource-agents-paf
        git-url: https://salsa.debian.org/ha-team/resource-agents-paf.git
        jobs:
                - git-packages

- project:
        name: patroni
        git-url: https://salsa.debian.org/postgresql/patroni.git
        upstream-url: https://github.com/zalando/patroni.git
        jobs:
                - git+upstream-snapshot

- project:
        name: pg-activity
        git-url: https://salsa.debian.org/kolter/pg-activity.git
        git-branch: unstable
        # buster, focal: needs python3-humanize 2.6
        # bullseye, jammy: pybuild-plugin-pyproject missing/too old
        dist-filter: '!(distribution in ["buster", "bullseye", "focal", "jammy"])'
        jobs:
                - git-packages

- project:
        name: pgagent
        git-url: https://salsa.debian.org/postgresql/pgagent.git
        jobs:
                - git-packages

- project:
        name: pgagroal
        git-url: https://salsa.debian.org/postgresql/pgagroal.git
        # buster: cmake too old
        # focal: cmake missing CheckLinkerFlag.cmake
        dist-filter: '!(distribution in ["buster", "focal"])'
        jobs:
                - git-packages

- project: # pgaudit for PostgreSQL 9.6
        name: pgaudit-1.1
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 1.1
        pg-supported-versions: 9.6
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 10
        name: pgaudit-1.2
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 1.2
        pg-supported-versions: 10
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 11
        name: pgaudit-1.3
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 1.3
        pg-supported-versions: 11
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 12
        name: pgaudit-1.4
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 1.4
        pg-supported-versions: 12
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 13
        name: pgaudit-1.5
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 1.5
        pg-supported-versions: 13
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 14
        name: pgaudit-1.6
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 1.6
        pg-supported-versions: 14
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 15
        name: pgaudit-1.7
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 1.7
        pg-supported-versions: 15
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 16
        name: pgaudit-16
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 16
        pg-supported-versions: 16
        jobs:
                - git-packages-only

- project: # pgaudit for PostgreSQL 17
        name: pgaudit-17
        git-url: https://salsa.debian.org/postgresql/pgaudit.git
        git-branch: 17
        pg-supported-versions: 17
        jobs:
                - git-packages-only

- project:
        name: pgauditlogtofile
        git-url: https://salsa.debian.org/postgresql/pgauditlogtofile.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-auto-failover
        git-url: https://github.com/dimitri/pgaf_debian.git
        git-branch: main
        upstream-url: https://github.com/citusdata/pg_auto_failover.git
        upstream-branch: main
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: pgbadger
        git-url: https://salsa.debian.org/postgresql/pgbadger.git
        jobs:
                - git-packages

- project:
        name: pgbackrest
        git-url: https://salsa.debian.org/postgresql/pgbackrest.git
        jobs:
                - git-packages

- project:
        name: pgbouncer
        git-url: https://salsa.debian.org/postgresql/pgbouncer.git
        jobs:
                - git-packages

- project:
        name: pg-bsd-indent
        git-url: https://salsa.debian.org/postgresql/pg-bsd-indent.git
        jobs:
                - git-packages

- project:
        name: pg-catcheck
        git-url: https://salsa.debian.org/postgresql/pg-catcheck.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-checksums
        git-url: https://salsa.debian.org/postgresql/pg-checksums.git
        upstream-url: https://github.com/credativ/pg_checksums.git
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: pg-cron
        git-url: https://salsa.debian.org/postgresql/pg-cron.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

# needs psycopg3
#- project:
#        name: pgcli
#        git-url: https://git.progress-linux.org/users/daniel.baumann/debian/packages/pgcli
#        git-branch: debian
#        shallow-clone: 'false'
#        jobs:
#                - git-packages

- project:
        name: pgcluu
        git-url: https://salsa.debian.org/postgresql/pgcluu.git
        jobs:
                - git-packages

- project:
        name: pgcopydb
        git-url: https://github.com/dimitri/pgcopydb.git
        git-branch: main
        jobs:
                - git-packages

- project:
        name: pgdg-buildenv
        git-url: https://git.postgresql.org/git/pgapt.git
        jobs:
                - git-packages

- project:
        name: pg-dirtyread
        git-url: https://github.com/df7cb/pg_dirtyread.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgextwlist
        git-url: https://github.com/dimitri/pgextwlist.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgfaceting
        git-url: https://salsa.debian.org/postgresql/pgfaceting.git
        # package is arch:all, but match pg-roaringbitmap architectures for testing
        arch-filter: '!(architecture in ["s390x"])'
        jobs:
                - git-packages-with-beta

- project:
        name: pg-failover-slots
        git-url: https://salsa.debian.org/postgresql/pg-failover-slots.git
        git-branch: main
        jobs:
                - git-packages-with-beta

- project:
        name: pg-fact-loader
        git-url: https://salsa.debian.org/postgresql/pg-fact-loader.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgfincore
        git-url: https://git.postgresql.org/git/pgfincore.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgformatter
        git-url: https://salsa.debian.org/postgresql/pgformatter.git
        jobs:
                - git-packages

- project:
        name: pg-gvm
        git-url: https://salsa.debian.org/pkg-security-team/pg-gvm.git
        git-branch: debian/master
        # only in sid: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986529
        dist-filter: 'distribution=="sid"'
        jobs:
                - git-packages-with-beta

- project:
        name: pg-hint-plan-12
        git-url: https://salsa.debian.org/postgresql/pg-hint-plan.git
        git-branch: 12
        pg-supported-versions: 12
        jobs:
                - git-packages

- project:
        name: pg-hint-plan-13
        git-url: https://salsa.debian.org/postgresql/pg-hint-plan.git
        git-branch: 13
        pg-supported-versions: 13
        jobs:
                - git-packages

- project:
        name: pg-hint-plan-14
        git-url: https://salsa.debian.org/postgresql/pg-hint-plan.git
        git-branch: 14
        pg-supported-versions: 14
        jobs:
                - git-packages

- project:
        name: pg-hint-plan-15
        git-url: https://salsa.debian.org/postgresql/pg-hint-plan.git
        git-branch: 15
        pg-supported-versions: 15
        jobs:
                - git-packages

- project:
        name: pg-hint-plan-16
        git-url: https://salsa.debian.org/postgresql/pg-hint-plan.git
        git-branch: 16
        pg-supported-versions: 16
        jobs:
                - git-packages

- project:
        name: pg-hint-plan-17
        git-url: https://salsa.debian.org/postgresql/pg-hint-plan.git
        git-branch: 17
        pg-supported-versions: 17
        jobs:
                - git-packages

- project:
        name: pg-ldap-sync
        git-url: https://salsa.debian.org/postgresql/pg-ldap-sync.git
        jobs:
                - git-packages

- project:
        name: pglast
        git-url: https://salsa.debian.org/postgresql/pglast.git
        jobs:
                - git-packages

- project:
        name: pgloader
        git-url: https://github.com/dimitri/pgloader.git
        # ppc64el doesn't have sbcl on the older Debian dists, and not on older Ubuntus at all
        # s390x doesn't have sbcl
        arch-filter: '!(architecture=="ppc64el" && distribution in ["jammy", "focal"] || architecture in ["s390x"])'
        jobs:
                - git-packages

- project:
        name: pglogical
        git-url: https://salsa.debian.org/postgresql/pglogical.git
        jobs:
                - git-packages-with-beta

- project:
        name: pglogical-ticker
        git-url: https://salsa.debian.org/postgresql/pglogical-ticker.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgl-ddl-deploy
        git-url: https://salsa.debian.org/postgresql/pgl-ddl-deploy.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgmemcache
        git-url: https://salsa.debian.org/postgresql/pgmemcache.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgmodeler
        git-url: https://salsa.debian.org/postgresql/pgmodeler.git
        upstream-url: https://github.com/pgmodeler/pgmodeler.git
        upstream-branch: develop
        # bullseye: missing qt6-base-dev
        # buster, focal: Qt5 too old
        dist-filter: '!(distribution in ["buster", "bullseye", "focal"])'
        jobs:
                - git+upstream-snapshot

- project:
        name: pgnodemx
        git-url: https://salsa.debian.org/postgresql/pgnodemx.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-rage-terminator
        git-url: https://github.com/disco-stu/pg-rage-terminator-pkg.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-rational
        git-url: https://salsa.debian.org/postgresql/pg-rational.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-repack
        git-url: https://salsa.debian.org/postgresql/pg-repack.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-roaringbitmap
        git-url: https://salsa.debian.org/postgresql/pg-roaringbitmap.git
        arch-filter: '!(architecture in ["s390x"])'
        jobs:
                - git-packages-with-beta

- project:
        name: pg-rrule
        git-url: https://salsa.debian.org/postgresql/pg-rrule.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-similarity
        git-url: https://salsa.debian.org/postgresql/pg-similarity.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: pg-show-plans
        git-url: https://salsa.debian.org/postgresql/pg-show-plans.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-snakeoil
        git-url: https://github.com/df7cb/pg_snakeoil.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-squeeze
        git-url: https://salsa.debian.org/postgresql/pg-squeeze.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-partman
        git-url: https://salsa.debian.org/postgresql/pg-partman.git
        upstream-url: https://github.com/pgpartman/pg_partman.git
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: pg-permissions
        git-url: https://salsa.debian.org/postgresql/pg-permissions.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgpcre
        git-url: https://salsa.debian.org/postgresql/pgpcre.git
        # doesn't work on big-endian
        arch-filter: 'architecture!="s390x"'
        jobs:
                - git-packages-with-beta

- project:
        name: pgpointcloud
        git-url: https://salsa.debian.org/postgresql/pgpointcloud.git
        upstream-url: https://github.com/pgpointcloud/pointcloud.git
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: pgpool2
        git-url: https://salsa.debian.org/postgresql/pgpool2.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-qualstats
        git-url: https://salsa.debian.org/postgresql/pg-qualstats.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgrouting
        git-url: https://salsa.debian.org/debian-gis-team/pgrouting.git
        # focal, buster: sphinx problems
        dist-filter: '!(distribution in ["buster", "focal"])'
        jobs:
                - git-packages-with-beta

- project:
        name: pgsphere
        git-url: https://salsa.debian.org/postgresql/pgsphere.git
        upstream-url: https://github.com/postgrespro/pgsphere.git
        snapshot-cron: 'H 1 * * *'
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: pgstat
        git-url: https://salsa.debian.org/postgresql/pgstat.git
        jobs:
                - git-packages

- project:
        name: pg-stat-kcache
        git-url: https://salsa.debian.org/postgresql/pg-stat-kcache.git
        jobs:
                - git-packages-with-beta

- project:
        name: pg-statviz
        git-url: https://salsa.debian.org/postgresql/pg-statviz.git
        # bullseye, buster, jammy, focal: python problems (TypeError: First argument must be a path or binary-mode file object)
        dist-filter: '!(distribution in ["bullseye", "buster", "jammy", "focal"])'
        jobs:
                - git-packages-with-beta

- project:
        name: pgsql-asn1oid
        git-url: https://github.com/df7cb/pgsql-asn1oid.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgsql-http
        git-url: https://salsa.debian.org/postgresql/pgsql-http.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgsql-ogr-fdw
        git-url: https://salsa.debian.org/debian-gis-team/pgsql-ogr-fdw.git
        upstream-url: https://github.com/pramsey/pgsql-ogr-fdw.git
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: pgtap
        git-url: https://salsa.debian.org/postgresql/pgtap.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgtt
        git-url: https://salsa.debian.org/postgresql/pgtt.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgtop
        git-url: https://salsa.debian.org/postgresql/pgtop.git
        jobs:
                - git-packages

- project:
        name: pg-track-settings
        git-url: https://salsa.debian.org/postgresql/pg-track-settings.git
        git-branch: master
        jobs:
                - git-packages-with-beta

- project:
        name: pgvector
        git-url: https://salsa.debian.org/postgresql/pgvector.git
        git-branch: develop
        jobs:
                - git-packages-with-beta

- project:
        name: pg-wait-sampling
        git-url: https://salsa.debian.org/postgresql/pg-wait-sampling.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgxnclient
        git-url: https://salsa.debian.org/postgresql/pgxnclient.git
        jobs:
                - git-packages

- project:
        name: pldebugger
        git-url: https://salsa.debian.org/postgresql/pldebugger.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: plpgsql-check
        git-url: https://salsa.debian.org/postgresql/plpgsql-check.git
        jobs:
                - git-packages-with-beta

- project:
        name: plprofiler
        git-url: https://salsa.debian.org/postgresql/plprofiler.git
        upstream-url: https://github.com/bigsql/plprofiler.git
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: plr
        git-url: https://salsa.debian.org/postgresql/plr.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgis
        git-url: https://salsa.debian.org/debian-gis-team/postgis.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgis-java
        git-url: https://salsa.debian.org/debian-gis-team/postgis-java.git
        jobs:
                - git-packages

- project:
        name: postgresql-8.2
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 8.2
        arch-filter: '(architecture!="arm64")'
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-8.3
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 8.3
        arch-filter: '(architecture!="arm64")'
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-8.4
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 8.4
        arch-filter: '(architecture!="arm64")'
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-9.0
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 9.0
        arch-filter: '(architecture!="arm64")'
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-9.1
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 9.1
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-9.2
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 9.2
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-9.3
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 9.3
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-9.4
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 9.4
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-9.5
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 9.5
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-9.6
        git-url: https://salsa.debian.org/postgresql/postgresql.git
        git-branch: 9.6
        dist-filter: *lts_dist_filter
        jobs:
                - git-packages-only

- project:
        name: postgresql-10
        git-branch: 10
        upstream-branch: REL_10_STABLE
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-11
        git-branch: 11
        upstream-branch: REL_11_STABLE
        snapshot-cron: 'H 1 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-12
        git-branch: 12
        upstream-branch: REL_12_STABLE
        snapshot-cron: 'H 2 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-13
        git-branch: 13
        upstream-branch: REL_13_STABLE
        snapshot-cron: 'H 3 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-14
        git-branch: 14
        upstream-branch: REL_14_STABLE
        snapshot-cron: 'H 4 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-15
        git-branch: 15
        upstream-branch: REL_15_STABLE
        snapshot-cron: 'H 5 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-16
        git-branch: 16
        upstream-branch: REL_16_STABLE
        snapshot-cron: 'H 6 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-17
        git-branch: 17
        upstream-branch: REL_17_STABLE
        snapshot-cron: 'H H/6 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-18
        git-branch: 18
        upstream-branch: master
        snapshot-cron: 'H H/6 * * *'
        jobs:
                - postgresql-server-jobs

- project:
        name: postgresql-12-age
        git-url: https://salsa.debian.org/postgresql/postgresql-age.git
        git-branch: 12
        jobs:
                - git-packages

- project:
        name: postgresql-13-age
        git-url: https://salsa.debian.org/postgresql/postgresql-age.git
        git-branch: 13
        jobs:
                - git-packages

- project:
        name: postgresql-14-age
        git-url: https://salsa.debian.org/postgresql/postgresql-age.git
        git-branch: 14
        jobs:
                - git-packages

- project:
        name: postgresql-15-age
        git-url: https://salsa.debian.org/postgresql/postgresql-age.git
        git-branch: 15
        jobs:
                - git-packages

- project:
        name: postgresql-16-age
        git-url: https://salsa.debian.org/postgresql/postgresql-age.git
        git-branch: 16
        jobs:
                - git-packages

- project:
        name: postgresql-common
        git-url: https://salsa.debian.org/postgresql/postgresql-common.git
        jobs:
                - git-packages

- project:
        name: postgres-decoderbufs
        git-url: https://salsa.debian.org/postgresql/postgres-decoderbufs.git
        upstream-url: https://github.com/debezium/postgres-decoderbufs.git
        upstream-branch: main
        jobs:
                - git+beta+upstream-snapshot

- project:
        name: postgresql-debversion
        git-url: https://salsa.debian.org/postgresql/postgresql-debversion.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-filedump
        git-url: https://salsa.debian.org/postgresql/postgresql-filedump.git
        #upstream-url: https://git.postgresql.org/git/pg_filedump.git
        jobs:
                - git-packages

- project:
        name: postgresql-hll
        git-url: https://salsa.debian.org/postgresql/postgresql-hll.git
        arch-filter: '!(architecture in ["s390x"])'
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-mysql-fdw
        git-url: https://salsa.debian.org/postgresql/postgresql-mysql-fdw.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-numeral
        git-url: https://github.com/df7cb/postgresql-numeral.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-periods
        git-url: https://github.com/xocolatl/periods.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-pgmp
        git-url: https://salsa.debian.org/postgresql/postgresql-pgmp.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-pljava
        git-url: https://salsa.debian.org/postgresql/postgresql-pljava.git
        # https://github.com/tada/pljava/issues/338
        # s390x also fails: https://github.com/tada/pljava/issues/469
        arch-filter: '!(architecture in ["ppc64el", "s390x"])'
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-pllua
        git-url: https://salsa.debian.org/postgresql/postgresql-pllua.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-plproxy
        git-url: https://salsa.debian.org/postgresql/postgresql-plproxy.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-plsh
        git-url: https://salsa.debian.org/postgresql/postgresql-plsh.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-prioritize
        git-url: https://salsa.debian.org/postgresql/postgresql-prioritize.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-q3c
        git-url: https://salsa.debian.org/postgresql/postgresql-q3c.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-rum
        git-url: https://salsa.debian.org/postgresql/postgresql-rum.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-semver
        git-url: https://salsa.debian.org/debian/postgresql-semver.git
        git-branch: debian/master
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-set-user
        git-url: https://salsa.debian.org/postgresql/postgresql-set-user.git
        upstream-url: https://github.com/pgaudit/set_user.git
        jobs:
                - git-packages-with-beta

- project:
        name: postgresql-unit
        git-url: https://github.com/df7cb/postgresql-unit.git
        jobs:
                - git-packages-with-beta

- project:
        name: powa-archivist
        git-url: https://github.com/powa-team/powa-archivist.git
        git-branch: master
        jobs:
                - git-packages-with-beta

- project:
        name: powa-collector
        git-url: https://salsa.debian.org/postgresql/powa-collector.git
        jobs:
                - git-packages

- project:
        name: powa-web
        git-url: https://salsa.debian.org/postgresql/powa-web.git
        git-branch: debian
        jobs:
                - git-packages

- project:
        name: prefix
        git-url: https://github.com/dimitri/prefix.git
        jobs:
                - git-packages-with-beta

- project:
        name: preprepare
        git-url: https://github.com/dimitri/preprepare.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: prometheus-sql-exporter
        git-url: https://salsa.debian.org/postgresql/prometheus-sql-exporter.git
        # buster: needs newer golang-github-lib-pq-dev (backport exists)
        # bullseye, focal: needs golang-github-go-kit-log-dev
        dist-filter: '!(distribution in ["buster", "bullseye", "focal"])'
        backports: 'BACKPORTS=yes ' # golang-* backports on buster (needed for existing 0.4.0 packages in repo even when we don't build newer ones there)
        jobs:
                - git-packages

- project:
        name: pspg
        git-url: https://salsa.debian.org/postgresql/pspg.git
        upstream-url: https://github.com/okbob/pspg.git
        jobs:
                - git-packages

- project:
        name: psqlodbc
        git-url: https://salsa.debian.org/postgresql/psqlodbc.git
        jobs:
                - git-packages

- project:
        name: psycopg2
        git-url: https://salsa.debian.org/python-team/modules/psycopg2.git
        git-branch: debian/master
        # buster, focal: sphinx too old
        dist-filter: '!(distribution in ["buster", "focal"])'
        jobs:
                - git-packages

- project:
        name: pysyncobj
        git-url: https://salsa.debian.org/mbanck/pysyncobj.git
        # buster, focal: tests fail
        dist-filter: '!(distribution in ["buster", "focal"])'
        jobs:
                - git-packages

- project:
        name: repmgr
        git-url: https://salsa.debian.org/postgresql/repmgr.git
        jobs:
                - git-packages-with-beta

- project:
        name: rdkit
        git-url: https://salsa.debian.org/debichem-team/rdkit.git
        # build-dependencies renamed on buster focal
        # symbols missing on bullseye
        # bookworm, mantic, jammy, focal: catch2 too old
        dist-filter: '!(distribution in ["bookworm", "bullseye", "buster", "mantic", "jammy", "focal"])'
        jobs:
                - git-packages-with-beta

- project:
        name: slony1-2
        git-url: https://salsa.debian.org/postgresql/slony1-2.git
        jobs:
                - git-packages-with-beta

- project:
        name: sqlreduce
        git-url: https://github.com/df7cb/sqlreduce.git
        jobs:
                - git-packages

- project:
        name: sqlsmith
        git-url: https://github.com/anse1/sqlsmith.git
        git-branch: debian
        jobs:
                - git-packages

- project:
        name: tablelog
        git-url: https://github.com/df7cb/table_log.git
        jobs:
                - git-packages-with-beta

- project:
        name: tdigest
        git-url: https://salsa.debian.org/postgresql/tdigest.git
        jobs:
                - git-packages-with-beta

- project:
        name: tds-fdw
        git-url: https://salsa.debian.org/postgresql/tds-fdw.git
        jobs:
                - git-packages-with-beta

- project:
        name: timescaledb
        git-url: https://salsa.debian.org/postgresql/timescaledb.git
        arch-filter: '!(architecture in ["s390x"])'
        jobs:
                - git-packages-with-beta

- project:
        name: toastinfo
        git-url: https://github.com/df7cb/toastinfo.git
        jobs:
                - git-packages-with-beta

- project:
        name: vip-manager
        git-url: https://salsa.debian.org/postgresql/vip-manager.git
        jobs:
                - git-packages

- project:
        name: vip-manager2
        git-url: https://salsa.debian.org/postgresql/vip-manager2.git
        git-branch: main
        # buster, focal: golang-github-mdlayher-arp-dev build dependency not available
        # bullseye, jammy: go.etcd.io/etcd/clientv3 missing
        dist-filter: '!(distribution in ["buster", "bullseye", "focal", "jammy"])'
        jobs:
                - git-packages

- project:
        name: wal2json
        git-url: https://salsa.debian.org/postgresql/wal2json.git
        jobs:
                - git-packages-with-beta

# upgrade tests

# lowest supported "upgrade from" version is 8.4, "upgrade to" 9.2
# lowest supported version on arm64 is 9.1
- project: { name: upgrade-8.4-9.2, oldversion: 8.4, newversion: 9.2, jobs: [ upgrade ], dist-filter: *lts_dist_filter, arch-filter: 'architecture!="arm64"' }
- project: { name: upgrade-9.0-9.2, oldversion: 9.0, newversion: 9.2, jobs: [ upgrade ], dist-filter: *lts_dist_filter, arch-filter: 'architecture!="arm64"' }
- project: { name: upgrade-9.1-9.2, oldversion: 9.1, newversion: 9.2, jobs: [ upgrade ], dist-filter: *lts_dist_filter }
- project: { name: upgrade-9.2-9.3, oldversion: 9.2, newversion: 9.3, jobs: [ upgrade ], dist-filter: *lts_dist_filter }
- project: { name: upgrade-9.3-9.4, oldversion: 9.3, newversion: 9.4, jobs: [ upgrade ], dist-filter: *lts_dist_filter }
- project: { name: upgrade-9.4-9.5, oldversion: 9.4, newversion: 9.5, jobs: [ upgrade ], dist-filter: *lts_dist_filter }
- project: { name: upgrade-9.5-9.6, oldversion: 9.5, newversion: 9.6, jobs: [ upgrade ], dist-filter: *lts_dist_filter }
- project: { name: upgrade-9.6-10,  oldversion: 9.6, newversion: 10,  jobs: [ upgrade ], dist-filter: *lts_dist_filter }
- project: { name: upgrade-10-11,   oldversion: 10,  newversion: 11,  jobs: [ upgrade ] }
- project: { name: upgrade-11-12,   oldversion: 11,  newversion: 12,  jobs: [ upgrade ] }
- project: { name: upgrade-12-13,   oldversion: 12,  newversion: 13,  jobs: [ upgrade ] }
- project: { name: upgrade-13-14,   oldversion: 13,  newversion: 14,  jobs: [ upgrade ] }
- project: { name: upgrade-14-15,   oldversion: 14,  newversion: 15,  jobs: [ upgrade ] }
- project: { name: upgrade-15-16,   oldversion: 15,  newversion: 16,  jobs: [ upgrade ] }
- project: { name: upgrade-16-17,   oldversion: 16,  newversion: 17,  jobs: [ upgrade ] }
- project: { name: upgrade-17-18,   oldversion: 17,  newversion: 18,  jobs: [ upgrade ] }

# larger jumps:
# pg_dump 14 supports 8.0+, but pg_upgrade 14 really only 9.0+ (https://www.postgresql.org/message-id/flat/1973418.1657040382%40sss.pgh.pa.us#06cfe6e815abc1478d15ea51986d85f5)
- project: { name: upgrade-9.0-14,  oldversion: 9.0, newversion: 14,  jobs: [ upgrade ], dist-filter: *lts_dist_filter, arch-filter: 'architecture!="arm64"' }
# pg_dump 15/16 supports 9.2+
- project: { name: upgrade-9.2-16,  oldversion: 9.2, newversion: 16,  jobs: [ upgrade ], dist-filter: '!(distribution in ["oracular"])' }
- project: { name: upgrade-9.2-17,  oldversion: 9.2, newversion: 15,  jobs: [ upgrade ], dist-filter: '!(distribution in ["oracular"])' }
- project: { name: upgrade-9.4-11,  oldversion: 9.4, newversion: 11,  jobs: [ upgrade ], dist-filter: *lts_dist_filter }
- project: { name: upgrade-9.6-13,  oldversion: 9.6, newversion: 13,  jobs: [ upgrade ], dist-filter: *lts_dist_filter }

# PgQ

- project:
        name: londiste
        git-url: https://salsa.debian.org/postgresql/londiste.git
        git-branch: debian
        # buster, bullseye, focal: missing pybuild-plugin-pyproject
        # jammy: plugin pyproject failed with: UNKNOWN wheel found: UNKNOWN-0.0.0-py3-none-any.whl. Does pyproject.toml specify a build-backend?
        dist-filter: '!(distribution in ["buster", "bullseye", "focal", "jammy"])'
        jobs:
                - git-packages

- project:
        name: londiste-sql
        git-url: https://salsa.debian.org/postgresql/londiste-sql.git
        git-branch: debian
        jobs:
                - git-packages-with-beta

- project:
        name: pgq
        git-url: https://salsa.debian.org/postgresql/pgq.git
        jobs:
                - git-packages-with-beta

- project:
        name: pgqd
        git-url: https://salsa.debian.org/postgresql/pgqd.git
        git-branch: debian
        jobs:
                - git-packages

- project:
        name: pgq-node
        git-url: https://salsa.debian.org/postgresql/pgq-node.git
        jobs:
                - git-packages-with-beta

- project:
        name: python-pgq
        git-url: https://salsa.debian.org/postgresql/python-pgq.git
        git-branch: debian
        # buster, bullseye, focal: missing pybuild-plugin-pyproject
        # jammy: plugin pyproject failed with: UNKNOWN wheel found: UNKNOWN-0.0.0-py3-none-any.whl. Does pyproject.toml specify a build-backend?
        dist-filter: '!(distribution in ["buster", "bullseye", "focal", "jammy"])'
        jobs:
                - git-packages

- project:
        name: python-skytools
        git-url: https://salsa.debian.org/postgresql/python-skytools.git
        git-branch: debian
        # buster, bullseye, focal: missing pybuild-plugin-pyproject
        # jammy: plugin pyproject failed with: UNKNOWN wheel found: UNKNOWN-0.0.0-cp37-abi3-linux_x86_64.whl. Does pyproject.toml specify a build-backend?
        dist-filter: '!(distribution in ["buster", "bullseye", "focal", "jammy"])'
        jobs:
                - git-packages

# backports

- project:
        name: architecture-properties
        git-url: https://salsa.debian.org/debian/architecture-properties.git
        dist-filter: '(distribution in ["bullseye", "buster", "jammy", "focal"])'
        backports: 'BACKPORTS=yes ' # bullseye: cmake >= 3.20
        generate-source-args: 'DOT="~" '
        jobs:
                - git-packages

##
