Created
December 8, 2020 19:20
-
-
Save cloudnull/5a25ecea8c89730b3f26a75174dc8404 to your computer and use it in GitHub Desktop.
tripleo repo scraper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMMIT_MSG="The lower constraint file has been removed | |
This file, and its tests, are not useful for tripleo so we're | |
removing because they're now becoming problematic." | |
git clone https://github.com/openstack/governance | |
pushd governance | |
python <<EOC | |
import yaml | |
with open('reference/projects.yaml') as f: | |
x = yaml.safe_load(f.read())['tripleo']['deliverables'] | |
repos = [] | |
for key, value in x.items(): | |
repos.extend(value['repos']) | |
with open('../repos.new', 'w') as f: | |
f.write('\n'.join(repos)) | |
EOC | |
popd | |
cat repos.new | while read line | |
do | |
git clone ssh://[email protected]:29418/${line}.git | |
if [[ $? == 0 ]]; then | |
pushd ${line#"openstack/"} | |
CHANGED=0 | |
rm -f lower-constraints.txt | |
if [[ $? == 0 ]]; then | |
CHANGED=1 | |
fi | |
if [ -f ".zuul.yaml" ]; then | |
grep -rnil lower-constraints ".zuul.yaml" | xargs -n 1 sed -i '/openstack-tox-lower-constraints/d' | |
if [[ $? == 0 ]]; then | |
CHANGED=1 | |
fi | |
fi | |
if [ -d "zuul.d" ]; then | |
grep -rnil lower-constraints "zuul.d" | xargs -n 1 sed -i '/openstack-tox-lower-constraints/d' | |
if [[ $? == 0 ]]; then | |
CHANGED=1 | |
fi | |
fi | |
if grep -q lower-constraints tox.ini; then | |
awk 'BEGIN{f=1} /\[testenv:lower-constraints\]/{f=0} f{print} !$0{f=1}' tox.ini > tox.ini.new | |
if [[ $? == 0 ]]; then | |
CHANGED=1 | |
mv tox.ini.new tox.ini | |
fi | |
fi | |
if [[ ${CHANGED} == 1 ]]; then | |
git commit -asS -m "${COMMIT_MSG}" | |
git review -t tripleo-lower | |
fi | |
CHANGED=0 | |
popd | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment