Where to get Yaml scheme (usually json) of bitbucket-pipelines.yml?
Hello everyone,
Some good news for you: the JSON schema for bitbucket-pipelines.yml configuration file is now available at https://api.bitbucket.org/schemas/pipelines-configuration
Bitbucket Linky is already using it, AtlasCode will start using it soon, too.
Cheers,
Daniil
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
Let me know which validation mechanism you use if it doesn't work for you.
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey! Thanks for the prompt response... its flagging it in VS Code on Windows... so does it get they schema from the Atlassian plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just saw the file it is using...
/.vscode/extensions/atlassian.atlascode-3.0.3/resources/schemas/pipelines-schema.json
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the ticket that you should watch for updates on this: https://bitbucket.org/atlassianlabs/atlascode/issues/66/yaml-validator-inconsistent-with-online
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sadly to read this. Why didn't you publish the schema?
It would be very helpful for developers all around the world.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.