From a117a6002797511adb7827650239d9b86cdd403d Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 30 Jan 2019 10:55:58 -0800 Subject: [PATCH] Add missing role This role, originally from openstack-infra/project-config, is used by jobs in this repo. Change-Id: If6fbf7ff070ff6c4b1ead74724fcaeb8e67ac7d1 --- roles/submit-subunit-jobs/README.rst | 36 ++++++++++++++++++++ roles/submit-subunit-jobs/defaults/main.yaml | 12 +++++++ roles/submit-subunit-jobs/meta/main.yaml | 2 ++ roles/submit-subunit-jobs/tasks/main.yaml | 10 ++++++ 4 files changed, 60 insertions(+) create mode 100644 roles/submit-subunit-jobs/README.rst create mode 100644 roles/submit-subunit-jobs/defaults/main.yaml create mode 100644 roles/submit-subunit-jobs/meta/main.yaml create mode 100644 roles/submit-subunit-jobs/tasks/main.yaml diff --git a/roles/submit-subunit-jobs/README.rst b/roles/submit-subunit-jobs/README.rst new file mode 100644 index 0000000..e1cfbff --- /dev/null +++ b/roles/submit-subunit-jobs/README.rst @@ -0,0 +1,36 @@ +Submit a log processing job to the subunit workers. + +This role examines all of the files in the log subdirectory of the job +work dir and any matching filenames are submitted to the gearman queue +for the subunit log processor. + +**Role Variables** + +.. zuul:rolevar:: subunit_gearman_server + :default: logstash.openstack.org + + The gearman server to use. + +.. zuul:rolevar:: subunit_processor_config + :type: dict + + The default file configuration for the subunit parser. + + This is a dictionary that contains a single entry: + + .. zuul:rolevar:: files + :type: list + + A list of files to search for in the ``work/logs/`` directory on + the executor. Each file will be compared to the entries in this + list, and if it matches, a processing job will be submitted to + the subunit processing queue, along with the tags for the + matching entry. Order is important: the first matcing is used. + This field is list of dictionaries, as follows: + + .. zuul:rolevar:: name + + The name of the file to process. This is treated as an + unanchored regular expression. To match the full path + (underneath ``work/logs``) start and end the string with + ``^`` and ``$`` respectively. diff --git a/roles/submit-subunit-jobs/defaults/main.yaml b/roles/submit-subunit-jobs/defaults/main.yaml new file mode 100644 index 0000000..89b5bc5 --- /dev/null +++ b/roles/submit-subunit-jobs/defaults/main.yaml @@ -0,0 +1,12 @@ +subunit_gearman_server: logstash.openstack.org +# For every file found in the logs directory (and its subdirs), the +# module will attempt to match the filenames below. If there is a +# match, the file is submitted to the subunit processing queue, along +# with the tags for that match. The first match wins, so be sure to +# list more specific names first. The names are un-anchored regular +# expressions (so if you need to match the root (i.e, the work/logs/ +# directory), be sure to anchor them with ^). +subunit_processor_config: + files: + - name: testrepository.subunit + - name: karma.subunit diff --git a/roles/submit-subunit-jobs/meta/main.yaml b/roles/submit-subunit-jobs/meta/main.yaml new file mode 100644 index 0000000..9f28a12 --- /dev/null +++ b/roles/submit-subunit-jobs/meta/main.yaml @@ -0,0 +1,2 @@ +dependencies: + - role: submit-log-processor-jobs diff --git a/roles/submit-subunit-jobs/tasks/main.yaml b/roles/submit-subunit-jobs/tasks/main.yaml new file mode 100644 index 0000000..0bc2244 --- /dev/null +++ b/roles/submit-subunit-jobs/tasks/main.yaml @@ -0,0 +1,10 @@ +- name: Submit subunit processing jobs to log processors + when: zuul.pipeline in ['gate', 'periodic', 'post'] + submit_log_processor_jobs: + gearman_server: "{{ subunit_gearman_server }}" + job: "push-subunit" + config: "{{ subunit_processor_config }}" + success: "{{ zuul_success }}" + host_vars: "{{ hostvars }}" + path: "{{ zuul.executor.log_root }}" + log_url: "{{ (lookup('file', zuul.executor.result_data_file) | from_json).get('zuul').get('log_url') }}"