From 74cb51faabcb1c48e227decf7df2406d3d2dd8fc Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Tue, 1 Aug 2023 11:02:54 -0700 Subject: [PATCH] new tests for custom fields (#5) * new tests for custom fields * update test * update test * update test * update tests * update tests and docs --- .github/workflows/test-positive.yml | 30 +++++++++++++++++++++++++++++ README.md | 14 +++++++++++--- README.yaml | 10 ++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-positive.yml b/.github/workflows/test-positive.yml index a49b305..4c0c542 100644 --- a/.github/workflows/test-positive.yml +++ b/.github/workflows/test-positive.yml @@ -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 @@ -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 }}" @@ -72,6 +83,25 @@ jobs: actual: "${{ steps.current.outputs.role }}" expected: '${{ matrix.expected-cluster-role }}' + - name: Environment info + uses: cloudposse/github-action-yaml-config-query@0.1.0 + 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] diff --git a/README.md b/README.md index 07a176f..c1c52f1 100644 --- a/README.md +++ b/README.md @@ -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/github-action-yaml-config-query@0.1.0 +id: environment-info +with: + query: . + config: ${{ steps.result.outputs.environment-config }} +``` -Full Workflow example: - -
Full Example: +
Full Workflow example: ```yaml name: 'Environments - ArgoCD' diff --git a/README.yaml b/README.yaml index 126cacb..a0faa0a 100644 --- a/README.yaml +++ b/README.yaml @@ -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/github-action-yaml-config-query@0.1.0 + id: environment-info + with: + query: . + config: ${{ steps.result.outputs.environment-config }} + ```
Full Workflow example: