> For the complete documentation index, see [llms.txt](https://docs.xygeni.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xygeni.io/xygeni-administration/platform-administration/integrations/integrate-scanner-cli-into-ci-cd-systems/bitbucket-integration.md).

# BitBucket Integration

### Introduction <a href="#introduction" id="introduction"></a>

`BitBucket` is a Git-based source code repository hosting service owned by Atlassian. It provides runners that allows you to run builds in Pipelines on your own infrastructure.

{% hint style="info" %}
The following configuration examples show how to install & run the scanner using an API Token stored as a secret named `XYGENI_TOKEN`. See [Generate Xygeni API Token for Scanner](/xygeni-administration/platform-administration/profile.md#generate_token_for_scanner-1) or ask your Xygeni administrator to generate it.

For registering a new secret in BitBucket, see [Variables and secrets](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/).
{% endhint %}

### Using the installation script

You may automatically install the scanner using the bootstrap script available from `https://get.xygeni.io/latest/scanner/get-xygeni.sh` for bash, or `https://get.xygeni.io/latest/scanner/get-xygeni.ps1` for PowerShell.

The script downloads the scanner, verifies its SHA-256 checksum and unpacks it into `$HOME/.xygeni` (pass a directory as the first argument to install elsewhere). Verify the script itself against its published checksum before running it, as shown below.

The scanner needs `Java 17 or higher` on the agent, and reads your API token from the `XYGENI_TOKEN` environment variable.

```yaml
pipelines:
  default:
    - parallel:
      - step:
          name: 'Install & run Xygeni scanner'
          script:
            - >
              curl -sSfL -o get-xygeni.sh https://get.xygeni.io/latest/scanner/get-xygeni.sh &&
              curl -sSfL -o get-xygeni.sh.sha256 https://raw.githubusercontent.com/xygeni/xygeni/main/checksum/latest/get-xygeni.sh.sha256 &&
              echo "$(cat get-xygeni.sh.sha256)  get-xygeni.sh" | sha256sum -c - &&
              bash get-xygeni.sh
            - $HOME/.xygeni/xygeni scan -n $PROJECT_NAME --dir $PROJECT_HOME
```

{% hint style="info" %}
Please refer to the [scanner documentation](/xygeni-scanner-cli/xygeni-cli-overview.md) for full details on the scanner command line options and configuration.
{% endhint %}

### Using the docker image <a href="#using_the_docker_image" id="using_the_docker_image"></a>

If it is not possible to install the scanner in the `BitBucket` host running the pipeline, you may run the docker image instead:

```linenums
pipelines:
  default:
    - parallel:
      - step:
          name: 'Install & run Xygeni scanner'
          script:
            - >
              docker run
                -v $PROJECT_HOME:/app
                -v $DD_CONF:/opt/xygeni_scanner/conf
                -t -rm
                xygeni_scanner/xygeni scan
                -n $PROJECT_NAME --dir /app
```

{% hint style="info" %}
See [Xygeni Scanner docker image](/xygeni-scanner-cli/xygeni-cli-overview/xygeni-cli-docker-image.md) for more details.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.xygeni.io/xygeni-administration/platform-administration/integrations/integrate-scanner-cli-into-ci-cd-systems/bitbucket-integration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
