Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Invalid script section on yaml anchor

Francis Poulin April 7, 2021

Hi,

 

I've been trying to figure out how to fix my issue in bitbucket pipelines. I had the same issue in the past but never figured out how I was able to resolved it (feels like a cache reset somewhere...). Whatsoever, the following yaml gives me the following error:


No commands or pipes defined for the step at [pipelines > branches > bitbucket-p

ipeline-test > 1 > step]. Check that you have defined a valid "script" section.

 

The yaml is valid through the bitbucket-pipeline validator, I tried to change the indentation at various places , but I still face the same problem

# Build configuration for Project
# -----
image: node:12

definitions:
pipes:
- pipe: &AWSCodeDeployUploadPipe
pipe: atlassian/aws-code-deploy:0.6.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: $AWS_APPLICATION_NAME
COMMAND: upload
DEPLOYMENT_GROUP: $AWS_DEPLOYMENT_GROUP
S3_BUCKET: $AWS_S3_BUCKET
ZIP_FILE: codedeploy-artifact.zip

- pipe: &AWSCodeDeployDeployPipe
pipe: atlassian/aws-code-deploy:0.6.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: $AWS_APPLICATION_NAME
COMMAND: deploy
DEPLOYMENT_GROUP: $AWS_DEPLOYMENT_GROUP
S3_BUCKET: $AWS_S3_BUCKET

steps:
- step: &BuildTestPackageStep
name: Build and Test
script:
- npm ci
- npm test
- npm run build
artifacts:
- '**'

- step: &UploadDeployAWSStep
deployment: integration
name: Upload and Deploy to AWS
image: atlassian/default-image:2
script:
- /bin/bash generateCodeDeployArtifact.sh
- *AWSCodeDeployUploadPipe
- *AWSCodeDeployDeployPipe

pipelines:
branches:
bitbucket-pipeline-test:
- step: *BuildTestPackageStep
- step:
≤≤: *UploadDeployAWSStep
name: test

 If I change the last section to the following it works... but I'm losing the flexibility to change the deployment environment ;) :

pipelines:
branches:
bitbucket-pipeline-test:
- step: *BuildTestPackageStep
- step: *UploadDeployAWSStep

Thanks for the help!

1 answer

1 accepted

0 votes
Answer accepted
Francis Poulin April 8, 2021

Fix:

I can't believe it was that simple. My keyboard language changed by inadvertence and the symbol  "≤" was at the same place as my usual "<" ... My eyes just went over that small detail.

Replacing it with the correct character fixed the issue...

The bitbucket pipeline validator didn't catch that issue due to the following bug: https://jira.atlassian.com/browse/BCLOUD-18299

Deleted user March 10, 2023

Thanks man for posting this code here. It helped me a lot to reduce my code.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events