2016-07-02 13:18:53 +00:00
# Contributing
Your contributions are always welcome!
2021-05-03 13:43:35 +00:00
## Getting started
1. Create your own or pick an opened issue from the [tracker ](https://github.com/sobolevn/git-secret/issues ). Take a look at the [`help-wanted` tag ](https://github.com/sobolevn/git-secret/labels/help%20wanted )
2. Fork the git-secret repo and then clone the repository using a command like `git clone https://github.com/${YOUR_NAME}/git-secret.git`
3. Make sure that everything works on the current platform by running `make test` .
You can also try the experimental `SECRETS_TEST_VERBOSE=1 make test` , which will
show you a lot of debug output while the tests are running.
Note that 'experimental' features may change or be removed in a future version of `git-secret` .
4. If you want to test on multiple operating systems just push your PR, GitHub Actions will cover everything else
Basically, our `make` file is the only thing you will need to work with this repo.
2016-07-02 13:18:53 +00:00
## Process
### Environment
2021-05-03 13:43:35 +00:00
For development of `git-secret` you should have these tools locally:
2016-07-02 13:18:53 +00:00
2016-07-02 13:29:43 +00:00
- git
- bash
2017-09-24 14:03:05 +00:00
- gawk
2019-03-05 12:09:27 +00:00
- gnupg (or gnupg2), see below if not packaged by your distribution/OS (i.e. MacOS)
2021-05-03 13:43:35 +00:00
- sha256sum (on freebsd and MacOS `shasum` is used instead)
- make
2019-03-05 12:09:27 +00:00
2021-05-03 13:43:35 +00:00
To test `git-secret` you will need:
2019-03-05 12:09:27 +00:00
2019-09-20 14:57:32 +00:00
- [docker ](https://www.docker.com/ )
2016-07-02 13:18:53 +00:00
2019-02-21 23:04:23 +00:00
### Code style
New features and changes should aim to be as clear, concise, simple, and consistent
1. clear: make it as obvious as possible what the code is doing
2021-05-03 13:43:35 +00:00
2. concise: your PR should be as few characters (not just lines) of changes as _reasonable_ .
However, generally choose clarity over being concise.
2019-02-21 23:04:23 +00:00
Clarity and conciseness can be in conflict with each other. But
it's more important for the code to be understandable than for it to be small.
Therefore favor writing clear code over making shorter diffs in your PRs.
2021-05-03 13:43:35 +00:00
3. simple: this dovetails with the previous two items.
2019-02-21 23:04:23 +00:00
git-secret is a security product, so it's best to have the code be easy to understand.
This also aids future development and helps minimize bugs.
4. consistent: Write code that is consistent with the surrounding code and the rest of the git-secret code base.
Every code base has its own conventions and style that develop and accrete over time.
Consistency also means that the inputs and outputs of git-secret should be as consistent as reasonable
2021-05-03 13:43:35 +00:00
with related Unix and git tools, and follow the 'rule of least surprise',
2019-02-21 23:04:23 +00:00
also known as the 'principle of least astonishment': < https: / / en . wikipedia . org / wiki / Principle_of_least_astonishment >
2021-05-03 13:43:35 +00:00
We wrote this to clarify our thinking about how git-secret should be written. Of course, these are philosophical goals,
2019-02-21 23:04:23 +00:00
not necessities for releasing code, so balancing these four ideals _perfectly_ is both unwarranted and impossible.
### Writing PRs
2021-05-03 13:43:35 +00:00
If you're planning a large change to `git-secret` (for example, a lot of lines/characters of diffs, affecting multiple commands,
changing/adding a lot of behavior, or adding multiple command-line options), it's best to discuss the changes in an Issue first.
Also it's often best to implement larger or complex changes as a series of planned-out, smaller PRs,
2019-02-21 23:04:23 +00:00
each making a small set of specific changes. This facilitates discussions of implementation, which often come to light
only after seeing the actual code used to perform a task.
2019-09-20 14:57:32 +00:00
As mentioned above, we seek to be consistent with surrounding git and Unix tools, so when writing changes to git-secret,
think about the input, output, and command-line options that similar Unix commands use.
2019-02-21 23:04:23 +00:00
2021-05-03 13:43:35 +00:00
Our favor toward traditional Unix and git command-style inputs and outputs can also mean it's appropriate to
2019-09-20 14:57:32 +00:00
lean heavily on git and widely-used Unix command features instead of re-implementing them in code.
2019-02-21 23:04:23 +00:00
2016-07-02 13:18:53 +00:00
### Development Process
2019-09-20 14:57:32 +00:00
1. Firstly, you should setup git-secret's development git hooks with `make install-hooks`
This will copy the hooks from utils/hooks into .git/hooks/pre-commit and .git/hooks/post-commit
2019-03-05 12:09:27 +00:00
2. Make changes to the git secret files that need to be changed
3. When making changes to any files inside `src/` , for changes to take effect you will need to rebuild the `git-secret` script with `make clean && make build`
2021-05-03 13:43:35 +00:00
4. Run `shellcheck` against all your changes with `make lint` .
2019-04-27 20:35:23 +00:00
You should also check your changes for spelling errors using 'aspell -c filename'.
2021-05-03 13:43:35 +00:00
2019-02-21 23:04:23 +00:00
5. Add an entry to CHANGELOG.md, referring to the related issue # if appropriate
2019-03-05 12:09:27 +00:00
2021-05-04 09:26:39 +00:00
6. Change the `man` source file(s) (we write them in markdown) in `man/man1` and `man/man7` to document your changes if appropriate
2019-03-05 12:09:27 +00:00
2021-05-03 13:43:35 +00:00
7. Now, add all your files to the commit with `git add --all` and commit changes with `git commit` .
2019-03-05 12:09:27 +00:00
Write a good commit message which explains your work
8. When running `git commit` the tests will run automatically, your commit will be canceled if they fail.
2019-02-21 23:04:23 +00:00
You can run the tests manually with `make clean build test` .
2019-09-20 14:57:32 +00:00
If you want to make a commit and not run the pre- and post-commit hooks, use 'git commit -n'
2021-05-03 13:43:35 +00:00
2019-09-20 14:57:32 +00:00
9. Push to your repository, and make a pull-request against `master` branch. It's ideal to have one commit per pull-request,
but don't worry, it's easy to `squash` PRs into a small number of commits when they're merged.
2016-07-02 13:18:53 +00:00
### Branches
2019-02-21 23:04:23 +00:00
We have two long-live branches: `master` for the git-secret code and man pages, and `gh-pages` for the static web site.
2020-12-15 15:49:51 +00:00
The `gh-pages` branch tracks the `master` branch's `docs` folder, and is kept up-to-date using a GitHub Action.
2016-07-02 13:18:53 +00:00
2019-02-21 23:04:23 +00:00
Development looks like this:
2016-07-02 13:18:53 +00:00
2018-09-28 08:18:10 +00:00
> `your-branch` -> `master`
2016-07-02 13:18:53 +00:00
2019-03-05 12:09:27 +00:00
- `master` branch is protected, so only fully tested code goes there. It is also used to create a new `git` tag and a `github` release
2019-09-20 14:57:32 +00:00
By convention, you can name your branches like `issue-###-short-description` , but that's not required.
2021-05-03 13:43:35 +00:00
The `gh-pages` branch is used for the pages at `git-secret.io` . See 'Release Process' below.
2016-07-02 13:18:53 +00:00
2019-04-29 22:21:30 +00:00
### Writing tests
`git-secret` uses [bats-core ](https://github.com/bats-core/bats-core ) for testing.
See the files in tests/ and the `bats-core` documentation for details.
Because the output of many commands can be affected by the SECRETS_VERBOSE environment
2021-05-03 13:43:35 +00:00
variable (which enables verbosity), it's best not to expect a particular number of lines of
2019-04-29 22:21:30 +00:00
output from commands.
2016-07-02 13:18:53 +00:00
### Release process
2020-11-23 17:19:05 +00:00
To create a new release, (you'll first need permission to commit to the repo, of course):
Update the content of `CHANGELOG.md` for the release (this should be a matter of changing headers),
2021-05-04 09:26:39 +00:00
and update the version string in `src/version.sh` .
2020-11-23 17:19:05 +00:00
2021-05-04 09:26:39 +00:00
When creating a commit inside the `master` branch (it is usually a documentation and changelog update with the version bump inside `src/version.sh` ).
2016-07-02 13:18:53 +00:00
2021-05-04 09:26:39 +00:00
Then, push your code to GitHub. It will start the CI.
2019-09-20 14:57:32 +00:00
2021-05-04 09:26:39 +00:00
After all the checks have executed, GitHub Actions will test and build releases for specific platforms.
2019-03-05 12:09:27 +00:00
2021-05-04 09:26:39 +00:00
While CI is doing it's building and testing, finish the release on github by pushing the new tag with:
2020-11-23 17:19:05 +00:00
2021-05-03 13:43:35 +00:00
```bash
git push --tags
```
2020-11-23 17:19:05 +00:00
and then go to https://github.com/sobolevn/git-secret/releases and 'draft a new release',
setting up a production release like the previous ones.
2021-05-03 13:43:35 +00:00
#### GitHub automated releases
2018-07-17 14:25:16 +00:00
2021-05-03 13:43:35 +00:00
TODO
2016-07-02 13:18:53 +00:00
#### Manual releases
2019-09-20 14:57:32 +00:00
Releases to `brew` are made manually, and involve opening a PR on the [Homebrew Core ](https://github.com/Homebrew/homebrew-core ) repo .
To get started, see the
[Homebrew docs about Formulae-related PRs ](https://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request#formulae-related-pull-request )
and `brew bump-formula-pr --help`
2016-07-02 13:18:53 +00:00
2019-01-15 04:16:41 +00:00
### Downstream Packages
2021-05-03 13:43:35 +00:00
There are several distributions and packaging systems that may already have git-secret packaged for your distribution (although sometimes their versions are not the most current, and we recommend all users upgrade to 0.2.5 or above).
2019-01-15 04:16:41 +00:00
### Notes to Downstream Packagers (Those who make packages for specific OSes/distributions)
First of all, thank you for packaging git-secret for your platform! We appreciate it.
2021-05-03 13:43:35 +00:00
We also would like to welcome you to collaborate or discuss any issues, ideas or thoughts you have about
git-secret by submitting [issue report ](https://github.com/sobolevn/git-secret/issues )
(which can also be feature requests) or
[pull requests ](https://help.github.com/en/articles/creating-a-pull-request )
via the git repo at
[git-secret on github ](https://github.com/sobolevn/git-secret )
2019-01-15 04:16:41 +00:00
2021-05-03 13:43:35 +00:00
Please let us know if there are any changes you'd like to see to the source,
packaging, testing, documentation, or other aspect of git-secret.
2019-01-15 04:16:41 +00:00
We look forward to hearing from you.
2018-02-03 07:57:14 +00:00
2021-05-03 13:43:35 +00:00
## About GnuPG
Here are some links to gnupg documentation that might be useful for those working with git-secret:
- [GnuPG PDF Documentation ](https://www.gnupg.org/documentation/manuals/gnupg.pdf )
- [GnuPG doc/DETAILS File ](https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=doc/DETAILS )
2018-02-03 07:57:14 +00:00
## Financial contributions
We also welcome financial contributions in full transparency on our [open collective ](https://opencollective.com/git-secret ).
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
## Credits
### Contributors
2021-05-03 13:43:35 +00:00
Thank you to all the people who have already contributed
to `git-secret` via commits to our git repository!
[![List of contributors ](https://opencollective.com/git-secret/contributors.svg?width=890&button=0 )](https://github.com/sobolevn/git-secret/contributors)
2018-02-03 07:57:14 +00:00
### Backers
Thank you to all our backers! [[Become a backer ](https://opencollective.com/git-secret#backer )]
2021-05-03 13:43:35 +00:00
< object type = "image/svg+xml" data = "https://opencollective.com/git-secret/tiers/backer.svg?avatarHeight=36&width=600" style = "max-width: 100%;" > < / object >
2018-02-03 07:57:14 +00:00
### Sponsors
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor ](https://opencollective.com/git-secret#sponsor ))
2021-05-03 13:43:35 +00:00
< object type = "image/svg+xml" data = "https://opencollective.com/git-secret/tiers/sponsor.svg?avatarHeight=36&width=600" style = "max-width: 100%;" > < / object >