Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Conversation

@gmann42
Copy link
Contributor

@gmann42 gmann42 commented Sep 25, 2023

Why ?

What

  • Removes interactiveness from ECS cli
    New Usage
POSTMAN_API_KEY=<postman-api-key> postman-lc-agent ecs add \
--collection <postman-collectionID> \
--region <aws-region> \
--cluster <full ARN of ECS cluster> \
--service <full ARN of ECS service>
  • Deletes un-used code listECSClusters, listTasks, ListServices etc.
  • Adds README.md for usage.

How

  • User inputs aws region, full ARN of cluster and service
  • Load profile AWS credentials
  • DescribeCluster to verify existence and get cluster name
  • DescribeService to verify existence and get TaskDefinitonARN
  • TaskDefinitonARN fetched is then used to describeTask
  • modifyTask use RegisterTask to create a new definition with postman-lc-agent container as the side car
  • updateService udpates the ECS service with new task definition

Ticket link: https://postmanlabs.atlassian.net/browse/OBS-393

@gmann42 gmann42 requested a review from mgritter September 25, 2023 12:17

wf.ecsService = aws.ToString(service.ServiceName)
wf.ecsServiceARN = arn(ecsServiceFlag)
wf.ecsTaskDefinitionARN = arn(*service.TaskDefinition)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dereference without checking nil, what if there is no task registered yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A service can not be created without a task, we are fetching the service from AWS and using it's output to pick the taskARN

Comment on lines 671 to 320
}
printer.Infof("Create a new version %d of task definition %q which includes the Postman Live Collections Agent as a sidecar.\n",
printer.Infof("Create a new version of task definition %q which includes the Postman Live Collections Agent as a sidecar.\n",
wf.ecsTaskDefinition.Revision+1, wf.ecsTaskDefinitionFamily)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed %d but kept it in the parameter list. We should specify the version number if it is still possible to do so.

Copy link
Contributor Author

@gmann42 gmann42 Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS auto-increments the revision numbers, we can't just do current + 1.

Revisions    Status
1                    Active
2                    Active
3                   Deployed in service
4                   Active
5                   Inactive(or even deleted aws remembers the highest count always)

New task definition revision will be 6, +1 would show incorrect value of 4.
For my testing i had deleted or marked inactive bunch of times, it always remembers the last highest + 1.
So this is not reliable without some sort of hack

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, good point. Do we show the revision number of our modified task anywhere in our output?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants