Skip to content

Commit

Permalink
Issue jenkinsci#316 add oauth config example
Browse files Browse the repository at this point in the history
  • Loading branch information
cverbiest committed Jan 20, 2024
1 parent e6cc1be commit f98f7ea
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ _Please note: the branch, related to the events which trigger the builds, must b
|---------------------|:---------|:----------|:-----------------------|----------------------------------------------------------------------------------------------------------------------|
| Username & Password | X | X | Username with password | deprecated by bbc, will be removed in march 2022 |
| HTTP access token | - | X | Secret Text | [learn more about HTTP tokens](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html) |
| OAuth consumers | X | - | Secret Text | [learn more about Oauth Consumers](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/) |
| OAuth consumers | X | - | Secret Text | [Oauth Consumers example config](./docs/oauth_config.md) |

1. you can set globally the credentials used by the plugin for the state notification
2. you can set for each job the credentials used by the plugin for the state notification, overwriting the global credentials
Expand Down
Binary file added docs/img/bitbucket_oauth2_client.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/bitbucket_oauth2_keyandsecret.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/jenkins_job_trigger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/jenkins_oauth_secret.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ TYPE | BB CLOUD | BB SERVER | JENKINS CREDENTIALS | NOTES
--- | :-- | :--- | :--- | ---
Username & Password | X | X | Username with password| deprecated by bbc, will be removed in march 2022
HTTP access token | - | X | Secret Text | [learn more about HTTP tokens](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html)
OAuth consumers | X | - | Secret Text | [learn more about Oauth Consumers](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)
OAuth consumers | X | - | Secret Text | [Oauth configuration](./oauth_config.md)

1. you can set globally the credentials used by the plugin for the state notification
2. you can set for each job the credentials used by the plugin for the state notification, overwriting the global credentials
Expand Down
36 changes: 36 additions & 0 deletions docs/oauth_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

## Warning
This info is not created by the maintainer of the package. It is how I got it working by trial, error and looking at the code

## Background
* [Atlassian support page about Oauth Consumers](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)

## Steps

### Create bitbucket.org oauth client

* go to https://bitbucket.org/yourorganisation/workspace/settings/api (cogwheel -> workspace settings -> oauth consumer)
* Add private consumer

![example consumer](./img/bitbucket_oauth2_client.png)
* Expand the consumer to show key and secret

![consumer key and secret](./img/bitbucket_oauth2_keyandsecret.png)

### Create Jenkins credential

* go to jenkins credential manager https://jenkinsurl/manage/credentials/store/system/domain/_/
* Add credential
* Type : Secret text
* Secret : the Secret from bitbucket oauth consumer
* ID : the Key from bitbucket oauth consumer
* Description :

![jenkins credential](./img/jenkins_oauth_secret.png)

### Jenkins Job config

Use the credential in the `Build with Butbucket Push and Pull Request Plugin` trigger

![jenkins credential](./img/jenkins_job_trigger.png)

0 comments on commit f98f7ea

Please sign in to comment.