From 9466f478b6a5f5a6e7e6c2021e59bde819cbcf09 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Wed, 7 Jun 2023 16:26:48 +0400 Subject: [PATCH 01/11] token added --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index f6c8219f37..d859fd3cc7 100755 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ from flask import Flask, jsonify, request, abort -JWT_SECRET = os.environ.get('JWT_SECRET', 'abc123abc1234') +JWT_SECRET = os.environ.get('JWT_SECRET', 'eyJhbGciOiJIUzI1NiJ9.eyJSb2xlIjoiQWRtaW4iLCJJc3N1ZXIiOiJJc3N1ZXIiLCJVc2VybmFtZSI6InRlc2xpbSIsImV4cCI6MTcxNzc1NjQwMCwiaWF0IjoxNjg2MTM0MDAwfQ.nCXz1TvNZbJ2zmrBVb1AIlgaWow_ejyt4_5EF3fLEO8') LOG_LEVEL = os.environ.get('LOG_LEVEL', 'INFO') From 6a46cc8078588efa23e292cc0e8a8e9a2e60b528 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Wed, 7 Jun 2023 17:44:04 +0400 Subject: [PATCH 02/11] version number updated --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 111531cfe5..0a41c5ba24 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pyjwt==1.7.1 +pyjwt==2.6.0 flask==1.1.2 Jinja2<3.0.0 MarkupSafe<2.0.0 From 890f15965a5d0e49435d8242f0822a768cd9b8f8 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Thu, 8 Jun 2023 15:41:20 +0400 Subject: [PATCH 03/11] build code added --- aws-auth-patch.yml | 8 ++++++-- ci-cd-codepipeline.cfn.yml | 2 +- requirements.txt | 2 +- trust.json | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/aws-auth-patch.yml b/aws-auth-patch.yml index 4c3b0e0f26..ca433504fc 100644 --- a/aws-auth-patch.yml +++ b/aws-auth-patch.yml @@ -7,11 +7,15 @@ data: - groups: - system:bootstrappers - system:nodes - rolearn: arn:aws:iam::519002666132:role/eksctl-simple-jwt-api-nodegroup-n-NodeInstanceRole-1DBHED9TMYRZZ + rolearn: arn:aws:iam::416274195800:role/eksctl-simple-jwt-api-nodegroup-n-NodeInstanceRole-1DBHED9TMYRZZ username: system:node:{{EC2PrivateDNSName}} - system:masters - rolearn: arn:aws:iam::519002666132:role/UdacityFlaskDeployCBKubectlRole + rolearn: arn:aws:iam::416274195800:role/UdacityFlaskDeployCBKubectlRole username: build + - groups: + - system:masters + rolearn: arn:aws:iam::416274195800:role/UdacityFlaskDeployCBKubectlRole + username: build kind: ConfigMap metadata: creationTimestamp: "2022-05-11T11:16:26Z" diff --git a/ci-cd-codepipeline.cfn.yml b/ci-cd-codepipeline.cfn.yml index c0f4d9d31b..b54d77bc50 100755 --- a/ci-cd-codepipeline.cfn.yml +++ b/ci-cd-codepipeline.cfn.yml @@ -40,7 +40,7 @@ Parameters: GitHubUser: Type: String - Default: SudKul + Default: teslimSulaiman Description: GitHub username or organization MinLength: 3 MaxLength: 100 diff --git a/requirements.txt b/requirements.txt index 0a41c5ba24..111531cfe5 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pyjwt==2.6.0 +pyjwt==1.7.1 flask==1.1.2 Jinja2<3.0.0 MarkupSafe<2.0.0 diff --git a/trust.json b/trust.json index f934cf3a3f..bf3590cb9a 100644 --- a/trust.json +++ b/trust.json @@ -4,7 +4,7 @@ { "Effect": "Allow", "Principal": { - "AWS": "arn:aws:iam::519002666132:root" + "AWS": "arn:aws:iam::416274195800:root" }, "Action": "sts:AssumeRole" } From cfc8d292f29924a2ca74c55aaab48e2585ee2c89 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Thu, 8 Jun 2023 16:07:12 +0400 Subject: [PATCH 04/11] just changed --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 947692587d..1e62c7ae5c 100755 --- a/README.md +++ b/README.md @@ -86,3 +86,4 @@ Completing the project involves several steps: 6. Create a CodeBuild stage which will build, test, and deploy your code For more detail about each of these steps, see the project lesson. +just changing From cc29122cf664c0873dfe55369fab6e714c4c1f36 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Thu, 8 Jun 2023 16:31:02 +0400 Subject: [PATCH 05/11] read me reverted --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 1e62c7ae5c..947692587d 100755 --- a/README.md +++ b/README.md @@ -86,4 +86,3 @@ Completing the project involves several steps: 6. Create a CodeBuild stage which will build, test, and deploy your code For more detail about each of these steps, see the project lesson. -just changing From 44491c161c5e9024dafde82c9b6c6e4c860722a6 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Thu, 8 Jun 2023 16:32:29 +0400 Subject: [PATCH 06/11] read me updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 947692587d..6fbdbdc1af 100755 --- a/README.md +++ b/README.md @@ -85,4 +85,4 @@ Completing the project involves several steps: 5. Create a CodePipeline pipeline triggered by GitHub checkins 6. Create a CodeBuild stage which will build, test, and deploy your code -For more detail about each of these steps, see the project lesson. +For more detail about each of these steps, see the project lesson From c3fbc0ab5362706bf06335aa2a77bdb933d70f40 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Thu, 8 Jun 2023 17:41:01 +0400 Subject: [PATCH 07/11] file reverted --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6fbdbdc1af..947692587d 100755 --- a/README.md +++ b/README.md @@ -85,4 +85,4 @@ Completing the project involves several steps: 5. Create a CodePipeline pipeline triggered by GitHub checkins 6. Create a CodeBuild stage which will build, test, and deploy your code -For more detail about each of these steps, see the project lesson +For more detail about each of these steps, see the project lesson. From 555e564f755c38de4f47f0e72b9202a354de75fc Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Thu, 8 Jun 2023 18:18:26 +0400 Subject: [PATCH 08/11] assert false added --- buildspec.yml | 2 ++ test_main.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 63e53d247f..c52221b7eb 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -38,6 +38,8 @@ phases: - $(aws ecr get-login --no-include-email) - export KUBECONFIG=$HOME/.kube/config - echo `ls -l` + - pip3 install -r requirements.txt + - python -m pytest test_main.py build: commands: - docker build --tag $REPOSITORY_URI:$TAG . diff --git a/test_main.py b/test_main.py index 3c6c8981fa..addbb10183 100644 --- a/test_main.py +++ b/test_main.py @@ -35,6 +35,6 @@ def test_auth(client): data=json.dumps(body), content_type='application/json') - assert response.status_code == 200 + assert response.status_code == 201 token = response.json['token'] assert token is not None From b71f11687ea841db3b1cd6da114625eebe28d966 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Thu, 8 Jun 2023 18:24:49 +0400 Subject: [PATCH 09/11] assert true added --- test_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_main.py b/test_main.py index addbb10183..3c6c8981fa 100644 --- a/test_main.py +++ b/test_main.py @@ -35,6 +35,6 @@ def test_auth(client): data=json.dumps(body), content_type='application/json') - assert response.status_code == 201 + assert response.status_code == 200 token = response.json['token'] assert token is not None From ddcda5ac8ce45175fab609738c4f0aaacba2dc7a Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Sat, 10 Jun 2023 09:46:26 +0400 Subject: [PATCH 10/11] env file removed from ignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9500e81546..22be409066 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ _mailinglist .idea/ docs/_build/ __pycache__ -.env_file # Coverage reports htmlcov/ From 33f193a52923b689cb2d3c8de4cd7851784b2233 Mon Sep 17 00:00:00 2001 From: teslimSulaiman Date: Sat, 10 Jun 2023 09:47:54 +0400 Subject: [PATCH 11/11] env file removed from ignore --- .env_file | 2 ++ .gitignore | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .env_file diff --git a/.env_file b/.env_file new file mode 100644 index 0000000000..0b5ec11164 --- /dev/null +++ b/.env_file @@ -0,0 +1,2 @@ +JWT_SECRET='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoidGVzbGltIiwicGFzc3dvcmQiOjE1MTYyMzkwMjJ9.QM1IQgwJ3RmeLRBhQGER1zaiWTFhO4FrDy-Oq9uMgyo' +LOG_LEVEL=DEBUG \ No newline at end of file diff --git a/.gitignore b/.gitignore index 22be409066..82d71c63eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .DS_Store -.env* .flaskenv *.pyc *.pyo