# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- project:
    check:
      jobs:
        - airship-deckhand-linter
        - airship-deckhand-ubuntu:
            voting: false
        - airship-deckhand-functional-docker-py35
        - airship-deckhand-functional-uwsgi-py35
        - airship-deckhand-integration-uwsgi-py35
    gate:
      jobs:
        - airship-deckhand-linter
        # NOTE(portdirect): enable when voting enabled.
        # - airship-deckhand-ubuntu:
        #     irrelevant-files:
        #       - ^.*\.rst$
        #       - ^doc/.*$
        #       - ^releasenotes/.*$
        - airship-deckhand-functional-docker-py35
        - airship-deckhand-functional-uwsgi-py35
        - airship-deckhand-integration-uwsgi-py35

- job:
    name: airship-deckhand-linter
    description: |
      Lints all files by checking them for whitespace.
    run: tools/gate/playbooks/zuul-linter.yaml
    nodeset: openstack-helm-single-node

- job:
    name: airship-deckhand-base
    roles:
      - zuul: openstack/openstack-helm-infra
    vars:
      zuul_osh_infra_relative_path: ../openstack-helm-infra/
    timeout: 3600
    pre-run:
      - tools/gate/playbooks/osh-infra-upgrade-host.yaml
      - tools/gate/playbooks/osh-infra-deploy-docker.yaml
      - tools/gate/playbooks/osh-infra-build.yaml
      - tools/gate/playbooks/osh-infra-deploy-k8s.yaml
    run: tools/gate/playbooks/airship-deckhand-check.yaml
    post-run: tools/gate/playbooks/osh-infra-collect-logs.yaml
    required-projects:
      - openstack/openstack-helm-infra

- job:
    name: airship-deckhand-ubuntu
    parent: airship-deckhand-base
    nodeset: openstack-helm-single-node
    irrelevant-files:
      - ^.*\.rst$
      - ^doc/.*$
      - ^releasenotes/.*$

- job:
    name: airship-deckhand-functional-docker-base
    description: |
      Base job for running airship-deckhand functional tests. Runs tests
      against Docker image generated from source code.
    roles:
      - zuul: openstack/openstack-helm-infra
    timeout: 3600
    pre-run:
      - tools/gate/playbooks/osh-infra-upgrade-host.yaml
      - tools/gate/playbooks/osh-infra-deploy-docker.yaml
    run: tools/gate/playbooks/run-functional-tests-docker.yaml
    required-projects:
      - openstack/openstack-helm-infra
    irrelevant-files:
      - ^.*\.rst$
      - ^doc/.*$
      - ^releasenotes/.*$

- job:
    name: airship-deckhand-functional-uwsgi-py35
    description: |
      Run tox-based functional tests for the Airship Deckhand project using a
      minimalistic deployment consisting of uwsgi for Deckhand API and pifpaf
      for ephemeral PostgreSQL DB, under cPython version 3.5.
    run: tools/gate/playbooks/run-functional-tests-uwsgi.yaml
    nodeset: openstack-helm-single-node
    vars:
      tox_envlist: functional-dev

- job:
    name: airship-deckhand-functional-docker-py35
    description: |
      Run tox-based functional tests for the Airship Deckhand project under
      cPython version 3.5. Uses tox with the ``functional-py35`` environment.
    parent: airship-deckhand-functional-docker-base
    nodeset: openstack-helm-single-node
    vars:
      tox_envlist: functional
      disable_keystone: true

- job:
    name: airship-deckhand-integration-uwsgi-py35
    description: |
      Run tox-based integration tests for the Airship Deckhand project using a
      minimalistic deployment consisting of uwsgi for Deckhand API and pifpaf
      for ephemeral PostgreSQL DB, under cPython version 3.5.
    run: tools/gate/playbooks/run-integration-tests-uwsgi.yaml
    nodeset: openstack-helm-single-node