From 6244e5567edad2a4a7262fdc31766006d83f5c34 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Sun, 30 Jan 2022 10:31:54 -0800 Subject: [PATCH] Adding a lint phase to the ci/cd pipeline. This should fail because animals.py is not formatted properly according to black --- .gitlab-ci.yml | 10 ++++++++++ app/animals.py | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) mode change 100755 => 100644 app/animals.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2b7e2c4..467c4bd8 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,8 +9,18 @@ variables: DOCKER_DRIVER: overlay2 stages: + - test - deploy + +lint_python_on_merge_request: + image: python:alpine + stage: test + script: + - echo "Linting Python code" + - pip install black && black --fast --check . + + build_and_push_container: stage: deploy script: diff --git a/app/animals.py b/app/animals.py old mode 100755 new mode 100644 index 402d5607..4c7b6161 --- a/app/animals.py +++ b/app/animals.py @@ -9,9 +9,7 @@ import get_from_reddit def get_red_panda(): red_panda = None while not red_panda: - red_panda = requests.get("https://some-random-api.ml/img/red_panda").json()[ - "link" - ] + red_panda = requests.get("https://some-random-api.ml/img/red_panda").json()["link"] return red_panda