diff --git a/.idea/hades.iml b/.idea/hades.iml deleted file mode 100644 index 7ee078d..0000000 --- a/.idea/hades.iml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_22_09_23,_21_16_[Changes]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Checkout_at_22_09_23,_21_16_[Changes]/shelved.patch deleted file mode 100644 index e62aeed..0000000 --- a/.idea/shelf/Uncommitted_changes_before_Checkout_at_22_09_23,_21_16_[Changes]/shelved.patch +++ /dev/null @@ -1,129 +0,0 @@ -Index: HadesAPI/main.go -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>package main\n\nimport (\n\t\"os\"\n\n\t\"github.com/Mtze/HadesCI/shared/queue\"\n\t\"github.com/gin-gonic/gin\"\n\tlog \"github.com/sirupsen/logrus\"\n)\n\nvar BuildQueue *queue.Queue\n\nfunc main() {\n\tif is_debug := os.Getenv(\"DEBUG\"); is_debug == \"true\" {\n\t\tlog.SetLevel(log.DebugLevel)\n\t\tlog.Warn(\"DEBUG MODE ENABLED\")\n\t}\n\n\t// var err error\n\t// BuildQueue, err = queue.Init(\"builds\", \"amqp://admin:admin@localhost:5672/\")\n\t// if err != nil {\n\t// \tlog.Panic(err)\n\t// }\n\n\tlog.Info(\"Starting HadesAPI\")\n\tgin.SetMode(gin.ReleaseMode)\n\tr := gin.Default()\n\tr.GET(\"/ping\", ping)\n\tr.POST(\"/build\", AddBuildToQueue)\n\tlog.Panic(r.Run(\":8080\")) // listen and serve on 0.0.0.0:8080 (for windows \"localhost:8080\")\n}\n -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/HadesAPI/main.go b/HadesAPI/main.go ---- a/HadesAPI/main.go (revision 946342fbe2228c33307360c6d6ef71ea2d41f7bc) -+++ b/HadesAPI/main.go (date 1695409092959) -@@ -11,16 +11,16 @@ - var BuildQueue *queue.Queue - - func main() { -- if is_debug := os.Getenv("DEBUG"); is_debug == "true" { -+ if isDebug := os.Getenv("DEBUG"); isDebug == "true" { - log.SetLevel(log.DebugLevel) - log.Warn("DEBUG MODE ENABLED") - } - -- // var err error -- // BuildQueue, err = queue.Init("builds", "amqp://admin:admin@localhost:5672/") -- // if err != nil { -- // log.Panic(err) -- // } -+ var err error -+ BuildQueue, err = queue.Init("builds", "amqp://admin:admin@localhost:5672/") -+ if err != nil { -+ log.Panic(err) -+ } - - log.Info("Starting HadesAPI") - gin.SetMode(gin.ReleaseMode) -Index: docker-compose.yml -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+># docker compose file for the project with three services\n\nversion: '3.7'\nservices:\n hadesAPI:\n image: hades-api\n build:\n context: .\n dockerfile: ./HadesAPI/Dockerfile\n ports:\n - \"8080:8080\"\n hadesScheduler:\n image: hades-scheduler\n build:\n context: .\n dockerfile: ./HadesScheduler/Dockerfile -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/docker-compose.yml b/docker-compose.yml ---- a/docker-compose.yml (revision 946342fbe2228c33307360c6d6ef71ea2d41f7bc) -+++ b/docker-compose.yml (date 1695407522495) -@@ -1,6 +1,5 @@ - # docker compose file for the project with three services -- --version: '3.7' -+version: '3.8' - services: - hadesAPI: - image: hades-api -Index: HadesScheduler/main.go -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"k8s.io/client-go/kubernetes\"\n\t\"k8s.io/client-go/tools/clientcmd\"\n\n\t\"github.com/Mtze/HadesCI/shared/queue\"\n\n\tamqp \"github.com/rabbitmq/amqp091-go\"\n\tlog \"github.com/sirupsen/logrus\"\n)\n\nvar BuildQueue *queue.Queue\n\n// This function inizializes the kubeconfig clientset using the kubeconfig file in the useres home directory\nfunc initializeKubeconfig() *kubernetes.Clientset {\n\n\tfmt.Println(\"Get Kubernetes pods\")\n\n\t// Load kubeconfig from default location\n\tuserHomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error getting user home dir\")\n\t\tos.Exit(1)\n\t}\n\tkubeConfigPath := filepath.Join(userHomeDir, \".kube\", \"config\")\n\tlog.Infof(\"Using kubeconfig: %s\\n\", kubeConfigPath)\n\n\t// Create kubeconfig object\n\tkubeConfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeConfigPath)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error getting Kubernetes clientset\")\n\t\tos.Exit(1)\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(kubeConfig)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error getting Kubernetes clientset\")\n\t\tos.Exit(1)\n\t}\n\n\treturn clientset\n\n}\n\nfunc main() {\n\n\tif is_debug := os.Getenv(\"DEBUG\"); is_debug == \"true\" {\n\t\tlog.SetLevel(log.DebugLevel)\n\t\tlog.Warn(\"DEBUG MODE ENABLED\")\n\t}\n\n\tvar err error\n\tBuildQueue, err = queue.Init(\"builds\", \"amqp://admin:admin@localhost:5672/\")\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tvar forever chan struct{}\n\n\tf := func(ch <-chan amqp.Delivery) {\n\t\tfor d := range ch {\n\t\t\tlog.Printf(\"Received a message: %s\", d.Body)\n\t\t}\n\t}\n\tBuildQueue.Dequeue(f)\n\n\tlog.Printf(\" [*] Waiting for messages. To exit press CTRL+C\")\n\t<-forever\n\n\t//clientset := initializeKubeconfig()\n\n\t//pods, err := clientset.CoreV1().Pods(\"kube-system\").List(context.Background(), v1.ListOptions{})\n\t//if err != nil {\n\t//\tlog.Infof(\"error getting pods: %v\\n\", err)\n\t//\tos.Exit(1)\n\t//}\n\t//for _, pod := range pods.Items {\n\t//\tlog.Infof(\"Pod name: %s\\n\", pod.Name)\n\t//}\n}\n -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/HadesScheduler/main.go b/HadesScheduler/main.go ---- a/HadesScheduler/main.go (revision 946342fbe2228c33307360c6d6ef71ea2d41f7bc) -+++ b/HadesScheduler/main.go (date 1695409521125) -@@ -2,11 +2,10 @@ - - import ( - "fmt" -- "os" -- "path/filepath" -- - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/clientcmd" -+ "os" -+ "path/filepath" - - "github.com/Mtze/HadesCI/shared/queue" - -@@ -48,8 +47,7 @@ - } - - func main() { -- -- if is_debug := os.Getenv("DEBUG"); is_debug == "true" { -+ if isDebug := os.Getenv("DEBUG"); isDebug == "true" { - log.SetLevel(log.DebugLevel) - log.Warn("DEBUG MODE ENABLED") - } -Index: HadesAPI/router.go -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>package main\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/Mtze/HadesCI/shared/payload\"\n\t\"github.com/gin-gonic/gin\"\n\tlog \"github.com/sirupsen/logrus\"\n)\n\nfunc ping(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"message\": \"pong\",\n\t})\n}\n\nfunc AddBuildToQueue(c *gin.Context) {\n\tvar payload payload.BuildJob\n\tif err := c.ShouldBind(&payload); err != nil {\n\t\tlog.WithError(err).Error(\"Failed to bind JSON\")\n\t\tc.String(http.StatusBadRequest, \"Failed to bind JSON\")\n\t\treturn\n\t}\n\n\tlog.Debug(\"Received build request \", payload)\n\tBuildQueue.Enqueue(c.Request.Context(), payload)\n}\n -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/HadesAPI/router.go b/HadesAPI/router.go ---- a/HadesAPI/router.go (revision 946342fbe2228c33307360c6d6ef71ea2d41f7bc) -+++ b/HadesAPI/router.go (date 1695409516381) -@@ -1,11 +1,10 @@ - package main - - import ( -- "net/http" -- - "github.com/Mtze/HadesCI/shared/payload" - "github.com/gin-gonic/gin" - log "github.com/sirupsen/logrus" -+ "net/http" - ) - - func ping(c *gin.Context) { -Index: docker/rabbitmq.yml -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>version: '3.7'\nservices:\n rabbitmq:\n image: rabbitmq:3-management\n container_name: rabbitmq\n ports:\n - 5672:5672\n - 15672:15672\n volumes:\n - rabbitmq_data:/var/lib/rabbitmq\n environment:\n RABBITMQ_DEFAULT_USER: admin\n RABBITMQ_DEFAULT_PASS: admin\n\nvolumes:\n rabbitmq_data: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/docker/rabbitmq.yml b/docker/rabbitmq.yml ---- a/docker/rabbitmq.yml (revision 946342fbe2228c33307360c6d6ef71ea2d41f7bc) -+++ b/docker/rabbitmq.yml (date 1695407522498) -@@ -4,8 +4,8 @@ - image: rabbitmq:3-management - container_name: rabbitmq - ports: -- - 5672:5672 -- - 15672:15672 -+ - "5672:5672" -+ - "15672:15672" - volumes: - - rabbitmq_data:/var/lib/rabbitmq - environment: diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 007fb87..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - { - "customColor": "", - "associatedIndex": 6 -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - \ No newline at end of file