Merge "improve pep8 check logic"
This commit is contained in:
commit
9fa4e71c1f
@ -94,7 +94,7 @@ Request
|
|||||||
|
|
||||||
**Example response: update an accelerator request**
|
**Example response: update an accelerator request**
|
||||||
|
|
||||||
.. literalinclude:: ../../../doc/api_samples/accelerator_requests/accelerator_requests-update-resp.json
|
.. literalinclude:: ../../../doc/api_samples/accelerator_requests/accelerator_requests-after-update-resp.json
|
||||||
|
|
||||||
Delete Accelerator Requests by ARQ uuid
|
Delete Accelerator Requests by ARQ uuid
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
@ -1,29 +1,3 @@
|
|||||||
Before PATCH
|
|
||||||
|
|
||||||
{
|
|
||||||
"instance_uuid":null,
|
|
||||||
"hostname":null,
|
|
||||||
"uuid":"89ec9c4d-73b2-4aaf-9225-485945aa7162",
|
|
||||||
"links":[
|
|
||||||
{
|
|
||||||
"href":"http://192.168.23.138/accelerator/v2/accelerator_requests/89ec9c4d-73b2-4aaf-9225-485945aa7162",
|
|
||||||
"rel":"self"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"created_at":"2019-10-25T12:01:05+00:00",
|
|
||||||
"device_profile_group_id":0,
|
|
||||||
"attach_handle_type":"",
|
|
||||||
"updated_at":null,
|
|
||||||
"state":"Initial",
|
|
||||||
"device_rp_uuid":null,
|
|
||||||
"device_profile_name":"chenke-dp1",
|
|
||||||
"attach_handle_info":{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
After PATCH
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"instance_uuid":"506220bc-18f2-4294-9b29-80267a021dc0",
|
"instance_uuid":"506220bc-18f2-4294-9b29-80267a021dc0",
|
||||||
"hostname":"centos-80",
|
"hostname":"centos-80",
|
||||||
@ -48,4 +22,3 @@ After PATCH
|
|||||||
"function":"0"
|
"function":"0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"instance_uuid":null,
|
||||||
|
"hostname":null,
|
||||||
|
"uuid":"89ec9c4d-73b2-4aaf-9225-485945aa7162",
|
||||||
|
"links":[
|
||||||
|
{
|
||||||
|
"href":"http://192.168.23.138/accelerator/v2/accelerator_requests/89ec9c4d-73b2-4aaf-9225-485945aa7162",
|
||||||
|
"rel":"self"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"created_at":"2019-10-25T12:01:05+00:00",
|
||||||
|
"device_profile_group_id":0,
|
||||||
|
"attach_handle_type":"",
|
||||||
|
"updated_at":null,
|
||||||
|
"state":"Initial",
|
||||||
|
"device_rp_uuid":null,
|
||||||
|
"device_profile_name":"chenke-dp1",
|
||||||
|
"attach_handle_info":{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
42
tools/check-cherry-picks.sh
Executable file
42
tools/check-cherry-picks.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# A tool to check the cherry-pick hashes from the current git commit message
|
||||||
|
# to verify that they're all on either master or stable/ branches
|
||||||
|
#
|
||||||
|
|
||||||
|
commit_hash=""
|
||||||
|
|
||||||
|
# Check if the patch is a merge patch by counting the number of parents.
|
||||||
|
# If the patch has 2 parents, then the 2nd parent is the patch we want
|
||||||
|
# to validate.
|
||||||
|
parent_number=$(git show --format='%P' --quiet | awk '{print NF}')
|
||||||
|
if [ $parent_number -eq 2 ]; then
|
||||||
|
commit_hash=$(git show --format='%P' --quiet | awk '{print $NF}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
hashes=$(git show --format='%b' --quiet $commit_hash | sed -nr 's/^.cherry picked from commit (.*).$/\1/p')
|
||||||
|
checked=0
|
||||||
|
branches+=""
|
||||||
|
for hash in $hashes; do
|
||||||
|
branch=$(git branch -a --contains "$hash" 2>/dev/null| grep -oE '(master|stable/[a-z]+)')
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Cherry pick hash $hash not on any master or stable branches"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
branches+=" $branch"
|
||||||
|
checked=$(($checked + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $checked -eq 0 ]; then
|
||||||
|
if ! grep -q '^defaultbranch=stable/' .gitreview; then
|
||||||
|
echo "Checked $checked cherry-pick hashes: OK"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
if ! git show --format='%B' --quiet | grep -qi 'stable.*only'; then
|
||||||
|
echo 'Stable branch requires either cherry-pick -x headers or [stable-only] tag!'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo Checked $checked cherry-pick hashes on branches: $(echo $branches | tr ' ' '\n' | sort | uniq)
|
||||||
|
fi
|
12
tox.ini
12
tox.ini
@ -12,7 +12,9 @@ basepython = python3
|
|||||||
usedevelop = True
|
usedevelop = True
|
||||||
whitelist_externals =
|
whitelist_externals =
|
||||||
bash
|
bash
|
||||||
|
find
|
||||||
rm
|
rm
|
||||||
|
env
|
||||||
make
|
make
|
||||||
install_command = {[testenv:common-constraints]install_command}
|
install_command = {[testenv:common-constraints]install_command}
|
||||||
setenv =
|
setenv =
|
||||||
@ -52,8 +54,16 @@ commands = bindep test
|
|||||||
usedevelop = False
|
usedevelop = False
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
|
description =
|
||||||
|
Run style checks.
|
||||||
|
envdir = {toxworkdir}/shared
|
||||||
commands =
|
commands =
|
||||||
flake8
|
bash tools/flake8wrap.sh {posargs}
|
||||||
|
# Check that all JSON files don't have \r\n in line.
|
||||||
|
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
|
||||||
|
# Check that all included JSON files are valid JSON
|
||||||
|
bash -c '! find doc/ -type f -name *.json | grep -v 'curl' | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
|
||||||
|
bash tools/check-cherry-picks.sh
|
||||||
doc8 doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
|
doc8 doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
|
||||||
|
|
||||||
[testenv:pep8-constraints]
|
[testenv:pep8-constraints]
|
||||||
|
Loading…
Reference in New Issue
Block a user