Move expected commit & distro hash regex into repo-setup role vars
We use these a lot and are duplicating unnecessarily across multiple files hurting maintainability and making errors likely This also adds the end line marker $ to tighten the regex as discussed in [1] and ^$ for a full match on the aggregate hash [1] https://review.opendev.org/#/c/713753/3/roles/repo-setup/tasks/get-dlrn-hash.yml Change-Id: I6f48aaf198cbfba8d8099c84aa3d769767bdd0ee
This commit is contained in:
parent
035d01ac85
commit
b442cdc5ea
|
@ -62,3 +62,5 @@ known_hash_tags:
|
|||
- current-passed-ci
|
||||
- promoted-components
|
||||
- component-ci-testing
|
||||
expected_commit_distro_hash_regex: "[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}$"
|
||||
expected_aggregate_hash_regex: "^[a-zA-Z0-9]{32}$"
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
fail:
|
||||
msg: "The newest DLRN hash or tag is not recognized. The hash or tag should not contain path slashes."
|
||||
when:
|
||||
- not dlrn_hash_tag_newest is match("[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}")
|
||||
- not dlrn_hash_tag_newest is match("[a-zA-Z0-9]{32}")
|
||||
- not dlrn_hash_tag_newest is match(expected_commit_distro_hash_regex)
|
||||
- not dlrn_hash_tag_newest is match(expected_aggregate_hash_regex)
|
||||
- dlrn_hash_tag_newest not in known_hash_tags
|
||||
|
||||
- name: Check DLRN hash newest - passed ready hash
|
||||
set_fact:
|
||||
dlrn_hash_newest: "{{ dlrn_hash_tag_newest }}"
|
||||
cacheable: true
|
||||
when: dlrn_hash_tag_newest is match("[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}") or dlrn_hash_tag is match("[a-zA-Z0-9]{32}")
|
||||
when: dlrn_hash_tag_newest is match(expected_commit_distro_hash_regex) or dlrn_hash_tag is match(expected_aggregate_hash_regex)
|
||||
|
||||
- when:
|
||||
- dlrn_hash_tag_newest in known_hash_tags
|
||||
|
@ -29,7 +29,7 @@
|
|||
dlrn_base=${dlrn_base/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
|
||||
fi
|
||||
curl -s --fail --show-error ${dlrn_base}/{{ dlrn_hash_tag_newest }}/delorean.repo \
|
||||
| grep baseurl | grep -Eo '[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}'
|
||||
| grep baseurl | grep -Eo {{ expected_commit_distro_hash_regex | quote }}
|
||||
register: full_hash_newest_result
|
||||
retries: 5
|
||||
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
fail:
|
||||
msg: "The DLRN hash or tag is not recognized. The hash or tag should not contain path slashes."
|
||||
when:
|
||||
- not dlrn_hash_tag is match("[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}")
|
||||
- not dlrn_hash_tag is match("[a-zA-Z0-9]{32}")
|
||||
- not dlrn_hash_tag is match(expected_commit_distro_hash_regex)
|
||||
- not dlrn_hash_tag is match(expected_aggregate_hash_regex)
|
||||
- dlrn_hash_tag not in known_hash_tags
|
||||
|
||||
- name: Check DLRN hash - passed ready hash
|
||||
set_fact:
|
||||
dlrn_hash: "{{ dlrn_hash_tag }}"
|
||||
cacheable: true
|
||||
when: dlrn_hash_tag is match("[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}") or dlrn_hash_tag is match("[a-zA-Z0-9]{32}")
|
||||
when: dlrn_hash_tag is match(expected_commit_distro_hash_regex) or dlrn_hash_tag is match(expected_aggregate_hash_regex)
|
||||
|
||||
# full_hash_result is used to help find the
|
||||
# correctly tagged containers and images
|
||||
|
@ -30,7 +30,7 @@
|
|||
dlrn_base=${dlrn_base/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
|
||||
fi
|
||||
curl -s --fail --show-error ${dlrn_base}/{{ dlrn_hash_tag }}/delorean.repo \
|
||||
| grep baseurl | grep -Eo '[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}'
|
||||
| grep baseurl | grep -Eo {{ expected_commit_distro_hash_regex | quote }}
|
||||
register: full_hash_result
|
||||
retries: 5
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
|||
dlrn_base=${dlrn_base/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
|
||||
fi
|
||||
curl -s --fail --show-error ${dlrn_base}/{{ dlrn_hash_tag }}/delorean.repo \
|
||||
| grep baseurl | grep -Eo '[a-zA-Z0-9]{40}_[a-zA-Z0-9]{8}'
|
||||
| grep baseurl | grep -Eo {{ expected_commit_distro_hash_regex }}
|
||||
register: full_overcloud_hash_result
|
||||
retries: 5
|
||||
|
||||
|
|
Loading…
Reference in New Issue