Feature/docker kuntoon (#11)
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 25s
CI Main / Check existing artifact (push) Successful in 22s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m47s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m4s
ci-docker-build-push Docker build & push 0.2.0 OK
CI Main / Build & Push Docker (push) Successful in 35s
CI Main / Report Summary (push) Successful in 4s
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 25s
CI Main / Check existing artifact (push) Successful in 22s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m47s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m4s
ci-docker-build-push Docker build & push 0.2.0 OK
CI Main / Build & Push Docker (push) Successful in 35s
CI Main / Report Summary (push) Successful in 4s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #11
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# https://docs.gitea.com/api/next/#tag/repository/operation/repoCreateStatus
|
||||
|
||||
STATE="${1:-}"
|
||||
DESCRIPTION="${2:-}"
|
||||
KEY="${3:-commit-${GITHUB_SHA:0:8}}"
|
||||
SUITE="${4:-}"
|
||||
CUSTOM_URL="${5:-}"
|
||||
|
||||
[ -z "$STATE" ] && echo "ERROR: state argument is required" >&2 && exit 1
|
||||
[ -z "$DESCRIPTION" ] && echo "ERROR: description argument is required" >&2 && exit 1
|
||||
[ -z "${GITEA_API_URL:-}" ] && echo "ERROR: GITEA_API_URL is not set" >&2 && exit 1
|
||||
[ -z "${GITEA_TOKEN:-}" ] && echo "ERROR: GITEA_TOKEN is not set" >&2 && exit 1
|
||||
|
||||
if [ -n "$SUITE" ]; then
|
||||
if [ -n "$CUSTOM_URL" ]; then
|
||||
URL="$CUSTOM_URL"
|
||||
elif [ -n "$SUITE" ]; then
|
||||
SUITE="${SUITE%/}/"
|
||||
URL="${GIT_PAGES_URL}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/${SUITE}"
|
||||
else
|
||||
@@ -28,15 +33,15 @@ HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-X POST "$GITEA_API_URL/api/v1/repos/$REPO/statuses/$COMMIT" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"state\":\"$STATE\",\"target_url\":\"$URL\",\"description\":\"$DESCRIPTION\",\"context\":\"$KEY\"}")
|
||||
-d "{\"state\":\"$STATE\",\"target_url\":\"$URL\",\"description\":\"$DESCRIPTION\",\"context\":\"$KEY\"}" || true)
|
||||
|
||||
if [ "$HTTP_CODE" = "201" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$HTTP_CODE" ]; then
|
||||
echo "ERROR: Failed to connect to Gitea API at $GITEA_API_URL" >&2
|
||||
if [ -z "$HTTP_CODE" ] || [ "$HTTP_CODE" = "000" ]; then
|
||||
echo "gitea-ci-library - ERROR: Failed to connect to Gitea API at $GITEA_API_URL" >&2
|
||||
else
|
||||
echo "ERROR: API returned HTTP $HTTP_CODE" >&2
|
||||
echo "gitea-ci-library - ERROR: gitea-ci-library, API returned HTTP $HTTP_CODE" >&2
|
||||
fi
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user