Module that leverages GitLab CI webhooks to send traces to Instana.
Prereqs:
- Python
3.x
: - Instana agent running on VM running this python module.
- Populate a
config.yaml
file with required GitLab (and, if applicable, AWX credentials):cat <<EOF > config.yaml gitlab: url: https://gitlab.example.com/ api-token: <GITLAB_PERSONNAL_ACCESS_TOKEN> awx: url: http://awx.example.com user: <AWX_USERNAME> password: <AWX_PASSWORD> EOF
- Run the module:
export INSTANA_DISABLE_AUTO_INSTR=true python3 pip install -r requirements.txt python3 main.py
- Edit the
k8s-resources.yaml
file to add required GitLab and, if applicable, AWX credentials:# k8s-resources.yaml ... apiVersion: v1 kind: Secret metadata: name: instana-gitlab-ci-observer-config namespace: instana-gitlab-ci-observer type: Opaque stringData: config.yaml: | gitlab: url: https://gitlab.example.com # CHANGEME api-token: gitlab-pat # CHANGEME awx: url: http://awx.example.com # CHANGEME user: admin # CHANGEME password: adminPassword # CHANGEME ...
- Note to create the GitLab personnal access token, navigate to your gitlab instance, click your user profile on the top right, then Preferences > Access Tokens, select the scope
read_api
then click Create personnal access token.
- Note to create the GitLab personnal access token, navigate to your gitlab instance, click your user profile on the top right, then Preferences > Access Tokens, select the scope
- Deploy the module by applying the resources:
kubectl apply -f k8s-resources.yaml
- Add the webhook on your GitLab instance:
- Add the webhook on your AWX instance:
- Naviage to the Notifications in your AWX instance:
- Click Add:
- Chose notification name, type Target URL
http://instana-gitlab-ci-observer:instana-gitlab-ci-observer:8088/awx
, chose Webhook as notification type then click Save: - Navigate to Templates, select your Ansible template, go to Notifications tab and enable notification webhook for that template (success and failure):
- Finally, run the pipeline in GitLab:
- When pipeline ends, you will see the trace in Instana: