BitBucket pipeline variable passing

Sumit Tyagi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 1, 2025

Hi Everyone...

am passing the custom jira variable to trigger the bitbucket pipeline from jira.... 
below is the payload: 

{ "target": { "ref_type": "branch", "type": "pipeline_ref_target", "ref_name": "main" }, "variables": [ { "key": "EXECUTION_ID", "value": "{{issue.key}}" }, { "key": "DEVICE_ID", "value": "{{issue.fields.customfield_10041}}" }, { "key": "TEST_LAB", "value": "{{issue.fields.customfield_10042}}" }, { "key": "DEVICE_TYPE", "value": "{{issue.fields.customfield_10040}}" } ] }

======================
now my bitbucket pipeline gets triggered but unable to access these variables

below is the yml file


pipelines:
default:
- step:
name: Run Appium Tests
caches:
- pip # Cache pip dependencies to avoid re-installing them every time
script:
- printenv
- env | sort
- echo "DEBUG Execution id is $EXECUTION_ID"
- echo "DEBUG DeviceType id is $DEVICE_ID"
- pip3 install -r requirements.txt
- python runner.py --test_execution_id=$EXECUTION_ID --deviceType=$DEVICE_TYPE --env "test" --jira_flag "true"

2 answers

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

Hi Sumit and welcome to the community!

Variables that are manually provided before the pipeline runs are only supported for custom pipelines, not for the default, branches, pull-requests, or tags pipelines.

This is the documentation on custom pipelines:

In the section Custom (manual) pipeline variables you will see an example of how to define a custom pipeline with variables that can be provided when the pipeline is triggered.

If you want to keep the default definition in your yml file for automated builds, you can add a custom pipeline as well with the same script and with the variables definitions. Please ensure you do this in the yml file of the branch you want to trigger the pipeline for.

On the following link you can see the data that needs to be provided when triggering a custom pipeline with variables via API:

Please feel free to reach out if you have any questions!

Kind regards,
Theodora

0 votes
Hari Babu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 2, 2025

Interesting..!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events