Coder Social home page Coder Social logo

amazon-ecs-render-task-definition's People

Contributors

alexndlm avatar amazreech avatar andrewlazenka avatar bmbferreira avatar bpyser avatar clareliguori avatar dannyrandall avatar dependabot-preview[bot] avatar dependabot[bot] avatar ecs-github-actions-cicd-bot avatar jamesiri avatar johnseekins-pathccm avatar kollaadithya avatar lou1415926 avatar michaelkimball avatar misterio77 avatar paragbhingre avatar piradeepk avatar sapekshm avatar sombriks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-ecs-render-task-definition's Issues

Error: Cannot read property 'containerDefinitions' of null

Hi there!

I´ve been running into that error in the title recently. I can´t figure out the source of that, already checked the task definition at ECS and everything else is working fine, yet I can´t finish the build...

Thank you for the help in advance.

Best reggards.

“Error: Task definition file does not exist: ” when deploying Docker images to AWS ECS

I am trying to push docker images from GitHub Actions to AWS ECR then to ECS with a task to deploy the latest container in AWS ECS.

I am using the default aws.config file with changes only for AWS ECR repository name, AWS ECS cluster name and it's service name and docker image details to push docker images to AWS ECR to which could then to deployed as containers to AWS ECS by defining tasks. And I got an error message with defining tasks to deploy to ECS(in the section "Fill in the new image ID in the Amazon ECS task definition" in aws.yml) and it is:

Error: Task definition file does not exist: ecs-task-definition.json

Some information to prove everything is in place(presumably):
Here's me checking the existence of file and pushing the task from my terminal to AWS ECS:
enter image description here

And here's that very task definition with the revision number and task's family name shown in screenshot above:
enter image description here

So, as you can see task-definition file does exist, but GitHub doesn't recognise it. What has caused this error and how do I fix this?

Here's the complete build screenshot:
enter image description here

and this is the error:
enter image description here

And here's the part of my ".github/workflows/aws.yml" in my repo for task definition (file can be found here in my repository)

    - name: Fill in the new image ID in the Amazon ECS task definition
      id: task-def
      uses: aws-actions/amazon-ecs-render-task-definition@v1
      with:
        task-definition: ecs-task-definition.json
        container-name: aws-dock-p-cont
        image: ${{ steps.build-image.outputs.image }}

Images are being pushed to my ECR repository without any problems, but the problem comes right before executing tasks to use those images and deploy as containers.

EDIT:
Here's the cluster I have used in aws.yml file:
enter image description here
Here's the role I have specified in the task json file:
enter image description here

I have done as described in this article.

Unexpected token ':'

I'm getting an error when I get to this section?

Run 97587c9
with:
task-definition: ecs-task-def-dev
container-name: dango-github-actions-dev
image: ***.dkr.ecr.us-east-2.amazonaws.com/django-github-actions-dev:bea5a7b64651a11221551d8a7fbcbe8d4ba9d4ed
env:
AWS_REGION: us-east-2
ECR_REPOSITORY: django-github-actions-dev
ECS_SERVICE: django-github-actions-dev-service
ECS_CLUSTER: django-github-actions-dev
ECS_TASK_DEFINITION: ecs-task-def-dev
CONTAINER_NAME: dango-github-actions-dev
DJANGO_ALLOWED_HOSTS: localhost 127.0.0.1
SECRET_KEY: foo
AWS_DEFAULT_REGION: us-east-2
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
Error: Unexpected token ':'

Error: Invalid task definition format: containerDefinitions section is not present or is not an array

Hey there,

I've been trying to get this GitHub action to work but have been running into issues. I've been programmatically been trying to retrieve the task definition using this command:
aws ecs describe-task-definition --task-definition ${{ env.ECS_TASK_DEFINITION }} > ecs/node/task_definition.json

Then using it for this action. But for some reason, it just isn't liking the containerDefinitions, which are returned in the JSON. I've verified the command does return correctly.

Here is our GitHub actions yaml:

steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: eu-west-1
      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1
      - name: Build and push
        uses: docker/build-push-action@v3
        with:
          push: true
          tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.REPO_NAME }}-${{ env.ENVIRONMENT }}:${{ github.sha }}
          build-args: |
            COMMIT=${{ github.sha }}
            BRANCH=${{ github.ref_name }}
          cache-from: type=gha
          cache-to: type=gha,mode=max
      - name: Send image version to SSM
        run: aws ssm put-parameter --name ${{ env.REPO_NAME }}-version-${{ env.ENVIRONMENT }} --value ${{ github.sha }} --overwrite
      - run: mkdir -p ecs/node
      - run: aws ecs describe-task-definition --task-definition ${{ env.ECS_TASK_DEFINITION }} > ecs/node/task_definition.json
      - uses: actions/upload-artifact@v3
        with:
          name: task-definition
          path: ecs/node/task_definition.json
      - uses: actions/download-artifact@v3
        with:
          name: task-definition
      - name: Display structure of downloaded files
        run: ls -R && cat ecs/node/task_definition.json # The file is present here <--------------
      - name: Fill in the new image ID in the Amazon ECS task definition
        id: task-def
        uses: aws-actions/amazon-ecs-render-task-definition@97587c9d45a4930bf0e3da8dd2feb2a463cf4a3a
        with:
          task-definition: ecs/node/task_definition.json # Issue arises here <--------------
          container-name: ${{ env.CONTAINER_NAME }}
          image: ${{ steps.login-ecr.outputs.registry }}/${{ env.REPO_NAME }}-${{ env.ENVIRONMENT }}:${{ github.sha }}
      - name: Deploy Amazon ECS task definition
        uses: aws-actions/amazon-ecs-deploy-task-definition@de0132cf8cdedb79975c6d42b77eb7ea193cf28e
        with:
          task-definition: ${{ steps.task-def.outputs.task-definition }}
          service: ${{ env.ECS_SERVICE }}
          cluster: ${{ env.ECS_CLUSTER }}
          wait-for-service-stability: true

I was hoping someone could direct me on what may be wrong here, or if I'm doing this incorrectly. I would ideally like to stick to dynamically generating the task definition using the AWS CLI, as it is our separate Terraform repo that spins up the ECS infrastructure, hence why I opted for AWS CLI to grab the task definition in order to use this action.

Changing other values, e.g. executionRoleArn

I wonder if there's a way for allowing this to update other values in the definition, e.g. executionRoleArn

The executionRoleArn includes the account ID, which may not be ideal to include in a public repo.

Add Ability to fetch the Task Definition Using AWS API for Node and Then Rendering it.

Currently this workflow expects to have the Task Definition Json to be part of the GitHub Repo.

If this action can be enhanced to fetch the task definition just by using family:revision provided to AWS.ECS. describeTaskDefinition API and then rendering it further , Then Users do not need to check in the task definition Json in the Repo.
Optionally - Updated task definition can be registered back using registerTaskDefinition API call with updated ECR Image ID.

This will achieve -

  1. Better user confidence to avoid checking in Spec file containing references to various AWS ARNs (Account Id ) etc.
  2. It will be guaranteed that Task Definition will always be correct / no need to validate its format specs etc.

ephemeralStorage value is not copied over

originally I have this on my task

"requiresAttributes": [
        {
            "name": "ecs.capability.extensible-ephemeral-storage"
        }, ...
],        
"ephemeralStorage": {
        "sizeInGiB": 50
},

However, after run this action, it's gone.

Validation errors in task-definition.json

Hi

I setup a simple test NodeJS project and try to use GitHub Actions to deploy ECR, ECS. The build and push to ECR step executed successfully. However, this action failed, i got these validations errors :

Run aws-actions/amazon-ecs-deploy-task-definition@v1
  with:
    task-definition: /home/runner/work/_temp/task-definition-3348qyZ6U3Tq2Is5.json
    service: xxx
    cluster: xxx
    wait-for-service-stability: true
  env:
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    AWS_DEFAULT_REGION: ap-southeast-2
    AWS_REGION: ap-southeast-2
##[error]There were 5 validation errors:
* UnexpectedParameter: Unexpected key 'compatibilities' found in params
* UnexpectedParameter: Unexpected key 'taskDefinitionArn' found in params
* UnexpectedParameter: Unexpected key 'requiresAttributes' found in params
* UnexpectedParameter: Unexpected key 'revision' found in params
* UnexpectedParameter: Unexpected key 'status' found in params

The content of task-definition.json is a direct copy-paste from AWS Console.

Is this because this action is not up to date or am I missing something here?

Many thanks,

Getting "unexpected key" github CI error while deploying aws ecs clusters

I am getting following error when i use it for deployment on github ci

`Warning: Ignoring property 'compatibilities' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'taskDefinitionArn' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'requiresAttributes' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'revision' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'status' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Error: Failed to register task definition in ECS: There were 2 validation errors:

  • UnexpectedParameter: Unexpected key 'registeredAt' found in params
  • UnexpectedParameter: Unexpected key 'registeredBy' found in params
    Error: There were 2 validation errors:
  • UnexpectedParameter: Unexpected key 'registeredAt' found in params
  • UnexpectedParameter: Unexpected key 'registeredBy' found in params`

environment-variables not working

The error:
Warning: Unexpected input(s) 'environment-variables', valid inputs are ['task-definition', 'container-name', 'image']

The definition:

- name: Fill in the new image ID in the Amazon ECS task definition
      id: task-def
      uses: aws-actions/amazon-ecs-render-task-definition@v1
      with:
        task-definition: ${{ env.ECS_TASK_DEFINITION }}
        container-name: ${{ env.CONTAINER_NAME }}
        image: ${{ steps.build-image.outputs.image }}
        environment-variables: |
          TEST=something

Feature Request: Modify CPU/Memory reservations

Would be great if you could pass in CPU/Memory reservations at the container level when rendering a new task definition.
This would support differing reservations based on environment (as most would resource Prod differently to dev/test for example).

An extra benefit would also be able to support modifying CPU/Memory reservations at the task level too.

BUG: RegisterTaskDefinition operation no longer accepts task-definitions without an `image`

When following the instructions for using this action here:
https://aws.amazon.com/blogs/opensource/github-actions-aws-fargate/

...I can no longer register the task definition because the image is filled in during the GitHub workflow after the image is built.

This must have changed recently because I implemented this workflow for a different project as recently as November.

task-definition.json

{
  "family": "web-task-staging",
  "networkMode": "awsvpc",
  "containerDefinitions": [
    {
      "name": "web-container-staging",
      "memory": 200,
      "cpu": 10,
      "essential": true,
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 80
        }
      ],
      ...

And the error:
An error occurred (ClientException) when calling the RegisterTaskDefinition operation: Container.image should not be null or empty.

dockers-labels not working

I was waiting for the PR #274 to be merged but it doesn't look like it's working.
"docker-labels" is not appearing as a valid input.
image

The documentation on the marketplace also differs for the action on default page and version selected page
On the default landing page the Readme has the docker-labels in the examples whereas when version is selected as version 1 which is the only available version the page doesn't has docker-labels example.
Ideally both should be same as version 1 is the latest and the only version.

Invalid Characters in Container.image

The following job fails every time (each service uses the same docker Image):

Deploy:
    runs-on: ubuntu-latest
    needs: [Build, Test]
    steps:
    - uses: actions/checkout@v2

    - name: Configure AWS Credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: eu-west-1

    - name: Login to Amazon ECR
      id: login-ecr
      uses: aws-actions/amazon-ecr-login@v1

    - name: Download task definitions
      run: |
        aws ecs describe-task-definition --task-definition service-a --query taskDefinition > service-a-task-definition.json
        aws ecs describe-task-definition --task-definition service-b --query taskDefinition > service-b-task-definition.json

    - name: Fill in the new image ID in the Amazon ECS task definition (service-a)
      env:
        ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
        ECR_REPOSITORY: service-a
        IMAGE_TAG: ${{ github.sha }}
      id: task-def-service-a
      uses: aws-actions/amazon-ecs-render-task-definition@v1
      with:
        task-definition: service-a-task-definition.json
        container-name: service-a
        image: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG    

    - name: Fill in the new image ID in the Amazon ECS task definition (service-b)
      id: task-def-service-b
      uses: aws-actions/amazon-ecs-render-task-definition@v1
      with:
        task-definition: service-b-task-definition.json
        container-name: service-a
        image: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

    - name: Deploy Amazon ECS task definition (service-a)
      uses: aws-actions/amazon-ecs-deploy-task-definition@v1
      with:
        task-definition: ${{ steps.task-def-service-a.outputs.task-definition }}
        service: service-a
        cluster: qa
        wait-for-service-stability: true

    - name: Deploy Amazon ECS task definition (service-b)
      uses: aws-actions/amazon-ecs-deploy-task-definition@v1
      with:
        task-definition: ${{ steps.task-def-service-b.outputs.task-definition }}
        service: service-b
        cluster: qa
        wait-for-service-stability: true

The error is:

Deploy Amazon ECS task definition (service-a)
##[error]Failed to register task definition in ECS: Container.image contains invalid characters.
##[error]Container.image contains invalid characters.

Github Actions obfuscates output so much that I can't tell what is written to the task definition. It's only when I go to re-write the image ID that we have failures...the docker image builds and is pulled for testing in previous jobs just fine.

This looks like a possible bug.

Github commit sha passed to task-definition.json

Hi,

I build and tag a docker image with the latest github commit sha (e.g. 2880ba75d205f0a57055d369968b5afbac984fa9).

After the build is complete, I push the image to my AWS ECR.

In my task-definition.json, I need to specify the image (in this case, this will be AWS ECR image URL that contains the github commit sha). However, I can't the commit sha in my task-definition.json.

Is there a way to get the commit sha passed from github action yaml to task-definition.json?

Cheers,
Justin

Node16 deprecation warning

Describe the bug
The GitHub Actions workflow is generating a deprecation warning due to the use of Node.js 16. GitHub Actions now requires the use of Node.js 20, as Node.js 16 actions have been deprecated.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the GitHub repository containing the workflow.
  2. Run the GitHub Actions workflow.
  3. Observe the deprecation warning in the workflow logs.
  4. The warning specifically mentions the use of Node.js 16 in aws-actions/amazon-ecs-render-task-definition@v1.

Expected behavior
The expected behavior is for the GitHub Actions workflow to run without any deprecation warnings. It should use the updated Node.js 20 environment for all actions.

Screenshots
Screenshot 2024-01-25 at 15 58 40

Desktop (please complete the following information):
OS Agnostic

Additional context
The deprecation of Node.js 16 actions is part of GitHub's ongoing maintenance and update of their Actions infrastructure. More information about this transition can be found at: GitHub Blog Changelog.

Render for more than one container

I think that a nice feature would be to allow to add more than one container in container-name input.
The purpose is that I have cases when I have more than one container inside my task definition. And I need these containers use the same image and same environment variables.

I saw in the README that you suggest using the action more than once to achieve this, but I need to do it in a more programatic way,.

Adding support for `dockerLabels` in task

ECS Fargate doesn't propagate labels as effectively as ECS on EC2, so being able to propagate labels down to containers using this action would be nice.

This has been attempted before with no real response: #138. Is it possible this could get done?

Dynamic task modification

In our use case, we need to modify some of our task definition parameters and use values that are known just during deployment. For example,
We need to provide to our component env variable VERSION:

{
   "environment": [
        {
          "name": "VERSION",
          "value": "7.0.1476"
        }
      ],
}

Some general mechanism for replacing placeholders with wanted value would be really helpful. For example we could define

{
    "environment": [
        {
          "name": "VERSION",
          "value": "#VERSION#"
        }
      ],
}

And pass there the correct value:

    - 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
        replacement_pattern: #VERSION#
        replacement_value: ${{steps.version.outputs.prop}}

The action would replace the replacement_pattern (regexp) with replacement_value.
Would be possible to add this or similar functionality ?

Github is deprecating the use of node12 on all actions.

Github will be deprecating the use of node12 on all Github Actions. The warning message as such:

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: aws-actions/amazon-ecs-render-task-definition

It seems, I can't find any updates on this repo for this issue. Other aws-actions are being updated and are at different stages.

Do you guys plan to update it?
Thanks

How replace the variables in the JSON file through the YML file?

Hi, task definition except to specifying ['task definition ',' container name ',' image '], what other valid inputs are available?

  • name: Render Amazon ECS task definition
    id: render-web-container
    uses: aws-actions/amazon-ecs-render-task-definition@v1
    with:
    task-definition: task-definition.json
    container-name: web
    image: amazon/amazon-ecs-sample:latest
    <"hostport ?">
    If I want to replace the variables in the JSON file through the YML file,
    for example: replacing "hostport" in JSON file in YML file
    "portMappings": [
    {
    "hostPort": 80,
    "protocol": "tcp",
    "containerPort": 80
    }

Ability to fill dynamic values & secrets

Not sure if this should be one in the same issue, but; I wanted to deploy task definitions to two environments changing the CPU value. Generally this is static, but could change; I also have a lot of application settings that could change. I'm unsure of the ability of actions/core but it would be nice to be able to have syntax that could provide this functionality. Secondly, it might fall in the same category, but a list of secrets we have (using AWS Secret Manager) being inputed dynamically into the task def (as those could change too). Hopefully that use case was easy to follow. I'd love to help develop this if it's possible and looking to discuss how it could be accomplished.

There are multiple containers in one task. Can I specify multiple container names for container-name?

Current

  - name: Fill in the new image ID in the Amazon ECS task definition
       id: task-def
       uses: aws-actions/amazon-ecs-render-task-definition@v1
       with:
         task-definition: task-definition.json
         container-name: sample-app
         image: ${{ steps.build-image.outputs.image }}

Asking

  - name: Fill in the new image ID in the Amazon ECS task definition
       id: task-def
       uses: aws-actions/amazon-ecs-render-task-definition@v1
       with:
         task-definition: task-definition.json
         container-name: 
           - sample-app1
           - sample-app2
         image: ${{ steps.build-image.outputs.image }}

Unable to use multi-line environment variables

We have an ECS task into which we've inserted a private key as a multi-line environment variable from a secret store. To retain the newlines, we wrap the environment variable in quotes inside of this actions:

environment-variables: |
  PRIVATE_KEY="{{ secrets.PRIVATE_KEY }}"

Because of how the action parses environment variables (by newlines), it will fail to see this multi-line value as a single variable:

Error: Cannot parse the environment variable '***'. Environment variable pairs must be of the form NAME=value.

Is there a way this scenario can be accommodated?

Task definition json

Sorry if this is a silly question, but does the task-definition json have to exist in the repo itself? Anyway to pull it dynamically from ECR and just update the image?

Ability to use ENV variables

When you try to add an environmental variable in image or cluster you get the following error
Cluster must match ^[a-zA-Z0-9\-_]{1,255}$, but was $CLUSTER_NAME

current status

What is the current status of this action? Last release was in January, I see a couple of PRs still open (I have one open for several months already without any answer from you). Seems that you are not answering any of the open issues as well. It would be good to know if there are any plans to maintain this action. Thank you

dynamic image change

I tried using amazon-ecr-login to get the image value, but I got the following error:

Error:

Run aws-actions/amazon-ecs-deploy-task-definition@v1
Warning: Ignoring property 'compatibilities' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'taskDefinitionArn' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'requiresAttributes' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'revision' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Warning: Ignoring property 'status' in the task definition file. This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, but it is not a valid field when registering a new task definition. This field can be safely removed from your task definition file.
Error: Failed to register task definition in ECS: Container.image contains invalid characters.
Error: Container.image contains invalid characters.

Code example

- name: Render Amazon ECS task definition\
        env:
          REGISTRY: ${{ steps.login-ecr.outputs.registry }}
          REPOSITORY: testrepository
          IMAGE_TAG: ${{ github.sha }}
        id: render-web-container
        uses: aws-actions/amazon-ecs-render-task-definition@v1
        with:
          task-definition: task-definition.json
          container-name: testcontainer
          image: $REGISTRY/$REPOSITORY:$IMAGE_TAG
          environment-variables: "LOG_LEVEL=info"

      - name: Deploy to Amazon ECS service
        uses: aws-actions/amazon-ecs-deploy-task-definition@v1
        with:
          task-definition: ${{ steps.render-web-container.outputs.task-definition }}

Q: Error: Invalid task definition: Could not find container definition with matching name

I'm using this action recently and it works fine for many services. But yesterday I added a new one, and rendering fails with "Error: Invalid task definition: Could not find container definition with matching name".
As far as I see, my task definition uses the same container name as I pass to the action, so I couldn't understand what is wrong here.

"containerDefinitions": [
        {
            "name": "fc-core-pay-bin-server",
Run aws-actions/amazon-ecs-render-task-definition@v1
  with:
    task-definition: xxxx-task-definition.json
    container-name: fc-core-pay-bin-server

TIA,
Vitaly

service discovery with AWS Cloud Map

Hi,
I want to use serviceRegistries with your aws actions to register the deploying task in AWS Cloud Map. I know per se serviceRegistries is an argument of the AWS::ECS::Service construct and not the AWS::ECS::TaskDefinition itself, but is there a way to make this work with your action?

Thanks,
bert

Add ability to update multiple containers in the same task

It would be helpful to be able to update the images if there are multiple containers in the same task definition. Currently, a user would have to chain multiple of these actions, creating multiple temp files with the iterative changes.

set-output command is deprecated

Hi using version aws-actions/amazon-ecs-render-task-definition@v1 and getting the following warning on every run of the action:

Warning: The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Not sure if there is a plan for the deprecation of the command, but hopefully this issue sets it into motion.

container-name parameter not using outputs value

I have an action that renders task definition, trying to set both image and container-name parameters with the outputs of previous steps. While image parameter works ok, I get
##[error]Input required and not supplied: container-name
for the container-name parameter when set like
container-name: ${{ steps.step.outputs.CONTAINER }}

Updating existing task definition

My scenario:

I want to update task definitions with a new image (this use case). However, the task definition has more dynamic values in it across different deployments/environments.

Ideally, I'd use another action to query the current task definition then update the image then use the other action to deploy.

I can maybe use a custom AWS CLI action to query the definition but was just wondering if there was a different suggestion in mind for my issue.

Thanks for this!

How to create a new revision for an existing task definition?

Suppose I use this "render task definition" task to create a new task definition. But then, how do I create a new revision the next time I run the workflow?
Can we have like, an environment variable or something that will just increment revision values every time the workflow runs so that it can create a new revision of that task definition?

Bug: Invalid task definition: Could not find container definition with matching name

I'm using this action with the latest version as well as with the v1.1.3, for one ECS Service, it works just fine, for the other service it does not. Rendering of the ECS Task fails with Error: Invalid task definition: Could not find container definition with matching name.
I have checked the ECS Task JSON and it contains the container name.

Both Services are identical in terms of ECS Task def structure. Just Env. vars are different.

Here my current action step:

      - name: Create new AWS ECS task definition on Stage (DEV)
        id: dev-task-def
        uses: aws-actions/[email protected] # Also used latest and it did not work.
        with:
          task-definition: task-definition.json
          container-name: ${{ inputs.ECS_CONTAINER_NAME }}
          image: ${{ steps.dev-image-build.outputs.image }}

@vitalykarasik was somehow able to get it to work (see Issue), still we don't know why it does not work in this case.

Any Idea or hint on how to fix this is highly appreciated.

Add ability to pass executionRoleArn

When using secrets it is required to add this field. In ARN there are sensitive data like region and AWS account number. Please consider adding this feature.

Unexpected input(s) 'executionRoleArn', valid inputs are ['task-definition', 'container-name', 'image']

Family name not parsing output parameter

I am trying to dynamically assign a family name using the branch name. The following lines in my action file generates the branch param:

 - name: Extract branch name
      shell: bash
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
      id: extract_branch

Then i reference it in my task definition:

"family": "frontend-${{ steps.extract_branch.outputs.branch }}"

However, it seems that it does not parse this output, since i get the following error when trying to deploy:
##[error]Failed to register task definition in ECS: Family contains invalid characters.
##[error]Family contains invalid characters.

I was of the impression that I could reference these output parameters anywhere in the task definition, as it works fine in
the image definition:

"image": "frontend:${{ steps.extract_branch.outputs.branch }}"

Are there some limitations to some of these fields in the task definition ? If so, it would be very desirable to have this on all task definition fields.

Task Definition with specific file path takes 2x times for deployment

I am using aws-actions/amazon-ecs-render-task-definition@v1 for ecs deployment, I have multiple task definition file depending on various env. When specified with file path the build time doubles

task-definition:
When specified with a file path takes lots of time to deploy

Total Build Time: ~ Approx. 4 - 5 min

 - name: Fill in the new image ID in the Amazon ECS task definition
      id: task-def
      uses: aws-actions/amazon-ecs-render-task-definition@v1
      with:
        **task-definition: task-definition.json**
        container-name: test
        image: ${{ steps.build-image.outputs.image }}

Total Build Time: ~ Approx. 9 - 12 min

 - name: Fill in the new image ID in the Amazon ECS task definition
      id: task-def
      uses: aws-actions/amazon-ecs-render-task-definition@v1
      with:
        **task-definition: deployment/test/task-definition-test.json**
        container-name: test
        image: ${{ steps.build-image.outputs.image }}

Change task definition Tags

Would a PR for this feature be useful?
Was thinking of doing it for myself but can obviously help the community

Idea is having an optional field for the tags attribute

environment-variables: "LOG_LEVEL=info"
tags: "ENV=prod"

Let me know what you think

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.