# Propagate exit code from api fuzzing scanner (if any)
-if [[ $(docker inspect apifuzzer --format='{{.State.ExitCode}}') != "0" ]]; then echo "API Fuzzing scanner exited with an error. Logs are available as job artifacts."; exit 1; fi
#
# Run user provided post-script
-sh -c "$FUZZAPI_POST_SCRIPT"
#
after_script:
#
# Shutdown all containers
-echo "Stopping all containers"
-if [ "$FUZZAPI_D_TARGET_IMAGE" != "" ]; then docker stop target; fi
-docker stop worker
-docker stop apifuzzer
#
# Save docker logs
-docker logs apifuzzer &> gl-api_fuzzing-logs.log
-if [ "$FUZZAPI_D_TARGET_IMAGE" != "" ]; then docker logs target &> gl-api_fuzzing-target-logs.log; fi