removed the returned value from the callRemoteExecution method, all the resp handling is done inside it
This commit is contained in:
		| @@ -265,14 +265,49 @@ func (b *ArgoBuilder) addS3annotations(art *Artifact, template *Template, rw gra | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| func (b *ArgoBuilder) addAuthInformation(storage *resources.StorageResource, namespace string, art *Artifact) { | ||||
| 	 | ||||
| 	sel := storage.GetSelectedInstance() | ||||
| 	 | ||||
| 	tool, err := tools2.NewService(conf.GetConfig().Mode) | ||||
| 	if err != nil || tool == nil { | ||||
| 		logger.Fatal().Msg("Could not create the access secret :" + err.Error()) | ||||
| 		}  | ||||
| 		 | ||||
| 		secretName, err := b.SetupS3Credentials(storage, namespace, tool) 			// this method return should be updated once we have decided how to retrieve credentials   | ||||
| 		 | ||||
| 		if err == nil { | ||||
| 			art.S3.AccessKeySecret = &Secret{ | ||||
| 				Name: secretName, | ||||
| 				Key:  "access-key", | ||||
| 			} | ||||
| 			art.S3.SecretKeySecret = &Secret{ | ||||
| 				Name: secretName, | ||||
| 				Key:  "secret-key", | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source+"/", "") | ||||
| 	art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source, "") | ||||
| 	splits := strings.Split(art.S3.EndPoint, "/") | ||||
| 	if len(splits) > 1 { | ||||
| 		art.S3.Bucket = splits[0] | ||||
| 		art.S3.EndPoint = strings.Join(splits[1:], "/") | ||||
| 		} else { | ||||
| 			art.S3.Bucket = splits[0] | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (b *ArgoBuilder) SetupS3Credentials(storage *resources.StorageResource, namespace string, tool tools2.Tool) (string, error) { | ||||
| 	s := tool.GetS3Secret(storage.UUID, namespace) | ||||
| 	// var s *v1.Secret | ||||
|  | ||||
| 	accessKey, secretKey := retrieveMinioCredential("peer",namespace) | ||||
| 	 | ||||
| 	if s == nil { | ||||
| 		id, err := tool.CreateAccessSecret( | ||||
| 			"hF9wRGog75JuMdshWeEZ", | ||||
| 			"OwXXJkVQyb5l1aVPdOegKOtDJGoP1dJYeo8O7mDW", | ||||
| 			accessKey, | ||||
| 			secretKey, | ||||
| 			storage.UUID, | ||||
| 			namespace, | ||||
| 		) | ||||
| @@ -289,45 +324,15 @@ func (b *ArgoBuilder) SetupS3Credentials(storage *resources.StorageResource, nam | ||||
| 	 | ||||
| } | ||||
|  | ||||
| func (b *ArgoBuilder) addAuthInformation(storage *resources.StorageResource, namespace string, art *Artifact) { | ||||
| 	 | ||||
| 	sel := storage.GetSelectedInstance() | ||||
| 	 | ||||
| 	tool, err := tools2.NewService(conf.GetConfig().Mode) | ||||
| 	if err != nil || tool == nil { | ||||
| 		logger.Fatal().Msg("Could not create the access secret :" + err.Error()) | ||||
| 	}  | ||||
|  | ||||
| 	secretName, err := b.SetupS3Credentials(storage, namespace, tool) 			// this method return should be updated once we have decided how to retrieve credentials   | ||||
|  | ||||
| 	if err == nil { | ||||
| 		art.S3.AccessKeySecret = &Secret{ | ||||
| 			Name: secretName, | ||||
| 			Key:  "access-key", | ||||
| 		} | ||||
| 		art.S3.SecretKeySecret = &Secret{ | ||||
| 			Name: secretName, | ||||
| 			Key:  "secret-key", | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source+"/", "") | ||||
| 	art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source, "") | ||||
| 	splits := strings.Split(art.S3.EndPoint, "/") | ||||
| 	if len(splits) > 1 { | ||||
| 		art.S3.Bucket = splits[0] | ||||
| 		art.S3.EndPoint = strings.Join(splits[1:], "/") | ||||
| 	} else { | ||||
| 		art.S3.Bucket = splits[0] | ||||
| 	} | ||||
| // This method needs to evolve to an API call to the peer passed as a parameter | ||||
| func retrieveMinioCredential(peer string, namespace string) (string,string) { | ||||
| 	return "hF9wRGog75JuMdshWeEZ", "OwXXJkVQyb5l1aVPdOegKOtDJGoP1dJYeo8O7mDW" | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| func (b *ArgoBuilder) addTaskToArgo(dag *Dag, graphItemID string, processing *resources.ProcessingResource, | ||||
| 	firstItems []string, lastItems []string) (*Dag, []string, []string) { | ||||
| 	unique_name := getArgoName(processing.GetName(), graphItemID) | ||||
| 	step := Task{Name: unique_name, Template: unique_name} | ||||
| 		unique_name := getArgoName(processing.GetName(), graphItemID) | ||||
| 		step := Task{Name: unique_name, Template: unique_name} | ||||
| 	instance := processing.GetSelectedInstance() | ||||
| 	if instance != nil { | ||||
| 		for _, value := range instance.(*resources.ProcessingInstance).Env { | ||||
| @@ -485,21 +490,21 @@ func (b *ArgoBuilder) retrieveProcessingCompute(graphID string) *resources.Compu | ||||
| // Execute the last actions once the YAML file for the Argo Workflow is created | ||||
| func (b *ArgoBuilder) CompleteBuild(executionsId string) (string, error) { | ||||
| 	logger.Info().Msg(fmt.Sprint("DEV :: Completing build")) | ||||
| 	setter := AdmiraltySetter{Id: executionsId} | ||||
| 	// Setup admiralty for each node | ||||
| 	for _, peer := range b.RemotePeers { | ||||
| 		logger.Info().Msg(fmt.Sprint("DEV :: Launching Admiralty Setup for ", peer)) | ||||
| 		setter.InitializeAdmiralty(conf.GetConfig().PeerID,peer) | ||||
| 	} | ||||
| 	// setter := AdmiraltySetter{Id: executionsId} | ||||
| 	// // Setup admiralty for each node | ||||
| 	// for _, peer := range b.RemotePeers { | ||||
| 	// 	logger.Info().Msg(fmt.Sprint("DEV :: Launching Admiralty Setup for ", peer)) | ||||
| 	// 	setter.InitializeAdmiralty(conf.GetConfig().PeerID,peer) | ||||
| 	// } | ||||
|  | ||||
| 	// Update the name of the admiralty node to use  | ||||
| 	for _, template := range b.Workflow.Spec.Templates { | ||||
| 		if len(template.Metadata.Annotations) > 0 { | ||||
| 			if peerId, ok := template.Metadata.Annotations["multicluster.admiralty.io/clustername"]; ok { | ||||
| 				template.Metadata.Annotations["multicluster.admiralty.io/clustername"] = "target-" + peerId + "-" + conf.GetConfig().ExecutionID | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	// // Update the name of the admiralty node to use  | ||||
| 	// for _, template := range b.Workflow.Spec.Templates { | ||||
| 	// 	if len(template.Metadata.Annotations) > 0 { | ||||
| 	// 		if peerId, ok := template.Metadata.Annotations["multicluster.admiralty.io/clustername"]; ok { | ||||
| 	// 			template.Metadata.Annotations["multicluster.admiralty.io/clustername"] = "target-" + peerId + "-" + conf.GetConfig().ExecutionID | ||||
| 	// 		} | ||||
| 	// 	} | ||||
| 	// } | ||||
|  | ||||
| 	// Generate the YAML file | ||||
| 	random_name := fakelish.GenerateFakeWord(5, 8) + "-" + fakelish.GenerateFakeWord(5, 8) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user