dynamic image change
Opened this issue · 1 comments
garciaaldo commented
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 commented
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 }}