Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events