Implement semantic version on windows developement for python
Asked by Marcel:

I'm developing a python project within windows and would like to implement a semantic versioning numbering.

I red:

<https://stackoverflow.com/questions/50371555/how-to-go-about-implementing-semantic-versioning-with-bitbucket-pipelines-and-br>

and some other blogs / articles but do not get it correctly

Currently I follow :

<https://support.atlassian.com/bitbucket-cloud/docs/set-a-new-value-for-the-pipelines-build-number/#Updating-the-Pipelines-build-number>

I have curl running onder windows and I'm doing command

curl -v -H "Content-Type: application/json" -XPUT -d "{'next': 2.1 }" --user "u:p" --url "<https://api.bitbucket.org/2.0/repositories/>\<workspace-id\>/\<repo-slug\>/pipelines_config/build_number"

The response is an error in authentication. Following the article:

<https://support.atlassian.com/bitbucket-cloud/docs/log-into-or-connect-to-bitbucket-cloud/>

I need to create an app password which I did with the following : repositires admin, pull request write, pipelines edit variabled

Then run the command:

curl -v -H "Content-Type: application/json" -XPUT -d "{'next': 2.1 }" --user "test3:XXX" --url "<https://api.bitbucket.org/2.0/repositories/>\<workspace-id\>/\<repo-slug\>/pipelines_config/build_number"

But still I do have an error on username password.

Also: when I try to run the curl in with my atlassion credentials then the result is

Your credentials lack one or more required privilege scopes.", "detail": {"required": \["pipeline:variable"\], "granted": \["pullrequest:write"\]}}}

Any suggestion what to do to get this running?


Answers:
author: Theodora Boudale
body: Hi [@Marcel](/t5/user/viewprofilepage/user-id/5072578) and welcome to the community!

I am not really sure how semantic versioning is related to the API call you are using.

The following endpoint you are using updates the next build number that should be assigned to a pipeline, if you are using Bitbucket Pipelines:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#api-repositories-workspace-repo-slug-pipelines-config-build-number-put>

Please note that Pipelines build numbers are integers, so you cannot assign to a build number a value like '2.1'.

* Are you using Bitbucket Pipelines for this repo?
* And could you perhaps explain how semantic versioning numbering is related to updating the next build's number?

A few things I noted regarding your API call:

**(1)** When you give credentials with

```
--user "test3:XXX"
```

the part **test3** should be the username of the Bitbucket account you generated this app password for.  
It should not be the label of the app password (this is a common mistake I see).

The username of the account can be found here <https://bitbucket.org/account/settings/> after you log in to the account.  
Please ensure you are using the correct one.

**(2)** The part **XXX** should be an app password with at least **Pipelines: Edit variables** permissions. The account's password cannot be used, only an app password.

Please make sure you use the correct username, and if you still see the same error ("Your credentials lack one or more required privilege scopes") generate a new app password with at least **Pipelines: Edit variables** permissions.

**(3)** In the data part:

```
-d "{'next': 2.1 }"
```

The build number needs to be an integer, you cannot use a number like 2.1

Additionally, the "next" parameter needs to be within double quotes, you can adjust the data as follows:

```
-d '{"next": 30 }'
```

where 30 you can replace with any integer higher than the current latest build number for this repository.

<br />

Just a heads up, I will remove the workspace-id and repo name from your post to comply with our privacy policy.

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud