From 6fa76388e23533cc864d903473f9e9c370e26119 Mon Sep 17 00:00:00 2001
From: Andre Sterba <andre.sterba@stud.h-da.de>
Date: Fri, 14 Oct 2022 06:39:17 +0000
Subject: [PATCH] Integrate renovatebot for dependency updates
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

See merge request danet/gosdn!361

Co-authored-by: André Sterba <andre.sterbastud.h-da.de>
---
 .gitlab-ci.yml           |  2 ++
 .gitlab/ci/.renovate.yml | 12 ++++++++++++
 config.js                | 24 ++++++++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 .gitlab/ci/.renovate.yml
 create mode 100644 config.js

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 145de5eae..f631e2080 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ workflow:
     - if: $CI_PIPELINE_SOURCE == 'push'
 
 stages:
+    - tools
     - build
     - test
     - analyze
@@ -25,3 +26,4 @@ include:
     - local: "/.gitlab/ci/.integration-test-containerlab.yml"
     - local: "/.gitlab/ci/.integration-test.yml"
     - local: "/.gitlab/ci/.uml-autogen-ci.yml"
+    - local: "/.gitlab/ci/.renovate.yml"
diff --git a/.gitlab/ci/.renovate.yml b/.gitlab/ci/.renovate.yml
new file mode 100644
index 000000000..ba873230b
--- /dev/null
+++ b/.gitlab/ci/.renovate.yml
@@ -0,0 +1,12 @@
+renovate:
+    stage: tools
+
+    image: renovate/renovate:32.127.0-slim@sha256:30824333e0978851f96ac8e58e7afa39aaf996de243f8bfcb1d7d6906b46488d
+
+    variables:
+        LOG_LEVEL: debug
+
+    only:
+        - schedules
+    script:
+        - renovate $RENOVATE_EXTRA_FLAGS
diff --git a/config.js b/config.js
new file mode 100644
index 000000000..466b8287b
--- /dev/null
+++ b/config.js
@@ -0,0 +1,24 @@
+Object.assign(process.env, {
+  GIT_AUTHOR_NAME: 'Renovate Bot',
+  GIT_AUTHOR_EMAIL: 'renovate@danet.fbi.h-da.de',
+  GIT_COMMITTER_NAME: 'Renovate Bot',
+  GIT_COMMITTER_EMAIL: 'renovate@danet.fbi.h-da.de',
+});
+
+module.exports = {
+  endpoint: process.env.CI_API_V4_URL,
+  hostRules: [
+    {
+      baseUrl: 'https://registry.code.fbi.h-da.de',
+      username: '@project_10161_bot',
+      password: process.env.GITLAB_REGISTRY_TOKEN,
+    },
+  ],
+  platform: 'gitlab',
+  username: '@project_10161_bot',
+  gitAuthor: 'Renovate Bot <renovate@danet.fbi.h-da.de>',
+  autodiscover: true,
+  prConcurrentLimit: 10,
+  commitMessagePrefix: '[renovate]',
+  labels: ['renovate']
+};
-- 
GitLab