gitgreen 1.1.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +302 -198
- package/data/cpu_physical_specs.json +105 -0
- package/data/source/GCP Machine types - Bare Metal Power Profiles.csv +22 -0
- package/data/source/GCP Machine types - CPU Profiles.csv +22 -0
- package/data/source/GCP Machine types - Dell R740 LCA.csv +37 -0
- package/data/source/GCP Machine types - Instances.csv +183 -0
- package/data/source/GCP Machine types - Machine Ratios.csv +29 -0
- package/data/source/GCP Machine types - Memory Ratios.csv +22 -0
- package/data/source/GCP Machine types - Scope 3 Ratios.csv +10 -0
- package/dist/init.js +61 -0
- package/dist/lib/carbon/power-profile-repository.js +50 -4
- package/dist/lib/integrations/db-setup.js +0 -32
- package/package.json +2 -1
- package/scripts/stress.sh +38 -0
package/README.md
CHANGED
|
@@ -1,279 +1,383 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">GitGreen</h1>
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Carbon footprint tracking for GitLab CI/CD pipelines</strong>
|
|
5
|
+
</p>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="#quick-start">Quick Start</a> •
|
|
8
|
+
<a href="#installation">Installation</a> •
|
|
9
|
+
<a href="#usage">Usage</a> •
|
|
10
|
+
<a href="#methodology">Methodology</a> •
|
|
11
|
+
<a href="#faq">FAQ</a>
|
|
12
|
+
</p>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
[](https://www.npmjs.com/package/gitgreen)
|
|
18
|
+
[](LICENSE)
|
|
19
|
+
[](https://nodejs.org/)
|
|
20
|
+
|
|
21
|
+
GitGreen measures the carbon emissions of your CI/CD jobs using real CPU/RAM metrics, grid carbon intensity data, and research-backed power models. Works with **GCP** and **AWS** runners.
|
|
2
22
|
|
|
3
|
-
|
|
23
|
+
```
|
|
24
|
+
Total emissions: 2.847 gCO₂e
|
|
25
|
+
├── CPU: 1.923 gCO₂e
|
|
26
|
+
├── RAM: 0.412 gCO₂e
|
|
27
|
+
└── Scope 3: 0.512 gCO₂e (embodied carbon)
|
|
28
|
+
```
|
|
4
29
|
|
|
5
|
-
##
|
|
30
|
+
## Quick Start
|
|
6
31
|
|
|
7
|
-
|
|
32
|
+
```bash
|
|
33
|
+
# Install globally
|
|
34
|
+
npm install -g gitgreen
|
|
8
35
|
|
|
9
|
-
|
|
36
|
+
# Initialize in your GitLab project
|
|
37
|
+
cd your-repo
|
|
38
|
+
gitgreen init
|
|
39
|
+
```
|
|
10
40
|
|
|
11
|
-
|
|
12
|
-
- Required to run the CLI tool
|
|
13
|
-
- Check version: `node --version`
|
|
41
|
+
The wizard configures everything: provider credentials, carbon budgets, and CI/CD integration.
|
|
14
42
|
|
|
15
|
-
|
|
16
|
-
- This project uses `pnpm@8.15.4` as the package manager
|
|
17
|
-
- Install pnpm: `npm install -g pnpm`
|
|
43
|
+
## Table of Contents
|
|
18
44
|
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
45
|
+
- [Installation](#installation)
|
|
46
|
+
- [Usage](#usage)
|
|
47
|
+
- [Advanced](#advanced)
|
|
48
|
+
- [Providers](#providers)
|
|
49
|
+
- [Output Integrations](#output-integrations)
|
|
50
|
+
- [Database Schema](#database-schema)
|
|
51
|
+
- [Methodology](#methodology)
|
|
52
|
+
- [Architecture](#architecture)
|
|
53
|
+
- [Configuration](#configuration)
|
|
54
|
+
- [FAQ](#faq)
|
|
55
|
+
- [Contributing](#contributing)
|
|
56
|
+
- [References](#references)
|
|
57
|
+
- [License](#license)
|
|
22
58
|
|
|
23
|
-
|
|
59
|
+
## Installation
|
|
24
60
|
|
|
25
|
-
|
|
26
|
-
- Required for GCP provider setup and authentication
|
|
27
|
-
- After installation, authenticate: `gcloud auth login`
|
|
28
|
-
- Set default project: `gcloud config set project YOUR_PROJECT_ID`
|
|
29
|
-
- Check version: `gcloud --version`
|
|
61
|
+
### Prerequisites
|
|
30
62
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
63
|
+
| Requirement | Version | Notes |
|
|
64
|
+
|-------------|---------|-------|
|
|
65
|
+
| Node.js | 20+ | [Download](https://nodejs.org/) |
|
|
66
|
+
| Git | Any | For GitLab project detection |
|
|
67
|
+
| gcloud CLI | Any | Required for GCP ([Install](https://cloud.google.com/sdk/docs/install-sdk)) |
|
|
68
|
+
| AWS CLI | Any | Required for AWS ([Install](https://aws.amazon.com/cli/)) |
|
|
69
|
+
| glab CLI | Any | Optional, for easier GitLab auth ([Install](https://docs.gitlab.com/cli/)) |
|
|
35
70
|
|
|
36
|
-
###
|
|
71
|
+
### Install
|
|
37
72
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- Check version: `glab --version`
|
|
42
|
-
- If not installed, you'll need to provide a GitLab Personal Access Token manually
|
|
73
|
+
```bash
|
|
74
|
+
npm install -g gitgreen
|
|
75
|
+
```
|
|
43
76
|
|
|
44
77
|
### API Keys
|
|
45
78
|
|
|
46
|
-
- **Electricity Maps
|
|
47
|
-
- Required for carbon intensity data
|
|
48
|
-
- You'll be prompted for this during `gitgreen init`
|
|
79
|
+
- **Electricity Maps** (required): [Get free API key](https://api-portal.electricitymaps.com)
|
|
49
80
|
|
|
50
|
-
##
|
|
51
|
-
- From npm (global CLI):
|
|
52
|
-
```bash
|
|
53
|
-
npm install -g gitgreen
|
|
54
|
-
gitgreen --help
|
|
55
|
-
```
|
|
81
|
+
## Usage
|
|
56
82
|
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm test
|
|
60
|
-
```
|
|
83
|
+
### Initialize a Project
|
|
61
84
|
|
|
62
|
-
Stress test multiple live configs (build first, real APIs):
|
|
63
85
|
```bash
|
|
64
|
-
|
|
65
|
-
npm stress
|
|
86
|
+
gitgreen init
|
|
66
87
|
```
|
|
67
88
|
|
|
68
|
-
|
|
89
|
+
The wizard will:
|
|
90
|
+
1. Configure your cloud provider (GCP/AWS)
|
|
91
|
+
2. Set machine type and region
|
|
92
|
+
3. Configure carbon budgets
|
|
93
|
+
4. Set up database exports (optional)
|
|
94
|
+
5. Append the tracking job to `.gitlab-ci.yml`
|
|
95
|
+
6. Store credentials in GitLab CI/CD variables
|
|
69
96
|
|
|
70
|
-
|
|
97
|
+
**That's it!** Run your next pipeline and carbon emissions will be calculated automatically. Results appear as MR comments, in your configured database, and are stored in carbon job artifacts.
|
|
71
98
|
|
|
72
|
-
|
|
99
|
+
---
|
|
73
100
|
|
|
74
|
-
|
|
75
|
-
# In your repo
|
|
76
|
-
gitgreen init
|
|
77
|
-
```
|
|
101
|
+
## Advanced
|
|
78
102
|
|
|
79
|
-
|
|
80
|
-
- Configure provider/machine/region settings
|
|
81
|
-
- Set carbon budgets
|
|
82
|
-
- Configure MR note preferences
|
|
83
|
-
- Choose to use an existing runner or spin up a new one with supported providers
|
|
103
|
+
### Providers
|
|
84
104
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
105
|
+
| Provider | Metrics Source | Status |
|
|
106
|
+
|----------|---------------|--------|
|
|
107
|
+
| **GCP** | Cloud Monitoring API | Full support |
|
|
108
|
+
| **AWS** | CloudWatch API | Full support |
|
|
88
109
|
|
|
89
|
-
###
|
|
110
|
+
### Output Integrations
|
|
90
111
|
|
|
91
|
-
|
|
112
|
+
Export carbon data to external databases for analytics and dashboards.
|
|
92
113
|
|
|
93
|
-
|
|
94
|
-
- `ELECTRICITY_MAPS_API_KEY` (required) - Get a free key from https://api-portal.electricitymaps.com
|
|
95
|
-
- `GCP_PROJECT_ID` / `GOOGLE_CLOUD_PROJECT` (required for GCP) - Your GCP project ID
|
|
96
|
-
- `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` (required for AWS CloudWatch) - Credentials with CloudWatch read access on the runner
|
|
97
|
-
- `AWS_REGION` (for AWS) - Region of the runner EC2 instance
|
|
114
|
+
#### Supported Connectors
|
|
98
115
|
|
|
99
|
-
|
|
116
|
+
| Connector | Job Data | Runner Inventory |
|
|
117
|
+
|-----------|----------|------------------|
|
|
118
|
+
| MySQL | `GITGREEN_JOB_MYSQL_*` | `GITGREEN_RUNNER_MYSQL_*` |
|
|
119
|
+
| PostgreSQL | `GITGREEN_JOB_POSTGRES_*` | `GITGREEN_RUNNER_POSTGRES_*` |
|
|
100
120
|
|
|
101
|
-
|
|
121
|
+
#### Database Migrations
|
|
102
122
|
|
|
103
|
-
|
|
123
|
+
```bash
|
|
124
|
+
gitgreen migrate --scope job # Job emissions tables
|
|
125
|
+
gitgreen migrate --scope runner # Runner inventory tables
|
|
126
|
+
gitgreen migrate --scope all # Both
|
|
127
|
+
```
|
|
104
128
|
|
|
105
|
-
|
|
106
|
-
|
|
129
|
+
Migrations run automatically in CI pipelines.
|
|
130
|
+
|
|
131
|
+
### Database Schema
|
|
132
|
+
|
|
133
|
+
<details>
|
|
134
|
+
<summary><strong>Job Table</strong> (per-job emissions)</summary>
|
|
135
|
+
|
|
136
|
+
| Column | Type | Description |
|
|
137
|
+
|--------|------|-------------|
|
|
138
|
+
| `id` | BIGSERIAL | Primary key |
|
|
139
|
+
| `ingested_at` | TIMESTAMPTZ | Insert timestamp |
|
|
140
|
+
| `provider` | TEXT | `gcp` or `aws` |
|
|
141
|
+
| `region` | TEXT | Cloud region/zone |
|
|
142
|
+
| `machine_type` | TEXT | Instance type |
|
|
143
|
+
| `runtime_seconds` | INT | Job duration |
|
|
144
|
+
| `total_emissions` | DOUBLE | Total gCO₂eq |
|
|
145
|
+
| `cpu_emissions` | DOUBLE | CPU gCO₂eq |
|
|
146
|
+
| `ram_emissions` | DOUBLE | RAM gCO₂eq |
|
|
147
|
+
| `scope3_emissions` | DOUBLE | Embodied gCO₂eq |
|
|
148
|
+
| `carbon_intensity` | DOUBLE | Grid intensity (gCO₂eq/kWh) |
|
|
149
|
+
| `pue` | DOUBLE | Power Usage Effectiveness |
|
|
150
|
+
| `carbon_budget` | DOUBLE | Budget threshold |
|
|
151
|
+
| `over_budget` | BOOLEAN | Budget exceeded |
|
|
152
|
+
| `gitlab_project_id` | BIGINT | GitLab project |
|
|
153
|
+
| `gitlab_pipeline_id` | BIGINT | Pipeline ID |
|
|
154
|
+
| `gitlab_job_id` | BIGINT | Job ID |
|
|
155
|
+
| `gitlab_job_name` | TEXT | Job name |
|
|
156
|
+
| `payload` | JSONB | Full result JSON |
|
|
157
|
+
|
|
158
|
+
</details>
|
|
159
|
+
|
|
160
|
+
<details>
|
|
161
|
+
<summary><strong>Timeseries Table</strong> (CPU/RAM metrics)</summary>
|
|
162
|
+
|
|
163
|
+
| Column | Type | Description |
|
|
164
|
+
|--------|------|-------------|
|
|
165
|
+
| `id` | BIGSERIAL | Primary key |
|
|
166
|
+
| `job_id` | BIGINT | Foreign key to job |
|
|
167
|
+
| `metric` | TEXT | `cpu`, `ram_used`, `ram_size` |
|
|
168
|
+
| `ts` | TIMESTAMPTZ | Timestamp |
|
|
169
|
+
| `value` | DOUBLE | Metric value |
|
|
170
|
+
|
|
171
|
+
</details>
|
|
172
|
+
|
|
173
|
+
<details>
|
|
174
|
+
<summary><strong>Runner Inventory Table</strong></summary>
|
|
175
|
+
|
|
176
|
+
| Column | Type | Description |
|
|
177
|
+
|--------|------|-------------|
|
|
178
|
+
| `id` | BIGSERIAL | Primary key |
|
|
179
|
+
| `runner_id` | TEXT | GitLab runner ID |
|
|
180
|
+
| `machine_type` | TEXT | Instance type |
|
|
181
|
+
| `provider` | TEXT | Cloud provider |
|
|
182
|
+
| `region` | TEXT | Region |
|
|
183
|
+
| `last_job_total_emissions` | DOUBLE | Last job emissions |
|
|
184
|
+
| `payload` | JSONB | Full metadata |
|
|
185
|
+
|
|
186
|
+
</details>
|
|
187
|
+
|
|
188
|
+
## Methodology
|
|
189
|
+
|
|
190
|
+
GitGreen's calculations are based on peer-reviewed methodologies from [re:cinq](https://re-cinq.com/blog/cloud-cpu-energy-consumption) and [Teads](https://github.com/re-cinq/emissions-data).
|
|
191
|
+
|
|
192
|
+
### Formula
|
|
107
193
|
|
|
108
|
-
## Architecture
|
|
109
|
-
Runtime flow:
|
|
110
|
-
```
|
|
111
|
-
CPU/RAM timeseries (GCP Monitoring JSON or custom collector)
|
|
112
|
-
|
|
|
113
|
-
v
|
|
114
|
-
+------------------+ +----------------------------+
|
|
115
|
-
| CLI (gitgreen) |--->| CarbonCalculator |
|
|
116
|
-
| - parse metrics | | - PowerProfileRepository |<- machine data in data/*.json
|
|
117
|
-
| - CLI/env opts | | - ZoneMapper (region→zone) |<- static + runtime PUE mapping
|
|
118
|
-
+------------------+ | - IntensityProvider |<- Electricity Maps API
|
|
119
|
-
+-------------+------------+
|
|
120
|
-
|
|
|
121
|
-
v
|
|
122
|
-
+-----------------------------+
|
|
123
|
-
| Report formatter |
|
|
124
|
-
| - Markdown/JSON artifacts |
|
|
125
|
-
| - Budget evaluation |
|
|
126
|
-
+-------------+---------------+
|
|
127
|
-
|
|
|
128
|
-
v
|
|
129
|
-
+-----------------------------+
|
|
130
|
-
| GitLab client (optional) |
|
|
131
|
-
| - MR note via CI_JOB_TOKEN |
|
|
132
|
-
+-----------------------------+
|
|
133
194
|
```
|
|
195
|
+
E_total = E_operational + E_embodied
|
|
134
196
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
Pipeline starts → component script fetches CPU/RAM timeseries from GCP Monitoring or AWS CloudWatch
|
|
138
|
-
→ writes JSON files → runs `gitgreen --provider gcp|aws ...`
|
|
139
|
-
→ emits `carbon-report.md` / `carbon-report.json`
|
|
140
|
-
→ optional MR note when CI_JOB_TOKEN is present
|
|
197
|
+
E_operational = (P_cpu + P_ram) × runtime_hours × PUE × carbon_intensity
|
|
198
|
+
E_embodied = scope3_hourly × runtime_hours
|
|
141
199
|
```
|
|
142
200
|
|
|
143
|
-
|
|
201
|
+
| Variable | Description | Source |
|
|
202
|
+
|----------|-------------|--------|
|
|
203
|
+
| `P_cpu` | CPU power (kW) | Interpolated from utilization |
|
|
204
|
+
| `P_ram` | RAM power (0.5 W/GB) | Industry standard for DDR4 |
|
|
205
|
+
| `PUE` | Data center efficiency | Google/AWS published data |
|
|
206
|
+
| `carbon_intensity` | Grid emissions (gCO₂eq/kWh) | Electricity Maps API |
|
|
207
|
+
| `scope3_hourly` | Embodied carbon rate | Dell R740 LCA study |
|
|
144
208
|
|
|
145
|
-
|
|
209
|
+
### CPU Power Model
|
|
146
210
|
|
|
147
|
-
|
|
148
|
-
- **Runner inventory** – the machine catalog that powers your GitLab runners, including machine type and scope 3 estimates.
|
|
211
|
+
CPU power is **non-linear** with utilization. We use cubic spline interpolation across measured data points:
|
|
149
212
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
213
|
+
| Utilization | Power (% of TDP) |
|
|
214
|
+
|-------------|------------------|
|
|
215
|
+
| 0% (idle) | 1.7% |
|
|
216
|
+
| 10% | 3.4% |
|
|
217
|
+
| 50% | 16.9% |
|
|
218
|
+
| 100% | 100% |
|
|
153
219
|
|
|
154
|
-
|
|
220
|
+
**VM Power Correction:** Cloud VMs share physical CPUs. We scale power by the ratio of VM vCPUs to physical threads:
|
|
155
221
|
|
|
156
|
-
|
|
157
|
-
|
|
222
|
+
```
|
|
223
|
+
P_vm = TDP × ratio × (vm_vcpus / physical_threads)
|
|
224
|
+
```
|
|
158
225
|
|
|
159
|
-
|
|
226
|
+
| CPU | Cores | Threads | TDP | Source |
|
|
227
|
+
|-----|-------|---------|-----|--------|
|
|
228
|
+
| Intel Xeon Gold 6268CL | 24 | 48 | 205W | [Intel](https://www.ebay.com/p/2321792675) |
|
|
229
|
+
| Intel Xeon Platinum 8481C | 56 | 112 | 350W | [TechPowerUp](https://www.techpowerup.com/cpu-specs/xeon-platinum-8481c.c3992) |
|
|
230
|
+
| AMD EPYC 7B12 | 64 | 128 | 240W | [AMD](https://www.newegg.com/p/1FR-00G6-00026) |
|
|
231
|
+
| Ampere Altra Q64-30 | 64 | 64 | 180W | [Ampere](https://amperecomputing.com/en/briefs/ampere-altra-family-product-brief) |
|
|
160
232
|
|
|
161
|
-
|
|
233
|
+
### Scope 3 (Embodied Carbon)
|
|
162
234
|
|
|
163
|
-
|
|
164
|
-
2. The data target it handles (`job` vs `runner`)
|
|
165
|
-
3. Prompted credential fields (label, env var key, input type, default, mask flag)
|
|
235
|
+
Manufacturing emissions amortized over hardware lifespan (6 years):
|
|
166
236
|
|
|
167
|
-
|
|
237
|
+
| Component | Emissions |
|
|
238
|
+
|-----------|-----------|
|
|
239
|
+
| Base server | ~1000 kgCO₂eq |
|
|
240
|
+
| Per CPU | ~100 kgCO₂eq |
|
|
241
|
+
| Per 32GB DIMM | ~44 kgCO₂eq |
|
|
242
|
+
| Per SSD | ~50-100 kgCO₂eq |
|
|
168
243
|
|
|
169
|
-
|
|
244
|
+
*Source: Dell PowerEdge R740 Life Cycle Assessment*
|
|
170
245
|
|
|
171
|
-
|
|
246
|
+
### Accuracy & Limitations
|
|
172
247
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
gitgreen migrate --scope all # convenience wrapper (used by the GitLab component)
|
|
177
|
-
```
|
|
248
|
+
**Expected Accuracy:**
|
|
249
|
+
- Relative comparisons: Excellent (comparing job A vs B)
|
|
250
|
+
- Absolute values: ±15-25% for CPU-bound workloads
|
|
178
251
|
|
|
179
|
-
|
|
252
|
+
**Known Limitations:**
|
|
180
253
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
5. Wire any CI automation (runner tags, MR note flags) to pass the correct provider, machine type, and region strings.
|
|
254
|
+
| Limitation | Impact | Notes |
|
|
255
|
+
|------------|--------|-------|
|
|
256
|
+
| No GPU modeling | High | GPU jobs underestimated |
|
|
257
|
+
| Fixed RAM power | Low | 0.5 W/GB industry standard |
|
|
258
|
+
| No network/storage I/O | Low | <5% of typical job power |
|
|
187
259
|
|
|
188
|
-
##
|
|
189
|
-
- Ensure version bump in `package.json`
|
|
190
|
-
- Run `pnpm -C node-module build && pnpm -C node-module test`
|
|
191
|
-
- Publish: `pnpm -C node-module publish --access public`
|
|
260
|
+
## Architecture
|
|
192
261
|
|
|
193
|
-
|
|
262
|
+
```
|
|
263
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
264
|
+
│ GitLab Pipeline │
|
|
265
|
+
├─────────────────────────────────────────────────────────────┤
|
|
266
|
+
│ ┌─────────────┐ ┌──────────────────────────────────┐ │
|
|
267
|
+
│ │ Your Jobs │───▶│ GitGreen Carbon Tracking Job │ │
|
|
268
|
+
│ └─────────────┘ │ ├─ Fetch CPU/RAM metrics │ │
|
|
269
|
+
│ │ ├─ Calculate emissions │ │
|
|
270
|
+
│ │ ├─ Post MR comment │ │
|
|
271
|
+
│ │ └─ Export to database │ │
|
|
272
|
+
│ └──────────────────────────────────┘ │
|
|
273
|
+
└─────────────────────────────────────────────────────────────┘
|
|
274
|
+
│
|
|
275
|
+
┌────────────────────┼────────────────────┐
|
|
276
|
+
▼ ▼ ▼
|
|
277
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
278
|
+
│ GCP Monitoring │ │ Electricity Maps│ │ MySQL/Postgres │
|
|
279
|
+
│ AWS CloudWatch │ │ API │ │ (optional) │
|
|
280
|
+
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
281
|
+
```
|
|
194
282
|
|
|
195
|
-
|
|
283
|
+
## Configuration
|
|
196
284
|
|
|
197
|
-
|
|
285
|
+
### Adding a New Provider
|
|
198
286
|
|
|
199
|
-
|
|
287
|
+
1. Add machine power profiles to `data/<provider>_machine_power_profiles.json`
|
|
288
|
+
2. Update `PowerProfileRepository.loadMachineData()`
|
|
289
|
+
3. Map regions to Electricity Maps zones in `ZoneMapper`
|
|
290
|
+
4. Parse metrics into `TimeseriesPoint` format
|
|
291
|
+
5. Wire CI automation for provider-specific settings
|
|
200
292
|
|
|
201
|
-
|
|
293
|
+
### Source Data Files
|
|
202
294
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
295
|
+
| File | Description |
|
|
296
|
+
|------|-------------|
|
|
297
|
+
| `data/cpu_physical_specs.json` | Physical CPU specs with sources |
|
|
298
|
+
| `data/cpu_power_profiles.json` | TDP and power ratios |
|
|
299
|
+
| `data/gcp_machine_power_profiles.json` | GCP machine mappings |
|
|
300
|
+
| `data/aws_machine_power_profiles.json` | AWS instance mappings |
|
|
301
|
+
| `data/source/*.csv` | Original re:cinq research data |
|
|
207
302
|
|
|
208
|
-
|
|
303
|
+
## FAQ
|
|
209
304
|
|
|
210
|
-
|
|
305
|
+
<details>
|
|
306
|
+
<summary><strong>Are my credentials secure?</strong></summary>
|
|
211
307
|
|
|
212
|
-
GitGreen
|
|
308
|
+
Yes. GitGreen stores all credentials in GitLab CI/CD variables (encrypted). Nothing is written to your local disk.
|
|
309
|
+
</details>
|
|
213
310
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
3. **Append-only changes** - GitGreen only appends new content to your CI file; it never removes or modifies existing jobs
|
|
217
|
-
4. **Confirmation prompt** - You're asked to confirm before any changes are made
|
|
311
|
+
<details>
|
|
312
|
+
<summary><strong>What APIs does GitGreen call?</strong></summary>
|
|
218
313
|
|
|
219
|
-
|
|
314
|
+
Only APIs you explicitly configure:
|
|
315
|
+
- Electricity Maps API (carbon intensity)
|
|
316
|
+
- GCP Monitoring API (metrics)
|
|
317
|
+
- AWS CloudWatch API (metrics)
|
|
318
|
+
- GitLab API (MR comments, via CI_JOB_TOKEN)
|
|
220
319
|
|
|
221
|
-
|
|
320
|
+
GitGreen has no backend server.
|
|
321
|
+
</details>
|
|
222
322
|
|
|
223
|
-
|
|
323
|
+
<details>
|
|
324
|
+
<summary><strong>Will it break my .gitlab-ci.yml?</strong></summary>
|
|
224
325
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
3. Running `gitgreen` directly with command-line options instead of using the component
|
|
326
|
+
No. GitGreen creates a backup before any changes, only appends content (never modifies existing jobs), and asks for confirmation.
|
|
327
|
+
</details>
|
|
228
328
|
|
|
229
|
-
|
|
329
|
+
<details>
|
|
330
|
+
<summary><strong>Can I run it without the wizard?</strong></summary>
|
|
230
331
|
|
|
231
|
-
|
|
332
|
+
Yes. Set CI/CD variables manually and run `gitgreen` with CLI options.
|
|
333
|
+
</details>
|
|
232
334
|
|
|
233
|
-
|
|
335
|
+
## Contributing
|
|
234
336
|
|
|
235
|
-
|
|
236
|
-
|
|
337
|
+
1. Fork the repository
|
|
338
|
+
2. Create a feature branch
|
|
339
|
+
3. Run tests: `npm test`
|
|
340
|
+
4. Submit a pull request
|
|
237
341
|
|
|
238
|
-
|
|
342
|
+
## References
|
|
239
343
|
|
|
240
|
-
###
|
|
344
|
+
### Research & Methodology
|
|
241
345
|
|
|
242
|
-
|
|
346
|
+
| Source | Description |
|
|
347
|
+
|--------|-------------|
|
|
348
|
+
| [re:cinq Cloud CPU Energy Consumption](https://re-cinq.com/blog/cloud-cpu-energy-consumption) | CPU power modeling methodology |
|
|
349
|
+
| [re:cinq emissions-data](https://github.com/re-cinq/emissions-data) | Machine power profiles and ratios |
|
|
350
|
+
| [Teads Engineering](https://engineering.teads.com/) | Original research on cloud carbon |
|
|
351
|
+
| Dell PowerEdge R740 LCA | Scope 3 embodied carbon data |
|
|
243
352
|
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
gitgreen --provider gcp \
|
|
247
|
-
--machine e2-standard-4 \
|
|
248
|
-
--region us-central1-a \
|
|
249
|
-
--cpu-timeseries cpu.json \
|
|
250
|
-
--ram-used-timeseries ram-used.json \
|
|
251
|
-
--ram-size-timeseries ram-size.json \
|
|
252
|
-
--out-md report.md
|
|
253
|
-
```
|
|
353
|
+
### Data Sources
|
|
254
354
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
--out-md report.md
|
|
264
|
-
```
|
|
355
|
+
| Data | Source |
|
|
356
|
+
|------|--------|
|
|
357
|
+
| Real-time carbon intensity | [Electricity Maps API](https://www.electricitymaps.com/) |
|
|
358
|
+
| GCP machine specifications | [Google Cloud CPU Platforms](https://cloud.google.com/compute/docs/cpu-platforms) |
|
|
359
|
+
| GCP data center PUE | [Google Data Center Efficiency](https://www.google.com/about/datacenters/efficiency/) |
|
|
360
|
+
| Intel CPU specifications | [Intel ARK](https://ark.intel.com/) |
|
|
361
|
+
| AMD CPU specifications | [AMD Product Pages](https://www.amd.com/en/products/specifications/processors) |
|
|
362
|
+
| Ampere CPU specifications | [Ampere Product Briefs](https://amperecomputing.com/briefs) |
|
|
265
363
|
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
gitgreen --provider aws \
|
|
269
|
-
--machine t3.medium \
|
|
270
|
-
--region us-east-1 \
|
|
271
|
-
--from-cloudwatch \
|
|
272
|
-
--out-md report.md
|
|
273
|
-
```
|
|
364
|
+
### CPU Specifications Used
|
|
274
365
|
|
|
275
|
-
|
|
366
|
+
| CPU | Cores | Threads | TDP | Source |
|
|
367
|
+
|-----|-------|---------|-----|--------|
|
|
368
|
+
| Intel Xeon Gold 6268CL | 24 | 48 | 205W | [Product Listing](https://www.ebay.com/p/2321792675) |
|
|
369
|
+
| Intel Xeon Gold 6253CL | 18 | 36 | 205W | [PassMark](https://www.cpubenchmark.net/cpu.php?cpu=Intel+Xeon+Gold+6253CL) |
|
|
370
|
+
| Intel Xeon Platinum 8481C | 56 | 112 | 350W | [TechPowerUp](https://www.techpowerup.com/cpu-specs/xeon-platinum-8481c.c3992) |
|
|
371
|
+
| Intel Xeon Platinum 8373C | 36 | 72 | 300W | [Wikipedia](https://en.wikipedia.org/wiki/List_of_Intel_Xeon_processors_(Ice_Lake-based)) |
|
|
372
|
+
| AMD EPYC 7B12 | 64 | 128 | 240W | [Newegg](https://www.newegg.com/p/1FR-00G6-00026) |
|
|
373
|
+
| Ampere Altra Q64-30 | 64 | 64 | 180W | [Ampere Brief](https://amperecomputing.com/en/briefs/ampere-altra-family-product-brief) |
|
|
276
374
|
|
|
277
375
|
## License
|
|
278
376
|
|
|
279
|
-
MIT License - see [LICENSE](LICENSE)
|
|
377
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
<p align="center">
|
|
382
|
+
<sub>Built with care for a sustainable software future.</sub>
|
|
383
|
+
</p>
|