Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy at QA and Trigger Tests from Test repo unable to invoke the test

Elumalai_ Gopal July 23, 2025

This is the first time we are implementing Continous testing using bitbucket pipeline. We are getting compilation error while modifyiing bitbucket-pipelines.yml file of dev repo to trigger test from a different repo (test repo), the file that we are modifying has code like this

pipelines:
    custom:
    deploy to dev:
      import: repo-1:main:deploy_to_dev
    deploy to qa:
      import: repo-1:main:deploy_to_qa
We are trying to add the following values after the deploy to qa with proper indentation
      pipe: atlassian/trigger-pipeline:5.0.0
         variables:
            REPOSITORY: 'repo-2'
            REF_TYPE: 'branch'
            REF_NAME: 'release'
            CUSTOM_PIPELINE_NAME: 'custom: test on qa'
            PIPELINE_VARIABLES: >
               [{
                 "key": "TestType",
                 "value": "smoketest" }]
            DEBUG: "true"
The code is not compiling, Please suggest correct way to invoke the test repo as given above with compilation working. I am sure this is not new and most of the company has implemented this.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 25, 2025

Hi @Elumalai_ Gopal and welcome to the community!

Just a heads up, I edited the repo names from your post to protect your privacy. I'm going to use a numbered list to address issues:

1. Indentation like the following will work:

pipelines:
custom:
deploy to dev:
import: repo-1:main:deploy_to_dev
deploy to qa:
import: repo-1:main:deploy_to_qa

Spaces need to be used for indentation, not tabs.

 

2. Is the pipe part of the custom pipeline "deploy to qa"? If so, this is not supported at the moment. Additional steps or commands cannot be added to an imported pipeline. We have a feature request here https://jira.atlassian.com/browse/BCLOUD-22855 for sharing steps between different repos, this would allow you to import a step only and then add a second step.

The available options now are:

(a) You could add this pipe in a separate custom pipeline, different than "deploy to qa".
(b) You could look into dynamic pipelines for sharing a step: https://community.atlassian.com/forums/Forge-for-Bitbucket-Cloud/Share-a-step-across-pipelines-Dynamic-Pipelines/ba-p/2712403
(c) You could add the pipe to the definition of "deploy to qa", in the repo where you are doing the export.
(d) You could omit the import for 'deploy to qa' and just define the step and script without importing, so you can add the pipe as an additional command.

 

3. With regards to the pipe definition:

(a) I recommend using the latest version of the pipe, which is 5.10.1 at the moment.
(b) You need to provide authentication details to the pipe, either with the variable BITBUCKET_ACCESS_TOKEN or with the variables ATLASSIAN_ACCOUNT_EMAIL and ATLASSIAN_API_TOKEN. Please see the README.md file in the pipe's repo: https://bitbucket.org/atlassian/trigger-pipeline/src/master/ (if you scroll down, you will see the README.md)
(c) in the value of the variable CUSTOM_PIPELINE_NAME, you need to remove the part "custom: ", UNLESS this is also part of the custom pipeline's name.

If the definition of the custom pipeline in repo2 looks like this:

pipelines:
custom:
test on qa:
- variables:
- name: TestType
- step:
script:
- echo "This is test on qa pipeline"

Then you need to use CUSTOM_PIPELINE_NAME: 'test on qa' in the pipe.

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Elumalai_ Gopal July 25, 2025

Thanks a lot for all the suggestions. Could you please provide a custom code on how to trigger a test from a destination repo (test), if the pipeline is already implemented in source repo (dev) as standard.

pipelines:
custom:
deploy to dev:
import: repo-1:main:deploy_to_dev
deploy to qa:
import: repo-1:main:deploy_to_qa

the destination repo details are as follows:

  repo:  'url to repo' 
  branch: 'release'
  pipelineName: 'custom: test on qa'
  testType: smoketest
Appreciate, we are blocked right now
Elumalai_ Gopal July 25, 2025

Please note the destination repo also has bitbucket-pipelines.yml file with the same entries

pipelines:
custom:
deploy to dev:
import: repo-1:main:deploy_to_dev
deploy to qa:
import: repo-1:main:deploy_to_qa
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2025

Hi @Elumalai_ Gopal ,

Let's assume you have this custom pipeline in the source repo:

pipelines:
  custom:
  test on qa:
- variables:
- name: TestType
- step:
script:
- echo "This is test on qa pipeline, $TestType"

In the destination repo, you can add another custom pipeline, that will trigger the custom one from the source repo:

pipelines:
custom:
deploy to dev:
import: repo-1:main:deploy_to_dev
deploy to qa:
import: repo-1:main:deploy_to_qa
trigger-pipeline-in-repo-1:
- step:
script:
- pipe: atlassian/trigger-pipeline:5.10.1
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
REPOSITORY: 'repo-1'
REF_TYPE: 'branch'
REF_NAME: 'release'
CUSTOM_PIPELINE_NAME: 'test on qa'
PIPELINE_VARIABLES: >
[{
"key": "TestType",
"value": "smoketest" }]
DEBUG: "true"

This is implemented as a separate custom pipeline in the destination repo (option (a) from the options I provided in my previous reply).

For the $BITBUCKET_ACCESS_TOKEN, you will need to generate a repository access token in the source repo (repo-1) from Repository settings > Access tokens that has Pipelines Write and Repositories Read permissions. Then, in the destination repo, you will need to go to Repository settings > Repository variables, create a secured variable named BITBUCKET_ACCESS_TOKEN with value the access token you created earlier. You need to have admin permissions to both repos to generate the access token and then create the variable.

If you still experience issues, you can also create a ticket with the support team for faster help. You can create a ticket via https://support.atlassian.com/contact/#/, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. When you are asked to provide the workspace URL, please make sure you enter the URL of the workspace that is on a paid billing plan to proceed with ticket creation. Please make sure you provide the URL of a failed build or the URL or the URL of the yml that is not compiling, so my colleagues can help you faster (anything you post in the ticket won't be publicly visible).

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Elumalai_ Gopal July 30, 2025
Elumalai_ Gopal July 31, 2025

The suggestions given so far are not working. 

We need to have a way to call two pipelines at once.

THe first one will be to custom deployment pipeline which contains import and the second one will be calling test execution in steps.

Currently we are facing challenges in combining two pipeline to perform continous testing calling "deploy and test in qa"

pipelines:
custom:
deploy to dev:
import: bap-tpal-cxd-appe:main:deploy_code_dev
deploy to qa:
import: bap-tpal-cxd-appe:main:deploy_code_qa
deploy and test in qa:
#- step:
# type: pipeline
# name: "Run QA deployment"
# custom: deploy to qa
- step:
type: pipeline
name: "Run functional test in qa"
custom: test in qa
test in qa:
- step:
name: "Run Smoke Tests"
script:
- name: "Trigger QA Smoke Test"
pipe: atlassian/trigger-pipeline:5.10.1
variables:
REPOSITORY: 'searchdataservice'
REF_TYPE: 'branch'
REF_NAME: 'release'
CUSTOM_PIPELINE_NAME: 'custom: test on qa'
PIPELINE_VARIABLES: >
[{
"key": "TestType",
"value": "smoketest"
}]
DEBUG: "true"

The error we got is

Failed

There is an error in the imported bitbucket-pipelines.yml file. Child pipelines cannot contain deployment steps. Please remove them from the child pipeline. So combining deployment and running tests after deployment does not work.

Is there a better solutions. I started feeling  Bitbucket is not having a good solution for this, and this is a basic solution to support Continuous testing and unable to make progress. If there is a suggestion please provide model code for implementation.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 1, 2025

Hi @Elumalai_ Gopal,

You're absolutely right, I missed the option of parent/child pipelines.

The specific error you mentioned indicates that you are using a deployment with a child pipeline, which is not supported as per the blog post you shared, https://www.atlassian.com/blog/bitbucket/introducing-parent-child-pipelines.

It is not clear to me though from the second sample yml you shared where exactly the deployment exists and which line gives this error.

Since your pipeline involves imports and different repos, I recommend creating a ticket with the support team for better help. If we have an open support ticket, the engineer working on it will be able to see your configuration across the different repos and make a better suggestion.

You can create a ticket via https://support.atlassian.com/contact/#/, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. When you are asked to provide the workspace URL, please make sure you enter the URL of the workspace that is on a paid billing plan to proceed with ticket creation. Please make sure you provide the URL of a failed build or the URL or the URL of the yml that is not compiling, so my colleagues can help you faster (anything you post in the ticket won't be publicly visible).

Kind regards,
Theodora

Elumalai_ Gopal August 1, 2025

The Code syntax is here:

    deploy to dev:
      import: repo-1:main:deploy_code_dev
    deploy to qa:
      import: repo-1:main:deploy_code_qa
    deploy and test in qa:
      - step:
          type: pipeline
          name: "Run QA deployment"
          custom: deploy to qa
      - step:
          type: pipeline
          name: "Run functional test in qa"
          custom: test in qa
    test in qa:
      - step:
          name: "Run Smoke Tests"
          script:
            - name: "Trigger QA Smoke Test"
              pipe: atlassian/trigger-pipeline:5.0.0
              variables:
                REPOSITORY: 'repo-2'
                REF_TYPE: 'branch'
                REF_NAME: 'release'
                CUSTOM_PIPELINE_NAME: 'custom: test on qa'
                PIPELINE_VARIABLES: >
                  [{
                    "key": "TestType",
                    "value": "smoketest"
                  }]
                DEBUG: "true"
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 4, 2025

Hi,

I checked the sample yml file you provided. I can only give advice based on what I see in this yml, and the advice may be limited, considering I cannot see the pipelines definitions in all the repos you reference in this file.

1) Regarding this error:

Failed
There is an error in the imported bitbucket-pipelines.yml file. Child pipelines cannot contain deployment steps. Please remove them from the child pipeline. So combining deployment and running tests after deployment does not work.

I assume this comes when you try to run the custom pipeline deploy and test in qa, since it is the only one with child pipelines.

The first child step of this pipeline points to custom: deploy to qa, which in turn imports the pipeline repo-1:main:deploy_code_qa.

Does the pipeline deploy_code_qa in branch main of repo1, have the deployment keyword? If so, you will not be able to use it as a child pipeline. As mentioned in the blog post, deployment are not supported in child pipelines.

You can use environments, along with concurrency groups:

Keep in mind though that with environments and concurrency groups, the pipeline will not show in the Deployments page of the repo.

If the definition of the pipeline deploy_code_qa in branch main of repo1 looks like this:

definitions:
pipelines:
deploy_code_qa:
- step:
deployment: QA
script:
- echo "This is deploy_code_qa"

Then, you can adjust it to something like this:

definitions:
pipelines:
deploy_code_qa:
- step:
concurrency-group: QA
environment: QA
script:
- echo "This is deploy_code_qa"

The value in environment must match a deployment environment, and the value in concurrency-group is an abritrary string, that will be used for concurrency control.

 

2) The variables in the pipe need to be adjusted.

There are no authentication details in the pipe. The version of the pipe you use is quite old, I recommend using the latest version 5.10.1 and an access token for authentication.

You will need to generate an access token in repo-2 (from Repository settings > Access tokens) with Pipelines Write and Repositories Read permissions. Then, create a repository variable in the repo where you have this yml (from Repository settings > Repository variables), and store the access token.

IF the name of the custom variable in repo-2 is test on qa, then you need to use only that as CUSTOM_PIPELINE_NAME.

Additionally, the name: "Trigger QA Smoke Test" part above the pipe definition will not have any effect.

You can adjust this step as follows:

test in qa:
- step:
name: "Run Smoke Tests"
script:
- pipe: atlassian/trigger-pipeline:5.10.1
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
REPOSITORY: 'repo-2'
REF_TYPE: 'branch'
REF_NAME: 'release'
CUSTOM_PIPELINE_NAME: 'test on qa'
PIPELINE_VARIABLES: >
[{
"key": "TestType",
"value": "smoketest"
}]
DEBUG: 'true'

Kind regards,
Theodora

Like Elumalai_ Gopal likes this
Elumalai_ Gopal August 4, 2025

 

The first pipeline to "deploy to qa" is not clear to me.

The second pipeline "test in qa" is clear and we can adjust to include authentication and version number.

Is this the recommendation?

 deploy to dev:
      import: repo-1:main:deploy_code_dev
deploy to qa:
- step:
concurrency-group: QA
environment: QA
script:
- echo "This is deploy_code_qa"
    deploy and test in qa:
      - step:
          type: pipeline
          name: "Run QA deployment"
          custom: deploy to qa
      - step:
          type: pipeline
          name: "Run functional test in qa"
          custom: test in qa
  test in qa:
- step:
name: "Run Smoke Tests"
script:
- pipe: atlassian/trigger-pipeline:5.10.1
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
REPOSITORY: 'repo-2'
REF_TYPE: 'branch'
REF_NAME: 'release'
CUSTOM_PIPELINE_NAME: 'test on qa'
PIPELINE_VARIABLES: >
[{
"key": "TestType",
"value": "smoketest"
}]
DEBUG: 'true'

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

Hi Elumalai,

The first pipeline to "deploy to qa" is not clear to me.

My feedback on this first pipeline concerned this error:

Failed
There is an error in the imported bitbucket-pipelines.yml file. Child pipelines cannot contain deployment steps. Please remove them from the child pipeline. So combining deployment and running tests after deployment does not work.

This error meant there was a child pipeline with a deployment step, which is not supported.

In the yml you gave me on 1st August here, the only pipeline with child pipelines was this:

deploy and test in qa:
- step:
type: pipeline
name: "Run QA deployment"
custom: deploy to qa
- step:
type: pipeline
name: "Run functional test in qa"
custom: test in qa

This has two children pipelines. The second of these children, custom: test in qa, is defined in the yml you gave me. It is the one calling the pipe atlassian/trigger-pipeline. It doesn't have the deployment keyword, so this is not the one causing this error.

So, we have to look at the first child, custom: deploy to qa. In the yml you gave me, this is defined as:

deploy to qa:
import: repo-1:main:deploy_code_qa

So, if you open repo-1 (on Bitbucket's website), look at the source code on the main branch, and open the bitbucket-pipelines.yml on that branch, you should see a pipeline definition for deploy_code_qa. Does this one have a step with the deployment keyword?

If so:

1) Instead of having this:

deploy to qa:
import: repo-1:main:deploy_code_qa

You can omit the import, define the step in the current yml and use the concurrency-group and environment like you shared in your last reply:

deploy to qa:
- step:
concurrency-group: QA
environment: QA
script:
- echo "This is deploy_code_qa"

 

2) If you want to keep the import statement, you would need to use the concurrency-group and environment in the deploy_code_qa pipeline of repo1 (on the main branch).

Does this make sense?

Kind regards,
Theodora

Elumalai_ Gopal August 5, 2025

Thanks Theodora,

I am out of station, I will try this one after I come back on Aug 18.

Thanks Again

Gopal

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 6, 2025

You are very welcome, Gopal.

Sure, please feel free to reach out when you have a chance to look into it.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events