- job:
    name: swift-tox-base
    parent: openstack-tox-py27
    description: |
      Base job for swift-tox jobs.

      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    timeout: 2400
    vars:
      tox_environment:
        TMPDIR: '{{ ansible_env.HOME }}/xfstmp'

- job:
    name: swift-tox-py27
    parent: swift-tox-base
    description: |
      Run unit-tests for swift under cPython version 2.7.

      Uses tox with the ``py27`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: py27
      tox_environment:
        NOSE_COVER_HTML: 1
        NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
    post-run: tools/playbooks/common/cover-post.yaml

- job:
    name: swift-tox-py27-centos-7
    parent: swift-tox-py27
    nodeset: centos-7

- job:
    name: swift-tox-py36
    parent: swift-tox-base
    nodeset: ubuntu-bionic
    description: |
      Run unit-tests for swift under cPython version 3.6.

      Uses tox with the ``py36`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: py36
      bindep_profile: test py36
      tox_environment:
        NOSE_COVER_HTML: 1
        NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
    post-run: tools/playbooks/common/cover-post.yaml

- job:
    name: swift-tox-py37
    parent: swift-tox-base
    nodeset: ubuntu-bionic
    description: |
      Run unit-tests for swift under cPython version 3.7.

      Uses tox with the ``py37`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: py37
      bindep_profile: test py37
      python_version: 3.7
      tox_environment:
        NOSE_COVER_HTML: 1
        NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
    post-run: tools/playbooks/common/cover-post.yaml

- job:
    name: swift-tox-func-py27
    parent: swift-tox-base
    description: |
      Run functional tests for swift under cPython version 2.7.

      Uses tox with the ``func`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func

- job:
    name: swift-tox-func-py37
    parent: swift-tox-base
    nodeset: ubuntu-bionic
    description: |
      Run functional tests for swift under cPython version 3.7.

      Uses tox with the ``func-py3`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-py3
      bindep_profile: test py37
      python_version: 3.7

- job:
    name: swift-tox-func-encryption-py37
    parent: swift-tox-func-py37
    description: |
      Run functional tests for swift under cPython version 3.7.

      Uses tox with the ``func-encryption-py3`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-encryption-py3

- job:
    name: swift-tox-func-ec-py37
    parent: swift-tox-func-py37
    description: |
      Run functional tests for swift under cPython version 3.7.

      Uses tox with the ``func-ec-py3`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-ec-py3

- job:
    name: swift-tox-func-domain-remap-staticweb-py37
    parent: swift-tox-func-py37
    description: |
      Run functional tests for swift under cPython version 3.7.

      Uses tox with the ``func-domain-remap-staticweb-py3`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-domain-remap-staticweb-py3

- job:
    name: swift-tox-func-s3api-py37
    parent: swift-tox-func-py37
    description: |
      Run functional tests for swift under cPython version 3.7.

      Uses tox with the ``func-s3api`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-s3api-py3

- job:
    name: swift-tox-func-py27-centos-7
    parent: swift-tox-func-py27
    nodeset: centos-7

- job:
    name: swift-tox-func-encryption-py27
    parent: swift-tox-base
    description: |
      Run functional tests for swift under cPython version 2.7.

      Uses tox with the ``func-encryption`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-encryption

- job:
    name: swift-tox-func-encryption-py27-centos-7
    parent: swift-tox-func-encryption-py27
    nodeset: centos-7

- job:
    name: swift-tox-func-ec-py27
    parent: swift-tox-base
    description: |
      Run functional tests for swift under cPython version 2.7.

      Uses tox with the ``func-ec`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-ec

- job:
    name: swift-tox-func-ec-py27-centos-7
    parent: swift-tox-func-ec-py27
    nodeset: centos-7

- job:
    name: swift-tox-func-domain-remap-staticweb-py27
    parent: swift-tox-base
    description: |
      Run functional tests for swift under cPython version 2.7.

      Uses tox with the ``func-domain-remap-staticweb`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-domain-remap-staticweb

- job:
    name: swift-tox-func-s3api-py27
    parent: swift-tox-base
    description: |
      Run functional tests for swift under cPython version 2.7.

      Uses tox with the ``func-s3api`` environment.
      It sets TMPDIR to an XFS mount point created via
      tools/test-setup.sh.
    vars:
      tox_envlist: func-s3api

- job:
    name: swift-dsvm-functional
    parent: devstack-minimal
    description: |
      Setup a Swift/Keystone environment and run Swift's func tests.
    required-projects:
      - opendev.org/openstack/requirements
      - opendev.org/openstack/swift
      - opendev.org/openstack/keystone
    timeout: 2700
    vars:
      tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/openstack/requirements/upper-constraints.txt'
      # This tox env get run twice; once for Keystone and once for tempauth
      tox_envlist: func
      devstack_localrc:
        # Other services are fine to run py3
        USE_PYTHON3: true
        # explicitly state that we want to test swift under py2
        DISABLED_PYTHON3_PACKAGES: 'swift'
        SWIFT_HASH: changeme
        # We don't need multiple replicas to run purely functional tests.
        # In fact, devstack special cases some things when there's only
        # one replica.
        SWIFT_REPLICAS: 1
        # One replica => no need for replicators, etc.
        SWIFT_START_ALL_SERVICES: False
        # Keystone v3 is currently the default, but may as well be explicit
        ENABLE_IDENTITY_V2: False
        IDENTITY_API_VERSION: 3
      devstack_services:
        keystone: true
        swift: true
      zuul_work_dir: src/opendev.org/openstack/swift
    pre-run: tools/playbooks/dsvm/pre.yaml
    run: tools/playbooks/dsvm/run.yaml
    post-run: tools/playbooks/dsvm/post.yaml

- job:
    name: swift-dsvm-functional-py3
    parent: swift-dsvm-functional
    description: |
      Setup a Swift/Keystone environment under py3 and run Swift's func tests
      (also under py3).
    vars:
      # This tox env get run twice; once for Keystone and once for tempauth
      tox_envlist: func-py3
      devstack_localrc:
        USE_PYTHON3: true
        # explicitly clear swift's default-disabled status
        DISABLED_PYTHON3_PACKAGES: ''

- job:
    name: swift-dsvm-functional-ipv6
    parent: swift-dsvm-functional
    vars:
      devstack_localrc:
        SERVICE_IP_VERSION: 6
        SERVICE_HOST: ""

- job:
    name: swift-tox-func-s3api-ceph-s3tests-tempauth
    parent: unittests
    voting: false
    nodeset: centos-7
    description: |
      Setup a SAIO dev environment and run ceph-s3tests
    pre-run:
      - tools/playbooks/common/install_dependencies.yaml
      - tools/playbooks/saio_single_node_setup/setup_saio.yaml
      - tools/playbooks/saio_single_node_setup/add_s3api.yaml
      - tools/playbooks/saio_single_node_setup/make_rings.yaml
    run: tools/playbooks/ceph-s3tests/run.yaml
    post-run:
      - tools/playbooks/probetests/post.yaml
      - tools/playbooks/ceph-s3tests/post.yaml

- job:
    name: swift-probetests-centos-7
    parent: unittests
    nodeset: centos-7
    description: |
      Setup a SAIO dev environment and run Swift's probe tests
    timeout: 3600
    pre-run:
      - tools/playbooks/common/install_dependencies.yaml
      - tools/playbooks/saio_single_node_setup/setup_saio.yaml
      - tools/playbooks/saio_single_node_setup/make_rings.yaml
    run: tools/playbooks/probetests/run.yaml
    post-run: tools/playbooks/probetests/post.yaml

- nodeset:
    name: swift-five-nodes
    nodes:
      - name: test-runner1
        label: centos-7
      - name: proxy1
        label: centos-7
      - name: account1
        label: centos-7
      - name: container1
        label: centos-7
      - name: object1
        label: centos-7
    groups:
      - name: test-runner
        nodes:
          - test-runner1
      - name: swift-cluster
        nodes:
          - proxy1
          - account1
          - container1
          - object1
      - name: proxy
        nodes:
          - proxy1
      - name: account
        nodes:
          - account1
      - name: container
        nodes:
          - container1
      - name: object
        nodes:
          - object1
      - name: storage
        nodes:
          - account1
          - container1
          - object1

- job:
    name: swift-multinode-rolling-upgrade
    parent: multinode
    nodeset: swift-five-nodes
    description: |
      Build a 4 node swift cluster and run functional tests
    timeout: 3600
    pre-run:
      - tools/playbooks/multinode_setup/pre.yaml
      - tools/playbooks/common/install_dependencies.yaml
      - tools/playbooks/multinode_setup/configure_loopback.yaml
      - tools/playbooks/multinode_setup/common_config.yaml
      - tools/playbooks/multinode_setup/make_rings.yaml
    run: tools/playbooks/multinode_setup/run.yaml
    post-run: tools/playbooks/probetests/post.yaml

- job:
    name: swift-multinode-rolling-upgrade-rocky
    parent: swift-multinode-rolling-upgrade
    vars:
      previous_swift_version: origin/stable/rocky

- job:
    name: swift-multinode-rolling-upgrade-stein
    parent: swift-multinode-rolling-upgrade
    vars:
      previous_swift_version: origin/stable/stein

- job:
    name: swift-multinode-rolling-upgrade-train
    parent: swift-multinode-rolling-upgrade
    vars:
      previous_swift_version: origin/stable/train

- job:
    name: swift-tox-lower-constraints
    parent: openstack-tox-lower-constraints
    vars:
      bindep_profile: test py27
      python_version: 2.7
      tox_environment:
        TMPDIR: '{{ ansible_env.HOME }}/xfstmp'

# Image building jobs
- secret:
    name: swift-dockerhub
    data:
      username: screamingfrenzy
      password: !encrypted/pkcs1-oaep
        - ruMizg1iVvKm4ABLQ8GshZMwt3EzxOyjPZsInL20+ZS+TQxhEwRbLFGzSxnrChIOdioyl
          7TMW1PxQeJ5T/mPIsV7TBsSsnIMKYRcDSbKjnC0hjILpKfQXLFw4/rV/d3jeB6oLDSTW1
          fIt4NmJqhsjlvst+VwT1JnFHLdrRaGMWYkjRU8rEmH82jDM7Wk7J+selykvTrlRQ7RpQR
          6huzniL6PJPOZ7I5VsQcCmEWYKwd/u9Ifhe50yjgxmKR7Fi+wl0nBSOzt38f9ZEXTB6So
          /ks0+RX2sTlgulNgJnnR8FG3p2AHxTJ75fcBnY1KkYlG0+KsdRTzNjxNXs2/Ao0pyJJTs
          JWniEHWVAq6T5agwD1SsmWAzFctBjGKDstxmTyHaSNNN5c6yoVZewRBrFDfYXMJUikyS+
          52bel/uihhiq60MnUCzKCiBg/TM1uonwRKA2KkDXWRh80oxBMIxw5nVZCMaHFpx7NW/ls
          k6aI8jio+/N0cLZlglWqGOsE3EC08Ddd+cqe668/LQVY97UgMjIu6aZRwX9Iwa2NXNDRE
          zPKQ3UDWYFgl8Za90PmrRD4qYuN/1lqCrLKp5cSJbche+EqdrGolCj701zUWcCdwjHMwz
          YA5zG1SbWFyC9BidZYTwMNbo/RRz4TtFmW35A4CRE5HYB5Uh5ccpGlBvI9Yv8A=

- job:
    name: swift-build-image
    parent: opendev-build-docker-image
    voting: false
    description: Build SAIO docker images.
    vars: &swift_image_vars
      docker_images:
        - context: .
          repository: openstackswift/saio

- job:
    name: swift-upload-image
    parent: opendev-upload-docker-image
    voting: false
    description: Build SAIO docker images and upload to Docker Hub.
    secrets:
      name: docker_credentials
      secret: swift-dockerhub
      pass-to-parent: true
    vars: *swift_image_vars

- job:
    name: swift-promote-image
    parent: opendev-promote-docker-image
    voting: false
    description: Promote previously uploaded Docker images.
    secrets:
      name: docker_credentials
      secret: swift-dockerhub
      pass-to-parent: true
    vars: *swift_image_vars

- job:
    name: swift-build-image-py3
    parent: opendev-build-docker-image
    voting: false
    description: Build py3 SAIO docker images.
    vars: &swift_image_vars_py3
      docker_images:
        - context: .
          dockerfile: Dockerfile-py3
          repository: openstackswift/saio
          tags:
           - py3

- job:
    name: swift-upload-image-py3
    parent: opendev-upload-docker-image
    voting: false
    description: Build py3 SAIO docker images and upload to Docker Hub.
    secrets:
      name: docker_credentials
      secret: swift-dockerhub
      pass-to-parent: true
    vars: *swift_image_vars_py3

- job:
    name: swift-promote-image-py3
    parent: opendev-promote-docker-image
    voting: false
    description: Promote previously uploaded Docker images.
    secrets:
      name: docker_credentials
      secret: swift-dockerhub
      pass-to-parent: true
    vars: *swift_image_vars_py3

- project:
    templates:
      - publish-openstack-docs-pti
      - periodic-stable-jobs
      - check-requirements
      - release-notes-jobs-python3
      - integrated-gate-object-storage
    check:
      jobs:
        - swift-build-image:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/(functional|probe)/.*$
        - swift-build-image-py3:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/(functional|probe)/.*$

        # Unit tests
        - swift-tox-py27:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/(functional|probe)/.*$
        - swift-tox-py36:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/(functional|probe)/.*$
        - swift-tox-py37:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/(functional|probe)/.*$

        # Functional tests
        - swift-tox-func-py27:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-encryption-py27:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-domain-remap-staticweb-py27:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-ec-py27:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-s3api-py27:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$

        # py3 functional tests
        - swift-tox-func-py37:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-encryption-py37:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-domain-remap-staticweb-py37:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-ec-py37:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-func-s3api-py37:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$

        # Other tests
        - swift-tox-func-s3api-ceph-s3tests-tempauth:
            irrelevant-files:
              - ^(api-ref|releasenotes)/.*$
              # Keep doc/saio -- we use those sample configs in the saio playbooks
              # Also keep doc/s3api -- it holds known failures for these tests
              - ^doc/(requirements.txt|(manpages|source)/.*)$
              - ^test/(unit|probe)/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-probetests-centos-7:
            irrelevant-files:
              - ^(api-ref|releasenotes)/.*$
              # Keep doc/saio -- we use those sample configs in the saio playbooks
              - ^doc/(requirements.txt|(manpages|s3api|source)/.*)$
              - ^test/(unit|functional)/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-dsvm-functional:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-dsvm-functional-py3:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-dsvm-functional-ipv6:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-lower-constraints:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/(functional|probe)/.*$
        - openstack-tox-pep8:
            irrelevant-files:
              - ^(api-ref|etc|examples|releasenotes)/.*$
              # Keep doc/manpages -- we want to syntax check them
              - ^doc/(requirements.txt|(saio|s3api|source)/.*)$
        - swift-multinode-rolling-upgrade:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - tempest-integrated-object-storage:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - tempest-ipv6-only:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - grenade-py3:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
    gate:
      jobs:
        # For gate jobs, err towards running more jobs (so, generally avoid
        # using irrelevant-files). Exceptions should mainly be made for
        # long-running jobs, like probetests or (once they move to
        # in-tree definitions) dsvm jobs.
        - swift-upload-image
        - swift-upload-image-py3
        - swift-tox-py27
        - swift-tox-py36
        - swift-tox-py37
        - swift-tox-func-py27
        - swift-tox-func-encryption-py27
        - swift-tox-func-domain-remap-staticweb-py27
        - swift-tox-func-ec-py27
        - swift-tox-func-s3api-py27
        - swift-tox-func-py37
        - swift-tox-func-encryption
        - swift-tox-func-domain-remap-staticweb-py37
        - swift-tox-func-ec-py37
        - swift-tox-func-s3api-py37
        - swift-probetests-centos-7:
            irrelevant-files:
              - ^(api-ref|releasenotes)/.*$
              # Keep doc/saio -- we use those sample configs in the saio playbooks
              - ^doc/(requirements.txt|(manpages|s3api|source)/.*)$
              - ^test/(unit|functional)/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-dsvm-functional:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-dsvm-functional-py3:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-dsvm-functional-ipv6:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/probe/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - swift-tox-lower-constraints:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/(functional|probe)/.*$
        - openstack-tox-pep8:
            irrelevant-files:
              - ^(api-ref|etc|examples|releasenotes)/.*$
              # Keep doc/manpages -- we want to syntax check them
              - ^doc/(requirements.txt|(saio|s3api|source)/.*)$
        - tempest-integrated-object-storage:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - tempest-ipv6-only:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
        - grenade-py3:
            irrelevant-files:
              - ^(api-ref|doc|releasenotes)/.*$
              - ^test/.*$
              - ^(.gitreview|.mailmap|AUTHORS|CHANGELOG)$
    experimental:
      jobs:
        - swift-tox-py27-centos-7
        - swift-tox-func-py27-centos-7
        - swift-tox-func-encryption-py27-centos-7
        - swift-tox-func-ec-py27-centos-7
        - swift-multinode-rolling-upgrade-rocky
        - swift-multinode-rolling-upgrade-stein
        - swift-multinode-rolling-upgrade-train

    post:
      jobs:
        - publish-openstack-python-branch-tarball
    promote:
      jobs:
        - swift-promote-image
        - swift-promote-image-py3