BitBucket
In this section, you will learn how to configure your SCM integration with BitBucket.
To integrate your
Requirements
- You need a premium BitBucket account.
- Enable the two-step verification in your BitBucket account. To do this, go to:
- 'Personal BitBucket Settings > Two-step verification' > 'Enable'.
Configure your BitBucket Workspace OAuth consumer keys
Step 1. In BitBucket, click "Workspace Settings > OAuth consumers".
Step 2. Click on 'Add consumer'. Then fill out the following mandatory fields:
- Name;
- Callback URL and/or URL;
- Enable the option "This is a private consumer";
- Select the following fields in "Permissions":
Projects
[x] Write
[x] Admin
Repositories
[x] Write
[x] Admin
Pipelines
[x] Edit variables
At the end click on "Save".
You can delete the OAuth consumers configuration after executing the Action.
Configure pipelines automatically (Recommended)
You will follow the steps below via STK CLI. To automatically create pipelines, you need a repository. Check how to create a GitHhub repository.
Step 1. Open your terminal and clone the Action repository:
git clone https://github.com/stack-spot/stackspot-workflows-action.git
The content is saved inside your current folder.
Step 2. Go to your repository's folder you've cloned. Execute the command below:
cd stackspot-workflows-action
stk run action .
Step 3. The terminal asks what your SCM provider is. Select the BitBucket option.
Step 4. Answer the following questions:
- Project key: Add a name of your BitBucket project.
- Repository Name: Add your repository name.
- Workspace Name: Your BitBucket user name.
- Client Key: Add the key that is inside 'Workspace settings > 'OAuth consumers'.
- Client Secret: Add the secret that is inside 'Workspace settings > 'OAuth consumers', just below the 'Client Key'.
If the specified repository exists and the main
branch also exists in it, a Pull Request will be created for main
.
If the repository does not exist, the Action creates the repository and the main
branch.
If you still don’t have a project, go to the top menu on your BitBucket account and click on 'Create' > 'Create a project'.
Done! You just run the Action. You enabled the pipelines in your repository.
Step 5. Check your repository on BitBucket, in the 'Repository details' section. The pipelines are already configured. The variables were also created, you can check them on the 'Repository variables' section.
Now, you need to integrate SCM on Stackspot Platform. Follow the next steps.
Integrate BitBucket with StackSpot
You will follow the steps below on StackSpot Platform.
Step 1. Go to your StackSpot Account dashboard on the StackSpot Platform;
Step 2. On the left side menu, in the Settings section, click on 'SCM Integration'. Then click on 'Configure SCM Integration';
Step 3. On the 'Select a provider' field, choose BitBucket;
Step 4. On Authentication method, select PAT (Personal Access Token). Fill out the fields:
- Username: Your username on BitBucket;
- Token: Use the Personal Access Token you generated before.
Step 5. In 'Workflow configuration' choose how your organization wants to manage the SCM access. Answer the 'Will the organization manage access to the SCM via User PAT?' question:
- Enable the button next to the phrase. This is for the user to manage access to the SCM via PAT (Personal Access Token).
- Disable button: This is for the organization to manage the SCM access.
By enabling this button, your account members must configure their individual SCM Access.
Step 6. On the Workflow URL, add the created repository with the pipelines so StackSpot can identify where your workflow is configured. For example https://bitbucket.org/my-username/my-repo-runner-actions
.
Step 7. Check the Review screen. Check your information and click on 'Integrate with StackSpot'.
Done! Your configuration is complete!