private void GetEcsDeployActionResources(PipelineActionEcsDeployOptions actionEcsDeployOptions, IDictionary <string, Artifact_> artifacts, out IBaseService service, out Artifact_ artifact, out IRole role) { service = AwsCdkHandler.LocateEcsServiceByAttrs(actionEcsDeployOptions.Name, new Ec2ServiceAttributes { Cluster = LocateEcsCluster(actionEcsDeployOptions.ClusterId, $"The cluster with {actionEcsDeployOptions.ClusterId} name does not exists", $"The EcsService with {actionEcsDeployOptions.ClusterId} must hace a cluster"), ServiceName = actionEcsDeployOptions.ServiceName }); // Locate artifact if (string.IsNullOrWhiteSpace(actionEcsDeployOptions.InputArtifact)) { throw new ArgumentException($"There is no input artifact in the pipeline action {actionEcsDeployOptions.Name}"); } else { if (!artifacts.TryGetValue(actionEcsDeployOptions.InputArtifact, out artifact)) { throw new ArgumentException($"The artifact {actionEcsDeployOptions.InputArtifact} of the pipeline action {actionEcsDeployOptions.Name} was not found"); } } // Locate role role = LocateRole(actionEcsDeployOptions.Role, $"The role {actionEcsDeployOptions.Role} of the pipeline action {actionEcsDeployOptions.Name} was not found"); }
private void CreateEcsDeployAction(IStage stage, IDictionary <string, Artifact_> artifacts, PipelineActionEcsDeployOptions actionEcsDeployOptions) { GetEcsDeployActionResources(actionEcsDeployOptions, artifacts, out var service, out var artifact, out var role); AwsCdkHandler.CreateEcsDeployActionInStage(stage, actionEcsDeployOptions.Name, service, actionEcsDeployOptions.DeploymentTimeoutMinutes, artifact, role); }