You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+ added a contribution section to the readme
+ added a local workflow to test changes
+ made the vault token configurable for tests
* bumped action/checkout
Copy file name to clipboardExpand all lines: README.md
+68Lines changed: 68 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ A helper action for easily pulling secrets from HashiCorp Vault™.
31
31
-[Reference](#reference)
32
32
-[Masking - Hiding Secrets from Logs](#masking---hiding-secrets-from-logs)
33
33
-[Normalization](#normalization)
34
+
-[Contributing](#contributing)
34
35
35
36
<!-- /TOC -->
36
37
@@ -419,3 +420,70 @@ This action uses GitHub Action's built-in masking, so all variables will automat
419
420
## Normalization
420
421
421
422
To make it simpler to consume certain secrets as env vars, if no Env/Output Var Name is specified `vault-action` will replace and `.` chars with `__`, remove any other non-letter or number characters. If you're concerned about the result, it's recommended to provide an explicit Output Var Key.
423
+
424
+
## Contributing
425
+
426
+
If you wish to contribute to this project, the following dependencies are recommended for local development:
427
+
- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) to install dependencies, build project and run tests
428
+
- [docker](https://docs.docker.com/get-docker/) to run the pre-configured vault containers for acceptance tests
429
+
- [docker-compose](https://docs.docker.com/compose/) to spin up the pre-configured vault containers for acceptance tests
430
+
- [act](https://github.com/nektos/act) to run the vault-action locally
431
+
432
+
### Build
433
+
434
+
Use npm to install dependencies and build the project:
435
+
436
+
```sh
437
+
$ npm install && npm run build
438
+
```
439
+
440
+
### Vault test instance
441
+
442
+
The Github Action needs access to a working Vault instance to function.
443
+
Multiple docker configurations are available via the docker-compose.yml file to run containers compatible with the various acceptance test suites.
444
+
445
+
```sh
446
+
$ docker-compose up -d vault # Choose one of: vault, vault-enterprise, vault-tls depending on which tests you would like to run
447
+
```
448
+
449
+
Instead of using one of the dockerized instance, you can also use your own local or remote Vault instance by exporting these environment variables:
450
+
451
+
```sh
452
+
$ export VAULT_HOST=<YOUR VAULT CLUSTER LOCATION> # localhost if undefined
453
+
$ export VAULT_PORT=<YOUR VAULT PORT> # 8200 if undefined
454
+
$ export VAULT_TOKEN=<YOUR VAULT TOKEN> # testtoken if undefined
455
+
```
456
+
457
+
### Running unit tests
458
+
459
+
Unit tests can be executed at any time with no dependencies or prior setup.
460
+
461
+
```sh
462
+
$ npm test
463
+
```
464
+
465
+
### Running acceptance tests
466
+
467
+
With a succesful build to take your local changes into account and a working Vault instance configured, you can now run acceptance tests to validate if any regressions were introduced.
468
+
469
+
```sh
470
+
$ npm run test:integration:basic # Choose one of: basic, enterprise, e2e, e2e-tls
471
+
```
472
+
473
+
### Running the action locally
474
+
475
+
You can use the [act](https://github.com/nektos/act) command to test your changes locally if desired. Unfortunately it is not currently possible to use uncommitted local changes for a shared workfow. You will still need to push
476
+
the changes you would like to validate beforehand. Even if a commit is necessary, this is still a more detailed and faster feedback loop than waiting for the action to be executed by Github in a different repository.
477
+
478
+
Push your changes into a feature branch.
479
+
```sh
480
+
$ git checkout -b my-feature-branch
481
+
$ git commit -m "testing new changes"
482
+
$ git push
483
+
```
484
+
485
+
Edit the ./.github/workflows/local-test.yaml file to use your new feature branch. You may have to additionally edit the vault url, token and secret path if you are not using one of the provided containerized instance.
0 commit comments