Skip to content

Commit

Permalink
Fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
goruha committed Dec 15, 2023
1 parent 9b7acb9 commit 5996298
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ GitHub Action that outputs list of Atmos components by jq query.
For example following query will fetch components that have in settings set `github.actions_enabled: true`:

```
to_entries[] | .key as $parent | .value.components.terraform | to_entries[] | select(.value.settings.github.actions_enabled // false) | [$parent, .key] | join(",")
.value.settings.github.actions_enabled // false
```

Output of this action is a list of basic component information. For example:
Expand All @@ -81,9 +81,8 @@ Output of this action is a list of basic component information. For example:

### Config

The action expects the Atmos GitOps configuration file to be present in the repository in `./.github/config/atmos-gitops.yaml`.

The config supports the following settings:
The action expects the atmos gitops configuration file to be present in the repository in `./.github/config/atmos-gitops.yaml`.
The config should have the following structure:

```yaml
atmos-version: 1.45.3
Expand All @@ -99,8 +98,10 @@ The config supports the following settings:
sort-by: .stack_slug
group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-")
```
[!IMPORTANT]
>**Please note!** the `terraform-state-*` parameters refer to the S3 Bucket and corresponding meta storage DynamoDB table used to store the Terraform Plan files, and not the "Terraform State". These parameters will be renamed in a subsequent release.
[!IMPORTANT]
>**Please note!** the `terraform-state-*` parameters refer to the S3 Bucket and corresponding meta storage DynamoDB table used to store the Terraform Plan files, and not the "Terraform State". These parameters will be renamed in a subsequent release.

### GitHub Actions Workflow Example

In following GitHub workflow example first job will filter components that have settings `github.actions_enabled: true` and then in following job `stack_slug` will be printed to stdout.
Expand Down Expand Up @@ -135,21 +136,19 @@ In following GitHub workflow example first job will filter components that have
```

### Migrating from `v0` to `v1`
The major changes between versions `v0` and `v1` are as follows:
- `v1` replaced the `jq-query` input parameter with a new parameter called `selected-filter` to simplify the query for end-users.

1. `v1` replaces the `jq-query` input parameter with a new parameter called `selected-filter` to simplify the query for end-users.
Now you need to specify only the part used inside of the `select(...)` function of the `jq-query`.

-`v1` moved parameters from the `inputs` to the Atmos GitOps config file, which defaults to `./.github/config/atmos-gitops.yaml`
2.`v1` moves most of the `inputs` to the Atmos GitOps config path `./.github/config/atmos-gitops.yaml`. Simply create this file, transfer your settings to it, then remove the corresponding arguments from your invocations of the `cloudposse/github-action-atmos-terraform-select-components` action.

| name |
|--------------------------|
| `atmos-version` |
| `atmos-config-path` |


For example, if you want the same behavior in `v1` as in `v0`, you should create the `./.github/config/atmos-gitops.yaml` config with the same variables as in `v1` inputs.

In `v1`, the GItHub Action would invocation would look like this:
If you want the same behavior in `v2` as in `v1` you should create config `./.github/config/atmos-gitops.yaml` with the same variables as in `v0` inputs.

```yaml
- name: Selected Components
Expand All @@ -160,7 +159,7 @@ In `v1`, the GItHub Action would invocation would look like this:
select-filter: '.settings.github.actions_enabled // false'
```

This is the same as the following `v0` configuration:
Which would produce the same behavior as in `v2`, doing this:

```yaml
- name: Selected Components
Expand Down
25 changes: 12 additions & 13 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ introduction: |-
For example following query will fetch components that have in settings set `github.actions_enabled: true`:
```
to_entries[] | .key as $parent | .value.components.terraform | to_entries[] | select(.value.settings.github.actions_enabled // false) | [$parent, .key] | join(",")
.value.settings.github.actions_enabled // false
```
Output of this action is a list of basic component information. For example:
Expand Down Expand Up @@ -66,9 +66,8 @@ references:
usage: |
### Config
The action expects the Atmos GitOps configuration file to be present in the repository in `./.github/config/atmos-gitops.yaml`.
The config supports the following settings:
The action expects the atmos gitops configuration file to be present in the repository in `./.github/config/atmos-gitops.yaml`.
The config should have the following structure:
```yaml
atmos-version: 1.45.3
Expand All @@ -84,8 +83,10 @@ usage: |
sort-by: .stack_slug
group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-")
```
[!IMPORTANT]
>**Please note!** the `terraform-state-*` parameters refer to the S3 Bucket and corresponding meta storage DynamoDB table used to store the Terraform Plan files, and not the "Terraform State". These parameters will be renamed in a subsequent release.
[!IMPORTANT]
>**Please note!** the `terraform-state-*` parameters refer to the S3 Bucket and corresponding meta storage DynamoDB table used to store the Terraform Plan files, and not the "Terraform State". These parameters will be renamed in a subsequent release.
### GitHub Actions Workflow Example
In following GitHub workflow example first job will filter components that have settings `github.actions_enabled: true` and then in following job `stack_slug` will be printed to stdout.
Expand Down Expand Up @@ -120,21 +121,19 @@ usage: |
```
### Migrating from `v0` to `v1`
The major changes between versions `v0` and `v1` are as follows:
- `v1` replaced the `jq-query` input parameter with a new parameter called `selected-filter` to simplify the query for end-users.
1. `v1` replaces the `jq-query` input parameter with a new parameter called `selected-filter` to simplify the query for end-users.
Now you need to specify only the part used inside of the `select(...)` function of the `jq-query`.
-`v1` moved parameters from the `inputs` to the Atmos GitOps config file, which defaults to `./.github/config/atmos-gitops.yaml`
2.`v1` moves most of the `inputs` to the Atmos GitOps config path `./.github/config/atmos-gitops.yaml`. Simply create this file, transfer your settings to it, then remove the corresponding arguments from your invocations of the `cloudposse/github-action-atmos-terraform-select-components` action.
| name |
|--------------------------|
| `atmos-version` |
| `atmos-config-path` |
For example, if you want the same behavior in `v1` as in `v0`, you should create the `./.github/config/atmos-gitops.yaml` config with the same variables as in `v1` inputs.
In `v1`, the GItHub Action would invocation would look like this:
If you want the same behavior in `v2` as in `v1` you should create config `./.github/config/atmos-gitops.yaml` with the same variables as in `v0` inputs.
```yaml
- name: Selected Components
Expand All @@ -145,7 +144,7 @@ usage: |
select-filter: '.settings.github.actions_enabled // false'
```
This is the same as the following `v0` configuration:
Which would produce the same behavior as in `v2`, doing this:
```yaml
- name: Selected Components
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ inputs:
required: false
nested-matrices-count:
required: false
description: 'Matrices nested levels count (from 1 to 3)'
description: 'Number of nested matrices that should be returned as the output (from 1 to 3)'
default: "2"
outputs:
selected-components:
description: Selected GitOps components
value: ${{ steps.selected-components.outputs.components }}
matrix:
description: Matrix for Selected GitOps components
value: ${{ steps.matrix.outputs.matrix }}
has-selected-components:
description: Whether there are selected components
value: ${{ steps.selected-components.outputs.components != '[]' }}
matrix:
description: The selected components as matrix structure suitable for extending matrix size workaround (see README)
value: ${{ steps.matrix.outputs.matrix }}

runs:
using: "composite"
Expand Down
4 changes: 2 additions & 2 deletions docs/github-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| debug | Enable action debug mode. Default: 'false' | false | false |
| head-ref | The head ref to checkout. If not provided, the head default branch is used. | ${{ github.sha }} | false |
| jq-version | The version of jq to install if install-jq is true | 1.6 | false |
| nested-matrices-count | Matrices nested levels count (from 1 to 3) | 2 | false |
| nested-matrices-count | Number of nested matrices that should be returned as the output (from 1 to 3) | 2 | false |
| select-filter | jq query that will be used to select atmos components | . | false |


Expand All @@ -17,6 +17,6 @@
| Name | Description |
|------|-------------|
| has-selected-components | Whether there are selected components |
| matrix | Matrix for Selected GitOps components |
| matrix | The selected components as matrix structure suitable for extending matrix size workaround (see README) |
| selected-components | Selected GitOps components |
<!-- markdownlint-restore -->

0 comments on commit 5996298

Please sign in to comment.