Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using YAML anchors in multiple steps

warmannj
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 9, 2019 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

0 votes
Rupert Broad
Contributor
August 20, 2020

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
atlassian, forge, forge learning path, atlassian learning, cloud app development, forge app development, build forge apps, atlassian certification, developer training, jira app development, confluence app development, automation, ui frameworks

Turn Ideas into Atlassian Apps 📱

From setup to deployment—this learning path shows you how to build your first app using Forge. Learn the essentials, streamline workflows, and bring custom solutions to life across Jira, Confluence, and more.

Start Learning
AUG Leaders

Atlassian Community Events