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
@@ -420,3 +421,70 @@ This action uses GitHub Action's built-in masking, so all variables will automat
420
421
## Normalization
421
422
422
423
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.
424
+
425
+
## Contributing
426
+
427
+
If you wish to contribute to this project, the following dependencies are recommended for local development:
428
+
- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) to install dependencies, build project and run tests
429
+
- [docker](https://docs.docker.com/get-docker/) to run the pre-configured vault containers for acceptance tests
430
+
- [docker-compose](https://docs.docker.com/compose/) to spin up the pre-configured vault containers for acceptance tests
431
+
- [act](https://github.com/nektos/act) to run the vault-action locally
432
+
433
+
### Build
434
+
435
+
Use npm to install dependencies and build the project:
436
+
437
+
```sh
438
+
$ npm install && npm run build
439
+
```
440
+
441
+
### Vault test instance
442
+
443
+
The Github Action needs access to a working Vault instance to function.
444
+
Multiple docker configurations are available via the docker-compose.yml file to run containers compatible with the various acceptance test suites.
445
+
446
+
```sh
447
+
$ docker-compose up -d vault # Choose one of: vault, vault-enterprise, vault-tls depending on which tests you would like to run
448
+
```
449
+
450
+
Instead of using one of the dockerized instance, you can also use your own local or remote Vault instance by exporting these environment variables:
451
+
452
+
```sh
453
+
$ export VAULT_HOST=<YOUR VAULT CLUSTER LOCATION> # localhost if undefined
454
+
$ export VAULT_PORT=<YOUR VAULT PORT> # 8200 if undefined
455
+
$ export VAULT_TOKEN=<YOUR VAULT TOKEN> # testtoken if undefined
456
+
```
457
+
458
+
### Running unit tests
459
+
460
+
Unit tests can be executed at any time with no dependencies or prior setup.
461
+
462
+
```sh
463
+
$ npm test
464
+
```
465
+
466
+
### Running acceptance tests
467
+
468
+
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.
469
+
470
+
```sh
471
+
$ npm run test:integration:basic # Choose one of: basic, enterprise, e2e, e2e-tls
472
+
```
473
+
474
+
### Running the action locally
475
+
476
+
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
477
+
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.
478
+
479
+
Push your changes into a feature branch.
480
+
```sh
481
+
$ git checkout -b my-feature-branch
482
+
$ git commit -m "testing new changes"
483
+
$ git push
484
+
```
485
+
486
+
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