From 97280b6e3ff0dca4dd16db2290cfbc20ea94204f Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Wed, 6 Nov 2024 11:17:02 +0100
Subject: [PATCH] Copy the badges

---
 .docs/images/coverage.svg        |  2 +-
 .docs/images/maintainability.svg | 24 ++++++++++++++++++++++++
 .docs/images/pipeline.svg        |  2 +-
 .docs/images/security.svg        | 24 ++++++++++++++++++++++++
 .docs/index.md                   |  2 ++
 .gitlab-ci.yml                   |  2 +-
 .gitlab/gen-badge.sh             |  3 +++
 7 files changed, 56 insertions(+), 3 deletions(-)
 create mode 100644 .docs/images/maintainability.svg
 create mode 100644 .docs/images/security.svg

diff --git a/.docs/images/coverage.svg b/.docs/images/coverage.svg
index 8d22334eb1..74b0307350 100644
--- a/.docs/images/coverage.svg
+++ b/.docs/images/coverage.svg
@@ -9,7 +9,7 @@
     </mask>
     <g mask="url(#anybadge_1)">
         <path fill="#555" d="M0 0h65v20H0z"/>
-        <path fill="#A9A9A9" d="M65 0h59v20H65z"/>
+        <path fill="#C0C0C0" d="M65 0h59v20H65z"/>
         <path fill="url(#b)" d="M0 0h124v20H0z"/>
     </g>
     <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
diff --git a/.docs/images/maintainability.svg b/.docs/images/maintainability.svg
new file mode 100644
index 0000000000..4d684e6d3d
--- /dev/null
+++ b/.docs/images/maintainability.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="158" height="20">
+    <linearGradient id="b" x2="0" y2="100%">
+        <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
+        <stop offset="1" stop-opacity=".1"/>
+    </linearGradient>
+    <mask id="anybadge_1">
+        <rect width="158" height="20" rx="3" fill="#fff"/>
+    </mask>
+    <g mask="url(#anybadge_1)">
+        <path fill="#555" d="M0 0h99v20H0z"/>
+        <path fill="#C0C0C0" d="M99 0h59v20H99z"/>
+        <path fill="url(#b)" d="M0 0h158v20H0z"/>
+    </g>
+    <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
+        <text x="50.5" y="15" fill="#010101" fill-opacity=".3">maintainability</text>
+        <text x="49.5" y="14">maintainability</text>
+    </g>
+    <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
+        <text x="129.5" y="15" fill="#010101" fill-opacity=".3">unknown</text>
+        <text x="128.5" y="14">unknown</text>
+    </g>
+</svg>
+
diff --git a/.docs/images/pipeline.svg b/.docs/images/pipeline.svg
index 17f9499891..d458c77061 100644
--- a/.docs/images/pipeline.svg
+++ b/.docs/images/pipeline.svg
@@ -9,7 +9,7 @@
     </mask>
     <g mask="url(#anybadge_1)">
         <path fill="#555" d="M0 0h57v20H0z"/>
-        <path fill="#A9A9A9" d="M57 0h59v20H57z"/>
+        <path fill="#C0C0C0" d="M57 0h59v20H57z"/>
         <path fill="url(#b)" d="M0 0h116v20H0z"/>
     </g>
     <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
diff --git a/.docs/images/security.svg b/.docs/images/security.svg
new file mode 100644
index 0000000000..2772393142
--- /dev/null
+++ b/.docs/images/security.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="119" height="20">
+    <linearGradient id="b" x2="0" y2="100%">
+        <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
+        <stop offset="1" stop-opacity=".1"/>
+    </linearGradient>
+    <mask id="anybadge_1">
+        <rect width="119" height="20" rx="3" fill="#fff"/>
+    </mask>
+    <g mask="url(#anybadge_1)">
+        <path fill="#555" d="M0 0h60v20H0z"/>
+        <path fill="#C0C0C0" d="M60 0h59v20H60z"/>
+        <path fill="url(#b)" d="M0 0h119v20H0z"/>
+    </g>
+    <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
+        <text x="31.0" y="15" fill="#010101" fill-opacity=".3">security</text>
+        <text x="30.0" y="14">security</text>
+    </g>
+    <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
+        <text x="90.5" y="15" fill="#010101" fill-opacity=".3">unknown</text>
+        <text x="89.5" y="14">unknown</text>
+    </g>
+</svg>
+
diff --git a/.docs/index.md b/.docs/index.md
index 351edbf441..f4cfbcb329 100644
--- a/.docs/index.md
+++ b/.docs/index.md
@@ -11,6 +11,8 @@ author: Martin Weise
 [![Image Pulls](https://img.shields.io/docker/pulls/dbrepo/data-service?style=flat)](https://hub.docker.com/u/dbrepo){ tabindex=-1 }
 [![Helm Chart version](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/dbrepo)](https://artifacthub.io/packages/helm/dbrepo/dbrepo){ tabindex=-1 }
 [![GitLab License](https://img.shields.io/gitlab/license/fair-data-austria-db-repository%2Ffda-services?gitlab_url=https%3A%2F%2Fgitlab.phaidra.org%2F&style=flat&cacheSeconds=3600)](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services){ tabindex=-1 }
+![Maintainability Rating](./images/maintainability.svg)
+![Security Rating](./images/security.svg)
 
 Documentation for version: [v1.5.0](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/releases).
 
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f87b4978cd..d5054047d8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -416,7 +416,7 @@ release-docs:
       - /^release-.*/
   before_script:
     - "pip install pipenv"
-    - "pipenv install --dev --system --deploy
+    - "pipenv install --dev --system --deploy"
     - "apk add --no-cache alpine-sdk bash sed wget openssh jq curl"
     - "mkdir -p ./final/${DOC_VERSION}/rest"
   script:
diff --git a/.gitlab/gen-badge.sh b/.gitlab/gen-badge.sh
index 5ef15a3b6c..cff4814af1 100644
--- a/.gitlab/gen-badge.sh
+++ b/.gitlab/gen-badge.sh
@@ -9,3 +9,6 @@ if [ "${PIPELINE_COVERAGE}" != "null" ]; then
 else
   echo "[WARNING] Skipping badge generation, displaying default badge text: unknown"
 fi
+curl "${SONARQUBE_URL}/api/project_badges/measure?project=fair-data-austria-db-repository_fda-services_a57fa043-ab99-4cdd-a721-162d9a916d77&metric=sqale_rating&token=${CI_SONAR_TOKEN}" > "./final/${APP_VERSION}/images/maintainability.svg"
+curl "${SONARQUBE_URL}/api/project_badges/measure?project=fair-data-austria-db-repository_fda-services_a57fa043-ab99-4cdd-a721-162d9a916d77&metric=security_rating&token=${CI_SONAR_TOKEN}" > "./final/${APP_VERSION}/images/security.svg"
+echo "[INFO] retrieved SonarQube badges"
\ No newline at end of file
-- 
GitLab