minor fixes

This commit is contained in:
pb 2024-07-02 12:24:23 +02:00
parent ab9f1359a0
commit eab5162389
3 changed files with 14 additions and 6 deletions

3
.gitignore vendored
View File

@ -22,3 +22,6 @@
go.work go.work
__debug_bin __debug_bin
workflows_argo/
*.xml

View File

@ -9,6 +9,7 @@ import (
"os" "os"
"slices" "slices"
"strings" "strings"
"time"
"github.com/beego/beego/v2/core/logs" "github.com/beego/beego/v2/core/logs"
"github.com/nwtgck/go-fakelish" "github.com/nwtgck/go-fakelish"
@ -47,7 +48,8 @@ func (b *ArgoBuilder) CreateDAG() bool {
b.Workflow.ApiVersion = "argoproj.io/v1alpha1" b.Workflow.ApiVersion = "argoproj.io/v1alpha1"
b.Workflow.Kind = "Workflow" b.Workflow.Kind = "Workflow"
b.Workflow.Metadata.GenerateName = "oc-test-" + generateWfName() random_name := generateWfName()
b.Workflow.Metadata.GenerateName = "oc-test-" + random_name
yamlified, err := yaml.Marshal(b.Workflow) yamlified, err := yaml.Marshal(b.Workflow)
@ -56,11 +58,17 @@ func (b *ArgoBuilder) CreateDAG() bool {
return false return false
} }
err = os.WriteFile("argo.yml", []byte(yamlified), 0660) // 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 := "workflows_argo/"
err = os.WriteFile(workflows_dir + file_name , []byte(yamlified), 0660)
if err != nil { if err != nil {
logs.Error("Could not write the yaml file") logs.Error("Could not write the yaml file")
return false return false
} }
fmt.Println("Created " + file_name)
return true return true
} }

View File

@ -13,10 +13,7 @@ import (
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
) )
type Link struct {
Src string
Dst string
}
type Graph struct { type Graph struct {
Datas []models.DataModel Datas []models.DataModel