Skip to content

Commit

Permalink
Merged in DEV-11599-update-slack-template (pull request #3)
Browse files Browse the repository at this point in the history
DEV-11599 update slack template

Approved-by: Swen Wenzel <[email protected]>
  • Loading branch information
hfjn committed Sep 3, 2018
2 parents 7d8d030 + 40941ac commit a118284
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ pipeline:
secrets: [ slack_webhook ]
webhook: ${SLACK_WEBHOOK}
channel: shop-data-eng-ci
username: drone
username: ${CI_REPO_NAME}
when:
status: [ success, failure ]
template: >
{{#success build.status}}
*success* {{build.link}} ({{build.branch}}) {{build.pull}} - (${PYTHON_VERSION})
:tada: {{build.link}} ({{build.branch}}) - (Python ${PYTHON_VERSION})
{{else}}
*failure* {{build.link}} ({{build.branch}}) {{build.pull}} - (${PYTHON_VERSION})
:facepalm: {{build.link}} ({{build.branch}}) - (Python ${PYTHON_VERSION})
{{/success}}
Expand Down
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
ignore = E999
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,*.pkl,*.json,*.csv,.venv,pre-commit
max-line-length=119
max-complexity=10
import-order-style=edited
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ VERSION := 0.0.2
GROUP := None
SHELL = /bin/bash

install-hooks:
pip3 install --user -r flake8-requirements.txt && \
pip3 install --user gitpython==2.1.10 && \
ln -sf ../../commithooks/pre-commit .git/hooks/pre-commit && \
ln -sf ../../commithooks/prepare-commit-msg .git/hooks/prepare-commit-msg && \
chmod +x .git/hooks/pre-commit && \
chmod +x .git/hooks/prepare-commit-msg && \
git config --bool flake8.strict true

install-system-packages:
sudo apt-get install docker docker-compose kafkacat python-virtualenv python3.7 -y

Expand All @@ -17,7 +26,7 @@ uninstall-hosts:
sudo sed -i /__start_pyconnect__/,/__stop_pyconnect__/d /etc/hosts


install-dev-env: install-system-packages install-virtualenv install-hosts
install-dev-env: install-system-packages install-virtualenv install-hosts install-hooks

reset-cluster:
sudo docker-compose -f test/testenv-docker-compose.yml rm -f
Expand Down
4 changes: 4 additions & 0 deletions commithooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# flake 8 invocation
python3 commithooks/pre-commit-flake.py || exit
10 changes: 10 additions & 0 deletions commithooks/pre-commit-flake.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sys

from flake8.main import git

if __name__ == '__main__':
sys.exit(
git.hook(
strict=git.config_for('strict'),
lazy=git.config_for('lazy'),
))
8 changes: 8 additions & 0 deletions commithooks/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

name=$(git branch | grep '*' | sed 's/* //')
if ! [[ $( echo "$name" | egrep -i "^dev-[0-9]+") ]]; then
exit 0
fi
nameshort=$( echo "$name" | egrep -io "dev-[0-9]+")
echo "$nameshort": "$(cat "$1")" > "$1"
5 changes: 5 additions & 0 deletions flake8-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
flake8==3.5.0
flake8-bugbear==18.2.0
flake8-deprecated==1.3
flake8-import-order==0.17.1
flake8-polyfill==1.0.2

0 comments on commit a118284

Please sign in to comment.