From 681364c1537cf171d4d31560c6d27535db82bbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kocsis=20Rich=C3=A1rd?= Date: Sun, 29 Mar 2020 16:59:10 +0200 Subject: [PATCH 1/8] Update 'requirements.txt' --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2be6044..9e669fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ sentry_sdk -flask -flask-redis \ No newline at end of file +request +redis \ No newline at end of file From f956cf56b40b25478f48855f5f8d2486d48fd6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kocsis=20Rich=C3=A1rd?= Date: Sun, 29 Mar 2020 17:00:35 +0200 Subject: [PATCH 2/8] Update 'app.py' --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 4aaddda..3f5fb88 100644 --- a/app.py +++ b/app.py @@ -2,10 +2,10 @@ import sentry_sdk """ -Main Flask RESTful API +Scheduler """ -__author__ = "@tormakris" +__author__ = "@kocsisr" __copyright__ = "Copyright 2020, GoldenPogácsa Team" __module_name__ = "app" __version__text__ = "1" @@ -13,4 +13,4 @@ __version__text__ = "1" sentry_sdk.init("https://0a106e104e114bc9a3fa47f9cb0db2f4@sentry.kmlabz.com/10") if __name__ == "__main__": - print("Producer") + print("Scheduler") From cf322fcf93be16c9efdc339da8acae45bdbc6587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 29 Mar 2020 17:04:12 +0200 Subject: [PATCH 3/8] update sentry dsn --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 3f5fb88..c5e9f30 100644 --- a/app.py +++ b/app.py @@ -10,7 +10,7 @@ __copyright__ = "Copyright 2020, GoldenPogácsa Team" __module_name__ = "app" __version__text__ = "1" -sentry_sdk.init("https://0a106e104e114bc9a3fa47f9cb0db2f4@sentry.kmlabz.com/10") +sentry_sdk.init("https://1b2c8467076c4e2e9158b60a4bb96bdc@sentry.kmlabz.com/11") if __name__ == "__main__": print("Scheduler") From 4388a7c37090eb9fb2611ec606ceeb95639b99eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 29 Mar 2020 17:06:11 +0200 Subject: [PATCH 4/8] add drone config --- .drone.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..2924cfd --- /dev/null +++ b/.drone.yml @@ -0,0 +1,53 @@ +kind: pipeline +type: docker +name: default + +steps: +- name: static_analysis + image: python:3 + commands: + - pip3 install pylint bandit mccabe + - pip3 install -r requirements.txt + - find . -name "*.py" -exec python3 -m py_compile '{}' \; + - find . -name "*.py" -exec pylint '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi + - find . -name "*.py" -exec python3 -m mccabe --min 3 '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi + - bandit -r . + || if [ $? -eq 1 ]; then echo "you fail"; fi + +- name: build + image: docker:stable-dind + volumes: + - name: dockersock + path: /var/run + environment: + DOCKER_USERNAME: + from_secret: DOCKER_USERNAME + DOCKER_PASSWORD: + from_secret: DOCKER_PASSWORD + commands: + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - docker build -t="$DOCKER_USERNAME/producer" . + - docker build -t="$DOCKER_USERNAME/producer:$DRONE_BUILD_NUMBER" . + - docker push "$DOCKER_USERNAME/producer" + - docker push "$DOCKER_USERNAME/producer:$DRONE_BUILD_NUMBER" + +- name: slack + image: plugins/slack + settings: + webhook: + from_secret: slack_webhook + channel: alerts-ci + icon_url: https://cloudcdn.tormakristof.eu/static/drone.svg + when: + status: [ failure ] + +services: +- name: docker + image: docker:stable-dind + privileged: true + volumes: + - name: dockersock + path: /var/run + +volumes: +- name: dockersock + temp: {} From 54e0e76776976be190c2239f70a72196345e85de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 29 Mar 2020 17:08:57 +0200 Subject: [PATCH 5/8] update repo slug in drone config --- .drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2924cfd..47daeb8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,10 +25,10 @@ steps: from_secret: DOCKER_PASSWORD commands: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - - docker build -t="$DOCKER_USERNAME/producer" . - - docker build -t="$DOCKER_USERNAME/producer:$DRONE_BUILD_NUMBER" . - - docker push "$DOCKER_USERNAME/producer" - - docker push "$DOCKER_USERNAME/producer:$DRONE_BUILD_NUMBER" + - docker build -t="$DOCKER_USERNAME/consumer-scheduler" . + - docker build -t="$DOCKER_USERNAME/consumer-scheduler:$DRONE_BUILD_NUMBER" . + - docker push "$DOCKER_USERNAME/consumer-scheduler" + - docker push "$DOCKER_USERNAME/consumer-scheduler:$DRONE_BUILD_NUMBER" - name: slack image: plugins/slack From 38784c3b048727c7c5b1f11abb6537cfd7d85750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kocsis=20Rich=C3=A1rd?= Date: Sun, 29 Mar 2020 17:11:26 +0200 Subject: [PATCH 6/8] Update 'app.py' --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index c5e9f30..1dd8f50 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,7 @@ import sentry_sdk Scheduler """ -__author__ = "@kocsisr" +__author__ = "@tormachris" __copyright__ = "Copyright 2020, GoldenPogácsa Team" __module_name__ = "app" __version__text__ = "1" From 874f4e3ca55cabf18349877b2ad141ae0b5f345e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kocsis=20Rich=C3=A1rd?= Date: Sun, 29 Mar 2020 17:11:46 +0200 Subject: [PATCH 7/8] Update 'app.py' --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 1dd8f50..6efb03f 100644 --- a/app.py +++ b/app.py @@ -13,4 +13,4 @@ __version__text__ = "1" sentry_sdk.init("https://1b2c8467076c4e2e9158b60a4bb96bdc@sentry.kmlabz.com/11") if __name__ == "__main__": - print("Scheduler") + print("Consumer-Scheduler") From 7972566edb8660d7ba3ee0dcc58ee8740922f62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kocsis=20Rich=C3=A1rd?= Date: Sun, 29 Mar 2020 17:16:41 +0200 Subject: [PATCH 8/8] Update 'app.py' --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 6efb03f..ffd854c 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,7 @@ import sentry_sdk Scheduler """ -__author__ = "@tormachris" +__author__ = "@kocsisr" __copyright__ = "Copyright 2020, GoldenPogácsa Team" __module_name__ = "app" __version__text__ = "1"