- hosts: all
  name: Autoconverted job legacy-osbackup-freezer-dsvm-centos7 from old job gate-osbackup-freezer-dsvm-centos7
  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/devstack-gate
              dest: devstack-gate
          EOF
          /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
              https://opendev.org \
              openstack/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 https://opendev.org/openstack/freezer
          # enable freezer-api and python-freezerclient
          enable_plugin freezer-api https://opendev.org/openstack/freezer-api
          # enable freezer-web-ui and python-freezerclient
          enable_plugin freezer-web-ui https://opendev.org/openstack/freezer-web-ui
          TEMPEST_PLUGINS='/opt/stack/new/freezer-tempest-plugin'

          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"
          export PROJECTS="openstack/freezer-tempest-plugin $PROJECTS"
          # tempest config
          export DEVSTACK_GATE_TEMPEST=1
          export DEVSTACK_GATE_TEMPEST_REGEX="freezer_tempest_plugin.tests.freezer_api"

          # 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 }}'
