Skip to content

Commit

Permalink
add enforce comment length
Browse files Browse the repository at this point in the history
  • Loading branch information
okankoAMZ committed Sep 21, 2023
1 parent b084443 commit 4f552a4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packaging/uniformBuild/aws_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,13 @@ func StopInstanceCmd(client *ec2.Client, instanceID string) error {
fmt.Println("Stopped instance with ID " + instanceID)
return nil
}

func enforceCommentLimit(s string) string {
const commentCharLimit = 100
if len(s) > commentCharLimit {
return s[:commentCharLimit]
}
return s
}
func RunCmdRemotely(ssmClient *ssm.Client, instance *types.Instance, command string, comment string) error {
// Specify the input for sending the command
timeout := int32(COMMAND_TRACKING_TIMEOUT.Seconds())
Expand All @@ -281,7 +287,7 @@ func RunCmdRemotely(ssmClient *ssm.Client, instance *types.Instance, command str
OutputS3KeyPrefix: aws.String("buildenvtesting/logs/"),
TimeoutSeconds: aws.Int32(timeout),

Comment: aws.String(comment),
Comment: aws.String(enforceCommentLimit(comment)),
}
// Run the script on the instance
fmt.Println("Command sent!")
Expand Down

0 comments on commit 4f552a4

Please sign in to comment.