These are the guidelines for contributing to the dexec
CLI and also applies to the associated Docker images and tooling projects.
Please consult the reference section of the README before creating issues. It may contain the answer to your problem.
Fork the repo. Make your changes. Raise a PR.
All PRs are welcome, and changes don't just have to be additive - if you have ideas about how to improve existing code, please feel free to submit these.
dexec
is written in go and changes must adhere to the default settings for all the following tools:
- go vet
- gofmt
- golint
A good place to start is with the go-plus package for Atom which automatically verifies the code against those tools.
Dependencies are managed using the experimental vendor feature introduced in Go 1.5. Versioned library code is committed to the dexec repo to guarantee reproducible builds, and the tool used to achieve this is Godep. Please read the Godep documentation if you need to add a new library.
Unit tests are required for new contributions in most cases. Don't break the existing ones. Run the following command from the path that you checked out dexec to run the unit tests:
go test ./...
A suite of acceptance tests can be found in the dexec/_bats folder. If you are adding a new image, you must also add to the acceptance tests.
Vagrant's VirtualBox provider is used to spin up an Ubuntu VM on which Docker is installed. The current dexec
folder is mounted in the VM, built and then run against four bats tests for each docker-exec image. The tests are:
- Verify simple output.
- Verify unicode output.
- Verify execution arguments are available to script.
- Verify code can be run as standalone script.
Run the following command from the path that you checked out dexec to run the acceptance tests:
acceptance_tests/acceptance_tests.sh run
By default, the vagrant box will be restored to its initial state at the start of every run. This guarantees sandboxing of the application and images, but means that all the images will be redownloaded every time you run the tests. This may not be desirable during development as it takes several minutes to download the images. To avoid this you can add the --no-clean
option to reuse images that have already been downloaded to the VM:
acceptance_tests/acceptance_tests.sh run --no-clean