Hi guys, I have this part of my pipeline:
# omitted
pipelines:
pull-requests:
'**':
- parallel: # this point
# omitted
Is it possible to run parallel tests on this part? The pipeline is valid but it doesn't work when I run it.
Valid pipeline:
Error to execute:
Thanks in advance.
Hi @Claudenir Machado , welcome to the Atlassian Community.
The bitbucket-pipelines.yaml online validation (the online tool in your screenshot) does not always show the whole picture.
In your case the configuration error message is mandatory highlighting the error.
The error is not a big one, the `name:` property needs to be indented once more into the `step:` property turning it into an actual object (instead being null).
That is meant by the error message that the step section is empty (it actually is).
Same is for `script:` in your following YAML. Just indent this all once more what belongs into `step:` and it should work.
Verifying / Validating a bitbucket-pipelines.yml file is possible on the command-line as well with the pipelines utility. Taking the YAML from your last comment:
Verify via `--show`:
$ pipelines --show
PIPELINE ID STEP IMAGE NAME
custom/create-release ERROR step requires a script
branches/develop ERROR step requires a script
branches/master ERROR step requires a script
pull-requests/** ERROR Parallel step must consist of steps only
Validate against schema via `--validate`:
$ bin/pipelines --validate
[pipelines.branches.develop[0].step] NULL value found, but an object is required
[pipelines.branches.develop[0]] The property step is not defined and the definition does not allow additional properties
[pipelines.branches.develop[0]] Failed to match at least one schema
[pipelines.branches.master[0].step] NULL value found, but an object is required
[pipelines.branches.master[0]] The property step is not defined and the definition does not allow additional properties
[pipelines.branches.master[0]] Failed to match at least one schema
[pipelines.custom.create-release[0]] The property step is not defined and the definition does not allow additional properties
[pipelines.custom.create-release[0].step] NULL value found, but an object is required
[pipelines.custom.create-release[0]] Failed to match at least one schema
[pipelines.pull-requests.**[0]] The property parallel is not defined and the definition does not allow additional properties
[pipelines.pull-requests.**[0].parallel[0].step] NULL value found, but an object is required
[pipelines.pull-requests.**[0].parallel[0]] The property script is not defined and the definition does not allow additional properties
[pipelines.pull-requests.**[0].parallel[1].step] NULL value found, but an object is required
[pipelines.pull-requests.**[0].parallel[1]] The property script is not defined and the definition does not allow additional properties
[pipelines.pull-requests.**[0]] Failed to match at least one schema
pipelines: validate done, with errors
No idea if these error message are more helpful though ;), just some more options.
If you're using and editor or IDE to edit the files, check for JSON Schema support, despite the file is YAML, JSON Schemas also apply to it (YAML has a JSON representation). Editors / IDEs normally highlight then the erroneous places more visually so errors are easier to catch.
bitbucket-pipelines.yml validation inside IntelliJ based IDE (here Phpstorm), works with JSON schema validation via https://www.schemastore.org/json/ .
Thanks @ktomk !
It works now!
image: maven:3.6.3-openjdk-11
definitions:
steps:
- step: &something
name: something
script:
- echo "step 1"
pipelines:
custom:
create-release:
- step: *something
branches:
develop:
- step: *something
release/*:
- step: *something
hotfix/*:
- step: *something
master:
- step: *something
pull-requests:
'**':
- parallel:
- step: *something
- step: *something
Thanks again @ktomk and @Theodora Boudale !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Claudenir,
Running parallel steps on pull-requests should be possible, it succeeds for me with a yml file like the following:
pipelines:
pull-requests:
'**':
- parallel:
- step:
script:
- echo "Step 1"
- step:
script:
- echo "Step 2"
Would it be possible for you to post here the whole content of your bitbucket-pipelines.yml file so I can check for any issues and try to reproduce this?
If you don't feel comfortable sharing this publicly, you can open a ticket with Bitbucket Cloud support team via https://support.atlassian.com/contact/#/ and ask for help with this issue. In "What can we help you with?" field select "Technical issues and bugs", then select Bitbucket Cloud as product.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Theodora,
For e.g.:
image: maven:3.6.3-openjdk-11
definitions:
steps:
- step: &something
name: something
script:
- echo "Step 1"
pipelines:
custom:
create-release:
- step: *something
branches:
develop:
- step: *something
master:
- step: *something
pull-requests:
'**':
- parallel:
- step:
script:
- echo "Step 1"
- step:
script:
- echo "Step 2"
Thanks in advance,
Claudenir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Claudenir,
Thank you for your reply and example.
As @ktomk correctly pointed out, this looks to be an issue with indentation.
Everything nested under - step: (like name:, script:) should have 4 spaces of indentation, instead of 2. (The commands under script: should still have 2 spaces)
Extra 2 spaces should be added for name:, script: in the definitions, and also in script: in the pull requests steps.
The reason that the validator doesn't show any errors is due to a bug when the yml files uses anchors:
Does this work for you with these indentation changes?
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.