From 67a1090c019b0bf7b5bb1497a0b4c5665c2cbcbf Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Mon, 6 Dec 2021 14:58:38 +0100
Subject: [PATCH] gitlab-ci: Pass DEBUG=1 to enable debug logging in the CI

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 .gitlab-ci.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b30d9fe..746c9c6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,6 +3,9 @@ default:
   image: debian:bullseye-slim
 
 variables:
+  DEBUG:
+    description: Set to any non-empty value to enable debug output
+    value: ""
   FILTER: 'pkg/*'
 
 stages:
@@ -57,6 +60,7 @@ packaging-data-fetch-downstream:
         --gitlab-server-url "${CI_SERVER_URL}"
         --filter "${FILTER}"
         --yaml packaging-data-downstream.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-data-downstream.yaml
@@ -80,6 +84,7 @@ packaging-data-fetch-sources-upstream:
     - ./bin/packaging-data-fetch-sources
         --sources-definitions data/sources.yaml
         --yaml packaging-data-sources-upstream.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-data-sources-upstream.yaml
@@ -107,6 +112,7 @@ packaging-data-fetch-sources-published:
         --output-key published
         --no-output-sources-definitions
         --yaml packaging-data-sources-published.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-data-sources-published.yaml
@@ -133,6 +139,7 @@ packaging-data-fetch-binaries-published:
         --sources-key channels
         --output-key published
         --yaml packaging-data-binaries-published.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-data-binaries-published.yaml
@@ -157,6 +164,7 @@ packaging-data-fetch-obs:
     - ./bin/packaging-data-fetch-obs
         --oscrc "$DASHBOARD_OSCRC"
         --yaml packaging-data-obs.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-data-obs.yaml
@@ -188,6 +196,7 @@ storage-usage:
   script:
     - cd storage_stats
     - export CARGO_HOME=$PWD/cargo
+    - test -n "$DEBUG" && RUST_LOG=debug
     - cargo run --release --
       --sources-definitions ../data/channels.yaml
       --sources-key channels
@@ -219,6 +228,7 @@ packaging-check-invariants:
     - ./bin/packaging-check-invariants
         --projects packaging-data.yaml
         --yaml packaging-checks.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-data.yaml
@@ -238,6 +248,7 @@ packaging-updates:
     - ./bin/packaging-updates
         --projects packaging-data.yaml
         --yaml packaging-updates.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-updates.yaml
@@ -258,6 +269,7 @@ packaging-updates-upstream-linux:
     - ./bin/packaging-updates-upstream-linux
         --projects packaging-data.yaml
         --yaml packaging-updates-upstream-linux.yaml
+        ${DEBUG:+--debug}
   artifacts:
     paths:
       - packaging-updates-upstream-linux.yaml
-- 
GitLab