minor fixes
This commit is contained in:
parent
ab9f1359a0
commit
eab5162389
3
.gitignore
vendored
3
.gitignore
vendored
@ -22,3 +22,6 @@
|
||||
go.work
|
||||
|
||||
__debug_bin
|
||||
|
||||
workflows_argo/
|
||||
*.xml
|
@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
"github.com/nwtgck/go-fakelish"
|
||||
@ -47,7 +48,8 @@ func (b *ArgoBuilder) CreateDAG() bool {
|
||||
|
||||
b.Workflow.ApiVersion = "argoproj.io/v1alpha1"
|
||||
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)
|
||||
|
||||
@ -56,11 +58,17 @@ func (b *ArgoBuilder) CreateDAG() bool {
|
||||
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 {
|
||||
logs.Error("Could not write the yaml file")
|
||||
return false
|
||||
}
|
||||
|
||||
fmt.Println("Created " + file_name)
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user