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

How to add tags to pipelines - doesn't accept tag name

I'm not sure why I can't specify what I thought was a simple name for the tags in the bitbucket-pipelines.yml

 

pipelines:

  tags:

    release-*:      

 

Using the validator the only way I can make this valid it to use * for the name of the tag after tags:. Anything else, even a single word like release gives me the error "Expected a List". I can't seem to find anywhere that details how this should work for identifying tags.

 

Validator - https://bitbucket-pipelines.prod.public.atl-paas.net/validator

 

1 answer

1 accepted

0 votes
Answer accepted

Hello @shilohuniversity,

Thanks for reaching out.

There's nothing wrong in the excerpt you posted. The validator is complaining on the missing content of release-* block: it has to be a list. That is, your config file is incomplete.

This is validated without any errors:

pipelines:
tags:
release-*:
- step:
script:
- echo "Hello world"

Hope this helps.

Cheers,
Daniil

Hi Daniil,

I was going fast and didn't actually add the entire script. Sorry for the confusion. Here is the whole script. Using release-* gives me an error in the validator:

pipelines:  
tags:
release-*:
-
step:
nameDeploy to Production
deploymentProduction
script:
ssh -tt $USER@$DOMAIN << EOF
cd $URL
touch newfilefromtag.tmp
exit $?
EOF

As I typed this in I realized that my formatting was off. Missing spaces in certain places. YAML is very picky. Here is the corrected code for reference:

pipelines:  
tags:
release-*:
- step:
name: Deploy to Production
deployment: Production
script:
- ssh -tt $USER@$DOMAIN << EOF
- cd $URL
- touch newfilefromtag.tmp
- exit $?
- EOF

Didn't have a space in between the dash and step. Also, needs 4 spaces below the step before name:

Thanks for your help!

Like Daniil Penkin likes this

Glad that it worked!

Missing spaces in certain places. YAML is very picky.

Yeah, this is a tradeoff of its conciseness, compared to JSON.

By the way, aside from the online validator there's at least a couple of plugins I'm aware of for IDEs which might help with debugging/validating Pipelines config file locally:

  • AtlasCode plugin for Visual Studio Code does a lot of things, but also bundles a JSON schema for bitbucket-pipelines.yml.
  • Bitbucket Linky plugin for IntelliJ IDEs also contains a JSON schema as well as some additional validations and inspections for bitbucket-pipelines.yml. Disclaimer: I'm the maintainer of this plugin

Hope this helps.

Cheers,
Daniil

Thanks! I just downloaded those plugins to try them out. Hoping that will help out with these formatting syntax errors in the future.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

1,138 views 5 4
Join discussion

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