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. Run the following command:
stk run action stackspot-core/setup-scm
Step 2. The terminal asks what your SCM provider is. Select the BitBucket option.
Step 3. 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'.
You've just run the Action. You enabled the pipelines in your repository.
Step 4. 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 directly to the Account Portal; or after logging into the StackSpot Portal, click on your profile avatar.
Step 2. Select the 'Organization' option from the displayed menu;
Step 3. In the Account Portal main menu, select the StackSpot EDP product and click on 'SCM'. Then click on 'Add SCM Integration';
Step 4. On the 'Select a provider' field, choose BitBucket;
Step 5. 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 6. 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 7. 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 8. Check the Review screen. Check your information and click on 'Integrate with StackSpot'.
Your configuration is complete!