diff --git a/README.md b/README.md index 53402f6..015b33b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Build Status](https://github.com/Moon-Knight13/devops-capstone-project/actions/workflows/ci-build.yaml/badge.svg) -This is my captsone project for IBM. +This is my capstone project for IBM. # DevOps Capstone Template diff --git a/deploy/deployment.yaml b/deploy/deployment.yaml index 171fa67..901ee1e 100644 --- a/deploy/deployment.yaml +++ b/deploy/deployment.yaml @@ -18,7 +18,7 @@ spec: app: accounts spec: containers: - - image: us.icr.io/sn-labs-chrism2013/accounts:1 + - image: IMAGE_NAME_HERE name: accounts resources: {} diff --git a/pipelinerun.txt b/pipelinerun.txt new file mode 100644 index 0000000..c8e4ccd --- /dev/null +++ b/pipelinerun.txt @@ -0,0 +1,263 @@ +[init : remove] Removing all files from /workspace/source ... + +[clone : clone] + '[' false '=' true ] +[clone : clone] + '[' false '=' true ] +[clone : clone] + '[' false '=' true ] +[clone : clone] + CHECKOUT_DIR=/workspace/output/ +[clone : clone] + '[' true '=' true ] +[clone : clone] + cleandir +[clone : clone] + '[' -d /workspace/output/ ] +[clone : clone] + rm -rf '/workspace/output//*' +[clone : clone] + rm -rf '/workspace/output//.[!.]*' +[clone : clone] + rm -rf '/workspace/output//..?*' +[clone : clone] + test -z +[clone : clone] + test -z +[clone : clone] + test -z +[clone : clone] + git config --global --add safe.directory /workspace/output +[clone : clone] + /ko-app/git-init '-url=https://github.com/Moon-Knight13/devops-capstone-project.git' '-revision=cd-pipeline' '-refspec=' '-path=/workspace/output/' '-sslVerify=true' '-submodules=true' '-depth=1' '-sparseCheckoutDirectories=' +[clone : clone] {"level":"info","ts":1781963402.3157027,"caller":"git/git.go:176","msg":"Successfully cloned https://github.com/Moon-Knight13/devops-capstone-project.git @ b2da57336b59bb29b5ab2bdfd9abc2ec04ce0ef9 (grafted, HEAD, origin/cd-pipeline) in path /workspace/output/"} +[clone : clone] {"level":"info","ts":1781963403.005369,"caller":"git/git.go:215","msg":"Successfully initialized and updated submodules in path /workspace/output/"} +[clone : clone] + cd /workspace/output/ +[clone : clone] + git rev-parse HEAD +[clone : clone] + RESULT_SHA=b2da57336b59bb29b5ab2bdfd9abc2ec04ce0ef9 +[clone : clone] + EXIT_CODE=0 +[clone : clone] + '[' 0 '!=' 0 ] +[clone : clone] + git log -1 '--pretty=%ct' +[clone : clone] + RESULT_COMMITTER_DATE=1781963293 +[clone : clone] + printf '%s' 1781963293 +[clone : clone] + printf '%s' b2da57336b59bb29b5ab2bdfd9abc2ec04ce0ef9 +[clone : clone] + printf '%s' https://github.com/Moon-Knight13/devops-capstone-project.git + +[lint : flake8] Collecting Werkzeug==2.1.2 +[lint : flake8] Downloading Werkzeug-2.1.2-py3-none-any.whl (224 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 224.9/224.9 kB 58.8 MB/s eta 0:00:00 +[lint : flake8] Collecting SQLAlchemy==1.4.46 +[lint : flake8] Downloading SQLAlchemy-1.4.46-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 104.6 MB/s eta 0:00:00 +[lint : flake8] Collecting Flask==2.1.2 +[lint : flake8] Downloading Flask-2.1.2-py3-none-any.whl (95 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.2/95.2 kB 51.7 MB/s eta 0:00:00 +[lint : flake8] Collecting Flask-SQLAlchemy==2.5.1 +[lint : flake8] Downloading Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl (17 kB) +[lint : flake8] Collecting psycopg2-binary==2.9.3 +[lint : flake8] Downloading psycopg2_binary-2.9.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 145.1 MB/s eta 0:00:00 +[lint : flake8] Collecting python-dotenv==0.20.0 +[lint : flake8] Downloading python_dotenv-0.20.0-py3-none-any.whl (17 kB) +[lint : flake8] Collecting gunicorn==20.1.0 +[lint : flake8] Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 40.5 MB/s eta 0:00:00 +[lint : flake8] Collecting honcho==1.1.0 +[lint : flake8] Downloading honcho-1.1.0-py2.py3-none-any.whl (21 kB) +[lint : flake8] Collecting pylint==2.14.0 +[lint : flake8] Downloading pylint-2.14.0-py3-none-any.whl (485 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 485.0/485.0 kB 99.5 MB/s eta 0:00:00 +[lint : flake8] Collecting flake8==4.0.1 +[lint : flake8] Downloading flake8-4.0.1-py2.py3-none-any.whl (64 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.1/64.1 kB 37.3 MB/s eta 0:00:00 +[lint : flake8] Collecting black==22.3.0 +[lint : flake8] Downloading black-22.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 144.1 MB/s eta 0:00:00 +[lint : flake8] Collecting nose==1.3.7 +[lint : flake8] Downloading nose-1.3.7-py3-none-any.whl (154 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 154.7/154.7 kB 58.9 MB/s eta 0:00:00 +[lint : flake8] Collecting pinocchio==0.4.3 +[lint : flake8] Downloading pinocchio-0.4.3-py3-none-any.whl (12 kB) +[lint : flake8] Collecting factory-boy==2.12.0 +[lint : flake8] Downloading factory_boy-2.12.0-py2.py3-none-any.whl (36 kB) +[lint : flake8] Collecting coverage==6.3.2 +[lint : flake8] Downloading coverage-6.3.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (210 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 210.7/210.7 kB 84.4 MB/s eta 0:00:00 +[lint : flake8] Collecting httpie==3.2.1 +[lint : flake8] Downloading httpie-3.2.1-py3-none-any.whl (124 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 64.0 MB/s eta 0:00:00 +[lint : flake8] Collecting greenlet!=0.4.17 +[lint : flake8] Downloading greenlet-3.2.5-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (587 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 587.5/587.5 kB 110.5 MB/s eta 0:00:00 +[lint : flake8] Collecting Jinja2>=3.0 +[lint : flake8] Downloading jinja2-3.1.6-py3-none-any.whl (134 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.9/134.9 kB 65.8 MB/s eta 0:00:00 +[lint : flake8] Collecting itsdangerous>=2.0 +[lint : flake8] Downloading itsdangerous-2.2.0-py3-none-any.whl (16 kB) +[lint : flake8] Collecting click>=8.0 +[lint : flake8] Downloading click-8.1.8-py3-none-any.whl (98 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.2/98.2 kB 40.9 MB/s eta 0:00:00 +[lint : flake8] Collecting importlib-metadata>=3.6.0 +[lint : flake8] Downloading importlib_metadata-8.7.1-py3-none-any.whl (27 kB) +[lint : flake8] Requirement already satisfied: setuptools>=3.0 in /usr/local/lib/python3.9/site-packages (from gunicorn==20.1.0->-r requirements.txt (line 12)) (58.1.0) +[lint : flake8] Collecting mccabe<0.8,>=0.6 +[lint : flake8] Downloading mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB) +[lint : flake8] Collecting typing-extensions>=3.10.0 +[lint : flake8] Downloading typing_extensions-4.15.0-py3-none-any.whl (44 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.6/44.6 kB 24.4 MB/s eta 0:00:00 +[lint : flake8] Collecting isort<6,>=4.2.5 +[lint : flake8] Downloading isort-5.13.2-py3-none-any.whl (92 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 92.3/92.3 kB 32.0 MB/s eta 0:00:00 +[lint : flake8] Collecting tomlkit>=0.10.1 +[lint : flake8] Downloading tomlkit-0.15.0-py3-none-any.whl (41 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.3/41.3 kB 24.7 MB/s eta 0:00:00 +[lint : flake8] Collecting astroid<=2.12.0-dev0,>=2.11.5 +[lint : flake8] Downloading astroid-2.11.7-py3-none-any.whl (251 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 251.2/251.2 kB 95.3 MB/s eta 0:00:00 +[lint : flake8] Collecting dill>=0.2 +[lint : flake8] Downloading dill-0.4.1-py3-none-any.whl (120 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 120.0/120.0 kB 52.2 MB/s eta 0:00:00 +[lint : flake8] Collecting platformdirs>=2.2.0 +[lint : flake8] Downloading platformdirs-4.4.0-py3-none-any.whl (18 kB) +[lint : flake8] Collecting tomli>=1.1.0 +[lint : flake8] Downloading tomli-2.4.1-py3-none-any.whl (14 kB) +[lint : flake8] Collecting mccabe<0.8,>=0.6 +[lint : flake8] Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB) +[lint : flake8] Collecting pyflakes<2.5.0,>=2.4.0 +[lint : flake8] Downloading pyflakes-2.4.0-py2.py3-none-any.whl (69 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 69.7/69.7 kB 37.1 MB/s eta 0:00:00 +[lint : flake8] Collecting pycodestyle<2.9.0,>=2.8.0 +[lint : flake8] Downloading pycodestyle-2.8.0-py2.py3-none-any.whl (42 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.1/42.1 kB 22.4 MB/s eta 0:00:00 +[lint : flake8] Collecting pathspec>=0.9.0 +[lint : flake8] Downloading pathspec-1.1.1-py3-none-any.whl (57 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.3/57.3 kB 32.2 MB/s eta 0:00:00 +[lint : flake8] Collecting mypy-extensions>=0.4.3 +[lint : flake8] Downloading mypy_extensions-1.1.0-py3-none-any.whl (5.0 kB) +[lint : flake8] Collecting colorama +[lint : flake8] Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB) +[lint : flake8] Collecting Faker>=0.7.0 +[lint : flake8] Downloading faker-37.12.0-py3-none-any.whl (2.0 MB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 30.8 MB/s eta 0:00:00 +[lint : flake8] Collecting charset-normalizer>=2.0.0 +[lint : flake8] Downloading charset_normalizer-3.4.7-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (208 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 208.4/208.4 kB 69.8 MB/s eta 0:00:00 +[lint : flake8] Collecting requests[socks]>=2.22.0 +[lint : flake8] Downloading requests-2.32.5-py3-none-any.whl (64 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.7/64.7 kB 38.5 MB/s eta 0:00:00 +[lint : flake8] Collecting requests-toolbelt>=0.9.1 +[lint : flake8] Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.5/54.5 kB 30.2 MB/s eta 0:00:00 +[lint : flake8] Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (from httpie==3.2.1->-r requirements.txt (line 29)) (23.0.1) +[lint : flake8] Collecting defusedxml>=0.6.0 +[lint : flake8] Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB) +[lint : flake8] Collecting Pygments>=2.5.2 +[lint : flake8] Downloading pygments-2.20.0-py3-none-any.whl (1.2 MB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 140.1 MB/s eta 0:00:00 +[lint : flake8] Collecting multidict>=4.7.0 +[lint : flake8] Downloading multidict-6.7.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (240 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.3/240.3 kB 72.6 MB/s eta 0:00:00 +[lint : flake8] Collecting rich>=9.10.0 +[lint : flake8] Downloading rich-15.0.0-py3-none-any.whl (310 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 310.7/310.7 kB 93.8 MB/s eta 0:00:00 +[lint : flake8] Collecting lazy-object-proxy>=1.4.0 +[lint : flake8] Downloading lazy_object_proxy-1.12.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (66 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.3/66.3 kB 40.3 MB/s eta 0:00:00 +[lint : flake8] Collecting wrapt<2,>=1.11 +[lint : flake8] Downloading wrapt-1.17.3-cp39-cp39-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (81 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 81.7/81.7 kB 40.5 MB/s eta 0:00:00 +[lint : flake8] Collecting tzdata +[lint : flake8] Downloading tzdata-2026.2-py2.py3-none-any.whl (349 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 349.3/349.3 kB 99.4 MB/s eta 0:00:00 +[lint : flake8] Collecting zipp>=3.20 +[lint : flake8] Downloading zipp-3.23.1-py3-none-any.whl (10 kB) +[lint : flake8] Collecting MarkupSafe>=2.0 +[lint : flake8] Downloading markupsafe-3.0.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (20 kB) +[lint : flake8] Collecting certifi>=2017.4.17 +[lint : flake8] Downloading certifi-2026.6.17-py3-none-any.whl (133 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.3/133.3 kB 64.0 MB/s eta 0:00:00 +[lint : flake8] Collecting idna<4,>=2.5 +[lint : flake8] Downloading idna-3.18-py3-none-any.whl (65 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 kB 36.6 MB/s eta 0:00:00 +[lint : flake8] Collecting urllib3<3,>=1.21.1 +[lint : flake8] Downloading urllib3-2.6.3-py3-none-any.whl (131 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 131.6/131.6 kB 63.7 MB/s eta 0:00:00 +[lint : flake8] Collecting PySocks!=1.5.7,>=1.5.6 +[lint : flake8] Downloading PySocks-1.7.1-py3-none-any.whl (16 kB) +[lint : flake8] Collecting markdown-it-py>=2.2.0 +[lint : flake8] Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB) +[lint : flake8] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 kB 44.5 MB/s eta 0:00:00 +[lint : flake8] Collecting mdurl~=0.1 +[lint : flake8] Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB) +[lint : flake8] Installing collected packages: nose, mccabe, honcho, zipp, wrapt, Werkzeug, urllib3, tzdata, typing-extensions, tomlkit, tomli, python-dotenv, PySocks, Pygments, pyflakes, pycodestyle, psycopg2-binary, platformdirs, pathspec, mypy-extensions, mdurl, MarkupSafe, lazy-object-proxy, itsdangerous, isort, idna, gunicorn, greenlet, dill, defusedxml, coverage, colorama, click, charset-normalizer, certifi, SQLAlchemy, requests, pinocchio, multidict, markdown-it-py, Jinja2, importlib-metadata, flake8, Faker, black, astroid, rich, requests-toolbelt, pylint, Flask, factory-boy, httpie, Flask-SQLAlchemy +[lint : flake8] Successfully installed Faker-37.12.0 Flask-2.1.2 Flask-SQLAlchemy-2.5.1 Jinja2-3.1.6 MarkupSafe-3.0.3 PySocks-1.7.1 Pygments-2.20.0 SQLAlchemy-1.4.46 Werkzeug-2.1.2 astroid-2.11.7 black-22.3.0 certifi-2026.6.17 charset-normalizer-3.4.7 click-8.1.8 colorama-0.4.6 coverage-6.3.2 defusedxml-0.7.1 dill-0.4.1 factory-boy-2.12.0 flake8-4.0.1 greenlet-3.2.5 gunicorn-20.1.0 honcho-1.1.0 httpie-3.2.1 idna-3.18 importlib-metadata-8.7.1 isort-5.13.2 itsdangerous-2.2.0 lazy-object-proxy-1.12.0 markdown-it-py-3.0.0 mccabe-0.6.1 mdurl-0.1.2 multidict-6.7.1 mypy-extensions-1.1.0 nose-1.3.7 pathspec-1.1.1 pinocchio-0.4.3 platformdirs-4.4.0 psycopg2-binary-2.9.3 pycodestyle-2.8.0 pyflakes-2.4.0 pylint-2.14.0 python-dotenv-0.20.0 requests-2.32.5 requests-toolbelt-1.0.0 rich-15.0.0 tomli-2.4.1 tomlkit-0.15.0 typing-extensions-4.15.0 tzdata-2026.2 urllib3-2.6.3 wrapt-1.17.3 zipp-3.23.1 +[lint : flake8] WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv +[lint : flake8] +[lint : flake8] [notice] A new release of pip is available: 23.0.1 -> 26.0.1 +[lint : flake8] [notice] To update, run: pip install --upgrade pip +[lint : flake8] ./tests/test_routes.py:147:9: E122 continuation line missing indentation or outdented +[lint : flake8] ./tests/test_routes.py:148:9: E122 continuation line missing indentation or outdented +[lint : flake8] ./tests/test_routes.py:149:9: E122 continuation line missing indentation or outdented +[lint : flake8] 3 E122 continuation line missing indentation or outdented +[lint : flake8] 3 + +[tests : nosetests] ***** Installing dependencies ***** +[tests : nosetests] Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (23.0.1) +[tests : nosetests] Collecting pip +[tests : nosetests] Downloading pip-26.0.1-py3-none-any.whl (1.8 MB) +[tests : nosetests] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 27.4 MB/s eta 0:00:00 +[tests : nosetests] Requirement already satisfied: wheel in /usr/local/lib/python3.9/site-packages (0.44.0) +[tests : nosetests] Collecting wheel +[tests : nosetests] Downloading wheel-0.47.0-py3-none-any.whl (32 kB) +[tests : nosetests] Collecting packaging>=24.0 +[tests : nosetests] Downloading packaging-26.2-py3-none-any.whl (100 kB) +[tests : nosetests] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.2/100.2 kB 52.3 MB/s eta 0:00:00 +[tests : nosetests] Installing collected packages: pip, packaging, wheel +[tests : nosetests] Attempting uninstall: pip +[tests : nosetests] Found existing installation: pip 23.0.1 +[tests : nosetests] Uninstalling pip-23.0.1: +[tests : nosetests] Successfully uninstalled pip-23.0.1 +[tests : nosetests] Attempting uninstall: wheel +[tests : nosetests] Found existing installation: wheel 0.44.0 +[tests : nosetests] Uninstalling wheel-0.44.0: +[tests : nosetests] Successfully uninstalled wheel-0.44.0 +[tests : nosetests] Successfully installed packaging-26.2 pip-26.0.1 wheel-0.47.0 +[tests : nosetests] WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv +[tests : nosetests] WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning. +[tests : nosetests] ***** Running nosetests with: -v --with-spec --spec-color +[tests : nosetests] +[tests : nosetests] Test Flask CLI Commands +[tests : nosetests] - It should call the db-create command +[tests : nosetests] +[tests : nosetests] Test Cases for Account Model +[tests : nosetests] - It should Create an account and add it to the database +[tests : nosetests] - It should Create an Account and assert that it exists +[tests : nosetests] - It should Delete an account from the database +[tests : nosetests] - It should Deserialize an account +[tests : nosetests] - It should not Deserialize an account with a KeyError +[tests : nosetests] - It should not Deserialize an account with a TypeError +[tests : nosetests] - It should Find an Account by name +[tests : nosetests] - It should List all Accounts in the database +[tests : nosetests] - It should Read an account +[tests : nosetests] - It should Serialize an account +[tests : nosetests] - It should Update an account +[tests : nosetests] +[tests : nosetests] Account Service Tests +[tests : nosetests] - It should not update an Account that does not exist +[tests : nosetests] - It should not Create an Account when sending the wrong data +[tests : nosetests] - It should Create a new Account +[tests : nosetests] - It should Delete an existing Account +[tests : nosetests] - It should not delete an Account that does not exist +[tests : nosetests] - It should Read a single Account +[tests : nosetests] - It should Get a list of Accounts +[tests : nosetests] - It should not return an incorrect number of Accounts +[tests : nosetests] - It should not Read an Account +[tests : nosetests] - It should be healthy +[tests : nosetests] - It should get 200_OK from the Home Page +[tests : nosetests] - It should not Create an Account when sending the wrong media type +[tests : nosetests] - It should Update an existing Account +[tests : nosetests] +[tests : nosetests] Name Stmts Miss Cover Missing +[tests : nosetests] ---------------------------------------------------------------- +[tests : nosetests] service/__init__.py 18 3 83% 32-35 +[tests : nosetests] service/common/__init__.py 0 0 100% +[tests : nosetests] service/common/cli_commands.py 7 0 100% +[tests : nosetests] service/common/error_handlers.py 32 6 81% 46-48, 76-78 +[tests : nosetests] service/common/log_handlers.py 10 1 90% 21 +[tests : nosetests] service/common/status.py 46 0 100% +[tests : nosetests] service/config.py 11 5 55% 12-16 +[tests : nosetests] service/models.py 69 3 96% 32, 98, 127 +[tests : nosetests] service/routes.py 57 0 100% +[tests : nosetests] ---------------------------------------------------------------- +[tests : nosetests] TOTAL 250 18 93% +[tests : nosetests] ---------------------------------------------------------------------- +[tests : nosetests] Ran 25 tests in 50.129s +[tests : nosetests] +[tests : nosetests] OK +[tests : nosetests] + diff --git a/tekton/pipeline.yaml b/tekton/pipeline.yaml index 7f5bdb9..fb6aa05 100644 --- a/tekton/pipeline.yaml +++ b/tekton/pipeline.yaml @@ -15,6 +15,7 @@ spec: - name: repo-url - name: branch default: main + - name: build-image tasks: - name: init workspaces: @@ -36,3 +37,64 @@ spec: value: $(params.branch) runAfter: - init + + - name: lint + workspaces: + - name: source + workspace: pipeline-workspace + taskRef: + name: flake8 + params: + - name: image + value: "python:3.9-slim" + - name: args + value: ["--count","--max-complexity=10","--max-line-length=127","--statistics"] + runAfter: + - clone + + - name: tests + workspaces: + - name: source + workspace: pipeline-workspace + taskRef: + name: nose + params: + - name: database_uri + value: "sqlite:///test.db" + - name: args + value: "-v --with-spec --spec-color" + runAfter: + - clone + + - name: build + workspaces: + - name: source + workspace: pipeline-workspace + taskRef: + name: buildah + kind: ClusterTask + params: + - name: IMAGE + value: "$(params.build-image)" + runAfter: + - tests + - lint + + - name: deploy + workspaces: + - name: manifest-dir + workspace: pipeline-workspace + taskRef: + name: openshift-client + kind: ClusterTask + params: + - name: SCRIPT + value: | + echo "Updating manifest..." + sed -i "s|IMAGE_NAME_HERE|$(params.build-image)|g" deploy/deployment.yaml + cat deploy/deployment.yaml + echo "Deploying to OpenShift..." + oc apply -f deploy/ + oc get pods -l app=accounts + runAfter: + - build \ No newline at end of file diff --git a/tekton/tasks.yaml b/tekton/tasks.yaml index 25644df..8ff73a5 100644 --- a/tekton/tasks.yaml +++ b/tekton/tasks.yaml @@ -49,4 +49,39 @@ spec: # Delete files and directories starting with .. plus any other character rm -rf "${WORKSPACE_SOURCE_PATH}"/..?* fi +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: nose +spec: + description: This task will run nosetests on the provided input. + workspaces: + - name: source + params: + - name: args + description: Arguments to pass to nose + type: string + default: "-v" + - name: database_uri + description: Database connection string + type: string + default: "sqlite:///test.db" + steps: + - name: nosetests + image: python:3.9-slim + workingDir: $(workspaces.source.path) + env: + - name: DATABASE_URI + value: $(params.database_uri) + script: | + #!/bin/bash + set -e + + echo "***** Installing dependencies *****" + python -m pip install --upgrade pip wheel + pip install -qr requirements.txt + + echo "***** Running nosetests with: $(params.args)" + nosetests $(params.args) diff --git a/tests/test_routes.py b/tests/test_routes.py index 48cd3bc..e16251b 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -129,8 +129,7 @@ def test_unsupported_media_type(self): def test_get_account(self): """It should Read a single Account""" account = self._create_accounts(1)[0] - response = self.client.get(f"{BASE_URL}/{account.id}", content_type="application/json" - ) + response = self.client.get(f"{BASE_URL}/{account.id}", content_type="application/json") self.assertEqual(response.status_code, status.HTTP_200_OK) data = response.get_json() self.assertEqual(data["name"], account.name) @@ -140,17 +139,15 @@ def test_get_account_not_found(self): response = self.client.get(f"{BASE_URL}/0") self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) - # update the account + # update the account def test_update_account(self): """It should Update an existing Account""" test_account = AccountFactory() response = self.client.post( BASE_URL, json=test_account.serialize(), - content_type="application/json" - ) + content_type="application/json") self.assertEqual(response.status_code, status.HTTP_201_CREATED) - new_account = response.get_json() new_account["name"] = "Something Known" response = self.client.put(f"{BASE_URL}/{new_account['id']}", json=new_account)