@@ -13,7 +13,7 @@ import (
1313var sessionInstance * ecs.Client
1414var sessionConfig aws.Config // Variable for session configuration
1515
16- // InitAWS initializes a new AWS session with the specified profile
16+ // InitAWS initializes a new AWS session with the specified profile for Ecsta realization
1717func InitAWS (profile string ) error {
1818 if sessionInstance == nil {
1919 cfg , err := config .LoadDefaultConfig (context .TODO (),
@@ -45,11 +45,9 @@ func ExecFargate(profile, cluster, service, containerName, command string) error
4545 configPath := "/app/.ssm-parent.yaml"
4646 fullCommand := fmt .Sprintf ("%s -c %s run -- %s" , entrypoint , configPath , command )
4747 execOpt := ecsta.ExecOption {
48- Service : aws .String (service ),
49- Container : containerName ,
5048 Command : fullCommand ,
5149 }
52-
50+ fmt . Println ( execOpt )
5351 if err := ecstaApp .RunExec (context .Background (), & execOpt ); err != nil {
5452 return fmt .Errorf ("failed to execute command: %w" , err )
5553 }
@@ -58,18 +56,4 @@ func ExecFargate(profile, cluster, service, containerName, command string) error
5856 return nil
5957}
6058
61- // FindLatestTaskArn locates the most recent task ARN for a specified ECS service
62- func FindLatestTaskArn (client * ecs.Client , clusterName , serviceName string ) (string , error ) {
63- resp , err := client .ListTasks (context .TODO (), & ecs.ListTasksInput {
64- Cluster : aws .String (clusterName ),
65- ServiceName : aws .String (serviceName ),
66- })
67- if err != nil {
68- return "" , fmt .Errorf ("error listing tasks: %w" , err )
69- }
70- if len (resp .TaskArns ) == 0 {
71- return "" , fmt .Errorf ("no tasks found for service %s on cluster %s" , serviceName , clusterName )
72- }
7359
74- return resp .TaskArns [0 ], nil
75- }
0 commit comments