Merge pull request #1364 from jberry-suse/travis-deploy-osc-api

dist/ci/obs-deploy: replace `osc request list` with `osc api` call.
This commit is contained in:
Jimmy Berry 2018-01-25 10:03:38 -06:00 committed by GitHub
commit 3cf74b3d12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
dist/ci/obs-deploy vendored
View File

@ -26,11 +26,9 @@ fi
OBS_TARGET_PROJECT="$(osc info | grep -oP "Link info:.*?project \K[^\s,]+")" OBS_TARGET_PROJECT="$(osc info | grep -oP "Link info:.*?project \K[^\s,]+")"
OBS_TARGET_PACKAGE="$(osc info | grep -oP "Link info:.*?, package \K[^\s,]+")" OBS_TARGET_PACKAGE="$(osc info | grep -oP "Link info:.*?, package \K[^\s,]+")"
echo "checking for existing requests to $OBS_TARGET_PROJECT/$OBS_TARGET_PACKAGE..." echo "checking for existing requests to $OBS_TARGET_PROJECT/$OBS_TARGET_PACKAGE..."
# Limit by user in an attempt to avoid requests sourced from target project. # `osc request list` is wholly inadequate for the task. :(
# Unfortunately the command line provides no mechanism to do so and a full API if osc api "/search/request?match=(state/@name='declined'+or+state/@name='new'+or+state/@name='review')+and+action/target/@project='$OBS_TARGET_PROJECT'+and+action/target/@package='$OBS_TARGET_PACKAGE'" |
# query is rather ungainly compared to this workaround. grep '<collection matches="0">' ; then
if osc request list -U "$OBS_USER" "$OBS_TARGET_PROJECT" "$OBS_TARGET_PACKAGE" |
grep 'No results for package' ; then
osc service wait osc service wait
# Only bother making a request if there is a diff (always 6 lines since # Only bother making a request if there is a diff (always 6 lines since
# binary source tarball dates changed after local run). # binary source tarball dates changed after local run).