Add static object-store OpenAPI

Swift API is neither easy to generate from the code, nor is it changing
often to justify the effort doing so. Add a static OpenAPI spec into the
tree and maybe sometime in the future it can be generated from sources
or moved to the Swift itself.

Change-Id: I3a5381705ecce6d28c9bd8d173116614210cb346
This commit is contained in:
Artem Goncharov 2024-06-20 12:00:34 +02:00
parent 7a442dbf3f
commit c2980a28c4
4 changed files with 1474 additions and 0 deletions

View File

@ -0,0 +1,56 @@
---
- hosts: all
vars:
specs_src: "{{ zuul.project.src_dir }}/static/openapi_specs/{{ openapi_service }}"
tasks:
- name: Ensure local output dirs
delegate_to: localhost
ansible.builtin.file:
path: "{{ zj_output_dir }}"
state: directory
mode: 0755
with_items:
- "{{ zuul.executor.work_root }}/artifacts"
loop_control:
loop_var: zj_output_dir
- name: Collect OpenAPI specs
synchronize:
dest: "{{ zj_output.dest }}"
mode: pull
src: "{{ zj_output.src }}"
verify_host: true
owner: false
group: false
loop:
- dest: "{{ zuul.executor.work_root }}/artifacts/openapi_specs"
src: "{{ specs_src }}"
loop_control:
loop_var: zj_output
- name: Find all generated specs
ansible.builtin.find:
paths: "{{ specs_src }}"
patterns: "*.yaml"
recurse: true
# Search for anything and filter later
file_type: "any"
register: openapi_specs
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "{{ openapi_service }} OpenAPI spec {{ zj_item.path | basename | splitext | first }}"
url: "artifacts/openapi_specs/{{ openapi_service }}{{ zj_item.path | regex_replace(specs_src) }}"
metadata:
type: openapi
service_type: "{{ openapi_service }}"
version: "{{ zj_item.path | basename | splitext | first }}"
loop: "{{ openapi_specs.files }}"
loop_control:
loop_var: zj_item
when:
# only interested in files/links
- "not zj_item.isdir"

File diff suppressed because it is too large Load Diff

View File

@ -210,6 +210,17 @@
project: "opendev.org/openstack/neutron-lib"
path: "/api-ref/build/html/v2/index.html"
- job:
name: codegenerator-openapi-object-store-static
parent: base
description: |
Generate OpenAPI spec for Swift
run:
- playbooks/openapi/static.yaml
vars:
codegenerator_work_dir: "wrk"
openapi_service: object-store
- job:
name: codegenerator-openapi-placement-tips
parent: codegenerator-openapi-tips-base
@ -286,6 +297,8 @@
soft: true
- name: codegenerator-openapi-network-tips-with-api-ref
soft: true
- name: codegenerator-openapi-object-store-static
soft: true
- name: codegenerator-openapi-placement-tips-with-api-ref
soft: true
- name: codegenerator-openapi-shared-file-system-tips-with-api-ref

View File

@ -12,6 +12,7 @@
- codegenerator-openapi-image-tips-with-api-ref
- codegenerator-openapi-load-balancing-tips-with-api-ref
- codegenerator-openapi-network-tips-with-api-ref
- codegenerator-openapi-object-store-static
- codegenerator-openapi-placement-tips-with-api-ref
- codegenerator-openapi-shared-file-system-tips-with-api-ref
- codegenerator-tox-publish-openapi-specs
@ -25,6 +26,7 @@
- codegenerator-openapi-image-tips-with-api-ref
- codegenerator-openapi-load-balancing-tips-with-api-ref
- codegenerator-openapi-network-tips-with-api-ref
- codegenerator-openapi-object-store-static
- codegenerator-openapi-placement-tips-with-api-ref
- codegenerator-openapi-shared-file-system-tips-with-api-ref
- codegenerator-tox-publish-openapi-specs