added oc monitor cwd to conf for better handling of filesé

This commit is contained in:
pb
2024-08-13 17:19:25 +02:00
parent edf82c595f
commit 99bdc1b784
3 changed files with 19 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ package workflow_builder
import (
"fmt"
"oc-monitor/conf"
"oc-monitor/logger"
. "oc-monitor/models"
"os"
@@ -40,7 +41,7 @@ type Spec struct {
}
func (b *ArgoBuilder) CreateDAG() (string, error) {
b.createTemplates()
b.createDAGstep()
b.createVolumes()
@@ -60,7 +61,7 @@ func (b *ArgoBuilder) CreateDAG() (string, error) {
// Give a unique name to each argo file with its timestamp DD:MM:YYYY_hhmmss
current_timestamp := time.Now().Format("02_01_2006_150405")
file_name := random_name + "_" + current_timestamp + ".yml"
workflows_dir := "argo_workflows/"
workflows_dir := conf.GetConfig().MonitorDir+"/argo_workflows/"
err = os.WriteFile(workflows_dir+file_name, []byte(yamlified), 0660)
if err != nil {
logger.Logger.Error().Msg("Could not write the yaml file")