Connect Bitbucket Cloud with OAuth
You can enable users to work with a remote Git repository that is hosted in the Bitbucket Cloud:
-
Set up an OAuth consumer (OAuth 2.0) in the Bitbucket Cloud.
-
Apply an OAuth consumer Secret for the Bitbucket Cloud.
Create an OAuth consumer in the Bitbucket Cloud
Create an OAuth consumer in the Bitbucket Cloud so that Che can authenticate your developers and provide credential-free access to Bitbucket Cloud repositories.
-
You are logged in to the Bitbucket Cloud.
-
Click your avatar and go to the All workspaces page.
-
Select a workspace and click it.
-
Go to .
-
Enter Che as the Name.
-
Enter
https://<che_fqdn>/api/oauth/callbackas the Callback URL. -
Under Permissions, check all of the Account and Repositories checkboxes, and click Save.
-
Expand the added consumer and then copy and save the Key value for use when applying the Bitbucket OAuth consumer Secret:
-
Copy and save the Secret value for use when applying the Bitbucket OAuth consumer Secret.
Connect Che to your Bitbucket Cloud OAuth consumer
Connect Che to your Bitbucket Cloud OAuth consumer so that developers can access Bitbucket Cloud repositories from workspaces without re-entering credentials.
-
You have configured the OAuth consumer in the Bitbucket Cloud.
-
You have the following values, which were generated when configuring the Bitbucket OAuth consumer:
-
Bitbucket OAuth consumer Key
-
Bitbucket OAuth consumer Secret
-
-
An active
kubectlsession with administrative permissions to the destination Kubernetes cluster. See Overview of kubectl.
-
Prepare the Secret:
kind: Secret apiVersion: v1 metadata: name: bitbucket-oauth-config namespace: eclipse-che (1) labels: app.kubernetes.io/part-of: che.eclipse.org app.kubernetes.io/component: oauth-scm-configuration annotations: che.eclipse.org/oauth-scm-server: bitbucket type: Opaque stringData: id: <Bitbucket_Oauth_Consumer_Key> (2) secret: <Bitbucket_Oauth_Consumer_Secret> (3)1 The Che namespace. The default is eclipse-che.2 The Bitbucket OAuth consumer Key. 3 The Bitbucket OAuth consumer Secret. -
Apply the Secret:
$ kubectl apply -f - <<EOF <Secret_prepared_in_the_previous_step> EOF
-
Verify that the output displays
secret/bitbucket-oauth-config created.