Skip to content

Commit faa6886

Browse files
goruhadudymasosterman
authored
Get any info from atmos describe component (#17)
## 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]>
1 parent 4c121e3 commit faa6886

File tree

4 files changed

+61
-6
lines changed

4 files changed

+61
-6
lines changed

.github/workflows/test-positive.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ jobs:
3030
with:
3131
component: foo
3232
stack: core-ue1-dev
33-
settings-path: level1.level2.level3.secrets-arn
33+
settings-path: settings.level1.level2.level3.secrets-arn
3434

3535
- uses: ./
3636
id: derived
3737
with:
3838
component: derived
3939
stack: core-ue1-dev
40-
settings-path: level1.example
40+
settings-path: settings.level1.example
4141

4242
- uses: ./
4343
id: defaults
4444
with:
4545
component: test-defaults
4646
stack: core-ue1-dev
47-
settings-path: level1.example
47+
settings-path: settings.level1.example
4848

4949
assert:
5050
runs-on: ubuntu-latest

README.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,41 @@ components:
9696
with:
9797
component: foo
9898
stack: core-ue1-dev
99-
settings-path: secrets-arn
99+
settings-path: settings.secrets-arn
100100

101101
- name: Set ENV Vars with AWS Secrets Manager Secret
102102
uses: aws-actions/aws-secretsmanager-get-secrets@v1
103103
with:
104104
secret-ids: ${{ steps.example.outputs.value }}
105105
```
106106
107+
## Migrating from `v0` to `v1`
108+
109+
Starting from `v1` the action is no longer restricted to retrieving the component config from only the `settings` section.
110+
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.
111+
For example, in `v1` you would provide `settings.secrets-arn` as the value to the `settings-path`
112+
```yaml
113+
- name: Get Atmos Setting for Secret ARN
114+
uses: cloudposse/github-action-atmos-get-setting@v1
115+
id: example
116+
with:
117+
component: foo
118+
stack: core-ue1-dev
119+
settings-path: settings.secrets-arn
120+
```
121+
122+
Which would provide the same output as passing only `secrets-arn` in `v0`
123+
124+
```yaml
125+
- name: Get Atmos Setting for Secret ARN
126+
uses: cloudposse/github-action-atmos-get-setting@v0
127+
id: example
128+
with:
129+
component: foo
130+
stack: core-ue1-dev
131+
settings-path: secrets-arn
132+
```
133+
107134

108135

109136

README.yaml

+29-1
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,41 @@ usage: |-
7272
with:
7373
component: foo
7474
stack: core-ue1-dev
75-
settings-path: secrets-arn
75+
settings-path: settings.secrets-arn
7676
7777
- name: Set ENV Vars with AWS Secrets Manager Secret
7878
uses: aws-actions/aws-secretsmanager-get-secrets@v1
7979
with:
8080
secret-ids: ${{ steps.example.outputs.value }}
8181
```
82+
83+
## Migrating from `v0` to `v1`
84+
85+
Starting from `v1` the action is no longer restricted to retrieving the component config from only the `settings` section.
86+
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.
87+
For example, in `v1` you would provide `settings.secrets-arn` as the value to the `settings-path`
88+
```yaml
89+
- name: Get Atmos Setting for Secret ARN
90+
uses: cloudposse/github-action-atmos-get-setting@v1
91+
id: example
92+
with:
93+
component: foo
94+
stack: core-ue1-dev
95+
settings-path: settings.secrets-arn
96+
```
97+
98+
Which would provide the same output as passing only `secrets-arn` in `v0`
99+
100+
```yaml
101+
- name: Get Atmos Setting for Secret ARN
102+
uses: cloudposse/github-action-atmos-get-setting@v0
103+
id: example
104+
with:
105+
component: foo
106+
stack: core-ue1-dev
107+
settings-path: secrets-arn
108+
```
109+
82110
83111
include:
84112
- "docs/github-action.md"

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ runs:
3232
-s ${{ inputs.stack }} \
3333
--format json \
3434
--file "$OUTPUT_FILE" || echo '{}' > "$OUTPUT_FILE"
35-
value=$(jq -rc --arg key ${{ inputs.settings-path }} '.settings | getpath($key | split("."))' "$OUTPUT_FILE")
35+
value=$(jq -rc --arg key ${{ inputs.settings-path }} '. | getpath($key | split("."))' "$OUTPUT_FILE")
3636
echo "value=$value" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)