From f3981f8475e06260af128ad6d12b4bab10e05ce2 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Sat, 28 Sep 2024 13:08:29 +0200 Subject: [PATCH] Generate raw --- .gitlab-ci.yml | 2 +- .gitlab/gen-badge.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .gitlab/gen-badge.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cfa29d080c..5097782055 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -441,7 +441,7 @@ release-docs: - "cp .docs/.swagger/custom.css ./final/${APP_VERSION}/rest/custom.css" # swagger - "cp -r ./site/* ./final/${APP_VERSION}" # mkdocs - "cp .docker/dist.tar.gz ./final/${APP_VERSION}/dist.tar.gz" # dist - - "anybadge --label pipeline --value \"$(curl -fsSL -H 'PRIVATE-TOKEN: ${CI_TOKEN}' 'https://gitlab.phaidra.org/api/v4/projects/450/pipelines?ref=${CI_COMMIT_BRANCH}' | jq '[.[]|select(.)][0].status')\" failed=red success=green > /tmp/pipeline.svg" + - "bash ./.gitlab/gen-badge.sh" - "cp /tmp/pipeline.svg ./final/${APP_VERSION}/images/pipeline.svg" # badges - eval $(ssh-agent -s) - "mkdir -p /root/.ssh" diff --git a/.gitlab/gen-badge.sh b/.gitlab/gen-badge.sh new file mode 100644 index 0000000000..a74f59d6c2 --- /dev/null +++ b/.gitlab/gen-badge.sh @@ -0,0 +1,7 @@ +#!/bin/bash +GITLAB_URL="https://gitlab.phaidra.org" +PIPELINE_ID=$(curl -fsSL -H "PRIVATE-TOKEN: ${CI_TOKEN}" "${GITLAB_URL}/api/v4/projects/450/pipelines?ref=${CI_COMMIT_BRANCH}" | jq '[.[]|select(.)][0].id') +echo "[INFO] pipeline id: ${PIPELINE_ID}" +STATUS_RAW=$(curl -fsSL -H "PRIVATE-TOKEN: ${CI_TOKEN}" "${GITLAB_URL}/api/v4/projects/450/pipelines/${PIPELINE_ID}" | jq '.detailed_status') +echo "[DEBUG] response: ${STATUS_RAW}" +anybadge --label pipeline --value "$(echo ${STATUS_RAW} | jq --raw-output .text)" failed=red passed=green canceled=darkgray > /tmp/pipeline.svg \ No newline at end of file -- GitLab