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

Running parallel steps on pull-requests

Claudenir Machado September 30, 2020

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:

Screenshot from 2020-09-30 20-15-57.png

Error to execute:

Screenshot from 2020-09-30 20-16-52.png

 

Thanks in advance.

2 answers

1 accepted

1 vote
Answer accepted
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2020

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.

Selection_080.png

bitbucket-pipelines.yml validation inside IntelliJ based IDE (here Phpstorm), works with JSON schema validation via https://www.schemastore.org/json/ .

Claudenir Machado October 7, 2020

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 !

Like Theodora Boudale likes this
0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 2, 2020

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

Claudenir Machado October 2, 2020

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

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 5, 2020

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

Like Claudenir Machado likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events