- hosts: all
  name: Autoconverted job legacy-osbackup-freezer-web-ui-dsvm from old job gate-osbackup-freezer-web-ui-dsvm-ubuntu-xenial
  tasks:

    - name: Ensure legacy workspace directory
      file:
        path: '{{ ansible_user_dir }}/workspace'
        state: directory

    - shell:
        cmd: |
          set -e
          set -x
          cat > clonemap.yaml << EOF
          clonemap:
            - name: openstack-infra/devstack-gate
              dest: devstack-gate
          EOF
          /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
              git://git.openstack.org \
              openstack-infra/devstack-gate
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: |
          set -e
          set -x
          cat << 'EOF' >>"/tmp/dg-local.conf"
          [[local|localrc]]
          # enable freezer-agent and freezer-scheduler
          enable_plugin freezer git://git.openstack.org/openstack/freezer
          # enable freezer-api and python-freezerclient
          enable_plugin freezer-api https://git.openstack.org/openstack/freezer-api
          # enable freezer-web-ui and python-freezerclient
          enable_plugin freezer-web-ui https://git.openstack.org/openstack/freezer-web-ui

          EOF
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: |
          set -e
          set -x
          # 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=0
          export DEVSTACK_GATE_TEMPEST_ALL_PLUGINS=0
          TEMPEST_REGEX="freezer_api_tempest_plugin"
          export DEVSTACK_GATE_TEMPEST_REGEX=freezer_api_tempest_plugin
          # which repo is being tested
          export DEVSTACK_PROJECT_FROM_GIT=freezer-api
          export "OVERRIDE_FREEZER_PROJECT_BRANCH"=$ZUUL_BRANCH

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

        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'