A big welcome and thank you for considering contributing to DontShaveTheYak (dsty) open source projects! It’s people like you that help reduce Yak Shaving in the DevOps community.
Reading and following these guidelines will help us make the contribution process easy and effective for everyone involved. It also communicates that you agree to respect the time of the developers managing and developing these open source projects. In return, we will reciprocate that respect by addressing your issue, assessing changes, and helping you finalize your pull requests.
Contributions are made to this repo via Issues and Pull Requests (PRs). A few general guidelines that cover both:
- Search for existing Issues and PRs before creating your own.
- We work hard to makes sure issues are handled in a timely manner but, depending on the impact, it could take a while to investigate the root cause. A friendly ping in the comment thread to the submitter or a contributor can help draw attention if your issue is blocking.
Issues should be used to report problems with the library, request a new feature, or to discuss potential changes before a PR is created.
If you find an Issue that addresses the problem you're having, please add your own reproduction information to the existing issue rather than creating a new one. Adding a reaction can also help be indicating to our maintainers that a particular problem is affecting more than just the reporter.
PRs to our libraries are always welcome and can be a quick way to get your fix or improvement slated for the next release. In general, PRs should:
- Only fix/add the functionality in question OR address wide-spread whitespace/style issues, not both.
- Add unit or integration tests for fixed or changed functionality (if a test suite already exists).
- Address a single concern in the least number of changed lines as possible.
- Include javadoc documentation in the repo.
In general, we follow the "fork-and-pull" Git workflow
- Fork the repository to your own Github account
- Clone the project to your machine
- Create a branch locally with a succinct but descriptive name
- Commit changes to the branch
- Following any formatting and testing guidelines specific to this repo
- Push changes to your fork
- Open a PR in our repository so that we can efficiently review the changes.
We are using GroovyLint to create a consistent experience when reading the source code. We do often ignore certain rules from GroovyLint like getter/setter rules so feel free to ignore a rule that you don't think applies.
The testing of this library is a little quirky. We currently test the library by creating Jenkins jobs in the jobs folder. The format is jobs/${packageName}/${className}_example.groovy
and this serves a basic example for users on how to use the class. You can also create unit tests using this format jobs/${packageName}/tests/test_${className}.groovy
We then use pytest to call a docker image that will run the jenkins job and return the output of the job. Pytest files use the following format tests/test_${packageName}/test_${className}.py
We highly recommend the development environment we have setup for vscode. This development environment contains all the tooling and dependencies you need to contribute to this project and will save you hours of time setting up these items manually.
The requirements for using the vscode dev environment is to have the remote-containers extension installed.
When you first open this repository in vscode you will get a notification that this workspace contains a dev container. Click "Reopen in Container"
If you miss the notification you can manually open the workspace in a remote container by opening up the command palette CTRL+SHIFT+P
and type Open Workspace in Container
.
Note: The first time you open the workspace using the remote-container it will take 5-10mins to configure the development environment. The next time you use the remote-container it will open much faster.
Once opened in the dev container you can:
- Run linting with
pre-commit run -a
- Open
http://localhost:5050
in your browser to access the Jenkins UI and run tests manually. When you click build on a job, it will automaticly use the latest job/library code. - Run all the tests in Jenkins UI automaticlly with
pytest -s
If you are not using docker or vscode you can setup a development environment using the following steps:
- Have python (we use 3.9) installed and you should probably setup a venv. Pyenv Guide
- Install the python requirements.
python -m pip install tests/requirements.txt
- Install pre-commit hooks.
pre-commit install
- Run pre-commit to test everything is setup correctly.
pre-commit run --all-files
- Make your changes and add or update tests.
- Run pytest
pytest -s
- Once all tests are passing commit your changes and open a PR.