upload-git-mirror: use retries to avoid races
To avoid errors in case of mirror race conditions, we currently (try to) ignore mirror errors, and check for presence of the reference after the mirror try. This requires having to play tricks to avoid errors when the job is run in the check pipeline, due to missing zuul.newrev. And for some reason, it does not seem to work[1]. Instead of ignoring errors and running an additional check, let's just retry the mirror operation three times. The race is rare-enough that it's very unlikely that we would hit it three times in a row. [1] https://zuul.openstack.org/build/4966cd5617624d348fa0048de14f1f96 Change-Id: Ifa4f25ad8c961a1b2dbd9f07a3a1e4652b790c9c
This commit is contained in:
parent
66e22d3b2e
commit
a6fab9c48f
@ -38,15 +38,10 @@
|
||||
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
ignore_errors: zuul.newrev is defined
|
||||
|
||||
- name: Check if the mirror contains the desired reference
|
||||
command: git fetch {{ git_mirror_credentials.user }}@{{ git_mirror_credentials.host }}:{{ git_mirror_repository }} {{ zuul.newrev }}
|
||||
args:
|
||||
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
when: zuul.newrev is defined
|
||||
register: result
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: result is not failed
|
||||
|
||||
always:
|
||||
# Registered variables below are only used for integration testing
|
||||
|
Loading…
x
Reference in New Issue
Block a user