-
Notifications
You must be signed in to change notification settings - Fork 249
feat: add ad-hoc task runs #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4ca14cb
to
9a8a47a
Compare
Thanks @inhumantsar! I've been running this in a fork for a couple of weeks, works reliably, has been very handy for running DB migrations as part of an ECS deployment flow. Would be great to see it merged to make it generally available. |
@clareliguori @mattsb42-aws sorry for the ping, just hoping to get a review on this. |
We would also very much like this feature. We've been using the amazon-ecs-deploy-task-definition action for quite a while and this will enable us to run one time tasks. |
@duggan @anitakrueger FYI you can use this PR prior to merge. See the updated PR description |
When I create a once-off task, the ENI is being created without a public IP address. It's the same as not ticking the Public IP address box on the AWS Console when running a task. This is preventing the task from fetching keys from the secrets manager. Is it possible to specify that an IP must be created? |
Would it be possible to adjust this so that the task definition isn't implicitly created / updated? This feature would help my team but we are managing our task defs / services via terraform and already have an ARN we could pass in. |
ab77eed
to
23acd87
Compare
|
||
const waitForTask = core.getInput('wait-for-task-stopped', { required: false }) || 'false'; | ||
const startedBy = core.getInput('run-task-started-by', { required: false }) || 'GitHub-Actions'; | ||
const launchType = core.getInput('run-task-launch-type', { required: false }) || 'FARGATE'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For users with a capacity provider, the launchType
param is supposed to be omitted. The implicit default of FARGATE
here would prevent that.
Any progress on this @inhumantsar? I really think this would be a valuable addition to the action. |
I wouldn't count on this PR being merged anytime soon. No one from AWS seems interested in even looking at it. Even after escalating it to our TAM. If I'm being totally honest, the scheduled and ad-hoc task operations seem like they haven't had any love from the ECS team in general, so I'm not optimistic about this execution model's future. I've been recommending that our devs leverage Lambda or Lambda+EC2 for anything like this going forward. Edit: FWIW, we've been running this fork in production for a year now without issue. |
@inhumantsar thanks for your work on this in any case. Quite frustrating that the AWS team won't support this package, as it's a very common use case. |
We ended up using the AWS CLI to run one-off commands after deployments from our pipeline. Then one can simply run a command as such: aws ecs execute-command --cluster CLUSTER_NAME --task ${{ steps.ecs_task_id.outputs.TASK_ID }} --container CONTAINER_NAME --interactive --command "uname -a" It is not as clean as I'd like, but it gets the job done in our case. |
Hi @inhumantsar, Thank you for your contribution, apologies on the delay. We will be working to review the changes in the Pull Request. In the meantime please ensure that below steps, if not already completed, are taken care of in your Pull Request:
|
index.test.js
Outdated
|
||
mockRunTask.mockImplementation(() => { | ||
return { | ||
promise() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mock needs to be updated as the action is now using JS SDK v3
Refer: #529
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provided diff for transforming JS SDK v2 APIs to v3.
Refs: #529
thanks @trivikr! i'll commit these and rebase later today |
Co-authored-by: Trivikram Kamat <[email protected]>
5384e81
to
8d80e1c
Compare
alright, i've dealt with the conflicts and updated the tests. should be good to go. @amazreech |
🎉 thanks! |
Issue #, if available: #54
Description of changes: This adds the ability to run tasks outside of a service, either standalone or as an init task.
This borrows a lot from #273 but offers a slightly cleaner interface and isn't dependent on a service.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
EDIT: In case you're seeing this and want to use it, you can pull it directly from the PR in your GitHub Actions workflow (see below). We've been using it in production for months now and I'm happy to keep supporting it.