# Adding Source control context

groundcover can integrate with your git repository, giving you more context when analyzing your workloads.

By enabling git integration, workload traces will be enriched with the workload's commit hash, and with a link to the commit in your git repository.

Currently, groundcover supports Github and Gitlab.

## How to use

The integration requires 2 steps:

1. Adding annotations to spec of pods
2. Providing installation overrides describing the chosen annotation names

{% hint style="info" %}
We will be using 2 annotations - **Commit Hash** and **Remote Repository URL.**

Note that the commit hash can also be specified as a label. However, due to Kubernetes restrictions on labels patterns, the repository URL must be added as an annotation.
{% endhint %}

{% hint style="info" %}
The names of the annotations do not matter, but make sure to keep them consistent between the two parts. The names are referenced below as **COMMIT\_HASH\_KEY\_NAME** and **FULL\_REPO\_URL\_NAME.**\
\
In our example we will be using:\
COMMIT\_HASH\_KEY\_NAME -> "GITHUB\_COMMIT\_HASH"\
FULL\_REPO\_URL\_NAME -> "GITHUB\_REPO\_URL"
{% endhint %}

### Step 1 - Adding the annotations

Add the following annotations to the pod template spec:

```bash
<COMMIT_HASH_KEY_NAME>: <COMMIT_HASH>
<FULL_REPO_URL_NAME>: <FULL_REPO_URL>

## example
GITHUB_COMMIT_HASH: 6b14c88
GITHUB_REPO_URL: https://github.com/groundcover-com/cli
```

### Step 2 - Providing installation overrides

#### Using CLI

When using CLI it's possible to provide the values directly from the command line:

<pre class="language-bash"><code class="lang-bash">groundcover deploy \
<strong>    --git-commit-hash-key-name &#x3C;COMMIT_HASH_KEY_NAME> \
</strong>    --git-repository-url-key-name &#x3C;FULL_REPO_URL_NAME>

## example
groundcover deploy \
    --git-commit-hash-key-name "GITHUB_COMMIT_HASH" \
    --git-repository-url-key-name "GITHUB_REPO_URL"
</code></pre>

#### Using Helm

When using Helm the values will be passed as overrides in the `values.yaml` file:

```yaml
commitHashKeyName: <COMMIT_HASH_KEY_NAME>
repositoryUrlKeyName: <FULL_REPO_URL_NAME>
 
## example
commitHashKeyName: "GITHUB_COMMIT_HASH"
repositoryUrlKeyName: "GITHUB_REPO_URL"
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.groundcover.com/customization/customize-deployment/source-control-gitlab-github.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
