The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

shilohuniversity
January 20, 2020

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 20, 2020

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

shilohuniversity
January 21, 2020

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
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2020

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

shilohuniversity
January 24, 2020

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

TAGS
AUG Leaders

Atlassian Community Events