diff --git a/.circleci/config.yml b/.circleci/config.yml index 0dad11f7..46aeb1e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,12 +72,18 @@ jobs: no_output_timeout: 40m command: | export PIPELINE="$CIRCLE_BRANCH" - ./build.sh && echo 'success' > .build-status || ( echo 'failed' > .build-status && exit 1 ) + set +e + ./build.sh + if [ $? = 0 ]; then + echo BUILD_STATUS=success >> .build.state + else + echo BUILD_STATUS=failed >> .build.state + exit 1 + fi - run: name: Send notification when: always command: | - export BUILD_STATUS=$( cat .build-status ) export CI_JOB_ID="$CIRCLE_BUILD_NUM" export CI_PROJECT_NAMESPACE="$CIRCLE_PROJECT_USERNAME" export CI_PROJECT_NAME="$CIRCLE_PROJECT_REPONAME" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afac9c20..c7c134db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,10 +16,17 @@ build-image: script: - | export PIPELINE="$CI_COMMIT_BRANCH" - ./build.sh && echo 'success' > .build-status || ( echo 'failed' > .build-status && exit 1 ) + set +e + ./build.sh + if [ $? = 0 ]; then + echo BUILD_STATUS=success >> .build.state + else + echo BUILD_STATUS=failed >> .build.state + exit 1 + fi artifacts: paths: - - .build-status + - .build.state when: always expire_in: never @@ -33,6 +40,5 @@ send-notification: script: - | apk add --no-cache curl - export BUILD_STATUS=$( cat .build-status ) export X_CI_WEBHOOK_SECRET_HEADER="x-gitlab-webhook-secret: $X_GITLAB_WEBHOOK_SECRET" ./notify.sh diff --git a/notify.sh b/notify.sh index ec144a71..b796fe5d 100755 --- a/notify.sh +++ b/notify.sh @@ -1,7 +1,6 @@ #!/bin/sh # Process job variables -BUILD_STATUS=${BUILD_STATUS:?err} GAME_VERSION=${GAME_VERSION:-} APPID=${APPID:-} CLIENT_APPID=${CLIENT_APPID:-} @@ -15,6 +14,15 @@ NO_TEST=${NO_TEST:-} NO_PUSH=${NO_PUSH:-} STEAM_LOGIN=${STEAM_LOGIN:-} +# Read build state file +echo "Reading .build.state file" +. ./.build.state + +# Process build state variables +BUILD_STATUS=${BUILD_STATUS:?err} +BASE_SIZE=${BASE_SIZE:-0} +LAYERED_SIZE=${LAYERED_SIZE:-0} + # Send notification date echo 'Sending notification' @@ -38,7 +46,12 @@ BODY=$( cat <