Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that overwrite env var works in nested action #453

Merged
merged 3 commits into from
May 20, 2023

Conversation

leonardovillela
Copy link
Contributor

Description 📜

This PR introduces changes to add an E2E test to verify if it's possible to overwrite env vars value set before in a nested action. This test is nice to ensure we do not introduce this bug again as a regression in the future.

Closes #350

cc: @Zlaticanin

@hashicorp-cla
Copy link

hashicorp-cla commented Apr 29, 2023

CLA assistant check
All committers have signed the CLA.

@thyton thyton self-requested a review May 3, 2023 17:21
Copy link
Contributor

@thyton thyton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @leonardovillela, thanks for taking this on!
Based on #350, the expected behavior is described as the env var should have the new value after a subsequent call to vault-action. Perhaps, a simple enough approach to testing it could be the following. We don't need a separate action file for this approach.

  • Creating another endpoint to secret/data that has a different secret value
await got(`http://${vaultUrl}/v1/secret/data/subsequent-test`, {
            method: 'POST',
            headers: {
                'X-Vault-Token': vaultToken,
            },
            json: {
                data: {
                    secret: 'SUBSEQUENT_TEST_SECRET',
                },
            },
        });
  • Calling vault-action twice and reading secret/data/test and the new endpoint subsequently
- name: Test Vault Action Overwrites Env Vars In Subsequent Action (part 1/2)
      uses: ./
      with:
        url: http://localhost:8200/
        token: testtoken
        secrets: |
          secret/data/test secret | SUBSEQUENT_TEST_SECRET;
- name: Test Vault Action Overwrites Env Vars In Subsequent Action (part 2/2)
      uses: ./
      with:
        url: http://localhost:8200/
        token: testtoken
        secrets: |
          secret/data/subsequent-test secret | SUBSEQUENT_TEST_SECRET;

@thyton thyton added the waiting-for-response Indicates a maintainer asked a question that must be answered by contributors before proceeding label May 5, 2023
@leonardovillela
Copy link
Contributor Author

Hi @thyton, thanks for your review 🙇

Based on #350, the expected behavior is described as the env var should have the new value after a subsequent call to vault-action.

On #350 the scenario described include also a new action that calls the vault-action, I tried to reproduce the exactly same scenario mentioned in the issue. But probably having this new action does not make that big difference, so I implemented your suggestion in 1d5aa91

.github/workflows/build.yml Outdated Show resolved Hide resolved
@thyton thyton merged commit d27529e into hashicorp:main May 20, 2023
@thyton thyton removed the waiting-for-response Indicates a maintainer asked a question that must be answered by contributors before proceeding label May 20, 2023
@fairclothjm fairclothjm mentioned this pull request Jun 7, 2023
fairclothjm added a commit that referenced this pull request Jun 8, 2023
fairclothjm added a commit that referenced this pull request Jun 8, 2023
thyton added a commit that referenced this pull request Jun 13, 2023
…action (#453)"  (#467)

Fix e2e CI failure VAULT-17057
Co-authored-by: Leonardo Villela <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants