Bitbucket-pipelines.yml Error : This section should be a map (it is currently defined as a list).
Asked by mark.rogerson:

Getting an error with trying to use my bitbucket-pipelines.yml file  
'There is an error in your bitbucket-pipelines.yml at \[pipelines \> pull-requests \> \*\* \> 2 \> step\]. This section should be a map (it is currently defined as a list).'  
File checks out OK in the validator. What am I doing wrong?  
File as below:  
image:  
name: 081836747304.dkr.ecr.eu-west-1.amazonaws.com/mojo-bitbucket-pipelines-nodejs-16:latest  
aws:  
access-key: $AWS_ACCESS_KEY_ID  
secret-key: $AWS_SECRET_ACCESS_KEY

definitions:  
caches:  
cypress: tmp/Cypress  
steps:  
- step: \&build  
name: Build  
size: 2x  
script:  
- . cypress-setup.sh  
- VERSION="${VERSION:-1.0}.$BITBUCKET_BUILD_NUMBER"  
- npm i --unsafe-perm  
- git tag -fa "${VERSION}" -m "Build ${VERSION}"  
- git push origin "${VERSION}" -f --tags  
after-script:  
- bitbucket_logger.sh failure_only  
artifacts:  
- node_modules/\*\*  
- tmp/Cypress/\*\*  
- step: \&deploy  
script:  
- . setup_aws_shared_creds.sh  
- curl -sL <https://sentry.io/get-cli/> \| SENTRY_CLI_VERSION="2.10.0" bash  
- terraform_apply.sh  
- npm version ${VERSION:-1.0}.$BITBUCKET_BUILD_NUMBER --git-tag-version false  
- VERSION="my.mojo.ui@${VERSION:-1.0}.$BITBUCKET_BUILD_NUMBER"  
- sentry-cli releases -o "uswitchcom" new -p "my-mojo-ui" "${VERSION}"  
- CI=false  
- npm run build-${AWS_PROFILE}  
- SENTRY_LOG_LEVEL=debug sentry-cli releases -o "uswitchcom" -p "my-mojo-ui" files "$VERSION" upload-sourcemaps ./dist  
- sentry-cli releases -o "uswitchcom" -p "my-mojo-ui" finalize "${VERSION}"  
- git push origin :refs/tags/${AWS_PROFILE}  
- git tag -fa "${AWS_PROFILE}" -m "Release to ${AWS_PROFILE}"  
- git push origin "${AWS_PROFILE}" -f --tags  
- s3_deploy.sh "dist/"  
after-script: \&bitbucket-logger  
- bitbucket_logger.sh  
- step: \&deploy-docs  
script:  
- CLOUDFRONT_ID="E3CTWDRTQZVRB3"  
- BUCKET="my-mojo-documentation"  
- AWS_DEFAULT_REGION="eu-west-1"  
- BUILD_FOLDER="build"  
- . setup_aws_shared_creds.sh  
- npm i --unsafe-perm  
- terraform_apply.sh  
- cd blueprint  
- npm i  
- CI=false  
- npm run build  
- aws s3 sync ${BUILD_FOLDER} s3://${BUCKET} --delete --region ${AWS_DEFAULT_REGION} --profile ${AWS_PROFILE}  
- aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths "/\*" --profile ${AWS_PROFILE}  
- step: \&BTL_PNV  
name: BTL_PNV  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/BTL_PNV.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&BTL_PWP  
name: BTL_PWP  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/BTL_PWP.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&BTL_REMOER  
name: BTL_REMOER  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/BTL_REMOER.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&BTL_REMOAB  
name: BTL_REMOAB  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/BTL_REMOAB.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&BTL_REMOL4L  
name: BTL_REMOL4L  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/BTL_REMOL4L.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&RESI_PNV_Coach  
name: RESI_PNV_Coach  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/RESI_PNV_Coach.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&RESI_PNV  
name: RESI_PNV  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/RESI_PNV.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&RESI_PWP_Together  
name: RESI_PWP_Together  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/RESI_PWP_Together.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&RESI_PWP  
name: RESI_PWP  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/RESI_PWP.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&RESI_REMOAB  
name: RESI_REMOAB  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/RESI_REMOAB.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&RESI_REMOER  
name: RESI_REMOER  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/RESI_REMOER.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&RESI_REMOL4L  
name: RESI_REMOL4L  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/RESI_REMOL4L.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&partner_BANKRATE  
name: partner_Bankrate  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/partner_BANKRATE.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&partner_FINDER  
name: partner_Finder  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/partner_FINDER.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&partner_GoCompare  
name: partner_GoCompare  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/partner_GoCompare.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&partner_Money  
name: partner_Money  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/partner_Money.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&partner_OMA  
name: partner_OMA  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/partner_OMA.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&partner_USWITCH  
name: partner_Uswitch  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/partner_USWITCH.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&partner_ZOOPLA  
name: partner_Zoopla  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/partner_ZOOPLA.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&Calendar  
name: calendar  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/calendar.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&newApplication_personalisedMessaging  
name: newApplication_personalisedMessaging  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/newApplication_personalisedMessaging.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&newApplication_purchaseConfig  
name: newApplication_purchaseConfig  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/newApplication_purchaseConfig.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&newApplication_remoConfig  
name: newApplication_remoConfig  
script:  
- npm ci  
- npm run start \&  
- npx cypress run --spec ./cypress/e2e/newApplication_remoConfig.cy.js  
artifacts:  
- cypress/screenshots/\*\*  
- cypress/videos/\*\*  
after-script:  
- bitbucket_logger.sh failure_only  
- step: \&test  
- parallel:  
- step: \*BTL_PNV  
- step: \*BTL_PWP  
- step: \*BTL_REMOAB  
- step: \*BTL_REMOER  
- step: \*BTL_REMOL4L  
- step: \*RESI_PNV_Coach  
- step: \*RESI_PNV  
- step: \*RESI_PWP_Together  
- step: \*RESI_PWP  
- step: \*RESI_REMOAB  
- step: \*RESI_REMOER  
- step: \*RESI_REMOL4L  
- step: \*partner_BANKRATE  
- step: \*partner_FINDER  
- step: \*partner_GoCompare  
- step: \*partner_Money  
- step: \*partner_OMA  
- step: \*partner_USWITCH  
- step: \*Calendar  
- step: \*newApplication_personalisedMessaging  
- step: \*newApplication_purchaseConfig  
- step: \*newApplication_remoConfig

pipelines:  
branches:  
master:  
- step: \*build  
- step:  
\<\<: \*deploy  
name: Deploy to test  
deployment: test  
- step:  
\<\<: \*deploy  
name: Deploy to staging  
deployment: staging  
trigger: manual  
- step:  
\<\<: \*deploy  
name: Deploy to prod  
deployment: production  
trigger: manual  
pull-requests:  
'\*\*':  
- step:  
name: 'Is merge to master'  
script:  
- if \[ "${BITBUCKET_PR_DESTINATION_BRANCH}" != "master" \]; then printf 'not a target branch we want to check'; exit; fi  
- step: \*build  
- step: \*test

custom:  
deploy-to-test:  
- step: \*build  
- step:  
\<\<: \*deploy  
name: Deploy to test  
deployment: test  
deploy-to-staging:  
- step: \*build  
- step:  
\<\<: \*deploy  
name: Deploy to staging  
deployment: staging  
deploy-to-prod:  
- step: \*build  
- step:  
\<\<: \*deploy  
name: Deploy to prod  
deployment: production  
deploy-docs:  
- step:  
\<\<: \*deploy-docs  
name: Deploy Docs  
deployment: test  
cypress:  
- step: \*build  
- step: \*test


Answers:
author: Theodora Boudale
body: Hi [@mark.rogerson](/t5/user/viewprofilepage/user-id/5135669) and welcome to the community!

I think the issue is with the definition of \&test:

```
- step: &test
  - parallel:
    - step: *BTL_PNV
    - step: *BTL_PWP
    - step: *BTL_REMOAB
    - step: *BTL_REMOER
    - step: *BTL_REMOL4L
    - step: *RESI_PNV_Coach
    - step: *RESI_PNV
    - step: *RESI_PWP_Together
    - step: *RESI_PWP
    - step: *RESI_REMOAB
    - step: *RESI_REMOER
    - step: *RESI_REMOL4L
    - step: *partner_BANKRATE
    - step: *partner_FINDER
    - step: *partner_GoCompare
    - step: *partner_Money
    - step: *partner_OMA
    - step: *partner_USWITCH
    - step: *Calendar
    - step: *newApplication_personalisedMessaging
    - step: *newApplication_purchaseConfig
    - step: *newApplication_remoConfig
```

There are steps inside another step which is not possible.

What you could do instead is use the [stage](https://support.atlassian.com/bitbucket-cloud/docs/stage-options/) option in order to group multiple steps in one stage. You can use it in the yaml anchor **definitions**:

```
stages:
  - stage: &test
      steps:
        - step: *BTL_PNV
        - step: *BTL_PWP
        - step: *BTL_REMOAB
        - step: *BTL_REMOER
        - step: *BTL_REMOL4L
        - step: *RESI_PNV_Coach
        - step: *RESI_PNV
        - step: *RESI_PWP_Together
        - step: *RESI_PWP
        - step: *RESI_REMOAB
        - step: *RESI_REMOER
        - step: *RESI_REMOL4L
        - step: *partner_BANKRATE
        - step: *partner_FINDER
        - step: *partner_GoCompare
        - step: *partner_Money
        - step: *partner_OMA
        - step: *partner_USWITCH
        - step: *Calendar
        - step: *newApplication_personalisedMessaging
        - step: *newApplication_purchaseConfig
        - step: *newApplication_remoConfig

```

Then in the pull-requests pipeline (and any other pipeline where you use \*test) you can reference the stage as follows:

```
pull-requests:
  '**':
    - step:
        name: 'Is merge to master'
        script:
          - if [ "${BITBUCKET_PR_DESTINATION_BRANCH}" != "master" ]; then printf 'not a target branch we want to check'; exit; fi
    - step: *build
    - stage: *test
```

Please keep in mind the following

1. The stages feature is still in beta and is subject to change.
2. Parallel steps are not supported in a stage at the moment. We do have a feature request to support it that you can vote for: <https://jira.atlassian.com/browse/BCLOUD-22214>

If you want to make use of parallelization, then you need to omit the definition for \&test and use the following in the pipelines that use **- step: \*test** (instead of -**step: \*test** use the below config)

```
- parallel:
  - step: *BTL_PNV
  - step: *BTL_PWP
  - step: *BTL_REMOAB
  - step: *BTL_REMOER
  - step: *BTL_REMOL4L
  - step: *RESI_PNV_Coach
  - step: *RESI_PNV
  - step: *RESI_PWP_Together
  - step: *RESI_PWP
  - step: *RESI_REMOAB
  - step: *RESI_REMOER
  - step: *RESI_REMOL4L
  - step: *partner_BANKRATE
  - step: *partner_FINDER
  - step: *partner_GoCompare
  - step: *partner_Money
  - step: *partner_OMA
  - step: *partner_USWITCH
  - step: *Calendar
  - step: *newApplication_personalisedMessaging
  - step: *newApplication_purchaseConfig
  - step: *newApplication_remoConfig
```

Kind regards,  
Theodora

comments: author: mark.rogerson
body: Thank you very much Theodora. I went with the second option as I want to use parallelization and it works.


Tags: bitbucket-pipelines