Comments (12)
@neugeeug thanks for bringing up this topic. This would be a very useful feature, I was just looking for something similar right now!
from amazon-ecs-render-task-definition.
@neugeeug thanks for bringing up this topic. This would be a very useful feature, I was just looking for something similar right now!
Thank you for the comment @faraquet.
I took a look to the code. Despite the fact that I am not a JS ninja, the change seems to be quite simple in the shape I proposed above. I am waiting for a green light from the owners side and can prepare the PR just when I get it :)
from amazon-ecs-render-task-definition.
@neugeeug thanks very much for the suggestion and PR! We've seen similar requests re: interpolating stage/env specific-values into a task definition before, but so far haven't landed on a choice re: implementation.
The linked approach (merging a task def 'fragment') strikes me as more extensible b/c you can apply a whole set of changes at once vs. a specific value. I understand the use cases may be somewhat different (to merge a JSON 'fragment' you need to have or add the JSON in a file, where for a single value creating a JSON string is more overhead), but I could be missing something. What do you think about a more general "merge" capability?
from amazon-ecs-render-task-definition.
@allisaurus thank you for the comment. I took a look to the linked approach and I agree, the more general solution might be good, but in my simple scenario will not solve the problem. I need to replace one value in the task definition and I know the new value only when the workflow is being executed (it is calculated during the build process). As you wrote, I would probably have to generate a JSON file first during the build process in order to be able to use it later in the proposed way. My idea was to keep it simple. I also see the constraints that @clareliguori mentioned regarding the input data types. There is not possible to define a kind of input map where you could define several different placeholders and values, but as a workaround you could use piping and call several time the same action. Each will replace another placeholder... I know it is not very elegant but seems to be simple.
I would like to mention that we are able to accept any solution that solves the problem in ASAP mode because a deadline is approaching. Would be really pity to eliminate the Github Actions because of lack of this functionality. Thank you again for your help. I hope we are able to find a right solution together.
from amazon-ecs-render-task-definition.
@neugeeug Re: getting quickly unblocked, would it be possible for you to use a basic envsubst action in addition to this one in your workflow? There are a few available, but taking a look at an example I think you could do something like the following:
...
- name: Render Amazon ECS task definition
id: render-task-definition
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: abc
container-name: abc
image: abc
- name: Render version env var
uses: nowactions/envsubst@v1
with:
input: ${{ steps.render-task-definition.outputs.task-definition }}
output: ./task-def-final.json
env:
VERSION: ${{ steps.version.outputs.prop }}
- name: Deploy to Amazon ECS service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ./task-def-final.json
service: my-service
cluster: my-cluster
...
from amazon-ecs-render-task-definition.
@neugeeug are you still experiencing this issue?
from amazon-ecs-render-task-definition.
@pkandasamy91 thank you for asking. I had to to switch for a while to another areas, and I have not had a time to test the solution proposed by @allisaurus. Fortunately I am going to switch back to the issue this week. I will let you know soon.
from amazon-ecs-render-task-definition.
@neugeeug No worries, please let us know if the proposed solution does not work for you.
from amazon-ecs-render-task-definition.
I've finally found a time to test the proposed solution and it seems that I am able to achieve the goal defined above in a simpler way, even without the render-task-definition action. It was not possible to use the action you proposed in a simple way because it is a Docker based action, and it is not so easy to pass the rendered task definition to the docker container (a copy action would be needed in order to transfer the file to place where Docker can see it)
/entrypoint.sh: line 3: can't open /home/runner/work/_temp/task-definition--2985-91iQ5SbzGlIT-.json: no such file
Anyway it inspired me a bit and the final solution looks like below:
- name: Replace version in ECS task definition
run: |
export VERSION=${{steps.version.outputs.prop}} && envsubst < "task-definition-template.json" > "task-definition-result.json"
- name: Deploy to Amazon ECS
timeout-minutes: 15
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ./task-definition-result.json
service: my-service
cluster: my-cluster
Thanks for help all of you @allisaurus @pkandasamy91
from amazon-ecs-render-task-definition.
Thanks for the additional info @neugeeug ! Very glad you got unblocked.
Since you no longer need it, and given our conversation above, can we close #54 ?
from amazon-ecs-render-task-definition.
can we close #54 ?
I did it already.
Thanks.
from amazon-ecs-render-task-definition.
Closing in favour of #20
from amazon-ecs-render-task-definition.
Related Issues (20)
- Error: Cannot read property 'containerDefinitions' of null
- Error: Invalid task definition format: containerDefinitions section is not present or is not an array HOT 2
- Github is deprecating the use of node12 on all actions. HOT 5
- set-output command is deprecated HOT 6
- Add ability to set env vars from file or from AWS AppConfig
- dynamic image change HOT 1
- The `set-output` command is deprecated HOT 4
- Render for more than one container HOT 3
- Q: Error: Invalid task definition: Could not find container definition with matching name HOT 14
- How to create a new revision for an existing task definition? HOT 2
- Unable to use multi-line environment variables HOT 3
- Bug: Invalid task definition: Could not find container definition with matching name HOT 2
- current status HOT 3
- how to update the awslogs-group? HOT 1
- new dist creation workflow (package) failing
- ephemeralStorage value is not copied over
- Adding support for `dockerLabels` in task HOT 1
- How to pass environment variable file to the action? HOT 2
- dockers-labels not working HOT 4
- Node16 deprecation warning HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-ecs-render-task-definition.