Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Using ":" in bitbucket pipelines

Hello,

I'm wondering why bitbucket pipelines are parsing stings inside the script section.

image: ubuntu:18.04

pipelines:
  default:
    - step:
      script:
        -  echo "Echo from pipelines : ${MY_VAR}"

 

This is not valid because of the ":" !!

2 answers

1 accepted

4 votes
Answer accepted

Hi Hamdi,

The colon character is causing the particular line you have to be parsed as a map instead of a string. This is part of the YAML specification, which the bitbucket-pipelines.yml file follows. Specifically, a colon followed by a space will make the entire line interpreted as a map instead of a string.

There are a few ways to work around this, which will all make the line be interpreted as a string instead.

1. Remove the space after the colon

image: ubuntu:18.04

pipelines:
  default:
    - step:
      script:
        -  echo "Echo from pipelines :${MY_VAR}"

2. Escape the space after the colon

image: ubuntu:18.04

pipelines:
  default:
    - step:
      script:
        -  echo "Echo from pipelines :\ ${MY_VAR}"

3. Quote the entire command line, which will indicate the line is a string.

image: ubuntu:18.04

pipelines:
  default:
    - step:
      script:
        -  'echo "Echo from pipelines : ${MY_VAR}"'

4. Quote the colon character

image: ubuntu:18.04

pipelines:
  default:
    - step:
      script:
        -  echo "Echo from pipelines ':' ${MY_VAR}"


Thanks,

Phil

Hello Phil,

Thank you for the answer.

For me, only the option 3 works since I was using 'echo -e'.

Thanks

Like Tuomas Tikkanen likes this

The php-codeception uses an option string like a YAML-syntax:

 ./vendor/bin/codecept run --override="paths: output: ./test-reports"

 Colons and unquoted spaces are mandatory. 
The only way I have found is:

pipelines:
  default:
    - step:
      script:
- printf './vendor/bin/codecept run --override="paths\x3a output\x3a ./test-reports"' | sh -

Suggest an answer

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

770 views 15 10
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