Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

check-yaml and bitbucket pipeline validator complain about colons in string

I'm using pre-commit's check-yaml hook and also used the bitbucket pipeline validator to check this. Both report a problem with the last line

image: python:3.6.9
definitions:
steps:
- step: &test
name: Run Unit Tests
script:
- echo "DATE: $(date -Iseconds) UTC_TIME: $(date "+%s") GIT_HASH: $BITBUCKET_COMMIT"
- echo ": : "

check-yaml reports that the second colon "mapping values are not allowed in this context".  Same error if you comment out the first echo step, and leave the second.

bitbucket pipeline validator reports "bad indentation of a sequence entry". Same error if you comment out the first echo step, and leave the second.

This shell code originally was in a bash script and runs fine, but including the shell code directly into the bitbucket-pipeline.yml creates errors. Is this caused by validators that cannot handled quoted strings?

2 answers

See my reply to @Dan Engel 

Did you ever figure out how to get around this? I am seeing the same issue (interpretation of colons in the script section as an attempt to map).

I went back to using a bash script called from the pipeline. In my experience, the more you can put into a script (bash, python, etc) rather than literal commands in the bitbucket-pipelines.yml the better. Benefits include:

- execution of the scripts in your development environment (faster modify-test-fix cycle) and other places (git-hooks)

- more code reuse as the bitbucket-pipelines validator stops validating when it finds a step definition

- fewer dependencies on yaml formatting for long wrapped steps

I am even considering replacing the use of atlassian provided pipelines for aws because they use environment variables instead of aws cli settings. That alone lead to many frustrating days.

Like Dan Engel likes this

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

111 views 2 4
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