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"
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
Interesting..!
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.