Files
codegenerator/playbooks/rust/propose-github.yaml
Artem Goncharov 298e6753ed Update typos version
Update verion of typos that we use to fix typos in the openapi specs.
Since there are quite lot findings (and fixes cause other failures) also
update pre-commit and the resulting changes.

Change-Id: I795215942e1587bf914d923edd09070fe729e9d5
Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
2025-10-10 08:30:13 +02:00

63 lines
2.1 KiB
YAML

---
- name: "Propose generated code changes upstream"
hosts: localhost
vars:
patch_file: "{{ zuul.executor.work_root }}/{{ zuul.change }}.patch"
branch_name: "codegenerator_{{ zuul.change }}"
tasks:
- name: "Check execution context"
when: "zuul.branch is not defined"
fail:
msg: "This playbook must be run in a branch-based pipeline (e.g., 'promote')."
- name: "Download docs archive"
ansible.builtin.include_role:
name: download-artifact
vars:
# download_artifact_job: provided by zuul job
download_artifact_api: "https://zuul.opendev.org/api/tenant/{{ zuul.tenant }}"
download_artifact_type:
- rust_patch
download_artifact_pipeline: gate
- name: "Check git patch presence"
ansible.builtin.stat:
path: "{{ patch_file }}"
register: "git_patch_stat"
- name: "Process patch"
when:
- "git_patch_stat.stat.exists"
block:
- name: "Checkout target repository"
ansible.builtin.git:
accept_newhostkey: true
repo: "{{ rust_sdk_git_repo }}"
dest: "{{ rust_project_dir }}"
- name: "Checkout new branch"
ansible.builtin.command: "git checkout -b {{ branch_name }}"
args:
chdir: "{{ ansible_user_dir }}/openstack"
- name: "Try to apply git patch"
ansible.builtin.command: "git am {{ git_patch_stat.stat.path }}"
args:
chdir: "{{ ansible_user_dir }}/openstack"
register: "patch_applied"
failed_when: false
- name: "Push changes"
ansible.builtin.command: "git push --set-upstream origin {{ branch_name }}"
args:
chdir: "{{ ansible_user_dir }}/openstack"
when: "patch_applied.changed"
register: "change_pushed"
- name: "Inform how to open PR"
ansible.builtin.debug:
msg: "Please follow the link https://github.com/gtema/openstack/pull/new/{{ branch_name }} to create new pull request"
when: "change_pushed.changed"