Skip to content
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

dynamic image change #214

Open
garciaaldo opened this issue Nov 29, 2022 · 1 comment
Open

dynamic image change #214

garciaaldo opened this issue Nov 29, 2022 · 1 comment

Comments

@garciaaldo
Copy link

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 }}
@philippbosch
Copy link

I think your syntax for accessing the environment variables is incorrect.

Instead of this:

image: $REGISTRY/$REPOSITORY:$IMAGE_TAG

try this:

image: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants