Skip to content

Commit

Permalink
Docs: add custom commands page; alphabetical order of howto
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIJ committed Dec 21, 2023
1 parent 65e8462 commit b793183
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 25 deletions.
28 changes: 28 additions & 0 deletions docs/howto/custom-commands.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "Custom commands"
---

You can specify custom steps using the `workflows` section in digger.yml. Handy for integration with other CLIs like infracost.

```
projects:
- name: production
dir: prod
workflow: with-infracost
workflows:
with-infracost:
plan:
steps:
- init
- plan
- run: infracost breakdown --path=. | tee -a $DIGGER_OUT
```

# $DIGGER_OUT

If your custom command writes into a file path defined in the `$DIGGER_OUT` env variable, then its content will be appended to the comment as "additional output":

![](/images/custom-command-output-infracost.png)

The value of `$DIGER_OUT` defaults to `$RUNNER_TEMP/digger-out.log`; you can change that if needed by setting the env var explicitly.
20 changes: 9 additions & 11 deletions docs/howto/using-infracost.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: "Using Infracost"
description: "This feature is in early development. If you find something that can be improved, please let us know by [filing an issue](https://github.com/diggerhq/digger/issues)"
---

<Note>You can configure Digger to use Infracost to estimate cloud costs.</Note>

## Pre-requisites

Infracost binary needs to be installed into your CI pipeline (see [Infracost docs](https://www.infracost.io/docs/integrations/generic%5Fcicd/))
- Infracost binary installed into your CI pipeline (see [Infracost docs](https://www.infracost.io/docs/integrations/generic%5Fcicd/))
- Infracost API key

## Set up Infracost

Expand All @@ -26,21 +24,21 @@ Use the official setup-infracost action in your workflow file ([README](https://

```
projects:
- name: project_a_d
dir: ./project_a/development
workflow: project_a
- name: production
dir: prod
workflow: with-infracost
workflows:
project_a:
with-infracost:
plan:
steps:
- init
- plan
- run: infracost breakdown --path=.
- run: infracost breakdown --path=. | tee -a $DIGGER_OUT
```

## See cost estimate output

After the pipeline run finishes, you should see Infracost breakdown output in your CI job logs:
After the pipeline run finishes, you should see Infracost breakdown output appended to digger run report comment as additional output:

![](/images/configuration/infracost-example.png)
![](/images/custom-command-output-infracost.png)
File renamed without changes.
Binary file added docs/images/custom-command-output-infracost.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 15 additions & 14 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,25 @@
{
"group": "How To",
"pages": [
"howto/terragrunt",
"howto/using-checkov",
"howto/using-infracost",
"howto/using-opa-conftest",
"howto/multiacc-aws",
"howto/project-level-roles",
"howto/apply-on-merge",
"howto/auto-merge",
"howto/backendless-mode",
"howto/commenting-strategies",
"howto/custom-commands",
"howto/destroy-manual",
"howto/disable-auto-checkout",
"howto/generate-projects",
"howto/include-exclude-patterns",
"howto/destroy-manual",
"howto/trigger-directly",
"howto/multiacc-aws",
"howto/policy-overrides",
"howto/versioning",
"howto/disable-auto-checkout",
"howto/backendless-mode",
"howto/project-level-roles",
"howto/segregate-cloud-accounts",
"howto/apply-on-merge",
"howto/auto-merge",
"howto/commenting-strategies"
"howto/trigger-directly",
"howto/using-checkov",
"howto/using-infracost",
"howto/using-opa-conftest",
"howto/using-terragrunt",
"howto/versioning"
]
},
{
Expand Down

0 comments on commit b793183

Please sign in to comment.