Skip to content

Commit

Permalink
new tests for custom fields (#5)
Browse files Browse the repository at this point in the history
* new tests for custom fields

* update test

* update test

* update test

* update tests

* update tests and docs
  • Loading branch information
Benbentwo authored Aug 1, 2023
1 parent b892ea1 commit 74cb51f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/test-positive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
- env: dev
expected-namespace: dev
expected-cluster-role: arn:aws:iam::123456789012:role/my-gha-cluster-role
- env: custom
expected-foo: bar
expected-namespace: dev
expected-service-config-ssm-path: service/app/config/custom/app-ns
env: [preview, preview-prs, production, dev]
runs-on: ubuntu-latest
continue-on-error: true
Expand Down Expand Up @@ -61,6 +65,13 @@ jobs:
namespace: dev
cluster-role: arn:aws:iam::123456789012:role/my-gha-cluster-role
custom:
cluster: dev
namespace: dev
cluster-role: foo
service-config-ssm-path: service/app/config/custom/app-ns
foo: bar
- uses: nick-fields/assert-action@v1
with:
actual: "${{ steps.current.outputs.namespace }}"
Expand All @@ -72,6 +83,25 @@ jobs:
actual: "${{ steps.current.outputs.role }}"
expected: '${{ matrix.expected-cluster-role }}'

- name: Environment info
uses: cloudposse/[email protected]
id: result
with:
query: .
config: ${{ steps.current.outputs.environment-config }}

- uses: nick-fields/assert-action@v1
if: ${{ matrix.expected-foo }}
with:
actual: "${{ steps.result.outputs.foo }}"
expected: '${{ matrix.expected-foo }}'

- uses: nick-fields/assert-action@v1
if: ${{ matrix.expected-service-config-ssm-path }}
with:
actual: "${{ steps.result.outputs.service-config-ssm-path }}"
expected: '${{ matrix.expected-service-config-ssm-path }}'

teardown:
runs-on: ubuntu-latest
needs: [test]
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,18 @@ With this action your `config` input can have several helper functions.
ssm-path: platform/staging-cluster
```
* To get custom key value pairs you can query the selected environment with a follow up step:
```yaml
- name: Environment info
uses: cloudposse/[email protected]
id: environment-info
with:
query: .
config: ${{ steps.result.outputs.environment-config }}
```
Full Workflow example:
<details><summary>Full Example:</summary>
<details><summary> Full Workflow example:</summary>
```yaml
name: 'Environments - ArgoCD'
Expand Down
10 changes: 10 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ usage: |-
ssm-path: platform/staging-cluster
```
* To get custom key value pairs you can query the selected environment with a follow up step:
```yaml
- name: Environment info
uses: cloudposse/[email protected]
id: environment-info
with:
query: .
config: ${{ steps.result.outputs.environment-config }}
```
<details><summary> Full Workflow example:</summary>
Expand Down

0 comments on commit 74cb51f

Please sign in to comment.