infra-cost 0.3.0 → 0.3.2
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 +113 -4
- package/dist/index.js +992 -103
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Multi-cloud FinOps CLI tool for comprehensive cost analysis and infrastructure optimization**
|
|
6
6
|
|
|
7
|
-
[](https://badge.fury.io/js/infra-cost)
|
|
7
|
+
[](https://badge.fury.io/js/infra-cost.svg)
|
|
8
8
|
[](https://npmjs.org/package/infra-cost)
|
|
9
9
|
[](https://opensource.org/licenses/MIT)
|
|
10
10
|
[](https://github.com/codecollab-co/infra-cost/issues)
|
|
@@ -85,6 +85,15 @@ npx infra-cost
|
|
|
85
85
|
docker run --rm codecollab-co/infra-cost --help
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
### GitHub Action
|
|
89
|
+
```yaml
|
|
90
|
+
- uses: codecollab-co/infra-cost@v0.3.0
|
|
91
|
+
with:
|
|
92
|
+
provider: aws
|
|
93
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
94
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
95
|
+
```
|
|
96
|
+
|
|
88
97
|
## 🎯 Quick Start
|
|
89
98
|
|
|
90
99
|
### 1. Basic AWS Cost Analysis
|
|
@@ -230,6 +239,99 @@ jobs:
|
|
|
230
239
|
--smart-alerts --trends 7
|
|
231
240
|
```
|
|
232
241
|
|
|
242
|
+
## 🤖 GitHub Actions Integration
|
|
243
|
+
|
|
244
|
+
**infra-cost** is available as a GitHub Action on the [GitHub Marketplace](https://github.com/marketplace/actions/infra-cost-multi-cloud-finops-analysis), making it easy to integrate cost analysis into your CI/CD workflows.
|
|
245
|
+
|
|
246
|
+
### Basic Usage
|
|
247
|
+
```yaml
|
|
248
|
+
name: Cost Analysis
|
|
249
|
+
on: [push, pull_request]
|
|
250
|
+
|
|
251
|
+
jobs:
|
|
252
|
+
analyze:
|
|
253
|
+
runs-on: ubuntu-latest
|
|
254
|
+
steps:
|
|
255
|
+
- uses: codecollab-co/infra-cost@v0.3.0
|
|
256
|
+
with:
|
|
257
|
+
provider: aws
|
|
258
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
259
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
260
|
+
analysis-type: summary
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### PR Cost Check with Comments
|
|
264
|
+
```yaml
|
|
265
|
+
name: PR Cost Check
|
|
266
|
+
on:
|
|
267
|
+
pull_request:
|
|
268
|
+
branches: [main]
|
|
269
|
+
|
|
270
|
+
jobs:
|
|
271
|
+
cost-check:
|
|
272
|
+
runs-on: ubuntu-latest
|
|
273
|
+
permissions:
|
|
274
|
+
pull-requests: write
|
|
275
|
+
steps:
|
|
276
|
+
- uses: codecollab-co/infra-cost@v0.3.0
|
|
277
|
+
with:
|
|
278
|
+
provider: aws
|
|
279
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
280
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
281
|
+
analysis-type: delta
|
|
282
|
+
delta-threshold: '10'
|
|
283
|
+
comment-on-pr: 'true'
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Daily Cost Report to Slack
|
|
287
|
+
```yaml
|
|
288
|
+
name: Daily Cost Report
|
|
289
|
+
on:
|
|
290
|
+
schedule:
|
|
291
|
+
- cron: '0 9 * * *'
|
|
292
|
+
|
|
293
|
+
jobs:
|
|
294
|
+
report:
|
|
295
|
+
runs-on: ubuntu-latest
|
|
296
|
+
steps:
|
|
297
|
+
- uses: codecollab-co/infra-cost@v0.3.0
|
|
298
|
+
with:
|
|
299
|
+
provider: aws
|
|
300
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
301
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
302
|
+
analysis-type: finops
|
|
303
|
+
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Action Inputs
|
|
307
|
+
|
|
308
|
+
| Input | Description | Default |
|
|
309
|
+
|-------|-------------|---------|
|
|
310
|
+
| `provider` | Cloud provider (aws, gcp, azure, alicloud, oracle) | `aws` |
|
|
311
|
+
| `profile` | Cloud provider profile | `default` |
|
|
312
|
+
| `region` | Cloud provider region | `us-east-1` |
|
|
313
|
+
| `aws-access-key-id` | AWS Access Key ID | - |
|
|
314
|
+
| `aws-secret-access-key` | AWS Secret Access Key | - |
|
|
315
|
+
| `analysis-type` | Type of analysis (summary, detailed, delta, forecast, anomaly, finops, audit) | `summary` |
|
|
316
|
+
| `forecast-days` | Days for forecast | `30` |
|
|
317
|
+
| `delta-threshold` | Alert threshold for cost changes (%) | `10` |
|
|
318
|
+
| `output-format` | Output format (text, json) | `text` |
|
|
319
|
+
| `slack-webhook` | Slack webhook URL | - |
|
|
320
|
+
| `comment-on-pr` | Post analysis as PR comment | `false` |
|
|
321
|
+
| `fail-on-threshold` | Fail if costs exceed threshold | `false` |
|
|
322
|
+
|
|
323
|
+
### Action Outputs
|
|
324
|
+
|
|
325
|
+
| Output | Description |
|
|
326
|
+
|--------|-------------|
|
|
327
|
+
| `total-cost` | Total cost for the analysis period |
|
|
328
|
+
| `cost-change` | Cost change percentage |
|
|
329
|
+
| `forecast-cost` | Forecasted cost |
|
|
330
|
+
| `anomalies-detected` | Number of anomalies detected |
|
|
331
|
+
| `report-json` | Full report in JSON format |
|
|
332
|
+
|
|
333
|
+
See [example workflows](.github/workflows/examples/) for more use cases.
|
|
334
|
+
|
|
233
335
|
## 🔧 Advanced Usage
|
|
234
336
|
|
|
235
337
|
### Cost Forecasting & Analytics
|
|
@@ -340,7 +442,7 @@ src/
|
|
|
340
442
|
```
|
|
341
443
|
|
|
342
444
|
### System Requirements
|
|
343
|
-
- Node.js
|
|
445
|
+
- Node.js 20+ (required)
|
|
344
446
|
- Memory: 512MB+ available
|
|
345
447
|
- Network: Internet access for cloud provider APIs
|
|
346
448
|
- Optional: Docker for containerized deployments
|
|
@@ -457,7 +559,14 @@ MIT © [Code Collab](https://github.com/codecollab-co)
|
|
|
457
559
|
|
|
458
560
|
## 🔄 Changelog
|
|
459
561
|
|
|
460
|
-
### v0.
|
|
562
|
+
### v0.3.0 - Latest Release
|
|
563
|
+
- ✅ **GitHub Marketplace Action** - Integrate cost analysis into CI/CD workflows
|
|
564
|
+
- ✅ **Node.js 20+ support** - Updated runtime requirements
|
|
565
|
+
- ✅ **Sprint 6 UX improvements** - Enhanced user experience
|
|
566
|
+
- ✅ **Configuration improvements** - Better config resolution and file permissions
|
|
567
|
+
- ✅ **Date normalization** - Consistent UTC date handling
|
|
568
|
+
|
|
569
|
+
### v0.2.4
|
|
461
570
|
- ✅ **Fixed CommonJS compatibility** - Homebrew installation now works perfectly
|
|
462
571
|
- ✅ **Enhanced error handling** and user experience improvements
|
|
463
572
|
- ✅ **Optimized build process** for better performance
|
|
@@ -483,4 +592,4 @@ This tool evolved from `aws-cost-cli` with full backward compatibility. Both `in
|
|
|
483
592
|
|
|
484
593
|
[⭐ Star us on GitHub](https://github.com/codecollab-co/infra-cost) • [🐦 Follow on Twitter](https://twitter.com/codecollabco) • [💼 LinkedIn](https://linkedin.com/company/codecollab-co)
|
|
485
594
|
|
|
486
|
-
</div>
|
|
595
|
+
</div>
|