Skip to content

Commit

Permalink
Add pre commit (#13)
Browse files Browse the repository at this point in the history
* add pre-commit config

* add yapf hook

* format using google style

* use black instead of yapf, add prettier

* fix missing .yaml

* run updated pre-commit

* set black line length to 120

* run pre-commit using line length=120
  • Loading branch information
tuterdust authored and whs committed Oct 7, 2019
1 parent 0d7d0bb commit 44918a0
Show file tree
Hide file tree
Showing 25 changed files with 341 additions and 333 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.git
__pycache__
test_*.py
.pre-commit-config.yaml
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v1.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: check-docstring-first
- id: trailing-whitespace
- id: check-symlinks
- repo: https://github.com/ambv/black.git
rev: 19.3b0
hooks:
- id: black
entry: black -l 120 --target-version py36
- repo: https://github.com/prettier/prettier.git
rev: 1.18.2
hooks:
- id: prettier
files: \.(css|less|scss|ts|tsx|graphql|gql|js|jsx|md|yaml|yml)$
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,74 +8,102 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]

## [4.4.1] - 2019-09-18

### Changed

- Bump pyyaml (@seehait)

## [4.4.0] - 2019-09-18

### Changed

- Docker image now use Debian Buster
- Docker image now comes with Kubectl 1.15.3

### Fixed

- Compatibility with kubectl 1.15 (@seehait)

## [4.3.0] - 2018-11-03

### Changed

- Job now exit with code 3 when job failure status is greater than zero.

## [4.2.1] - 2018-10-01

### Fixed

- Republished due to unclean build directory. Now using CI to cleanly submit

## [4.2.0] - 2018-09-24

### Changed

- Deploy now exit with code 3 when `kubectl rollout wait` exit with status code

## [4.1.2] - 2018-08-17

### Fixed

- Republished due to unclean build directory

## [4.1.1] - 2018-08-06

### Changed

- Updated dependencies
- Docker now use Python 3.7
- Updated Kubernetes client in Docker image to 1.11.1

## [4.1.0] - 2018-07-06

### Changed

- Job deployment will always removed after job success or failed
- Fix exception raised when deploy job but pod was not scheduled

## [4.0.0] - 2018-06-15

### Added

- Pluggable formatters

### Changed

- BREAKING: The `formatter` module is moved to `yaml_formatter`. `formatter` now offer an abstract base class and the previous `format` function
- BREAKING: Unmatched variable now cause warning (#4, @blead)

## [3.0.1] - 2018-04-17

### Changed

- Set PYTHONUNBUFFERED in Docker
- Default timeout is 300s

## [3.0.0] - 2018-04-10

### Changed

- BREAKING: Timed out jobs now exit with status code 2
- BREAKING: Job timeout now count only idle time.
- The previous behavior resulting in failing deployments when rollout involve many pods. A workaround is to adjust timeout based on expected number of pod. This new behavior ensure that the default timeout should be relevant regardless of number of pods. It should still be adjusted if the pod takes longer to start.
- The new timeout timer will reset when output of `kubectl rollout status` changed.
- Updated kubectl

## [2.1.0] - 2017-12-22

### Added

- deploy/job now have `--timeout` option, defaulting to 60s

## [2.0.0] - 2017-12-22

### Changed

- Initial open source release 🎉

[Unreleased]: https://github.com/wongnai/eastern/compare/v4.4.0...HEAD
[unreleased]: https://github.com/wongnai/eastern/compare/v4.4.0...HEAD
[4.4.0]: https://github.com/wongnai/eastern/compare/v4.3.0...v4.4.0
[4.3.0]: https://github.com/wongnai/eastern/compare/v4.2.1...v4.3.0
[4.2.1]: https://github.com/wongnai/eastern/compare/v4.2.0...v4.2.1
Expand Down
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ A Kubernetes templating and deployment tool.

## Table of Contents

* [Features](#features)
* [Installation](#installation)
* [Installing from PyPI](#installing-from-pypi)
* [Running from Docker Image](#running-from-docker-image)
* [Installing from Git](#installing-from-git)
* [Usage](#usage)
* [Template language](#template-language)
* [Deploy](#deploy)
* [Deploy jobs](#deploy-jobs)
* [Plugin](#plugin)
* [License](#license)
- [Features](#features)
- [Installation](#installation)
- [Installing from PyPI](#installing-from-pypi)
- [Running from Docker Image](#running-from-docker-image)
- [Installing from Git](#installing-from-git)
- [Usage](#usage)
- [Template language](#template-language)
- [Deploy](#deploy)
- [Deploy jobs](#deploy-jobs)
- [Plugin](#plugin)
- [License](#license)

## Features

* Simple, logicless template engine designed for YAML
* Work with multiple environments
* In use in production at [Wongnai](https://www.wongnai.com)
* Extensible plugin architecture
- Simple, logicless template engine designed for YAML
- Work with multiple environments
- In use in production at [Wongnai](https://www.wongnai.com)
- Extensible plugin architecture

## Installation

Expand All @@ -52,7 +52,9 @@ docker run -v `pwd`:/projects/ --rm wongnai/eastern eastern generate /projects/k
3. Run `eastern` to verify that it is installed.

## Usage
### Template language

### Template language

At its core, Eastern is a YAML templating tool. Eastern provides the following commands as YAML comment.

- `load? file_1.yaml, file_2.yaml ...`: Load the first file available
Expand Down Expand Up @@ -87,16 +89,19 @@ Available options:
- `--no-wait`: Exit after running `kubectl` without waiting for rolling deploy

### Deploy jobs

Eastern comes with [Job](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/) deployment tool.

To start a job, run `eastern job path/to/file.yaml namespace image_tag`. The file must have the job as its only document. Eastern will add `image_tag` as job suffix, deploy, wait until job's completion and remove the job.

Supplied `image_tag` is available in the template as `${IMAGE_TAG}`.

## Plugin

Eastern is extensible. We use Eastern plugins ourselves. The API docs is available on [Read the Docs](https://eastern.readthedocs.io/en/latest/).

## License

(C) 2017 Wongnai Media Co, Ltd.

Eastern is licensed under [MIT License](LICENSE)
48 changes: 25 additions & 23 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,33 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'Eastern'
copyright = '2017, Wongnai'
author = 'Wongnai'
project = "Eastern"
copyright = "2017, Wongnai"
author = "Wongnai"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.0.0'
version = "2.0.0"
# The full version, including alpha/beta/rc tags.
release = '2.0.0'
release = "2.0.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -68,10 +68,10 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -81,7 +81,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -92,7 +92,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -104,23 +104,20 @@
# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'Easterndoc'
htmlhelp_basename = "Easterndoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -129,22 +126,27 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Eastern.tex', 'Eastern Documentation', 'Wongnai', 'manual'),
]
latex_documents = [(master_doc, "Eastern.tex", "Eastern Documentation", "Wongnai", "manual")]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'eastern', 'Eastern Documentation', [author], 1)]
man_pages = [(master_doc, "eastern", "Eastern Documentation", [author], 1)]

# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Eastern', 'Eastern Documentation', author, 'Eastern',
'One line description of project.', 'Miscellaneous'),
(
master_doc,
"Eastern",
"Eastern Documentation",
author,
"Eastern",
"One line description of project.",
"Miscellaneous",
)
]
Loading

0 comments on commit 44918a0

Please sign in to comment.