diff --git a/gocd/slfo-stagings.gocd.yaml b/gocd/slfo-stagings.gocd.yaml index 36a7c07b7..f13d017b2 100644 --- a/gocd/slfo-stagings.gocd.yaml +++ b/gocd/slfo-stagings.gocd.yaml @@ -122,15 +122,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -206,15 +215,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -290,15 +308,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -374,15 +401,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -458,15 +494,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -542,15 +587,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -626,15 +680,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -710,15 +773,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -794,15 +866,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -878,15 +959,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -962,15 +1052,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1105,15 +1204,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1190,15 +1298,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1275,15 +1392,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1360,15 +1486,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1445,15 +1580,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1530,15 +1674,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1615,15 +1768,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1700,15 +1862,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1785,15 +1956,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1870,15 +2050,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -1955,15 +2144,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: diff --git a/gocd/slfo-stagings.gocd.yaml.erb b/gocd/slfo-stagings.gocd.yaml.erb index ed3652ad6..7df80517b 100644 --- a/gocd/slfo-stagings.gocd.yaml.erb +++ b/gocd/slfo-stagings.gocd.yaml.erb @@ -123,15 +123,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: @@ -268,15 +277,24 @@ pipelines: - staging-bot tasks: - script: |- + minutes=1 osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build" export PYTHONPATH=$PWD/scripts - while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do - if [ ${ret} -eq 2 ]; then - echo "product repository not found. Project configuration issue?" >&2 + ## Let the scheduler warm up first + sleep 60 + while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do + if [ ${minutes} -gt 180 ]; then + echo "Product is still building after timeout, exiting..." >&2 exit 1 fi sleep 60 + minutes=$(expr $minutes + 1) done + ## Always fail on broken/failed products + if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then + echo "Some products failed to build, exiting..." >&2 + exit 1 + fi - Enable.images.repo: resources: diff --git a/osc-staging.py b/osc-staging.py index e9cab5363..d164fae51 100644 --- a/osc-staging.py +++ b/osc-staging.py @@ -93,6 +93,8 @@ def clean_args(args): help='split the requests into individual groups') @cmdln.option('--supersede', action='store_true', help='replace staged requests when superseded') +@cmdln.option('--adi-details', action='store_true', + help='show detailed summary for packages that are not in any ring') @cmdln.option('--filter-from', metavar='STAGING', help='filter request list to only those from a specific staging') @cmdln.option('-p', '--project', dest='project', metavar='PROJECT', @@ -307,7 +309,7 @@ def do_staging(self, subcmd, opts, *args): osc staging frozenage [STAGING...] osc staging ignore [-m MESSAGE] REQUEST... osc staging unignore [--cleanup] [REQUEST...|all] - osc staging list [--supersede] + osc staging list [--supersede] [--adi-details] osc staging lock [-m MESSAGE] osc staging select [--no-freeze] [--remove-exclusion] [--move [--filter-from STAGING]] STAGING REQUEST... @@ -578,7 +580,7 @@ def do_staging(self, subcmd, opts, *args): elif cmd == 'unignore': UnignoreCommand(api).perform(args[1:], opts.cleanup) elif cmd == 'list': - ListCommand(api).perform(supersede=opts.supersede) + ListCommand(api).perform(supersede=opts.supersede, adi_details=opts.adi_details) elif cmd == 'lock': lock.hold(opts.message) elif cmd == 'adi': diff --git a/osclib/list_command.py b/osclib/list_command.py index ec55a2c20..9af760c16 100644 --- a/osclib/list_command.py +++ b/osclib/list_command.py @@ -18,7 +18,32 @@ class ListCommand: def __init__(self, api): self.api = api - def perform(self, supersede=False): + def print_request(self, request): + hide_source = self.api.project == 'openSUSE:Factory' + request_id = int(request.get('id')) + action = request.find('action') + target_package = action.find('target').get('package') + ring = action.find('target').get('ring', None) + + line = f"{request_id} {Fore.CYAN}{target_package:<30}{Fore.RESET}" + if ring: + ring_color = Fore.MAGENTA if ring.startswith('0') else '' + line += f" -> {ring_color}{ring:<12}{Fore.RESET}" + + if not hide_source and action.find('source') is not None: + source_project = action.find('source').get('project') + source_project = self.project_strip(source_project) + line += f' ({Fore.YELLOW + source_project + Fore.RESET})' + if action.get('type') == 'delete': + line += ' (' + Fore.RED + 'delete request' + Fore.RESET + ')' + + message = self.api.ignore_format(request_id) + if message: + line += '\n' + Fore.WHITE + message + Fore.RESET + + print(' ', line) + + def perform(self, supersede=False, adi_details=False): """ Perform the list command """ @@ -34,39 +59,23 @@ def perform(self, supersede=False): splitter.group_by('./action/target/@devel_project') splitter.split() - hide_source = self.api.project == 'openSUSE:Factory' for group in sorted(splitter.grouped.keys()): print(Fore.YELLOW + group) for request in splitter.grouped[group]['requests']: - request_id = int(request.get('id')) - action = request.find('action') - target_package = action.find('target').get('package') - ring = action.find('target').get('ring') - ring_color = Fore.MAGENTA if ring.startswith('0') else '' - - line = '{} {}{:<30}{} -> {}{:<12}{}'.format( - request_id, Fore.CYAN, target_package, Fore.RESET, - ring_color, ring, Fore.RESET) - - if not hide_source and action.find('source') is not None: - source_project = action.find('source').get('project') - source_project = self.project_strip(source_project) - line += f' ({Fore.YELLOW + source_project + Fore.RESET})' - if action.get('type') == 'delete': - line += ' (' + Fore.RED + 'delete request' + Fore.RESET + ')' - - message = self.api.ignore_format(request_id) - if message: - line += '\n' + Fore.WHITE + message + Fore.RESET - - print(' ', line) + self.print_request(request) if len(splitter.other): - non_ring_packages = [] - for request in splitter.other: - non_ring_packages.append(request.find('./action/target').get('package')) - print('Not in a ring: ' + ' '.join(sorted(non_ring_packages))) + non_ring_requests = splitter.other + if adi_details: + print('Not in a ring: ') + for request in non_ring_requests: + self.print_request(request) + else: + non_ring_packages = sorted( + request.find('./action/target').get('package') + for request in non_ring_requests) + print('Not in a ring: ' + ' '.join(non_ring_packages)) # Print requests not handled by staging process to highlight them. splitter.stageable = False diff --git a/osclib/stagingapi.py b/osclib/stagingapi.py index 9b52cd867..1cb8b4cb3 100644 --- a/osclib/stagingapi.py +++ b/osclib/stagingapi.py @@ -1289,7 +1289,11 @@ def get_prj_results(self, prj, arch): return results def is_repo_dirty(self, project, repository): - url = self.makeurl(['build', project, f'_result?code=broken&repository={repository}']) + query = { + 'code': 'broken', + 'repository': repository + } + url = self.makeurl(['build', project, '_result'], query=query) root = ET.parse(http_GET(url)).getroot() for repo in root.findall('result'): repostate = repo.get('state', 'missing')