Hi,
I'm trying to run, from my pipeline, a pipeline from other repo using the pipe "Trigger pipeline 0.3.0".
Both repositories belongs to a Team.
The pipe requires an app password which can not be generated for the team, so I've generated it in my own account with ALL the permissions checked (just for testing).
When I try to run the pipe I always get the following error:
DEBUG: https://api.bitbucket.org:443 "POST /2.0/repositories/TEAM/REPO/pipelines/ HTTP/1.1" 401 0
✖ API request failed with status 401. Check your account and app password and try again.
If I change the "account" parameter and set my user I have the same error:
DEBUG: https://api.bitbucket.org:443 "POST /2.0/repositories/MY_USER/REPO/pipelines/ HTTP/1.1" 401 0
✖ API request failed with status 401. Check your account and app password and try again.
I think it is maybe not using the right user for login.
Anyway, I think it would be better to use OAuth credentials over App passwords so it could be run over the team account and not in my personal one.
I've tried this from command line, with OAuth credentials for the Team account, and it seems to work properly:
apt update && apt -y install jq
ACCESS_TOKEN=$(curl -s -X POST -u "$BITBUCKET_OAUTH_KEY:$BITBUCKET_OAUTH_SECRET" https://bitbucket.org/site/oauth2/access_token -d grant_type=client_credentials | jq -r ".access_token")
curl -X POST -is -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" https://api.bitbucket.org/2.0/repositories/TEAM/REPO/pipelines/ -d '
{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
}
}'
I was able to run trigger-pipeline:3.0.0 with an individual account. This has different options than the 0.3.0 version you are using so maybe just moving to the latest may resolve your problem.
https://bitbucket.org/atlassian/trigger-pipeline/src/master/
+1 for the experiment with OAuth for the team account.
Hi @Iván Arias , thanks for your research and suggestion. We're currently considering adding support for using OAuth credentials in the pipe. So chances are that upcoming version will have it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alexander, I am having the same issue (error 401) on trigger-pipeline:4.2.1, using OAuth credentials. Does it work now by any chance?
Thank you in advance.
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.