BitBucket Pipeline unexpected EOF while looking for matching `"' Edited

Good day,

Hi guys, please help me, Ive been trying to get pipeline work with ECS by using tutorial from atlassian link here, and manage to be able to get the docker image through to ECR.

But it just keep failing when executes export TASK_VERSION command, below is the error message, I have tried to find this missing `"' but I havent found it yet. I also include my bitbucket-pipeline.yml & Dockerfile. Thanks in advance. 

Error message :

+ export TASK_VERSION=$(aws ecs register-task-definition --family test_ecs_dev --container-definitions "[{\"name\":\"test_ecs_container\",\"image\":\"$IMAGE_NAME",\"cpu\":10,\"command\":[\"echo\",\"hello\"],\"memory\":10,\"essential\":true}]")
bash: /opt/atlassian/pipelines/agent/tmp/bashScript2767235545855639452.sh: line 81: unexpected EOF while looking for matching `"' 

Build log screenshot :

Screen Shot 2017-07-01 at 4.23.41 AM.png

bitbucket-pipeline.yml & Dockerfile :

# This is a sample build configuration for Go.
# Check our guides at https://confluence.atlassian.com/x/5Q4SMw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: golang:1.8

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - PACKAGE_PATH="${GOPATH}/src/bitbucket.org/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}"
          - mkdir -pv "${PACKAGE_PATH}"
          - tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C "${PACKAGE_PATH}"
          - cd "${PACKAGE_PATH}"
          - go get -v
          - go build -v
          - go test -v
          - export IMAGE_NAME=irahardianto/test_ecs:$BITBUCKET_COMMIT
          # build the Docker image (this will use the Dockerfile in the root of the repo)
          - docker build -t $IMAGE_NAME .
          # authenticate with the Docker Hub registry
          - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
          # push the new Docker image to the Docker registry
          - docker push $IMAGE_NAME
          - curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
          - apt-get update -y
          - apt-get upgrade -y
          - apt-get install -y jq zip unzip
          - unzip awscli-bundle.zip
          - ./awscli-bundle/install -b ~/bin/aws
          - export PATH=~/bin:$PATH
          - $(aws ecr get-login --no-include-email --region ap-southeast-1)
          - docker tag $IMAGE_NAME 047415648520.dkr.ecr.ap-southeast-1.amazonaws.com/test_ecs:latest
          - docker push 047415648520.dkr.ecr.ap-southeast-1.amazonaws.com/test_ecs:latest
          # register the ECS task definition and capture the version
          - export TASK_VERSION=$(aws ecs register-task-definition --family test_ecs_dev --container-definitions "[{\"name\":\"test_ecs_container\",\"image\":\"$IMAGE_NAME",\"cpu\":10,\"command\":[\"echo\",\"hello\"],\"memory\":10,\"essential\":true}]" | jq --raw-output '.taskDefinition.revision')
          - echo "Registered ECS Task Definition:" $TASK_VERSION
          # Update the ECS service to use the updated Task version
          - aws ecs update-service --cluster test-ecs-cluster --service test_ecs_service --task-definition test_ecs_dev:$TASK_VERSION

options:
  docker: true
FROM golang:wheezy

# Create app directory
RUN mkdir -p /go/src/app
WORKDIR /go/src/app

COPY . /go/src/app/

EXPOSE 8000

WORKDIR /go/src/app
CMD ["go run", "hello.go"]

 

 

0 answers

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

673 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot