- project:
    vars:
      ensure_tox_version: '<4'
    queue: integrated
    templates:
      - publish-openstack-docs-pti
      - release-notes-jobs-python3
    check:
      jobs:
        - openstack-tox-pep8
        - cinderlib-tox-py38
        - cinderlib-tox-py39
        - cinderlib-tox-py310
        # TODO: make this voting when cinderlib opens for 2024.1 development
        - cinderlib-tox-py311:
            voting: false

        - cinderlib-lvm-functional
        - cinderlib-ceph-functional
        # NOTE: when cinderlib opens for 2024.1 development, use the parent
        # job instead
        - cinderlib-os-brick-src-tempest-lvm-lio-barbican-2023.2

    gate:
      jobs:
        - openstack-tox-pep8
        - cinderlib-tox-py38
        - cinderlib-tox-py39
        - cinderlib-tox-py310

        - cinderlib-lvm-functional
        - cinderlib-ceph-functional
        # NOTE: when cinderlib opens for 2024.1 development, use the parent
        # job instead
        - cinderlib-os-brick-src-tempest-lvm-lio-barbican-2023.2
    post:
      jobs:
        - publish-openstack-python-branch-tarball

- job:
    name: cinderlib-tox-py38
    parent: openstack-tox-py38
    required-projects:
      - name: openstack/os-brick
        override-checkout: stable/2023.2
      - name: openstack/cinder
        override-checkout: stable/2023.2
      - name: openstack/requirements
        override-checkout: stable/2023.2

- job:
    name: cinderlib-tox-py39
    parent: openstack-tox-py39
    required-projects:
      - name: openstack/os-brick
        override-checkout: stable/2023.2
      - name: openstack/cinder
        override-checkout: stable/2023.2
      - name: openstack/requirements
        override-checkout: stable/2023.2

- job:
    name: cinderlib-tox-py310
    parent: openstack-tox-py310
    required-projects:
      - name: openstack/os-brick
        override-checkout: stable/2023.2
      - name: openstack/cinder
        override-checkout: stable/2023.2
      - name: openstack/requirements
        override-checkout: stable/2023.2

- job:
    name: cinderlib-tox-py311
    parent: openstack-tox-py311
    required-projects:
      - name: openstack/os-brick
        override-checkout: stable/2023.2
      - name: openstack/cinder
        override-checkout: stable/2023.2
      - name: openstack/requirements
        override-checkout: stable/2023.2

- job:
    name: cinderlib-functional
    parent: openstack-tox-functional-with-sudo
    required-projects:
      - name: openstack/os-brick
        override-checkout: stable/2023.2
      - name: openstack/cinder
        override-checkout: stable/2023.2
      - name: openstack/requirements
        override-checkout: stable/2023.2
    pre-run: playbooks/required-projects-bindeps.yaml
    irrelevant-files:
      - ^.*\.rst$
      - ^doc/.*$
      - ^releasenotes/.*$

- job:
    name: cinderlib-lvm-functional
    parent: cinderlib-functional
    pre-run: playbooks/setup-lvm.yaml
    nodeset: centos-9-stream
    vars:
      tox_environment:
        # Workaround for https://github.com/pypa/pip/issues/6264
        PIP_OPTIONS: "--no-use-pep517"
        CL_FTEST_MEMORY_PERSISTENCE: "false"
        # These come from great-great-grandparent tox job
        NOSE_WITH_HTML_OUTPUT: 1
        NOSE_HTML_OUT_FILE: nose_results.html
        NOSE_WITH_XUNIT: 1

# The Ceph job tests cinderlib without unnecessary libraries
- job:
    name: cinderlib-ceph-functional
    parent: cinderlib-functional
    pre-run: playbooks/setup-ceph.yaml
    # TODO: move back to centos as soon as Ceph packages are available
    nodeset: ubuntu-focal
    vars:
      tox_environment:
        CL_FTEST_CFG: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/cinderlib'].src_dir }}/cinderlib/tests/functional/ceph.yaml"
        # These come from great-great-grandparent tox job
        NOSE_WITH_HTML_OUTPUT: 1
        NOSE_HTML_OUT_FILE: nose_results.html
        NOSE_WITH_XUNIT: 1

- job:
    name: cinderlib-os-brick-src-tempest-lvm-lio-barbican-2023.2
    parent: os-brick-src-tempest-lvm-lio-barbican
    description: |
      Use this job during the phase when cinderlib master is still
      the development branch of the cinder previous release.  When
      cinderlib master and cinder master are the development branches
      for the *same* release, you should use the parent job directly
      in the check and gate, above.
    override-checkout: stable/2023.2
    # NOTE: while the cinderlib stable/2023.2 branch does not exist,
    # zuul will fall back to using cinderlib master, which is the
    # behavior we want.
