From c5733ee95560d6af66511da2ef4dd5cd81c0b956 Mon Sep 17 00:00:00 2001 From: ricolin Date: Sun, 27 Sep 2020 19:33:16 +0800 Subject: [PATCH] Move heat-templates-check job to zuul v3 Change-Id: Ie858c406b6a7d973f9632aa98360b7322758fc3a --- .zuul.yaml | 49 +++++++++++++-- playbooks/devstack/post.yaml | 15 ----- playbooks/devstack/run.yaml | 61 +++---------------- .../defaults/main.yaml | 2 + roles/run-heat-template-check/tasks/main.yaml | 28 +++++++++ tools/validate-templates | 3 + 6 files changed, 85 insertions(+), 73 deletions(-) delete mode 100644 playbooks/devstack/post.yaml create mode 100644 roles/run-heat-template-check/defaults/main.yaml create mode 100644 roles/run-heat-template-check/tasks/main.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 7674b0e9..fa2f64c3 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,14 +1,51 @@ - job: name: heat-templates-check - parent: legacy-dsvm-base + parent: devstack run: playbooks/devstack/run.yaml - post-run: playbooks/devstack/post.yaml timeout: 7500 required-projects: - - openstack/devstack-gate - - openstack/heat - - openstack/heat-agents - - openstack/heat-templates + - opendev.org/openstack/heat + - opendev.org/openstack/heat-agents + - opendev.org/openstack/heat-templates + roles: + - zuul: opendev.org/openstack/devstack + vars: + devstack_services: + s-account: false + s-container: false + s-object: false + s-proxy: false + devstack_plugins: + heat: https://opendev.org/openstack/heat + devstack_local_conf: + post-config: + $HEAT_CONF: + DEFAULT: + convergence_engine: true + logging_exception_prefix: "%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s" + heat_api: + workers: 2 + heat_api_cfn: + workers: 2 + cache: + enabled: True + eventlet_opts: + client_socket_timeout: 120 + oslo_messaging_notifications: + driver: messagingv2 + test_results_stage_name: test_results + zuul_copy_output: + '{{ stage_dir }}/{{ test_results_stage_name }}.subunit': logs + '{{ stage_dir }}/{{ test_results_stage_name }}.html': logs + '{{ stage_dir }}/stackviz': logs + extensions_to_txt: + conf: true + log: true + yaml: true + yml: true + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ - project: check: diff --git a/playbooks/devstack/post.yaml b/playbooks/devstack/post.yaml deleted file mode 100644 index e07f5510..00000000 --- a/playbooks/devstack/post.yaml +++ /dev/null @@ -1,15 +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=/logs/** - - --include=*/ - - --exclude=* - - --prune-empty-dirs diff --git a/playbooks/devstack/run.yaml b/playbooks/devstack/run.yaml index 1f2bd419..360e1207 100644 --- a/playbooks/devstack/run.yaml +++ b/playbooks/devstack/run.yaml @@ -1,54 +1,11 @@ - hosts: all - name: job for templates-devstack - tasks: + # This is the default strategy, however since orchestrate-devstack requires + # "linear", it is safer to enforce it in case this is running in an + # environment configured with a different default strategy. + strategy: linear + roles: + - orchestrate-devstack - - 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_plugin heat https://opendev.org/openstack/heat - EOF - 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_TEMPEST=0 - export PROJECTS="openstack/heat-agents $PROJECTS" - function post_test_hook { - cd $BASE/new/heat-templates/tools - ./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 }}' +- hosts: controller + roles: + - run-heat-template-check diff --git a/roles/run-heat-template-check/defaults/main.yaml b/roles/run-heat-template-check/defaults/main.yaml new file mode 100644 index 00000000..b601d49d --- /dev/null +++ b/roles/run-heat-template-check/defaults/main.yaml @@ -0,0 +1,2 @@ +devstack_base_dir: /opt/stack +tempest_test_timeout: '' diff --git a/roles/run-heat-template-check/tasks/main.yaml b/roles/run-heat-template-check/tasks/main.yaml new file mode 100644 index 00000000..ec2699bd --- /dev/null +++ b/roles/run-heat-template-check/tasks/main.yaml @@ -0,0 +1,28 @@ +- name: prepare check env + shell: + cmd: | + set -x + source ${DEVSTACK_BASE_DIR}/devstack/openrc admin admin + source ${DEVSTACK_BASE_DIR}/devstack/functions-common + neutron_service=$(get_or_create_service "neutron" "network" "Neutron Service") + get_or_create_endpoint $neutron_service "$REGION_NAME" "http://localhost" + aodh_service=$(get_or_create_service "aodh" "alarming" "OpenStack Alarming Service") + get_or_create_endpoint $aodh_service "$REGION_NAME" "http://localhost" + mistral_service=$(get_or_create_service "mistral" "workflowv2" "Workflow Service v2") + get_or_create_endpoint $mistral_service "$REGION_NAME" "http://localhost" + senlin_service=$(get_or_create_service "senlin" "clustering" "Senlin Clustering Service") + get_or_create_endpoint $senlin_service "$REGION_NAME" "http://localhost" + monasca_service=$(get_or_create_service "monasca" "monitoring" "Monasca Monitoring Service") + get_or_create_endpoint $monasca_service "$REGION_NAME" "http://localhost" + zaqar_service=$(get_or_create_service "zaqar" "messaging" "Zaqar Service") + get_or_create_endpoint $zaqar_service "$REGION_NAME" "http://localhost" + designate_service=$(get_or_create_service "designate" "dns" "Designate DNS Service") + get_or_create_endpoint $designate_service "$REGION_NAME" "http://localhost" + barbican_service=$(get_or_create_service "barbican" "key-manager" "Barbican Service") + get_or_create_endpoint $barbican_service "$REGION_NAME" "http://localhost" + + source ${DEVSTACK_BASE_DIR}/devstack/openrc demo demo + {{ ansible_python.executable }} ${DEVSTACK_BASE_DIR}/heat-templates/tools/validate-templates ${DEVSTACK_BASE_DIR}/heat-templates + executable: /bin/bash + environment: + DEVSTACK_BASE_DIR: "{{ devstack_base_dir }}" diff --git a/tools/validate-templates b/tools/validate-templates index 9585ca4a..7d20b2dd 100755 --- a/tools/validate-templates +++ b/tools/validate-templates @@ -15,6 +15,9 @@ def main(args): path = args[0] got_error = False for root, dirs, files in os.walk(path): + # Skip Zuul scripts + if 'roles/run-heat-template-check' in root: + continue for excluded in EXCLUDED_DIRS: if excluded in dirs: dirs.remove(excluded)