aws-actions/amazon-ecs-render-task-definition

Ability to use ENV variables

Closed this issue · 4 comments

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

@renjinsk Thank you for reporting this issue, we will investigate on this one and get back to you.

@renjinsk Could you please share your more information about this issue like your task def JSON and action settings that you are using while seeing the error?
It would be helpful for us to understand the issue better if we look at your configurations.

Assuming you have the following workflow:

name: Some deployment workflow
on:
  push:
    branches:
      - master

env:
  CLUSTER_NAME: MyClusterName
  ECR_REGISTRY: ecr_registry
  REPO_ONE: repo_one
  REPO_TWO: repo_two
  IMAGE_TAG: sometag
jobs:
  deploy_task:
    name: Deploy The Task
    runs-on: ubuntu-latest
    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: <key>
          aws-secret-access-key: <secret>
          aws-region: <region>

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

      - name: Download Task Definition
        run: |
          aws ecs describe-task-definition \
          --task-definition <task-def-name> \
          --query taskDefinition > task-definition.json

      - name: Change image 1
        uses: aws-actions/amazon-ecs-render-task-definition@v1
        id: ch-task-def
        with:
          task-definition: task-definition.json
          container-name: <container-name>
          image: $ECR_REPOSITORY/$REPO_ONE:$IMAGE_TAG # This will fail with the message described in issue #49 

      - name: Deploy Task
        uses: aws-actions/amazon-ecs-deploy-task-definition@v1
        with:
          task-definition: ${{ steps.ch-task-def.outputs.task-definition }}
          service: <service-name>
          cluster: $CLUSTER_NAME # This will fail too with the message "Cluster must match ^[a-zA-Z0-9\-_]{1,255}$, but was $CLUSTER_NAME"

As you see in the codeblock comment, image: will throw the message described in #49 and cluster: the message already posed initial from me.
This happens when you use env variables

Oh Dear, I just noticed I made the issue on the wrong repository. I'm terribly sorry! I will close and reopen in the correct one