Skip to content

Commit

Permalink
Merge pull request #133 from brigade-automation/develop
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
dbarrosop authored May 4, 2018
2 parents 6c0ac18 + 28a57e0 commit b30c40c
Show file tree
Hide file tree
Showing 242 changed files with 6,161 additions and 9,127 deletions.
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is an example .flake8 config, used when developing *Black* itself.
# Keep in sync with setup.cfg which is used for source packages.

[flake8]
ignore = E266, E501, W503
max-line-length = 80
max-complexity = 15
select = B,C,E,F,W,T4,B9
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/

# C extensions
*.so
Expand Down Expand Up @@ -51,6 +52,7 @@ coverage.xml

# Django stuff:
*.log
*.log.*
local_settings.py

# Flask stuff:
Expand All @@ -62,7 +64,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/ref/configuration/generated/*.rst
docs/configuration/generated/*.rst

# PyBuilder
target/
Expand Down Expand Up @@ -97,3 +99,10 @@ tags
output/

.DS_Store

.pytest_cache/

.vscode

# Generated when testing
nsot-docker.sqlite3
17 changes: 14 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ python:
- 3.5
- 3.6

matrix:
include:
- python: 3.6
env: TOXENV=sphinx
- python: 3.6
env: TOXENV=black
- python: 3.6
env: TOXENV=pylama

install:
- pip install tox-travis
- pip install coveralls
- pip install tox tox-travis coveralls

script:
- tox
Expand All @@ -25,7 +33,10 @@ deploy:
provider: pypi
user: dbarroso
password:
secure: Zq2sLJ1yQzir4rlX9oopchnNqTNkAsbSOApWWPFYZwnLK8swvgMd95PDjLvY07Wzf4NBo1qy+cA1NwXIcAAd2HFr7hmnpj4ZMn2VxJBeznMW9h8OpGRusZs94ilK10A1CEcH77vQsRJYjycLV0hrslbXWfkJh88RJoeJYG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A3UiO28Htu54q3IplhMaaxiMkTUNCj8BVBtykIK956TmDEjp0rJZTX+/64NN+68YYejFwW/Bkjkpra6LOK0AmM1sVoDBm9mNDIHMjiVIyw=
on:
tags: true
branch: master

after_success:
- coveralls
96 changes: 96 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
How to contribute to Brigade
============================

First of all, thank you for conidering to contribute to this project!

Several ways to contribute
--------------------------

There are several things you can do to help the project.

- Spread the word about Brigade
- Suggest great features
- Report bugs
- Fix typos
- Write documentation
- Contribute your plugins
- Improve the Brigade core

Spread the word about Brigade
-----------------------------

Even if you aren't in the position that you can contribute your time to this project, it still helps us if you spread the word about the project. It could be just a short notice in social media or a discussion you have with your friends. As more people become aware of the project there's a better chance that we reach people who are able to contribute. So, even if you can't directly contribute yourself, someone you refer to us might.

Suggesting new features
-----------------------

It could be that you are aware of something that would be great to have in Brigade and we are always welcoming feature requests. Make sure you explain in what scenario your suggested feature would be useful.

Reporting bugs
--------------

When you are `reporting bugs <https://github.com/brigade-automation/brigade/issues>`_, make sure that you give a explaination about the outcome that you expect and what you are seeing. The bugs which are hardest to fix are the ones which we are unable to reproduce. For this reason it's important that you describe what you did and show us how we can reproduce the bug in another environment.

Fix typos
---------

While we try to take care, getting all the works correct can be.. differcult. Typos are the easiest things to fix and if you find any you can help us from looking silly. You can find more typos to fix by looking in the `Brigade source code <https://github.com/brigade-automation/brigade/tree/develop/brigade>`_ or by visiting the `Brigade documentation <https://brigade.readthedocs.io>`_.

Writing documentation
---------------------

Documentation is another great way to help if you don't want to contribute actual code. The documentation of Brigade is divided into different sections.

- Tutorials: Aims to help people learn Brigade with a lot of handholding, the user might not end up with something useful after following the tutorial. The goal is for people to learn how to use Brigade.
- How-to guides: This sections goal is to help people solve a specific task with Brigade
- Reference guides: This section describe the Brigade API and plugins. Most of the content in this area is generated from the source code itself.

Contributions to the documentation can be small fixes such as changing scentences to make the text more clear, or it could be new guides.

Contributing plugins
--------------------

If you have written your custom plugin for Brigade there's a good chance that it can be useful for others as well. General guidelines when writing plugins are:

- Make them as generic as possible, it doesn't help others if they only work in your environment
- Make sure that it's possible to have unit tests which automatically test that the plugins are working


Contributing to the Brigade core
--------------------------------

When you are contributing code to the core of Brigade make sure that the existing tests are passing, and add tests to the code you have added. Having your tests in place ensures that other won't accidentally brake it in the future.

Before you make any significant code changes to the core it's recommended that you open an issue to discuss your ideas before writing the code.

Setting up your environment
---------------------------

In order to run tests locally you need to have `Docker <https://docs.docker.com/install/>`_ and `Pandoc <https://pandoc.org/installing.html>`_ installed. Docker is used to test the Brigade plugins and Pandoc is required for building the documentation provided by `Sphinx <http://www.sphinx-doc.org/>`_. After those are installed you can go ahead and install the needed Python dependencies.

.. code-block:: bash
pip -r requirements-dev.txt
Running tests
-------------

While the automated tests will be triggered when you submit a new pull request it can still save you time to run the tests locally first.

.. code-block:: bash
make tests
The test above will run the tests against the Brigade code and documentation.


Coding style
------------

Brigade uses `Black <https://github.com/ambv/black>`_, the the uncompromising Python code formatter. Black makes it easy for you to format your code as you can do so automatically after installing it. Note that Python 3.6 is required to run Black.

.. code-block:: bash
make format
The Black GitHub repo has information about how you can integrate Black in your editor.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include requirements*
include README.md
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@

.PHONY: format
format:
black .

.PHONY: start_nsot
start_nsot:
docker run -v $(PWD)/tests/inventory_data/nsot/nsot.sqlite3:/nsot.sqlite3 -p 8990:8990 -d --name=nsot nsot/nsot start --noinput
cp $(PWD)/tests/inventory_data/nsot/nsot.sqlite3 $(PWD)/tests/inventory_data/nsot/nsot-docker.sqlite3
docker run -v $(PWD)/tests/inventory_data/nsot/nsot-docker.sqlite3:/nsot.sqlite3 -p 8990:8990 -d --name=nsot nsot/nsot start --noinput

.PHONY: stop_nsot
stop_nsot:
docker rm -f nsot

.PHONY: tests
tests:
tox
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
[![Build Status](https://travis-ci.org/brigade-automation/brigade.svg?branch=develop)](https://travis-ci.org/brigade-automation/brigade) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Coverage Status](https://coveralls.io/repos/github/brigade-automation/brigade/badge.svg?branch=develop)](https://coveralls.io/github/brigade-automation/brigade?branch=develop)


Brigade
=======
Brigade is a pure Python automation framework intented to be used directly from Python. While most automation frameworks use their own DSL which you use to describe what you want to have done, Brigade lets you control everything from Python.

One of the benefits we want to highlight with this approach is the ease of troubleshooting, if something goes wrong you can just use your existing debug tools directly from Python (just add a line of `import pdb` & `pdb.set_trace()` and you're good to go). Doing the same using a DSL can be quite time consuming.

What Brigade brings to the table is that it takes care of dealing with your inventory and manages the job of dispatching the tasks you want to run against your nodes and devices. The framework provides a very simple way to write plugins if you aren't happy with the ones we ship. Of course if you have written a plugin you think can be useful to others, please send us your code and test cases as a [pull request](https://github.com/brigade-automation/brigade/pulls).


Install
=======

While Brigade still supports Python 2.7 the recommended version is 3.6. Install it with pip.

```
pip install brigade
```

Documentation
=============

Read the [Brigade documentation](https://brigade.readthedocs.io/) online or review it's [code here](https://github.com/brigade-automation/brigade/tree/develop/docs)

Examples
========

You can find some examples and already made tools [here](https://github.com/brigade-automation/brg-tools/)


Bugs & New features
===================

If you think you have bug or would like to request a new feature, please register a GitHub account and [open an issue](https://github.com/brigade-automation/brigade/issues).


Contact & Support
=================

While we are happy to help, the [GitHub issues](<https://github.com/brigade-automation/brigade/issues>) are intended for bugs and discussions about new features. If are struggling to get something to work but don't believe its due to a bug in Brigade, the place to ask questions is in the #brigade channel in the [networktoCode Slack team](https://networktocode.herokuapp.com/).


Contributing to Brigade
=======================

See [docs](https://brigade.readthedocs.io).
If you want to help the project, the [Contribution Guidelines](https://brigade.readthedocs.io/en/develop/contributing/index.html) is the best place to start.
2 changes: 1 addition & 1 deletion brigade/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pkg_resources

try:
__version__ = pkg_resources.get_distribution('brigade').version
__version__ = pkg_resources.get_distribution("brigade").version
except pkg_resources.DistributionNotFound:
__version__ = "Not installed"
Loading

0 comments on commit b30c40c

Please sign in to comment.