Scheme URL of bitbucket-pipelines.yml

Trurl McByte July 2, 2018

Where to get Yaml scheme (usually json) of bitbucket-pipelines.yml?

3 answers

1 vote
Sam Gendler August 24, 2021

Especially since your own parser appears to reject yaml which adheres to the structure specified in your documentation.  It would be really nice if 'condition' worked as advertised, since there is no schema I can look at to see how it is supposed to be.  The docs cover it, but using it as specified results in an error

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 24, 2021

Hello @Sam Gendler

Can you provide an example which didn't work for you?

There is a more recent JSON schema than linked above – can you please check if your example is validated against it? However be aware that it is not an official schema for Pipelines configuration YAML either, and it is maintained on the best effort basis.

Let me know if this helps.

Cheers,
Daniil

Chris Heale May 25, 2023

@Daniil Penkin I see you've been maintaining the Schema, but there is still a problem with the Artifacts... 

The desire is to skip Downloads for a particular step that also doesn't publish an artifact

The "Artifacts" node, if in "complex" context, requires both "download" and "paths" with a minimum of 1 entry 

Latest commit 

artifact_list": {
  "type": "array",
  "description": "Files produced by a step to share with a following step",
  "items": {
    "type": "string",
    "description": "Glob pattern for the path to the artifacts"
  },
  "minItems": 1
},
"complex_artifacts": {
  "type": "object",
  "properties": {
    "download": {
      "type": "boolean",
      "description": "Enables downloading of all available artifacts at the start of a step",
      "default": true
    },
    "paths": {
      "$ref": "#/definitions/artifact_list"
    }
  }
},

can it use the anyOf construct?

 

"complex_artifacts": {
  "type": "object",
  "properties": {
    "anyOf": [
      {"download": {
        "type": "boolean",
        "description": "Enables downloading of all available artifacts at the start of a step",
        "default": true
      }},
      {"paths": {
        "$ref": "#/definitions/artifact_list"
      }}
    ]
  }
},

 

Cheers

Chris

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2023

Hey @Chris Heale,

Thanks for reaching out.

complex_artifacts doesn't actually require both download and path since there's no required directive. It should work fine with one or both properties (and also with no properties at all, which in fact is invalid in Pipelines, but schema isn't 100% accurate).

Check out the screencast: the step is highlighted when it doesn't match the schema (highlighting isn't very accurate, but that's a limitation of the validation engine used).

artifacts.gif

Let me know which validation mechanism you use if it doesn't work for you.

Cheers,
Daniil

Chris Heale May 26, 2023

Hey! Thanks for the prompt response... its flagging it in VS Code on Windows... so does it get they schema from the Atlassian plugin?

 

Zw8TIE4kJR.png

Chris Heale May 26, 2023

Just saw the file it is using...

/.vscode/extensions/atlassian.atlascode-3.0.3/resources/schemas/pipelines-schema.json

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 26, 2023

Right, I see now.

Unfortunately, VS Code plugin has its own schema which seems to be out of date indeed. In fact, there's no single JSON schema for Bitbucket Pipelines, so both AtlasCode (official Atlassian plugin for VS Code) and Bitbucket Linky (unofficial plugin for IntelliJ maintained mostly by me) have their own handcrafted versions which are updated irregularly. Definitely some room for improvement here :)

I'll raise a PR to bring in latest changes into AtlasCode schema early next week.

Thanks for bringing this up.

Cheers,
Daniil

Like # people like this
Chris Heale May 29, 2023

That's awesome.. thanks @Daniil Penkin !

1 vote
Lucian Mocanu November 5, 2019

Actually you can find the schema here, as part of the vscode extension:

https://bitbucket.org/atlassianlabs/atlascode/src/devel/resources/schemas/pipelines-schema.json

However, it has a lot of problems, so I wouldn't rely on it.

If I have time I could submit a pull request for my issues, but I'm sure Atlassian could do a better job since they already have a pipelines validator.

Lucian Mocanu November 5, 2019

Here is the ticket that you should watch for updates on this: https://bitbucket.org/atlassianlabs/atlascode/issues/66/yaml-validator-inconsistent-with-online 

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 21, 2019

Hi everyone,

Just an FYI: I recently made quite a few fixes and improvements to the schema @Lucian Mocanu linked to above, so hopefully it is now in a better shape.

Let me know if you have any questions.

Cheers,
Daniil

Lucian Mocanu November 22, 2019

I would be nice if it supported steps definitions, like it was requested in that ticket too. We use them quite frequently, since we reuse steps in various pipelines.

I have a fix for that, but it was a quick solution that didn't consider other use cases, so I wouldn't feel comfortable making it public :)

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 22, 2019

Well, any piece of YAML can be reused, it's not limited just to steps. What I mean is that an anchor can be declared anywhere in the schema, and used later on. definitions object is just a conventional place to keep reusable pieces.

I don't think adding steps to definitions is a good idea. It'd only help with configs for some users, potentially small number of them. Others would want to reuse parallel, or maybe variables – should we add them do definitions too? Of course, we can add every single entity type as a possible child of definitions, but that would really clutter the schema.

Finally, validation should actually kick in where you use the anchor. That is, it will work as if the anchored bit is inlined. It then depends on how good the validator is in terms of whether the error it shows makes any sense (for instance, IntelliJ is not great here, I'm not sure about VS Code).

0 votes
lassian
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2018

Hi Trurl,

We dont currently publish a schema for our yaml format :(

The closest we have is you could create one based on the description of our yaml as described here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html

Kind Regards,

Nathan Burrell

Frank Giesecke October 16, 2018

Sadly to read this. Why didn't you publish the schema?
It would be very helpful for developers all around the world.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events