- job-template:
    name: 'gate-osbackup-{name}-dsvm-{node}{suffix}'
    node: '{node}'
    wrappers:
      - build-timeout:
          timeout: 70
      - timestamps

    builders:
      - link-logs
      - net-info
      - devstack-checkout
      - shell: |
          #!/bin/bash -xe
          export PYTHONUNBUFFERED=true
          # checkout freezer components
          export PROJECTS="openstack/freezer-api $PROJECTS"
          export PROJECTS="openstack/freezer-web-ui $PROJECTS"
          export PROJECTS="openstack/freezer $PROJECTS"
          export PROJECTS="openstack/python-freezerclient $PROJECTS"
          # tempest config
          export DEVSTACK_GATE_TEMPEST=1
          export DEVSTACK_GATE_TEMPEST_ALL_PLUGINS=1
          TEMPEST_REGEX="{name}_tempest_plugin"
          export DEVSTACK_GATE_TEMPEST_REGEX=${{TEMPEST_REGEX/\-/\_ }}
          # enable freezer-agent and freezer-scheduler
          export DEVSTACK_LOCAL_CONFIG="enable_plugin freezer https://git.openstack.org/openstack/freezer"
          # enable freezer-api and python-freezerclient
          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin freezer-api https://git.openstack.org/openstack/freezer-api"
          # enable freezer-web-ui and python-freezerclient
          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin freezer-web-ui https://git.openstack.org/openstack/freezer-web-ui"

          # which repo is being tested
          export DEVSTACK_PROJECT_FROM_GIT={name}

          # This ensures that if we set override branch to something
          # else, we still take repo being tested from the zuul branch
          # name. So override branch can be 'stable/mitaka' but we can
          # test master changes.
          uc_project=`echo $DEVSTACK_PROJECT_FROM_GIT | tr [:lower:] [:upper:] | tr '-' '_' | sed 's/[^A-Z_]//'`
          export "OVERRIDE_"$uc_project"_PROJECT_BRANCH"=$ZUUL_BRANCH

          function gate_hook {{
              source $BASE/new/{name}/devstack/gate_hook.sh
          }}
          export -f gate_hook

          cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
          ./safe-devstack-vm-gate-wrap.sh

    publishers:
      - test-results
      - devstack-logs
      - console-log