fixing package import
This commit is contained in:
parent
2343a5329e
commit
2932fb2710
2
go.mod
2
go.mod
@ -20,6 +20,7 @@ require (
|
|||||||
github.com/golang/protobuf v1.5.4 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||||
|
github.com/ugorji/go/codec v1.1.7 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
|
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
|
||||||
@ -70,7 +71,6 @@ require (
|
|||||||
github.com/robfig/cron v1.2.0 // indirect
|
github.com/robfig/cron v1.2.0 // indirect
|
||||||
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
|
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
|
||||||
github.com/smartystreets/goconvey v1.6.4 // indirect
|
github.com/smartystreets/goconvey v1.6.4 // indirect
|
||||||
github.com/ugorji/go/codec v1.1.7 // indirect
|
|
||||||
github.com/x448/float16 v0.8.4 // indirect
|
github.com/x448/float16 v0.8.4 // indirect
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||||
github.com/xdg-go/scram v1.1.2 // indirect
|
github.com/xdg-go/scram v1.1.2 // indirect
|
||||||
|
@ -54,12 +54,6 @@ func (s *AdmiraltySetter) InitializeAdmiralty(localPeerID string,remotePeerID st
|
|||||||
tools.ADMIRALTY_NODES: {
|
tools.ADMIRALTY_NODES: {
|
||||||
tools.GET:"/:id",
|
tools.GET:"/:id",
|
||||||
},
|
},
|
||||||
tools.ADMIRALTY_TARGET: {
|
|
||||||
tools.POST:"/:id",
|
|
||||||
},
|
|
||||||
tools.ADMIRALTY_NODES: {
|
|
||||||
tools.GET:"/:id",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9,14 +9,18 @@ import (
|
|||||||
"oc-monitord/conf"
|
"oc-monitord/conf"
|
||||||
. "oc-monitord/models"
|
. "oc-monitord/models"
|
||||||
tools2 "oc-monitord/tools"
|
tools2 "oc-monitord/tools"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
oclib "cloud.o-forge.io/core/oc-lib"
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
"cloud.o-forge.io/core/oc-lib/logs"
|
"cloud.o-forge.io/core/oc-lib/logs"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/common/enum"
|
"cloud.o-forge.io/core/oc-lib/models/common/enum"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||||
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||||
|
"github.com/nwtgck/go-fakelish"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var logger zerolog.Logger
|
var logger zerolog.Logger
|
||||||
@ -423,8 +427,38 @@ func (b *ArgoBuilder) CompleteBuild(executionsId string) (string, error) {
|
|||||||
// Setup admiralty for each node
|
// Setup admiralty for each node
|
||||||
for _, peer := range b.RemotePeers {
|
for _, peer := range b.RemotePeers {
|
||||||
fmt.Println("DEV :: Launching Admiralty Setup for ", peer)
|
fmt.Println("DEV :: Launching Admiralty Setup for ", peer)
|
||||||
setter := AdmiraltySetter{Id: executionsId}
|
setter.InitializeAdmiralty(conf.GetConfig().PeerID,peer)
|
||||||
setter.InitializeAdmiralty(conf.GetConfig().PeerID, peer)
|
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
|
// Update the name of the admiralty node to use
|
||||||
|
for _, template := range b.Workflow.Spec.Templates {
|
||||||
|
if len(template.Metadata.Annotations) > 0 {
|
||||||
|
if resp, ok := template.Metadata.Annotations["multicluster.admiralty.io/clustername"]; ok {
|
||||||
|
fmt.Println(resp)
|
||||||
|
template.Metadata.Annotations["multicluster.admiralty.io/clustername"] = "target-" + conf.GetConfig().ExecutionID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the YAML file
|
||||||
|
random_name := fakelish.GenerateFakeWord(5, 8) + "-" + fakelish.GenerateFakeWord(5, 8)
|
||||||
|
b.Workflow.Metadata.Name = "oc-monitor-" + random_name
|
||||||
|
logger = oclib.GetLogger()
|
||||||
|
yamlified, err := yaml.Marshal(b.Workflow)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Could not transform object to yaml file")
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
// 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/"
|
||||||
|
err = os.WriteFile(workflows_dir+file_name, []byte(yamlified), 0660)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Could not write the yaml file")
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return workflows_dir + file_name, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user