ci(aio): do not fail when re-deploying preview for the same PR/SHA
Previously, when trying to upload the build artifacts for a PR/SHA that was already successfully deployed (e.g. when re-running a Travis job), the preview server would return a 403 and the build would fail. Since we have other mechanisms to verify that the PR author is trusted and the artifacts do indeed come from the specified PR and since the new artifacts should be the same with the already deployed ones (same SHA), there is no reason to fail the build. The preview server will reject the request with a special HTTP status code (409 - Conflict), which the `deploy-preview` script will recognize and exit with 0.
This commit is contained in:

committed by
Pete Bacon Darwin

parent
9cb5964b4d
commit
d263595c63
@ -24,8 +24,9 @@ httpCode=$(
|
||||
| sed 's/HTTP_CODE: //'
|
||||
)
|
||||
|
||||
# Exit with an error if the request failed
|
||||
if [ $httpCode -lt 200 ] || [ $httpCode -ge 400 ]; then
|
||||
# Exit with an error if the request failed.
|
||||
# (Ignore 409 failures, which mean trying to re-deploy for the same PR/SHA.)
|
||||
if [ $httpCode -lt 200 ] || ([ $httpCode -ge 400 ] && [ $httpCode -ne 409 ]); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user