It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using YAML anchors in multiple steps Edited

HI,

My pipeline has multiple steps and I'm trying to get it to work for multiple environments. It was working fine for one environment.  I already followed the guide in this document: https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html?_ga=2.260751877.964504472.1573266564-336097571.1573266564

But it doesn't appear to be correct as I get the error: `There is an error in your bitbucket-pipelines.yml at [pipelines > branches > develop > 0]. To be precise: Step is empty, null, or missing.`, when following the syntax in the example directly.

 

Here's my pipeline yml file:

image: atlassian/default-image:2

definitions:
  steps:
  - step: &pushToECR
  name: Push to ECR
  script:
    - unset NPM_CONFIG_USER
    - docker build -t $ECR_IMAGE_NAME .
    - pipe: atlassian/aws-ecr-push-image:1.0.1
    variables:
      AWS_ACCESS_KEY_ID: '$AWS_ACCESS_KEY_ID'
      AWS_SECRET_ACCESS_KEY: '$AWS_SECRET_ACCESS_KEY'
      AWS_DEFAULT_REGION: '$AWS_REGION'
      IMAGE_NAME: '$ECR_IMAGE_NAME'

- step: &deployToECS
name: Deploy to ECS
deployment: development
services:
- docker
script: # Modify the commands below to build your repository.
- pipe: atlassian/aws-ecs-deploy:1.0.4
  variables:
    AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
    AWS_DEFAULT_REGION: $AWS_REGION
    CLUSTER_NAME: '$ECS_CLUSTER_NAME'
    SERVICE_NAME: '$ECS_SERVICE_NAME'
    TASK_DEFINITION: '$ECS_TASK_DEFINITION_FILE'
    DEBUG: 'true'

pipelines:
  branches:
    develop:
      - step:
        <<: *pushToECR
        deployment: development
   - step:
     <<: *deployToECS
     deployment: development

1 answer

A little difficult to tell if the problem is with your yaml formatting - it's all out of whack - or the code itself. I would guess the issue is that you haven't declared "deployment" in your pushtoEcr definition.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,032 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you