Invalid Characters in Container.image
huslage opened this issue · 3 comments
huslage commented
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.
huslage commented
This is a new workflow.
luzimar-pricefy commented
To fix, replace: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
To:${{env.ECR_REGISTRY}}/${{env.ECR_REPOSITORY}}:${{env.IMAGE_TAG}}