When I try to run this pipeline, I get the following error. Is there an issue with my pipeline?
There is an error in your bitbucket-pipelines.yml at [pipelines > custom > development > 0]. Step is empty, null, or missing.
Hi Sanjaya,
This error usually indicates an issue with indentation. Indentation should be at least 1 space from the previous level, except for things under - step:, which should have at least 3 spaces indentation. Additionally, ensure that no tabs are used, only spaces.
You could try indentation as follows (I am using 2 and 4 spaces respectively):
image: maven:3.8.1-jdk-8-openj9
definitions:
steps:
- step: &snyk_scan
name: Snyk Security Scan
script:
- pipe: snyk/snyk-scan:1.0.2
variables:
SNYK_TOKEN: $SNYK_TOKEN
LANGUAGE: "java" # For Maven projects
SEVERITY_THRESHOLD: "high"
CODE_INSIGHTS_RESULTS: "true" # Integrate with Bitbucket Code Insights
MONITOR: "true" # Track scan results in Snyk dashboard
DONT_BREAK_BUILD: "false" # Fail build on vulnerabilities
ORGANIZATION: "my-org-name" # Optional, if using Snyk Organizations
PROJECT_FOLDER: "." # Root directory of the project
EXTRA_ARGS: "--all-projects --detection-depth=6" # Scan all sub-projects
- step: &build
name: Build MydocsApi
caches:
- maven
script:
- mvn clean package -DskipTests
- cp target/sampleapp.jar /opt/atlassian/pipelines/agent/build/
- mkdir -p sampleapp-artifact
- zip -r sampleapp/sampleapp-${BITBUCKET_BUILD_NUMBER}.zip /opt/atlassian/pipelines/agent/build/sampleapp.jar .platform/* Procfile
artifacts:
- sampleapp/*.zip
- step: &deploy
name: Deploy to AWS Elastic Beanstalk
oidc: true
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:1.4.1
variables:
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
AWS_OIDC_ROLE_ARN: $AWS_OIDC_ROLE_ARN
APPLICATION_NAME: $APPLICATION_NAME
ENVIRONMENT_NAME: $ENVIRONMENT_NAME
ZIP_FILE: 'sampleapp/sampleapp-${BITBUCKET_BUILD_NUMBER}.zip'
#-----------------------------------------------------------------------------------------------------------------------------------#
pipelines:
custom:
development:
- step: *snyk_scan
- step: *build
- step:
<<: *deploy
deployment: development
staging:
- step: *snyk_scan
- step: *build
- step:
<<: *deploy
deployment: staging
production:
- step: *snyk_scan
- step: *build
- step:
<<: *deploy
deployment: production
Please feel free to let me know if that helps.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.