From 0de19e4978bf9ab8fa93f685741db4b613c8b3e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20=C5=81opatowski?=
 <lukasz.lopatowski@gmail.com>
Date: Mon, 3 Jul 2023 09:07:47 +0200
Subject: [PATCH] Added additional debug logs for GitLab related operations

---
 pkg/service/v1/config-service.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/service/v1/config-service.go b/pkg/service/v1/config-service.go
index bab3b13..5ad7142 100644
--- a/pkg/service/v1/config-service.go
+++ b/pkg/service/v1/config-service.go
@@ -94,6 +94,7 @@ func prepareInfoResponse(status v1.Status, message string, info string) *v1.Info
 //Find proper project, given user namespace and instance uid
 func (s *configServiceServer) FindGitlabProjectId(api *gitlab.Client, uid string, domain string) (int, error) {
 	//Find exact group
+	log.Printf("Searching for GitLab Group by domain %s", domain)
 	groups, _, err := api.Groups.SearchGroup(domain)
 	if len(groups) != 1 || err != nil {
 		log.Printf("Found %d groups in domain %s", len(groups), domain)
@@ -102,6 +103,7 @@ func (s *configServiceServer) FindGitlabProjectId(api *gitlab.Client, uid string
 	}
 
 	//List group projects
+	log.Printf("Searching for GitLab Projects within Group %d / %s", groups[0].ID, groups[0].Name)
 	projs, _, err := api.Groups.ListGroupProjects(groups[0].ID, nil)
 	if err != nil || len(projs) == 0 {
 		log.Printf("Group %s is empty or unaccessible", groups[0].Name)
@@ -109,6 +111,7 @@ func (s *configServiceServer) FindGitlabProjectId(api *gitlab.Client, uid string
 	}
 
 	//Find our project in group projects list
+    log.Printf("Found %d Projects and looking for %s", len(groups), uid)
 	for _, proj := range projs {
 		if proj.Name == uid {
 			return proj.ID, nil
@@ -229,7 +232,7 @@ func (s *configServiceServer) CreateOrReplace(ctx context.Context, req *v1.Insta
 
 	repo, err = s.PrepareDataMapFromRepository(s.gitAPI, proj)
 	if err != nil {
-		log.Print("Error occured while retriving content of the Git repository. Will not create any ConfigMap")
+		log.Print("Error occurred while retriving content of the Git repository. Will not create any ConfigMap")
 		return prepareResponse(v1.Status_FAILED, "Failed to create ConfigMap"), err
 	}
 
-- 
GitLab