Hi
We want trigger a BitBucket pipeline through another BitBucket pipeline. but our BitBucket repo restricted with VPN(we can access only through vpn)
Thank you for reaching out to the community.
When you trigger a Pipelines build from another Pipelines build, would it be possible for you to confirm if you're using the Pipes script atlassian/trigger-pipeline or you're using an API endpoint manually?
Regards,
Mark C
Hi @Mark C
we are using API endpoint
using below script we want to trigger another bitbucket pipeline
#!/bin/bash
client_id="XXXXYYYYZZZ
secret="xxxyyyzz"
access_token=`curl -X POST https://bitbucket.org/site/oauth2/access_token -d grant_type=client_credentials -u $client_id:$secret | jq '.access_token'`
curl -X POST -is -u $client_id:$secret \
-H "Authorization: Bearer $access_token" \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/xyz/ \
-d '{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
},
"variables": [
{
"key": "file",
"value": "testFile"
}
]
}'
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.
In your second CURL POST command, could you try removing the "-u $client_id:$secret" part?
curl -X POST -is -u $client_id:$secret \ ..........
I do believe it won't be necessary because you're using an authentication bearer (access token) in this case. After that, try it again.
If the issue still persists, you can try using the Pipes script atlassian/trigger-pipeline instead of using the CURL command.
Let me know how it goes.
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Mark C ,
I'm not able to trigger bitbucket pipeline from another bitbucket pipeline because of vpn restrictions.
How to achieve this task without removing vpn security
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @abhishek_singh
For us to further check, would you be able to share the error message you're getting when you try to use the CURL command and the Pipes script atlassian/trigger-pipeline?
Regards,
Mark C
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.