Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 4e1927e

Browse files
Amir Blumgitbook-bot
Amir Blum
authored andcommitted
GitBook: [master] 26 pages modified
1 parent c1877e4 commit 4e1927e

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [Manual Spans](getting-started/install/manual-spans.md)
1010
* [Install on AWS Lambda](getting-started/install/lambda.md)
1111
* [Install on GCF](getting-started/install/gcf.md)
12+
* [Install in CI](getting-started/install/install-in-ci.md)
1213
* [Advanced](getting-started/install/advanced.md)
1314
* [Configure Logs](getting-started/install/configure-logs.md)
1415
* [Custom Collector](getting-started/install/custom-collector.md)
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
description: Instrument services that run from CI and generate reports with insights
3+
---
4+
5+
# Install in CI
6+
7+
When running tests as part CI workflow, Aspecto can compare a run to a previous baseline and generate a report with insights about changes and possible issues introduced into the system by a change in the codebase.
8+
9+
To mark a service as running in CI context, set the environment variable `ASPECTO_CI_REPORT` to `1`, or use the `ciReport: true` when calling the `instrument` function.
10+
11+
Additionally, Aspecto needs to detect the git SHA value of the commit, and the branch name. These will be auto detected from the `.git` folder, or from relevant CI environment variables. If your run your service in a conatainer, pass those variables into the container
12+
13+
### Github Actions
14+
15+
`docker run -e ASPECTO_CI_REPORT=1 -e GITHUB_HEAD_REF -e GITHUB_REF -e GITHUB_SHA`
16+
17+
### CircleCI
18+
19+
`docker run -e ASPECTO_CI_REPORT=1 -e CIRCLE_BRANCH -e CIRCLE_SHA1`
20+
21+
## Running from docker-compose
22+
23+
If you run your services in CI with docker-compose, it is recommended to add the relevant environment variables to the `docker-compose.yml`file, and set `ASPECTO_CI_REPORT=1` in your CI workflow:
24+
25+
```text
26+
services:
27+
my_serivce:
28+
image: **set your image here**
29+
environment:
30+
- ASPECTO_CI_REPORT
31+
32+
# Github Actions:
33+
- GITHUB_HEAD_REF
34+
- GITHUB_REF
35+
- GITHUB_SHA
36+
37+
# CircleCI:
38+
- CIRCLE_BRANCH
39+
- CIRCLE_SHA1
40+
```
41+
42+
And from your workflow:
43+
44+
```text
45+
jobs:
46+
test:
47+
steps:
48+
- name: Setup service for CI tests
49+
run: docker-compose up -d
50+
env:
51+
ASPECTO_CI_REPORT: 1
52+
53+
```
54+

0 commit comments

Comments
 (0)