Skip to content

Commit

Permalink
Get any info from atmos describe component (#17)
Browse files Browse the repository at this point in the history
## what
* Remove restriction to `settings` section.

## Why
* To reuse this action for fetching `component_info.component_path` settings


Co-authored-by: Jeremy White <[email protected]>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
  • Loading branch information
3 people authored Dec 13, 2023
1 parent 4c121e3 commit faa6886
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-positive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ jobs:
with:
component: foo
stack: core-ue1-dev
settings-path: level1.level2.level3.secrets-arn
settings-path: settings.level1.level2.level3.secrets-arn

- uses: ./
id: derived
with:
component: derived
stack: core-ue1-dev
settings-path: level1.example
settings-path: settings.level1.example

- uses: ./
id: defaults
with:
component: test-defaults
stack: core-ue1-dev
settings-path: level1.example
settings-path: settings.level1.example

assert:
runs-on: ubuntu-latest
Expand Down
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,41 @@ components:
with:
component: foo
stack: core-ue1-dev
settings-path: secrets-arn
settings-path: settings.secrets-arn

- name: Set ENV Vars with AWS Secrets Manager Secret
uses: aws-actions/aws-secretsmanager-get-secrets@v1
with:
secret-ids: ${{ steps.example.outputs.value }}
```
## Migrating from `v0` to `v1`

Starting from `v1` the action is no longer restricted to retrieving the component config from only the `settings` section.
If you want the same behavior in `v1` as in`v0`, you should add the `settings.` prefix to the value of the `settings-path` variable.
For example, in `v1` you would provide `settings.secrets-arn` as the value to the `settings-path`
```yaml
- name: Get Atmos Setting for Secret ARN
uses: cloudposse/github-action-atmos-get-setting@v1
id: example
with:
component: foo
stack: core-ue1-dev
settings-path: settings.secrets-arn
```

Which would provide the same output as passing only `secrets-arn` in `v0`

```yaml
- name: Get Atmos Setting for Secret ARN
uses: cloudposse/github-action-atmos-get-setting@v0
id: example
with:
component: foo
stack: core-ue1-dev
settings-path: secrets-arn
```




Expand Down
30 changes: 29 additions & 1 deletion README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,41 @@ usage: |-
with:
component: foo
stack: core-ue1-dev
settings-path: secrets-arn
settings-path: settings.secrets-arn
- name: Set ENV Vars with AWS Secrets Manager Secret
uses: aws-actions/aws-secretsmanager-get-secrets@v1
with:
secret-ids: ${{ steps.example.outputs.value }}
```
## Migrating from `v0` to `v1`
Starting from `v1` the action is no longer restricted to retrieving the component config from only the `settings` section.
If you want the same behavior in `v1` as in`v0`, you should add the `settings.` prefix to the value of the `settings-path` variable.
For example, in `v1` you would provide `settings.secrets-arn` as the value to the `settings-path`
```yaml
- name: Get Atmos Setting for Secret ARN
uses: cloudposse/github-action-atmos-get-setting@v1
id: example
with:
component: foo
stack: core-ue1-dev
settings-path: settings.secrets-arn
```
Which would provide the same output as passing only `secrets-arn` in `v0`
```yaml
- name: Get Atmos Setting for Secret ARN
uses: cloudposse/github-action-atmos-get-setting@v0
id: example
with:
component: foo
stack: core-ue1-dev
settings-path: secrets-arn
```
include:
- "docs/github-action.md"
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ runs:
-s ${{ inputs.stack }} \
--format json \
--file "$OUTPUT_FILE" || echo '{}' > "$OUTPUT_FILE"
value=$(jq -rc --arg key ${{ inputs.settings-path }} '.settings | getpath($key | split("."))' "$OUTPUT_FILE")
value=$(jq -rc --arg key ${{ inputs.settings-path }} '. | getpath($key | split("."))' "$OUTPUT_FILE")
echo "value=$value" >> $GITHUB_OUTPUT

0 comments on commit faa6886

Please sign in to comment.