A k6 extension enables k6 tests to comfortably encrypt and decrypt ansible vault values. Using ansible vault in tests makes possible to publish secrets with tests in a safe way. The vault password can be pass as environment variable when test run.
The underlying implementation is https://github.com/sosedoff/ansible-vault-go
Import an entire module's contents:
import * as vault from "k6/x/ansible-vault";
Import a single export from a module:
import { encrypt, decrypt } from "k6/x/ansible-vault";
Functions:
For complete API documentation click here!
To build a k6
binary with this extension, first ensure you have the prerequisites:
- Go toolchain
- Git
Then:
- Install
xk6
:
$ go install go.k6.io/xk6/cmd/xk6@latest
- Build the binary:
$ xk6 build --with github.com/szkiba/xk6-ansible-vault@latest