Source control (Gitlab/Github)

Enrich traces with relevant source control metadata.

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

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.

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"

Step 1 - Adding the annotations

Add the following annotations to the pod template spec:

<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:

groundcover deploy \
    --git-commit-hash-key-name <COMMIT_HASH_KEY_NAME> \
    --git-repository-url-key-name <FULL_REPO_URL_NAME>

## example
groundcover deploy \
    --git-commit-hash-key-name "GITHUB_COMMIT_HASH" \
    --git-repository-url-key-name "GITHUB_REPO_URL"

Using Helm

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

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

Last updated