Helllo guys,
We have several integrations with Bitbucket API and we would like to use Pipelines to automate some tasks.
In order to do that, we need a Pipeline API that should:
Do you have plans for that?
Community moderators have prevented the ability to post new answers.
Hello,
Just to follow up, the REST API has been released.
Information can be found here: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pipelines
Thanks,
Phil
Hi @PravinU, unfortunately we currently don't have a public REST endpoint available to achieve this. What exactly is your use case for this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jeroen De RaedtI'm trying to create an automated process which takes some inputs and changes bitbucket pipeline envvars as a result, it's a CI type solution, can I do this from outside the application? Say in a shell script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Louis Willcock,
there are REST endpoints available to create variables:
Obviously you can invoke these endpoints as part of a shell script or something.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jeroen De RaedtCheers for the links, one thing that has been baffling me is being able to actually access the API's, for example authing and whatnot, I dunno if I'm just being a noob but I can't wrap my head around how to actually get anything back off them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What exactly is your use case?
If you are setting up some kind of automation, I recommend using an App password: https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication#app-pw
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jeroen De RaedtGot my main issue sorted now, however another question for you would be whether I can force updates on POST for config variables when they already exist, or whether I have to use the PUT api instead? I have noticed there is an answer to a very similar question underneath this one, but I guess I'm wondering if there's a cleaner solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alternatively you could do a DELETE and then a POST but that's a bit more cumbersome.
Out of curiosity, what are you trying to accomplish?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why are the docs for pipelines currently empty?
They had content for sure two months ago. The API still works though and the swagger spec has them too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ward Loos Good catch! I've opened an internal ticket to get that looked into. You can follow the public ticket here: https://bitbucket.org/site/master/issues/18981/pipelines-and-pipelines_config-rest-api
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Joao,
We've almost completed work for the Bitbucket Pipelines REST API. The API, and all its core functionality is done. It is still currently undocumented and there are possibly some small modifications to be made. But, you can try out the API now!
Our UI makes use of the API (have a look at the Logs Page, Pipelines Page, and Pipelines Settings pages), so you can look at the network traffic to determine the usage.
You can watch this issue to get notified when we complete the remaining work (and officially release the API). https://bitbucket.org/site/master/issues/13116/add-pipelines-endpoint-to-rest-api
As a world of warning, since we haven't officially released it yet. Consider the API to still be volatile to changes. But try it out, and know that it's on the way!
Thanks,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sometimes when i am calling
curl -X GET -s -u usr:pwd -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/<owner>/<repo>/pipelines/<uuid>/steps/
i am getting error
{"error": {"message": "Bad request", "data": {"arguments": {}, "key": "rest-service.rest-service.invalid-state"}, "detail": "Invalid state provided 'READY'"}}
but the next call to the same url is responding with OK and expected data.
that happens , probably, because i am trying to get steps of a pipeline that is in running state.
Any ways to fix that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is indeed a weird error. Is still happening now, or has it been resolved?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello there!
I have checked out the API available for Bitbucket Pipelines, but haven't found there a way to change environment variables using the API. Are these methods available?
Basically I would like to implement a hack to update env vars every 12 hours with new username and password information to be able to get my private docker images from AWS ECR service.
See question 39136149 for more details about this hack.
Slava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Slava,
I've did something like this. All commands bellow are part of pipeline script.
# Get current release version from Pipelines environment variable - export RELEASE_VERSION=`curl -s -X GET --user "$BB_AUTH_TOKEN" "https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/pipelines_config/variables/" | sed 's/"{//g' | sed 's/}"//g' | sed 's/[{]/{\'$'\n/g' | sed 's/[}]/\'$'\n}/g' | awk "/RELEASE_VERSION/ {print $1}" | sed 's/"//g' | sed 's/value:\ //g' | awk -F', ' '{print $1}'` - export RELEASE_VAR_UUID=`curl -s -X GET --user "$BB_AUTH_TOKEN" "https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/pipelines_config/variables/" | sed 's/"{//g' | sed 's/}"//g' | sed 's/[{]/{\'$'\n/g' | sed 's/[}]/\'$'\n}/g' | awk "/RELEASE_VERSION/ {print $1}" | sed 's/"//g' | sed 's/uuid:\ //g' | awk -F', ' '{print $4}'` # Increment release version and update Piplines environment variable RELEASE_VERSION to increased value - export RELEASE_VERSION="${RELEASE_VERSION%.*}.$((${RELEASE_VERSION##*.}+1))" - curl -s -X PUT curl -H 'Content-Type:application/json' --user "$BB_AUTH_TOKEN" -d '{"value":"'"$RELEASE_VERSION"'"}' "https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/pipelines_config/variables/%7B$RELEASE_VAR_UUID%7D"
Hope it will useful for you.
Cheers,
Artem
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.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.