Merge "Replace git.openstack.org URLs with opendev.org URLs"
diff --git a/.zuul.yaml b/.zuul.yaml
index 58e2dd5..0965b9d 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,21 +1,59 @@
 - job:
-    name: telemetry-dsvm-integration
-    parent: legacy-dsvm-base
-    run: playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml
-    post-run: playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post.yaml
+    name: telemetry-tempest-base
+    parent: devstack-tempest
+    irrelevant-files:
+      - ^(test-|)requirements.txt$
+      - ^setup.cfg$
+      - ^doc/.*$
+      - ^.*\.rst$
+      - ^releasenotes/.*$
     timeout: 7800
     required-projects:
       - openstack/devstack-gate
+      - openstack/panko
       - openstack/aodh
       - openstack/ceilometer
-      - openstack/panko
       - openstack/telemetry-tempest-plugin
-      - openstack/heat
       - openstack/heat-tempest-plugin
-      # following are required when DEVSTACK_GATE_HEAT, which this
-      # job turns on
+      - openstack/heat
       - openstack/dib-utils
       - openstack/diskimage-builder
+      - openstack/tempest
+    vars:
+      devstack_plugins:
+        heat: https://opendev.org/openstack/heat
+        ceilometer: https://opendev.org/openstack/ceilometer
+        aodh: https://opendev.org/openstack/aodh
+        panko: https://opendev.org/openstack/panko
+      devstack_services:
+        tempest: true
+        tls-proxy: false
+      devstack_localrc:
+        TEMPEST_PLUGINS: '"/opt/stack/telemetry-tempest-plugin /opt/stack/heat-tempest-plugin"'
+        GNOCCHI_ARCHIVE_POLICY_TEMPEST: "ceilometer-high-rate"
+        CEILOMETER_BACKEND: "gnocchi"
+        CEILOMETER_PIPELINE_INTERVAL: 15
+      tempest_test_regex: telemetry_tempest_plugin
+      tox_envlist: all
+
+- job:
+    name: telemetry-dsvm-integration
+    parent: telemetry-tempest-base
+    branches: ^(?!stable/(ocata|pike|queens|rocky)).*$
+
+- job:
+    name: telemetry-dsvm-integration
+    parent: telemetry-tempest-base
+    branches:
+      - stable/pike
+      - stable/queens
+      - stable/rocky
+    vars:
+      devstack_localrc:
+        GNOCCHI_ARCHIVE_POLICY_TEMPEST: "ceilometer-high"
+        GNOCCHI_ARCHIVE_POLICY: "high"
+        CEILOMETER_ALARM_AGGREGATION_METHOD: "mean"
+        CEILOMETER_ALARM_METRIC_NAME: "cpu_util"
 
 - project:
     templates:
diff --git a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post.yaml b/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post.yaml
deleted file mode 100644
index dac8753..0000000
--- a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post.yaml
+++ /dev/null
@@ -1,80 +0,0 @@
-- hosts: primary
-  tasks:
-
-    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
-      synchronize:
-        src: '{{ ansible_user_dir }}/workspace/'
-        dest: '{{ zuul.executor.log_root }}'
-        mode: pull
-        copy_links: true
-        verify_host: true
-        rsync_opts:
-          - --include=**/*nose_results.html
-          - --include=*/
-          - --exclude=*
-          - --prune-empty-dirs
-
-    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
-      synchronize:
-        src: '{{ ansible_user_dir }}/workspace/'
-        dest: '{{ zuul.executor.log_root }}'
-        mode: pull
-        copy_links: true
-        verify_host: true
-        rsync_opts:
-          - --include=**/*testr_results.html.gz
-          - --include=*/
-          - --exclude=*
-          - --prune-empty-dirs
-
-    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
-      synchronize:
-        src: '{{ ansible_user_dir }}/workspace/'
-        dest: '{{ zuul.executor.log_root }}'
-        mode: pull
-        copy_links: true
-        verify_host: true
-        rsync_opts:
-          - --include=/.testrepository/tmp*
-          - --include=*/
-          - --exclude=*
-          - --prune-empty-dirs
-
-    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
-      synchronize:
-        src: '{{ ansible_user_dir }}/workspace/'
-        dest: '{{ zuul.executor.log_root }}'
-        mode: pull
-        copy_links: true
-        verify_host: true
-        rsync_opts:
-          - --include=**/*testrepository.subunit.gz
-          - --include=*/
-          - --exclude=*
-          - --prune-empty-dirs
-
-    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
-      synchronize:
-        src: '{{ ansible_user_dir }}/workspace/'
-        dest: '{{ zuul.executor.log_root }}/tox'
-        mode: pull
-        copy_links: true
-        verify_host: true
-        rsync_opts:
-          - --include=/.tox/*/log/*
-          - --include=*/
-          - --exclude=*
-          - --prune-empty-dirs
-
-    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
-      synchronize:
-        src: '{{ ansible_user_dir }}/workspace/'
-        dest: '{{ zuul.executor.log_root }}'
-        mode: pull
-        copy_links: true
-        verify_host: true
-        rsync_opts:
-          - --include=/logs/**
-          - --include=*/
-          - --exclude=*
-          - --prune-empty-dirs
diff --git a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post_test_hook.sh b/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post_test_hook.sh
deleted file mode 100755
index b787994..0000000
--- a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post_test_hook.sh
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/bin/bash -xe
-
-# 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.
-
-# This script is executed inside post_test_hook function in devstack gate.
-
-function export_subunit_data {
-    target="$1"
-    if [ -f .testrepository/0 ]; then
-        sudo testr last --subunit > $WORKSPACE/testrepository.subunit.$target
-    fi
-}
-
-function generate_testr_results {
-    cat $WORKSPACE/testrepository.subunit.* | sudo tee $BASE/logs/testrepository.subunit
-    sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
-    sudo gzip -9 $BASE/logs/testrepository.subunit
-    sudo gzip -9 $BASE/logs/testr_results.html
-    sudo chown $USER:$USER $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
-    sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
-}
-
-function generate_telemetry_report(){
-    set -x
-    set +e
-
-    echo "* Message queue status:"
-    sudo rabbitmqctl list_queues | grep -e \\.sample -e \\.info
-
-    source $BASE/new/devstack/openrc admin admin
-
-    echo "* Heat stack:"
-    openstack stack show integration_test
-    echo "* Alarm list:"
-    aodh alarm list
-    echo "* Alarm show:"
-    aodh alarm show $(aodh alarm list -f value -c alarm_id)
-    echo "* Nova instance list:"
-    openstack server list --all-projects
-
-    echo "* Gnocchi instance list:"
-    gnocchi resource list -t instance
-    for instance_id in $(openstack server list -f value -c ID --all-projects); do
-        echo "* Nova instance detail:"
-        openstack server show $instance_id
-        echo "* Gnocchi instance detail:"
-        gnocchi resource show -t instance $instance_id
-        echo "* Gnocchi measures for instance ${instance_id}:"
-        if [[ $ZUUL_BRANCH =~ (stable/ocata|stable/pike|stable/queens|stable/rocky) ]]; then
-            gnocchi metric show -r $instance_id cpu_util
-            gnocchi --debug measures show -r $instance_id --aggregation mean cpu_util
-        else
-            gnocchi metric show -r $instance_id cpu
-            gnocchi --debug measures show -r $instance_id --aggregation rate:mean cpu
-        fi
-    done
-
-    gnocchi status
-
-    echo "* Unprocessed measures:"
-    for key in $(redis-cli --scan --pattern 'incoming*'); do echo -n "$key length = " && redis-cli llen $key; done
-
-    echo "* locale:"
-    locale
-    echo
-    echo "* tempest locale:"
-    sudo -H -u tempest locale
-    echo
-    echo "* tempest tox locale:"
-    sudo -H -u tempest tox -evenv-tempest -- locale
-    echo
-
-    set -e
-    set -x
-}
-
-function generate_reports_and_maybe_exit() {
-    local ret="$1"
-    if [[ $ret != 0 ]]; then
-        # Collect and parse result
-        generate_telemetry_report
-        generate_testr_results
-        exit $ret
-    fi
-}
-
-function change_config_for_old_branch() {
-    local TEMPEST_CONFIG="$BASE/new/tempest/etc/tempest.conf"
-    if [[ $ZUUL_BRANCH =~ (stable/ocata|stable/pike|stable/queens|stable/rocky) ]]; then
-        if ! sudo grep -q "alarm_aggregation_method" "$TEMPEST_CONFIG" 2>/dev/null; then
-            sudo echo -e "alarm_aggregation_method = mean" | sudo tee --append "$TEMPEST_CONFIG" > /dev/null
-            sudo echo -e "alarm_metric_name = cpu_util" | sudo tee --append "$TEMPEST_CONFIG" > /dev/null
-        else
-            sudo sed -e "s/\(^\s*alarm_aggregation_method \s*=\).*$/\1 mean/" -i "$TEMPEST_CONFIG"
-            sudo sed -e "s/\(^\s*alarm_metric_name \s*=\).*$/\1 cpu_util/" -i "$TEMPEST_CONFIG"
-        fi
-    fi
-}
-
-
-# Run tests with tempest
-sudo chown -R tempest:stack $BASE/new/tempest
-sudo chown -R tempest:stack $BASE/data/tempest
-cd $BASE/new/tempest
-change_config_for_old_branch
-sudo -H -u tempest tox -evenv-tempest -- pip install /opt/stack/new/telemetry-tempest-plugin
-sudo -H -u tempest tox -evenv-tempest -- pip install /opt/stack/new/heat-tempest-plugin
-echo "Checking installed Tempest plugins:"
-sudo -H -u tempest tox -evenv-tempest -- tempest list-plugins
-set +e
-sudo -H -u tempest OS_TEST_TIMEOUT=$TEMPEST_OS_TEST_TIMEOUT tox -evenv-tempest -- tempest run -r telemetry_tempest_plugin --concurrency=$TEMPEST_CONCURRENCY
-EXIT_CODE=$?
-set -e
-export_subunit_data "venv-tempest"
-generate_reports_and_maybe_exit $EXIT_CODE
-
-exit $EXIT_CODE
diff --git a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml b/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml
deleted file mode 100644
index 4e060d6..0000000
--- a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml
+++ /dev/null
@@ -1,62 +0,0 @@
-- hosts: all
-  name: Autoconverted job legacy-telemetry-dsvm-integration-ceilometer from old job
-    gate-telemetry-dsvm-integration-ceilometer-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/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
-          export PYTHONUNBUFFERED=true
-          export DEVSTACK_GATE_HEAT=1
-          export DEVSTACK_GATE_NEUTRON=1
-          export DEVSTACK_GATE_TEMPEST=1
-          export DEVSTACK_GATE_EXERCISES=0
-          export DEVSTACK_GATE_INSTALL_TESTONLY=1
-          export DEVSTACK_GATE_TEMPEST_NOTESTS=1
-          export PROJECTS="openstack/ceilometer openstack/aodh openstack/panko openstack/telemetry-tempest-plugin openstack/heat openstack/heat-tempest-plugin"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin panko https://opendev.org/openstack/panko"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin ceilometer https://opendev.org/openstack/ceilometer"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin aodh https://opendev.org/openstack/aodh"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin heat https://opendev.org/openstack/heat"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin heat-tempest-plugin https://opendev.org/openstack/heat-tempest-plugin"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"INSTALL_TEMPEST='False'"
-          if [[ $ZUUL_BRANCH =~ (stable/ocata|stable/pike|stable/queens|stable/rocky) ]]; then
-              export DEVSTACK_LOCAL_CONFIG+=$'\n'"GNOCCHI_ARCHIVE_POLICY=high"
-              export DEVSTACK_LOCAL_CONFIG+=$'\n'"GNOCCHI_ARCHIVE_POLICY_TEMPEST=ceilometer-high"
-          else
-              export DEVSTACK_LOCAL_CONFIG+=$'\n'"GNOCCHI_ARCHIVE_POLICY_TEMPEST=ceilometer-high-rate"
-          fi
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"CEILOMETER_BACKEND=gnocchi"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"CEILOMETER_PIPELINE_INTERVAL=15"
-          function post_test_hook {
-              cd /opt/stack/new/telemetry-tempest-plugin/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/
-              ./post_test_hook.sh
-          }
-          export -f post_test_hook
-          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 }}'