Search code examples
amazon-web-servicesaws-code-deployaws-codepipeline

Deploy stage returns Start of list found where not expected in Codepipeline


Buildspec.yml

version: 0.2

phases:
  install:
    commands:
      - apt-get update
      - apt install jq
  post_build:
    commands:
      - pwd
      - ls
artifacts:
  files:
    - taskdef.json
    - appspec.yaml

Appspec.yaml

version: 0.0
Resources:
  - TargetService:
      Type: AWS::ECS::Service
      Properties:
        TaskDefinition: "arn:aws:ecs:eu-west-1:309:task-definition/my-task:8"
        LoadBalancerInfo:
          ContainerName: "container-name"
          ContainerPort: "8080"
        NetworkConfiguration:
          AwsvpcConfiguration:
            Subnets: ["subnet-1","subnet-2","subnet-3"]
            SecurityGroups: ["sg-1","sg-2","sg-3"]
            AssignPublicIp: "DISABLED"

Taskdef.json

[
    {
      "name": "name",
      "image": "ecr-url-image:latest",
      "cpu": 7,
      "dnsSearchDomains": null,
      "network_configuration":"awsvpc",
      "entryPoint": null,
      "portMappings": [
        {
          "hostPort": 8080,
          "protocol": "tcp",
          "containerPort": 8080
        },
        {
          "hostPort": 8793,
          "protocol": "tcp",
          "containerPort": 8793
        }
      ],
      "command": null,
      "linuxParameters": null,
      "environment": [],
      "resourceRequirements": null,
      "ulimits": null,
      "dnsServers": null,
      "mountPoints": [
        {
          "readOnly": null,
          "containerPath": "/usr/local/airflow/dags",
          "sourceVolume": "dags"
        },
        {
          "readOnly": null,
          "containerPath": "/usr/local/airflow/logs",
          "sourceVolume": "logs"
        },
        {
          "readOnly": null,
          "containerPath": "/folder",
          "sourceVolume": "folder"
        }
      ],
      "workingDirectory": null,
      "secrets": null,
      "dockerSecurityOptions": null,
      "memoryReservation": 128,
      "volumesFrom": [],
      "stopTimeout": null,
      "startTimeout": null,
      "firelensConfiguration": null,
      "dependsOn": null,
      "disableNetworking": null,
      "interactive": null,
      "healthCheck": null,
      "essential": true,
      "links": null,
      "hostname": null,
      "extraHosts": null,
      "pseudoTerminal": null,
      "user": null,
      "readonlyRootFilesystem": null,
      "dockerLabels": null,
      "systemControls": null,
      "privileged": null,
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-region": "eu-west-1",
          "awslogs-group": "my-group"
        }
      }
    }
  ]

Te output of deploy stage in codepipeline is:

Action setup is not valid

enter image description here


Solution

  • This is a generic error meaning somewhere you have put a list [] where it was not supposed to (maybe required a number or string). Please review all the parameters specially the task definition.