From b5b2f2d50f7909fd900090282205f366397a6df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 26 Mar 2024 18:24:25 +0100 Subject: [PATCH 01/91] (add new apps + add models) + make migration + add apps to settings --- .gitignore | 1 + lettings/__init__.py | 0 lettings/admin.py | 3 ++ lettings/apps.py | 5 +++ lettings/migrations/0001_initial.py | 36 ++++++++++++++++++ .../migrations/0002_auto_20240326_1424.py | 21 ++++++++++ .../migrations/0003_auto_20240326_1507.py | 29 ++++++++++++++ lettings/migrations/__init__.py | 0 lettings/models.py | 22 +++++++++++ lettings/tests.py | 3 ++ lettings/views.py | 3 ++ oc-lettings-site.sqlite3 | Bin 151552 -> 176128 bytes oc_lettings_site/settings.py | 4 ++ profiles/__init__.py | 0 profiles/admin.py | 3 ++ profiles/apps.py | 5 +++ profiles/migrations/0001_initial.py | 25 ++++++++++++ .../migrations/0002_auto_20240326_1424.py | 19 +++++++++ .../migrations/0003_auto_20240326_1631.py | 23 +++++++++++ profiles/migrations/__init__.py | 0 profiles/models.py | 10 +++++ profiles/tests.py | 3 ++ profiles/views.py | 3 ++ 23 files changed, 218 insertions(+) create mode 100644 lettings/__init__.py create mode 100644 lettings/admin.py create mode 100644 lettings/apps.py create mode 100644 lettings/migrations/0001_initial.py create mode 100644 lettings/migrations/0002_auto_20240326_1424.py create mode 100644 lettings/migrations/0003_auto_20240326_1507.py create mode 100644 lettings/migrations/__init__.py create mode 100644 lettings/models.py create mode 100644 lettings/tests.py create mode 100644 lettings/views.py create mode 100644 profiles/__init__.py create mode 100644 profiles/admin.py create mode 100644 profiles/apps.py create mode 100644 profiles/migrations/0001_initial.py create mode 100644 profiles/migrations/0002_auto_20240326_1424.py create mode 100644 profiles/migrations/0003_auto_20240326_1631.py create mode 100644 profiles/migrations/__init__.py create mode 100644 profiles/models.py create mode 100644 profiles/tests.py create mode 100644 profiles/views.py diff --git a/.gitignore b/.gitignore index b4405ebab4..47391aa2a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ **/__pycache__ *.pyc venv +.idea diff --git a/lettings/__init__.py b/lettings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lettings/admin.py b/lettings/admin.py new file mode 100644 index 0000000000..8c38f3f3da --- /dev/null +++ b/lettings/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/lettings/apps.py b/lettings/apps.py new file mode 100644 index 0000000000..b6abff1791 --- /dev/null +++ b/lettings/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class LettingsConfig(AppConfig): + name = 'lettings' diff --git a/lettings/migrations/0001_initial.py b/lettings/migrations/0001_initial.py new file mode 100644 index 0000000000..a95b8cfbf0 --- /dev/null +++ b/lettings/migrations/0001_initial.py @@ -0,0 +1,36 @@ +# Generated by Django 3.0 on 2024-03-26 13:33 + +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Address', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('number', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(9999)])), + ('street', models.CharField(max_length=64)), + ('city', models.CharField(max_length=64)), + ('state', models.CharField(max_length=2, validators=[django.core.validators.MinLengthValidator(2)])), + ('zip_code', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(99999)])), + ('country_iso_code', models.CharField(max_length=3, validators=[django.core.validators.MinLengthValidator(3)])), + ], + ), + migrations.CreateModel( + name='Letting', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=256)), + ('address', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='lettings.Address')), + ], + ), + ] diff --git a/lettings/migrations/0002_auto_20240326_1424.py b/lettings/migrations/0002_auto_20240326_1424.py new file mode 100644 index 0000000000..91b46ced2d --- /dev/null +++ b/lettings/migrations/0002_auto_20240326_1424.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0 on 2024-03-26 14:24 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('lettings', '0001_initial'), + ] + + operations = [ + migrations.RenameModel( + old_name='Address', + new_name='NewAddress', + ), + migrations.RenameModel( + old_name='Letting', + new_name='NewLetting', + ), + ] diff --git a/lettings/migrations/0003_auto_20240326_1507.py b/lettings/migrations/0003_auto_20240326_1507.py new file mode 100644 index 0000000000..150dc182f6 --- /dev/null +++ b/lettings/migrations/0003_auto_20240326_1507.py @@ -0,0 +1,29 @@ +from django.db import migrations + + +def new_tables(apps, schema_editor): + old_address_table = apps.get_model('oc_lettings_site', 'Address') + new_address_table = apps.get_model('lettings', 'NewAddress') + old_letting_table = apps.get_model('oc_lettings_site', 'Letting') + new_letting_table = apps.get_model('lettings', 'NewLetting') + + old_address_datas = old_address_table.objects.all() + old_letting_datas = old_letting_table.objects.all() + + for data in old_address_datas: + new_letting_data = new_address_table(id=data.id, number=data.number, street=data.street, city=data.city, state=data.state, zip_code=data.zip_code, country_iso_code=data.country_iso_code) + new_letting_data.save() + + for data in old_letting_datas: + new_letting_data = new_letting_table(id=data.id, title=data.title, address_id=data.address_id) + new_letting_data.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('lettings', '0002_auto_20240326_1424'), + ] + + operations = [ + migrations.RunPython(new_tables), + ] diff --git a/lettings/migrations/__init__.py b/lettings/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lettings/models.py b/lettings/models.py new file mode 100644 index 0000000000..88da011466 --- /dev/null +++ b/lettings/models.py @@ -0,0 +1,22 @@ +from django.core.validators import MaxValueValidator, MinLengthValidator +from django.db import models + + +class NewAddress(models.Model): + number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)]) + street = models.CharField(max_length=64) + city = models.CharField(max_length=64) + state = models.CharField(max_length=2, validators=[MinLengthValidator(2)]) + zip_code = models.PositiveIntegerField(validators=[MaxValueValidator(99999)]) + country_iso_code = models.CharField(max_length=3, validators=[MinLengthValidator(3)]) + + def __str__(self): + return f'{self.number} {self.street}' + + +class NewLetting(models.Model): + title = models.CharField(max_length=256) + address = models.OneToOneField(NewAddress, on_delete=models.CASCADE) + + def __str__(self): + return self.title diff --git a/lettings/tests.py b/lettings/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/lettings/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/lettings/views.py b/lettings/views.py new file mode 100644 index 0000000000..91ea44a218 --- /dev/null +++ b/lettings/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/oc-lettings-site.sqlite3 b/oc-lettings-site.sqlite3 index 3d885414f9f3ed046704e8b09bdcd5c791c82d42..1c684ba363638746b8daece4edd999d94618cdc4 100644 GIT binary patch delta 2509 zcmah}Z)g)|7{9l7`E!>y_gees!rE%G*`{flY}{I7+u6E7ofKprW{fs!SWP8K zErX4i7KfW(Rn}Hlyp5V=>lRbObU07LNzUfLOd9@VXqFHYkvPKp_?7&;r_r#!)9?&>eIJ zUE&|0P^s`eKPE6;t`#FS9}wfZkD3izJx*M3#n8~zPRQS<&@bp)bQ&$8d6Y#-G=^l< zfoT4Isqh^?)(#n}%cY;Ywq3ieg0J4LovXvic13yO8ZAOs(XxHqVehh=;P3DT{2HEt zC*YfKKb(LO=qeS?+wyG;@B(-^m7Fu&vM4Yh0N_+o+c9at166$Qfkb-05%;$;zyqMR zxqUYk-uBCTpf2HH*#qmYC{OITA%*q|K|VX@AG#{g}3-I6Ab_q zaSY(-$I(}bwtgJFIQHS_sYI?9M>mc=ICd}le!j7r=IP6-WiwdMfKKWiwQnV)2Z5tJw--oehN6JGRCo@QPp7~jC|`;J z&;+<;aElf{VNL;&7Olrr%T+M$;AXiOIe~q^e#5@cCfO+4Y`tw=wjL`LoYuTYG*Q4C zt{GK%)i*R?k_5Tm$*r(5s*`tqqhe@AheYk6bsF z6|&Z8qp+tRTdp6~CoGe}^Lep{mHAy6U)^#(m&DRKzpu)#c_s;?XU#G}-5zYYZrY8O z3DMJwE!V#R!->4%n#n->+}OkF_d@qfEbH{1D!pczBo3tW2C}xqcR`@? zhd+Wnvmfntp8Ep;alQ2m3YwQF{x-j8KVTQ&F6gqo%ULWRvtOE**f&ar!{+VtaM&Wq zGFTYOCH71w^$(-rE7JgS5APU_O^!MzV_RMxbv|oksIeJvap(NnSXK2UtV*slTTvzJ z29W1T)dmc8%~lXr=`@&VF=ol>)yLaFAGo+!xL_U~F$=HC_}vQ_-H~-X*Z}Mu-Lg`Y zH_DTBJlFv2Tc8HKf=Fty-dB4{JHbchy1q=N;Cy7%m6 zMS33ifkP>RNVQ3O+;BK)7wdRRK~RdN3SuV*!J(jD2l2swc)tgKcyDG)n^_d|nN*1} z)*s$KRqSJho)R0%u0}&d*xd`#*!5C3??W6ooCvKRuRH3#e%Cr4_v)Fa5o3c17!2R> z7%jZQD&}w*Ct$eN@1$eoTO^#he1%MBBR`nYweW>NkwM}%W^o-=e8qFDqv%?P;1tgU zy#fV>FL;9`Ji=YvLK77fTQsbJQRNn@KPC`NO0F zT9@h=9f|O9dMF3R=&CzEO8%c|BJRIEOQ*6q3uADvd#ln2~X zCa5pD&4R>K((Z002IHS>>xr~G{E}}r=qT5=5sGW;yENW+S$El4$>u3~Q8 diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index a18bee8106..2acd312121 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -2,6 +2,8 @@ from pathlib import Path +from django.contrib import staticfiles + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = Path(__file__).resolve().parent.parent @@ -28,6 +30,8 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'lettings', + 'profiles' ] MIDDLEWARE = [ diff --git a/profiles/__init__.py b/profiles/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/profiles/admin.py b/profiles/admin.py new file mode 100644 index 0000000000..8c38f3f3da --- /dev/null +++ b/profiles/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/profiles/apps.py b/profiles/apps.py new file mode 100644 index 0000000000..5501fdad35 --- /dev/null +++ b/profiles/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ProfilesConfig(AppConfig): + name = 'profiles' diff --git a/profiles/migrations/0001_initial.py b/profiles/migrations/0001_initial.py new file mode 100644 index 0000000000..9613cfed09 --- /dev/null +++ b/profiles/migrations/0001_initial.py @@ -0,0 +1,25 @@ +# Generated by Django 3.0 on 2024-03-26 14:23 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Profile1', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('favorite_city', models.CharField(blank=True, max_length=64)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/profiles/migrations/0002_auto_20240326_1424.py b/profiles/migrations/0002_auto_20240326_1424.py new file mode 100644 index 0000000000..f5357aa8b0 --- /dev/null +++ b/profiles/migrations/0002_auto_20240326_1424.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0 on 2024-03-26 14:24 + +from django.conf import settings +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('profiles', '0001_initial'), + ] + + operations = [ + migrations.RenameModel( + old_name='Profile1', + new_name='NewProfile', + ), + ] diff --git a/profiles/migrations/0003_auto_20240326_1631.py b/profiles/migrations/0003_auto_20240326_1631.py new file mode 100644 index 0000000000..2ac6989f1b --- /dev/null +++ b/profiles/migrations/0003_auto_20240326_1631.py @@ -0,0 +1,23 @@ +from django.db import migrations + + +def new_tables(apps, schema_editor): + old_profile_table = apps.get_model('oc_lettings_site', 'Profile') + new_profile_table = apps.get_model('profiles', 'NewProfile') + + old_address_datas = old_profile_table.objects.all() + + for data in old_address_datas: + new_letting_data = new_profile_table(id=data.id, favorite_city=data.favorite_city, user_id=data.user_id) + new_letting_data.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('profiles', '0002_auto_20240326_1424'), + ] + + operations = [ + migrations.RunPython(new_tables), + ] diff --git a/profiles/migrations/__init__.py b/profiles/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/profiles/models.py b/profiles/models.py new file mode 100644 index 0000000000..5046197cd6 --- /dev/null +++ b/profiles/models.py @@ -0,0 +1,10 @@ +from django.db import models +from django.contrib.auth.models import User + + +class NewProfile(models.Model): + user = models.OneToOneField(User, on_delete=models.CASCADE) + favorite_city = models.CharField(max_length=64, blank=True) + + def __str__(self): + return self.user.username diff --git a/profiles/tests.py b/profiles/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/profiles/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/profiles/views.py b/profiles/views.py new file mode 100644 index 0000000000..91ea44a218 --- /dev/null +++ b/profiles/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. From bb7e272f5907ed8f5eaa548d4e85dea61c592375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Wed, 27 Mar 2024 17:45:44 +0100 Subject: [PATCH 02/91] erase oc_lettings files + (changes urls + html) + mage migrations --- lettings/admin.py | 5 +- .../migrations/0004_auto_20240327_1335.py | 21 ++++++++ lettings/models.py | 6 +-- .../templates}/__init__.py | 0 lettings/templates/lettings/__init__.py | 0 .../templates/lettings/index.html | 4 +- .../templates/lettings}/letting.html | 4 +- lettings/urls.py | 9 ++++ lettings/views.py | 16 +++++- oc-lettings-site.sqlite3 | Bin 176128 -> 180224 bytes oc_lettings_site/admin.py | 10 ---- oc_lettings_site/apps.py | 5 -- oc_lettings_site/migrations/0001_initial.py | 46 ------------------ oc_lettings_site/models.py | 31 ------------ oc_lettings_site/settings.py | 3 +- .../templates}/base.html | 4 +- .../templates}/index.html | 4 +- oc_lettings_site/tests.py | 2 - oc_lettings_site/urls.py | 8 ++- oc_lettings_site/views.py | 40 --------------- profiles/admin.py | 4 +- .../migrations/0004_auto_20240327_1335.py | 19 ++++++++ profiles/models.py | 2 +- profiles/templates/__init__.py | 0 profiles/templates/profiles/__init__.py | 0 .../templates/profiles/index.html | 4 +- .../templates/profiles}/profile.html | 4 +- profiles/urls.py | 9 ++++ profiles/views.py | 13 ++++- 29 files changed, 112 insertions(+), 161 deletions(-) create mode 100644 lettings/migrations/0004_auto_20240327_1335.py rename {oc_lettings_site/migrations => lettings/templates}/__init__.py (100%) create mode 100644 lettings/templates/lettings/__init__.py rename templates/lettings_index.html => lettings/templates/lettings/index.html (89%) rename {templates => lettings/templates/lettings}/letting.html (95%) create mode 100644 lettings/urls.py delete mode 100644 oc_lettings_site/admin.py delete mode 100644 oc_lettings_site/apps.py delete mode 100644 oc_lettings_site/migrations/0001_initial.py delete mode 100644 oc_lettings_site/models.py rename {templates => oc_lettings_site/templates}/base.html (97%) rename {templates => oc_lettings_site/templates}/index.html (92%) delete mode 100644 oc_lettings_site/tests.py create mode 100644 profiles/migrations/0004_auto_20240327_1335.py create mode 100644 profiles/templates/__init__.py create mode 100644 profiles/templates/profiles/__init__.py rename templates/profiles_index.html => profiles/templates/profiles/index.html (88%) rename {templates => profiles/templates/profiles}/profile.html (96%) create mode 100644 profiles/urls.py diff --git a/lettings/admin.py b/lettings/admin.py index 8c38f3f3da..f16b2913ff 100644 --- a/lettings/admin.py +++ b/lettings/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin -# Register your models here. +from .models import Letting, Address + +admin.site.register(Letting) +admin.site.register(Address) \ No newline at end of file diff --git a/lettings/migrations/0004_auto_20240327_1335.py b/lettings/migrations/0004_auto_20240327_1335.py new file mode 100644 index 0000000000..e9b0998457 --- /dev/null +++ b/lettings/migrations/0004_auto_20240327_1335.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0 on 2024-03-27 13:35 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('lettings', '0003_auto_20240326_1507'), + ] + + operations = [ + migrations.RenameModel( + old_name='NewAddress', + new_name='Address', + ), + migrations.RenameModel( + old_name='NewLetting', + new_name='Letting', + ), + ] diff --git a/lettings/models.py b/lettings/models.py index 88da011466..d05b2071e6 100644 --- a/lettings/models.py +++ b/lettings/models.py @@ -2,7 +2,7 @@ from django.db import models -class NewAddress(models.Model): +class Address(models.Model): number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)]) street = models.CharField(max_length=64) city = models.CharField(max_length=64) @@ -14,9 +14,9 @@ def __str__(self): return f'{self.number} {self.street}' -class NewLetting(models.Model): +class Letting(models.Model): title = models.CharField(max_length=256) - address = models.OneToOneField(NewAddress, on_delete=models.CASCADE) + address = models.OneToOneField(Address, on_delete=models.CASCADE) def __str__(self): return self.title diff --git a/oc_lettings_site/migrations/__init__.py b/lettings/templates/__init__.py similarity index 100% rename from oc_lettings_site/migrations/__init__.py rename to lettings/templates/__init__.py diff --git a/lettings/templates/lettings/__init__.py b/lettings/templates/lettings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/lettings_index.html b/lettings/templates/lettings/index.html similarity index 89% rename from templates/lettings_index.html rename to lettings/templates/lettings/index.html index 92857a78d9..a85f3a348e 100644 --- a/templates/lettings_index.html +++ b/lettings/templates/lettings/index.html @@ -20,7 +20,7 @@

Lettings

@@ -36,7 +36,7 @@

Lettings

Home - + Profiles diff --git a/templates/letting.html b/lettings/templates/lettings/letting.html similarity index 95% rename from templates/letting.html rename to lettings/templates/lettings/letting.html index 7e5f3a73fd..252d68035e 100644 --- a/templates/letting.html +++ b/lettings/templates/lettings/letting.html @@ -25,14 +25,14 @@

{{ title }}

diff --git a/lettings/urls.py b/lettings/urls.py new file mode 100644 index 0000000000..b2f0174c74 --- /dev/null +++ b/lettings/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from . import views + +app_name = 'lettings' + +urlpatterns = [ + path('', views.index, name='index'), + path('/', views.letting, name='letting'), +] diff --git a/lettings/views.py b/lettings/views.py index 91ea44a218..c2dba214fe 100644 --- a/lettings/views.py +++ b/lettings/views.py @@ -1,3 +1,17 @@ from django.shortcuts import render +from lettings.models import Letting -# Create your views here. + +def index(request): + lettings_list = Letting.objects.all() + context = {'lettings_list': lettings_list} + return render(request, 'lettings/index.html', context) + + +def letting(request, letting_id): + letting = Letting.objects.get(id=letting_id) + context = { + 'title': letting.title, + 'address': letting.address, + } + return render(request, 'lettings/letting.html', context) diff --git a/oc-lettings-site.sqlite3 b/oc-lettings-site.sqlite3 index 1c684ba363638746b8daece4edd999d94618cdc4..2fa7f817c6d64c0bac53f22b8a58defd3008622d 100644 GIT binary patch delta 1782 zcmb7EZ%i9y9KN@Ay}S0V@5`SmY)z#t*&IUQu6L!hbVWp9Od~iKKM_lX!f*tTR?);{ zJ&1{Mi=k`ebjd!=5B!PF1~(E-1SNq_3Q-cLAAn@=LCr?g51K`zcQ1E@^_w4l&%Muc z_j`W7d;ev2?3oNVyXsgaE_t;A@ zmz8igHjj>t^bZatQ-UDK@x*KCk$6A|$bu9I#YIU9>clTd{y@khN)f3(A_%oXDI^8M zvEw*@D49+V4iEgVd@(48I>fePR>I%dJklFCJ>sdsbW&?1P}qnd%SRg#B0(V{$+e+S zNS4KgKaL^Vvq{*HK%k$|H8h5n(5L7!>P7-;Lorm2%Hh?#G72d~5S3Y_f zou#B7m@^PJ29(pOsfRro1KL?~M9mG>y#k`S&AMu@%dSl|5BF)LqBNRB{ip*~AO`KC zIkX1%k(^i7;b|x3b{$qS3h`PZ*3DYRlPlD7HBCPqzfYsPXcf((X*7XSD2dJ>2|b2r zct5Xv3uC1`MYvt&zZg%=sFc(7f(p8BKdR?yI`5ECPR=o19RiOWZtj7@%I)#@xbOHM zxMlupZl0gxrunPfB>xsaz`e?Ma@~B0Yv;Y3_Jg01mIsEOpcrL7i;TkSIcDSe zQ*ayp2)~ElAcSm)g#W-b_!ayD-hzL^-{7xs58i~c@CLk|SKRQ7l>~r~Vr;}1!5G$& zYrq)7SdTHNqg}=*VGLjt7xuO)6q2WIFETyAO;X%7pzZeez~b#b@Z3c*O0TNS21t~% z{cMbVl=+?6U}l&M)6GPf68aZ+e3)0>2Xs>#UG{=s?Mi}jb!*mQJ8NvpxM&Pg<~C&~ z=vJo8?+24j>BP%J`pLnUtNFf=GwSI%OBrLxYEe4~s^lk@PBk-Qv8h*PEVY!QjCe7t zoTHnbK5XI{^Oi7ATU;zuPECx*a3gPfA8y2$&%;L4;GCs`K2TNE4(ipVUhvoA<$22$ zKoJDEn^(3$+XUHi@LOT*R#>f&Ki+b#wfTIj=X~>1&$fDe=4T}V@L6u)2IyO00=XIgldAGt|rrKDq}6`0N(W+s~>Y+e=v8%`^ACw;Ip$H#@q=$%7BGiZQp&)~<*E_eiYl91i-}#^4IluEetiRvf z|Jn2~JH3V=h$7{S{ThdgU1W{i{1j-LaXrFWow7J%oLb)l>|TOEc$$Fk@EH1F7M{Zc zXo51Z;rI9(o|eT&*vs#tU1V=xPkU#V5b$>kH?)}H)0IS*5Da#9cc=+1X8DYyL`z#+ zpAZPJut3;`+`AidtaJt0)9T+Y4s-?ue~dQ=^s+JX9ITU#be3EtOCt*C zeL%0!I2uN`Q3vv(a^#T37v?F)#U(nL=A(Y+P4+WBx)d)*xcNpa02q~V{@|bZ2VTL; zvUmqiEq}@rX$!qC$~BX@v=D|ej<2X72b{r{%Uwc>E1GvZ;oQly9(R++-sG-6c^-qm=PnypP|hGtI#;aYEHFP?(}Y zGd8hGg9=m)MumF|P~D3v?%ktU?{SuItx!k4n_{-c<#+Cs$qyAAQ?D)T*S|K6VW)aW zqGwq;=cd(fFWqZRrjkyNQ6;SR=znBr+t!hxW$dBs@+}#4`ZBb4$-QHLafU=08L2X) IstIcDFB94UhX4Qo diff --git a/oc_lettings_site/admin.py b/oc_lettings_site/admin.py deleted file mode 100644 index 63328c6dd3..0000000000 --- a/oc_lettings_site/admin.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.contrib import admin - -from .models import Letting -from .models import Address -from .models import Profile - - -admin.site.register(Letting) -admin.site.register(Address) -admin.site.register(Profile) diff --git a/oc_lettings_site/apps.py b/oc_lettings_site/apps.py deleted file mode 100644 index 6489692f04..0000000000 --- a/oc_lettings_site/apps.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.apps import AppConfig - - -class OCLettingsSiteConfig(AppConfig): - name = 'oc_lettings_site' diff --git a/oc_lettings_site/migrations/0001_initial.py b/oc_lettings_site/migrations/0001_initial.py deleted file mode 100644 index 774cf23f58..0000000000 --- a/oc_lettings_site/migrations/0001_initial.py +++ /dev/null @@ -1,46 +0,0 @@ -# Generated by Django 3.0 on 2020-06-14 09:35 - -from django.conf import settings -import django.core.validators -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='Address', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('number', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(9999)])), - ('street', models.CharField(max_length=64)), - ('city', models.CharField(max_length=64)), - ('state', models.CharField(max_length=2, validators=[django.core.validators.MinLengthValidator(2)])), - ('zip_code', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(99999)])), - ('country_iso_code', models.CharField(max_length=3, validators=[django.core.validators.MinLengthValidator(3)])), - ], - ), - migrations.CreateModel( - name='Profile', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('favorite_city', models.CharField(blank=True, max_length=64)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Letting', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=256)), - ('address', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='oc_lettings_site.Address')), - ], - ), - ] diff --git a/oc_lettings_site/models.py b/oc_lettings_site/models.py deleted file mode 100644 index ed255e8c11..0000000000 --- a/oc_lettings_site/models.py +++ /dev/null @@ -1,31 +0,0 @@ -from django.db import models -from django.core.validators import MaxValueValidator, MinLengthValidator -from django.contrib.auth.models import User - - -class Address(models.Model): - number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)]) - street = models.CharField(max_length=64) - city = models.CharField(max_length=64) - state = models.CharField(max_length=2, validators=[MinLengthValidator(2)]) - zip_code = models.PositiveIntegerField(validators=[MaxValueValidator(99999)]) - country_iso_code = models.CharField(max_length=3, validators=[MinLengthValidator(3)]) - - def __str__(self): - return f'{self.number} {self.street}' - - -class Letting(models.Model): - title = models.CharField(max_length=256) - address = models.OneToOneField(Address, on_delete=models.CASCADE) - - def __str__(self): - return self.title - - -class Profile(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE) - favorite_city = models.CharField(max_length=64, blank=True) - - def __str__(self): - return self.user.username diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 2acd312121..9cffdf3eb2 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -23,7 +23,6 @@ # Application definition INSTALLED_APPS = [ - 'oc_lettings_site.apps.OCLettingsSiteConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -49,7 +48,7 @@ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'DIRS': [os.path.join(BASE_DIR, 'oc_lettings_site/templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/templates/base.html b/oc_lettings_site/templates/base.html similarity index 97% rename from templates/base.html rename to oc_lettings_site/templates/base.html index ab7addba01..403b342755 100644 --- a/templates/base.html +++ b/oc_lettings_site/templates/base.html @@ -24,10 +24,10 @@
Logo Orange County Lettings diff --git a/templates/index.html b/oc_lettings_site/templates/index.html similarity index 92% rename from templates/index.html rename to oc_lettings_site/templates/index.html index 71a8e61a46..fc9a76c7ab 100644 --- a/templates/index.html +++ b/oc_lettings_site/templates/index.html @@ -14,10 +14,10 @@

Welcome to Holiday Homes

diff --git a/oc_lettings_site/tests.py b/oc_lettings_site/tests.py deleted file mode 100644 index 3fd62bb718..0000000000 --- a/oc_lettings_site/tests.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_dummy(): - assert 1 diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index f0ff5897ab..61f42f013c 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -1,13 +1,11 @@ from django.contrib import admin -from django.urls import path +from django.urls import path, include from . import views urlpatterns = [ path('', views.index, name='index'), - path('lettings/', views.lettings_index, name='lettings_index'), - path('lettings//', views.letting, name='letting'), - path('profiles/', views.profiles_index, name='profiles_index'), - path('profiles//', views.profile, name='profile'), path('admin/', admin.site.urls), + path('lettings/',include('lettings.urls',namespace='lettings')), + path('profiles/',include('profiles.urls',namespace='profiles')), ] diff --git a/oc_lettings_site/views.py b/oc_lettings_site/views.py index a72db27074..4c96023229 100644 --- a/oc_lettings_site/views.py +++ b/oc_lettings_site/views.py @@ -1,45 +1,5 @@ from django.shortcuts import render -from .models import Letting, Profile - - -# Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque molestie quam lobortis leo consectetur ullamcorper non id est. Praesent dictum, nulla eget feugiat sagittis, sem mi convallis eros, -# vitae dapibus nisi lorem dapibus sem. Maecenas pharetra purus ipsum, eget consequat ipsum lobortis quis. Phasellus eleifend ex auctor venenatis tempus. -# Aliquam vitae erat ac orci placerat luctus. Nullam elementum urna nisi, pellentesque iaculis enim cursus in. Praesent volutpat porttitor magna, non finibus neque cursus id. def index(request): return render(request, 'index.html') - -# Aenean leo magna, vestibulum et tincidunt fermentum, consectetur quis velit. Sed non placerat massa. Integer est nunc, pulvinar a -# tempor et, bibendum id arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Cras eget scelerisque -def lettings_index(request): - lettings_list = Letting.objects.all() - context = {'lettings_list': lettings_list} - return render(request, 'lettings_index.html', context) - - -#Cras ultricies dignissim purus, vitae hendrerit ex varius non. In accumsan porta nisl id eleifend. Praesent dignissim, odio eu consequat pretium, purus urna vulputate arcu, vitae efficitur -# lacus justo nec purus. Aenean finibus faucibus lectus at porta. Maecenas auctor, est ut luctus congue, dui enim mattis enim, ac condimentum velit libero in magna. Suspendisse potenti. In tempus a nisi sed laoreet. -# Suspendisse porta dui eget sem accumsan interdum. Ut quis urna pellentesque justo mattis ullamcorper ac non tellus. In tristique mauris eu velit fermentum, tempus pharetra est luctus. Vivamus consequat aliquam libero, eget bibendum lorem. Sed non dolor risus. Mauris condimentum auctor elementum. Donec quis nisi ligula. Integer vehicula tincidunt enim, ac lacinia augue pulvinar sit amet. -def letting(request, letting_id): - letting = Letting.objects.get(id=letting_id) - context = { - 'title': letting.title, - 'address': letting.address, - } - return render(request, 'letting.html', context) - -# Sed placerat quam in pulvinar commodo. Nullam laoreet consectetur ex, sed consequat libero pulvinar eget. Fusc -# faucibus, urna quis auctor pharetra, massa dolor cursus neque, quis dictum lacus d -def profiles_index(request): - profiles_list = Profile.objects.all() - context = {'profiles_list': profiles_list} - return render(request, 'profiles_index.html', context) - -# Aliquam sed metus eget nisi tincidunt ornare accumsan eget lac -# laoreet neque quis, pellentesque dui. Nullam facilisis pharetra vulputate. Sed tincidunt, dolor id facilisis fringilla, eros leo tristique lacus, -# it. Nam aliquam dignissim congue. Pellentesque habitant morbi tristique senectus et netus et males -def profile(request, username): - profile = Profile.objects.get(user__username=username) - context = {'profile': profile} - return render(request, 'profile.html', context) diff --git a/profiles/admin.py b/profiles/admin.py index 8c38f3f3da..308a0b3b62 100644 --- a/profiles/admin.py +++ b/profiles/admin.py @@ -1,3 +1,5 @@ from django.contrib import admin -# Register your models here. +from .models import Profile + +admin.site.register(Profile) diff --git a/profiles/migrations/0004_auto_20240327_1335.py b/profiles/migrations/0004_auto_20240327_1335.py new file mode 100644 index 0000000000..fee95e3446 --- /dev/null +++ b/profiles/migrations/0004_auto_20240327_1335.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0 on 2024-03-27 13:35 + +from django.conf import settings +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('profiles', '0003_auto_20240326_1631'), + ] + + operations = [ + migrations.RenameModel( + old_name='NewProfile', + new_name='Profile', + ), + ] diff --git a/profiles/models.py b/profiles/models.py index 5046197cd6..84c85c1001 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -2,7 +2,7 @@ from django.contrib.auth.models import User -class NewProfile(models.Model): +class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) favorite_city = models.CharField(max_length=64, blank=True) diff --git a/profiles/templates/__init__.py b/profiles/templates/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/profiles/templates/profiles/__init__.py b/profiles/templates/profiles/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/profiles_index.html b/profiles/templates/profiles/index.html similarity index 88% rename from templates/profiles_index.html rename to profiles/templates/profiles/index.html index 4ad1daf92f..563b7a0166 100644 --- a/templates/profiles_index.html +++ b/profiles/templates/profiles/index.html @@ -18,7 +18,7 @@

Profiles

@@ -34,7 +34,7 @@

Profiles

Home - + Lettings
diff --git a/templates/profile.html b/profiles/templates/profiles/profile.html similarity index 96% rename from templates/profile.html rename to profiles/templates/profiles/profile.html index d150d30e63..4b1af37496 100644 --- a/templates/profile.html +++ b/profiles/templates/profiles/profile.html @@ -24,14 +24,14 @@

{{ profile.user.username }}

diff --git a/profiles/urls.py b/profiles/urls.py new file mode 100644 index 0000000000..36449cd58c --- /dev/null +++ b/profiles/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from . import views + +app_name = 'profiles' + +urlpatterns = [ + path('', views.index, name='index'), + path('/', views.profile, name='profile'), +] \ No newline at end of file diff --git a/profiles/views.py b/profiles/views.py index 91ea44a218..0846566215 100644 --- a/profiles/views.py +++ b/profiles/views.py @@ -1,3 +1,14 @@ from django.shortcuts import render +from profiles.models import Profile -# Create your views here. + +def index(request): + profiles_list = Profile.objects.all() + context = {'profiles_list': profiles_list} + return render(request, 'profiles/index.html', context) + + +def profile(request, username): + profile = Profile.objects.get(user__username=username) + context = {'profile': profile} + return render(request, 'profiles/profile.html', context) From b875852153680429381ed1ba2a19352919a94177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Thu, 28 Mar 2024 12:50:24 +0100 Subject: [PATCH 03/91] add 404 and 500 error pages + correct flake8 issues + correct admin page --- lettings/admin.py | 2 +- lettings/models.py | 4 ++++ lettings/tests.py | 3 --- oc-lettings-site.sqlite3 | Bin 180224 -> 180224 bytes oc_lettings_site/settings.py | 7 +++---- oc_lettings_site/templates/404.html | 30 ++++++++++++++++++++++++++++ oc_lettings_site/templates/500.html | 30 ++++++++++++++++++++++++++++ oc_lettings_site/urls.py | 5 +++-- profiles/tests.py | 3 --- profiles/urls.py | 2 +- 10 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 oc_lettings_site/templates/404.html create mode 100644 oc_lettings_site/templates/500.html diff --git a/lettings/admin.py b/lettings/admin.py index f16b2913ff..b83e07c525 100644 --- a/lettings/admin.py +++ b/lettings/admin.py @@ -3,4 +3,4 @@ from .models import Letting, Address admin.site.register(Letting) -admin.site.register(Address) \ No newline at end of file +admin.site.register(Address) diff --git a/lettings/models.py b/lettings/models.py index d05b2071e6..997ac2e05e 100644 --- a/lettings/models.py +++ b/lettings/models.py @@ -13,6 +13,10 @@ class Address(models.Model): def __str__(self): return f'{self.number} {self.street}' + class Meta: + verbose_name = 'Address' + verbose_name_plural = 'Addresses' + class Letting(models.Model): title = models.CharField(max_length=256) diff --git a/lettings/tests.py b/lettings/tests.py index 7ce503c2dd..e69de29bb2 100644 --- a/lettings/tests.py +++ b/lettings/tests.py @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/oc-lettings-site.sqlite3 b/oc-lettings-site.sqlite3 index 2fa7f817c6d64c0bac53f22b8a58defd3008622d..d586d0366a2a8ffd7fd473502d46ce1551e25d2e 100644 GIT binary patch delta 262 zcmZo@;BIK(o*>QWGf~Ew(Pv{q^n5WBT?1oXBMSusODjVYD^m+Sa|=U5g`$ ynqO6g*_V-!6-?9b*fVJWH6CW*f5d+nsBt^Lyd1M5qmh9T4vU$#Kk{diD*ymt%TCq+ delta 117 zcmZo@;BIK(o*>QWIZ?)$(Q{)$^n5V`T>~>+LlXr9ODhvYD^oK)OLJ30^X7~5w_lvk zXxzZY$ajc=@6g7^9ef;3){LyaEv$~yAJ{V~Y=5Q4B*n +
+
+

404 PAGE NOT FOUND

+
+
+
+ +
+
+
+

"Oops, unfortunately the page you are looking for seems to have taken an unexpected vacation."

+
+
+
+ +
+ +
+ +{% endblock %} diff --git a/oc_lettings_site/templates/500.html b/oc_lettings_site/templates/500.html new file mode 100644 index 0000000000..7661da570d --- /dev/null +++ b/oc_lettings_site/templates/500.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% block title %}ERROR 500{% endblock title %} + +{% block content %} + +
+
+
+

500 INTERNAL SERVER ERROR

+
+
+
+ +
+
+
+

"Oops, our server decided to take a surprise vacation! We're working on bringing it back quickly."

+
+
+
+ +
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index 61f42f013c..ff9a7be681 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -3,9 +3,10 @@ from . import views + urlpatterns = [ path('', views.index, name='index'), path('admin/', admin.site.urls), - path('lettings/',include('lettings.urls',namespace='lettings')), - path('profiles/',include('profiles.urls',namespace='profiles')), + path('lettings/', include('lettings.urls', namespace='lettings')), + path('profiles/', include('profiles.urls', namespace='profiles')), ] diff --git a/profiles/tests.py b/profiles/tests.py index 7ce503c2dd..e69de29bb2 100644 --- a/profiles/tests.py +++ b/profiles/tests.py @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/profiles/urls.py b/profiles/urls.py index 36449cd58c..9a6d0ee8e3 100644 --- a/profiles/urls.py +++ b/profiles/urls.py @@ -6,4 +6,4 @@ urlpatterns = [ path('', views.index, name='index'), path('/', views.profile, name='profile'), -] \ No newline at end of file +] From c71877fe09603fbd9fa4ae4b42035d26413e4ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Thu, 28 Mar 2024 12:51:21 +0100 Subject: [PATCH 04/91] Auto stash before merge of "master" and "chore/improved_modular_architecture" --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 47391aa2a3..ac09184bb2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ **/__pycache__ *.pyc venv -.idea +.idea \ No newline at end of file From 88a5506533d60eb730460b7bf2bfe6a8fc7a0345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Thu, 28 Mar 2024 17:56:13 +0100 Subject: [PATCH 05/91] add views and urls unit tests + add setup coverage --- .coverage | Bin 0 -> 53248 bytes .../migrations/0005_auto_20240328_1224.py | 17 ++++++++++++++ lettings/{tests.py => tests/__init__.py} | 0 lettings/tests/test_urls.py | 16 +++++++++++++ lettings/tests/test_view.py | 20 +++++++++++++++++ oc-lettings-site.sqlite3 | Bin 180224 -> 180224 bytes oc_lettings_site/settings.py | 5 +++-- profiles/{tests.py => tests/__init__.py} | 0 profiles/tests/test_urls.py | 16 +++++++++++++ profiles/tests/test_view.py | 21 ++++++++++++++++++ requirements.txt | 3 ++- setup.cfg | 19 ++++++++++++++-- 12 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 .coverage create mode 100644 lettings/migrations/0005_auto_20240328_1224.py rename lettings/{tests.py => tests/__init__.py} (100%) create mode 100644 lettings/tests/test_urls.py create mode 100644 lettings/tests/test_view.py rename profiles/{tests.py => tests/__init__.py} (100%) create mode 100644 profiles/tests/test_urls.py create mode 100644 profiles/tests/test_view.py diff --git a/.coverage b/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..d0ab17cf3329a1fe0905090b06a7fe46846eb837 GIT binary patch literal 53248 zcmeI4&u<$=6vy|My>=RB3Z=5D2z4$r4J0v9TOr^8AruKHDlHW)Lc(3!lVriW>+Y_b z9$m2~}<+jL^rUzPEi z%1d`6)#8bc@@T5#f(uD~PSxEO)r!?BiRgr`=Y*T`HMKdH6v)mNtBp9#AR)?K^|^%H zpH-igp;}R)@|!A3wb<{rW+!IPzcFD~ckR+IsKh2GY|>}PkTsMsFy-kL64VUB7Hi)K z9lyDzqB-gGEo=s)=SG}b8wOr24rJT)6EpqDjorYPYC|=+tc>e#5}ZJ*}TB zCvKFrR<^N+TqtkJ>kOm$Ax}9`H_Qi;e;Xw88iP?X?<3g}GH2c{R+pwnnUj^PFJ_5S z&$jI9?%jGX?GZdK@wYH!1m_I8z*Q5$e^WdunD!Ifz<$8N{yZXQbdas*x#&n#iM>MH>POf&gYYaKb zRR;(Da+C&K`n9vwPng{n9K4&Jfd{v=1sf@ayj1pEXJVEY_`3K@qYnZIfB*=900@8p z2!H?xfB*=900@Ad?@ zOd96BBL9oWgF-i_tJ$9b9$GlKaBzaGGQ<^4ToJ$jKMjP|AOHd&00JNY0w4eaAOHd& z00JNY0y%+6^Iko_3Sdl_)8*_U0N?*FRc1Bup*S-2)70Bj2P$7x&QS&e2!H?xfB*=9 z00@8p2!H?xY*zv&OP1C zwdXhEwZNZ0x;%eG#r!gwX#T0=wN4oDljTwEtgF@|dSd-Wn*=Y8QE)eGv)q%#@hD91 z;YpMqC|nqi!hOM+!gY(}F5ftapjppF*XeyYs;~GfCY@mECY&HM;FLk~58b%@zKeK4 zOC@c2N*|BpoJ*}QneYFXD)(#Rqp5?Hucv;VdPh80IZqh~AOHd&00JNY0w4eaAOHd& zux$yPvU&&fF)r@%^?&K4)mt2=;A}N&k4fSFnlV?nI3|Vrf-{8+r>)-d7(k3%|66sd zw{$a3kQrdUWc3b>LH@Pte}mfcQ2EB4uaCUH{>S_Ow(Woh!$AN9KmY_l00ck)1V8`; zKmY``2LV$zwF=+=*Tvr&eGotZ1V8`;KmY_l00ck)1V8`;KmY{pKmw*&DJReWi;p$& zhxl3iD83P2h)=~Qlz{*OAOHd&00JNY0w4eaAOHd&00JOzs|na8OE2#%?c1_)HUjiQni7 zz$NjWxF|lS3}QWJ5k1&(RX9Q5`JbGj@Ogf1cuTT9O}cWME`sU~FU&Z)jv>0^;Zz80#8YC>R=98JSoa8|oRGnpm0{Z`PK) RBE~4wWYA{7xXgfQ0swraA7ual delta 47 zcmZo@;BIK(o*>QWGf~Ew(Pv}A5`JcBPVLF;0_GbV-*Rl$mb@ayDBWbxX27`2fN25% DR~-&G diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 58224d584a..b789114f02 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -14,7 +14,7 @@ SECRET_KEY = 'fp$9^593hsriajg$_%=5trot9g!1qa@ew(o-1#@=&4%=hp46(s' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = True ALLOWED_HOSTS = ["*"] @@ -28,6 +28,7 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'oc_lettings_site', 'lettings', 'profiles' ] @@ -113,4 +114,4 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = '/static/' -STATICFILES_DIRS = [BASE_DIR / "static", ] +STATICFILES_DIRS = [BASE_DIR / "static",] diff --git a/profiles/tests.py b/profiles/tests/__init__.py similarity index 100% rename from profiles/tests.py rename to profiles/tests/__init__.py diff --git a/profiles/tests/test_urls.py b/profiles/tests/test_urls.py new file mode 100644 index 0000000000..0a4063dd82 --- /dev/null +++ b/profiles/tests/test_urls.py @@ -0,0 +1,16 @@ +import pytest +from django.contrib.auth.models import User + +from django.urls import reverse, resolve +from profiles.models import Profile + + +@pytest.mark.django_db +def test_profiles_url(): + user = User.objects.create_user(username='4meRomance', password='password') + Profile.objects.create(id=1, favorite_city="Marseille", user_id=user.id) + + path = reverse('profiles:profile', kwargs={'username': user.username}) + + assert path == "/profiles/4meRomance/" + assert resolve(path).view_name == 'profiles:profile' diff --git a/profiles/tests/test_view.py b/profiles/tests/test_view.py new file mode 100644 index 0000000000..2c6a6abd07 --- /dev/null +++ b/profiles/tests/test_view.py @@ -0,0 +1,21 @@ +import pytest + +from django.test import Client +from django.contrib.auth.models import User +from django.urls import reverse +from profiles.models import Profile + + +@pytest.mark.django_db +def test_profiles_view(): + client = Client() + user = User.objects.create_user(username='4meRomance', password='password', email='edygaram@gmail.com') + Profile.objects.create(id=1, favorite_city="Marseille", user_id=user.id) + + path = reverse('profiles:profile', kwargs={'username': user.username}) + response = client.get(path) + content = response.content.decode() + expected_content = "edygaram@gmail.com" + + assert response.status_code == 200 + assert expected_content in content diff --git a/requirements.txt b/requirements.txt index c48c84ea40..368d7d9b96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ django==3.0 flake8==3.7.0 -pytest-django==3.9.0 \ No newline at end of file +pytest-django==3.9.0 +pytest~=8.1.1 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 9346841bbc..609aadaf03 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,5 +4,20 @@ exclude = **/migrations/*,venv [tool:pytest] DJANGO_SETTINGS_MODULE = oc_lettings_site.settings -python_files = tests.py -addopts = -v +python_files = test_*.py +python_functions = test_* +addopts = -v --nomigrations + +[coverage:run] +omit = + */migrations/* + */tests/* + */tests.py + */__init__.py + */apps.py + */admin.py + */manage.py + */settings.py + */wsgi.py + */asgi.py + From 2f78ae21da67c384fcec96cb3c14cdd735f11e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 29 Mar 2024 14:34:18 +0100 Subject: [PATCH 06/91] add doc-strings + made some adjustments --- .coverage | Bin 53248 -> 0 bytes lettings/admin.py | 3 ++- lettings/apps.py | 9 +++++++++ lettings/models.py | 28 ++++++++++++++++++++++++++++ lettings/tests/test_urls.py | 18 +++++++++++++++--- lettings/tests/test_view.py | 22 +++++++++++++++++++++- lettings/urls.py | 13 +++++++++++++ lettings/views.py | 26 ++++++++++++++++++++++++++ manage.py | 5 +++++ oc_lettings_site/asgi.py | 4 ++-- oc_lettings_site/settings.py | 2 +- oc_lettings_site/urls.py | 15 +++++++++++++++ oc_lettings_site/views.py | 10 ++++++++++ oc_lettings_site/wsgi.py | 4 ++-- profiles/admin.py | 3 ++- profiles/apps.py | 9 +++++++++ profiles/models.py | 11 +++++++++++ profiles/tests/test_urls.py | 19 +++++++++++++++++++ profiles/tests/test_view.py | 20 +++++++++++++++++++- profiles/urls.py | 13 +++++++++++++ profiles/views.py | 24 ++++++++++++++++++++++++ setup.cfg | 2 +- 22 files changed, 247 insertions(+), 13 deletions(-) delete mode 100644 .coverage diff --git a/.coverage b/.coverage deleted file mode 100644 index d0ab17cf3329a1fe0905090b06a7fe46846eb837..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 53248 zcmeI4&u<$=6vy|My>=RB3Z=5D2z4$r4J0v9TOr^8AruKHDlHW)Lc(3!lVriW>+Y_b z9$m2~}<+jL^rUzPEi z%1d`6)#8bc@@T5#f(uD~PSxEO)r!?BiRgr`=Y*T`HMKdH6v)mNtBp9#AR)?K^|^%H zpH-igp;}R)@|!A3wb<{rW+!IPzcFD~ckR+IsKh2GY|>}PkTsMsFy-kL64VUB7Hi)K z9lyDzqB-gGEo=s)=SG}b8wOr24rJT)6EpqDjorYPYC|=+tc>e#5}ZJ*}TB zCvKFrR<^N+TqtkJ>kOm$Ax}9`H_Qi;e;Xw88iP?X?<3g}GH2c{R+pwnnUj^PFJ_5S z&$jI9?%jGX?GZdK@wYH!1m_I8z*Q5$e^WdunD!Ifz<$8N{yZXQbdas*x#&n#iM>MH>POf&gYYaKb zRR;(Da+C&K`n9vwPng{n9K4&Jfd{v=1sf@ayj1pEXJVEY_`3K@qYnZIfB*=900@8p z2!H?xfB*=900@Ad?@ zOd96BBL9oWgF-i_tJ$9b9$GlKaBzaGGQ<^4ToJ$jKMjP|AOHd&00JNY0w4eaAOHd& z00JNY0y%+6^Iko_3Sdl_)8*_U0N?*FRc1Bup*S-2)70Bj2P$7x&QS&e2!H?xfB*=9 z00@8p2!H?xY*zv&OP1C zwdXhEwZNZ0x;%eG#r!gwX#T0=wN4oDljTwEtgF@|dSd-Wn*=Y8QE)eGv)q%#@hD91 z;YpMqC|nqi!hOM+!gY(}F5ftapjppF*XeyYs;~GfCY@mECY&HM;FLk~58b%@zKeK4 zOC@c2N*|BpoJ*}QneYFXD)(#Rqp5?Hucv;VdPh80IZqh~AOHd&00JNY0w4eaAOHd& zux$yPvU&&fF)r@%^?&K4)mt2=;A}N&k4fSFnlV?nI3|Vrf-{8+r>)-d7(k3%|66sd zw{$a3kQrdUWc3b>LH@Pte}mfcQ2EB4uaCUH{>S_Ow(Woh!$AN9KmY_l00ck)1V8`; zKmY``2LV$zwF=+=*Tvr&eGotZ1V8`;KmY_l00ck)1V8`;KmY{pKmw*&DJReWi;p$& zhxl3iD83P2h)=~Qlz{*OAOHd&00JNY0w4eaAOHd&00JOzs|na8OE2#%?c1_)HUjiQni7 zz$NjWxF|lS3} Date: Tue, 2 Apr 2024 16:21:42 +0200 Subject: [PATCH 07/91] add docker files + set parameters --- .dockerignore | 2 ++ Dockerfile | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..a715c9d790 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..4a781d9357 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.10 + +WORKDIR /app + +COPY requirements.txt . + +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +EXPOSE 8000 + +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] From be069dd6694dec463788e10d259d78e8e49066a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 2 Apr 2024 17:57:00 +0200 Subject: [PATCH 08/91] add pipeline setup --- .github/workflows/oc_lettings.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/oc_lettings.yml diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml new file mode 100644 index 0000000000..b7312fc8c9 --- /dev/null +++ b/.github/workflows/oc_lettings.yml @@ -0,0 +1,10 @@ +name: GitHub Actions Demo +run-name: Pipeline is testing out GitHub Actions +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: sudo apt-get update; sudo apt-get upgrade; sudo apt install python3-pip; + - run: pip3 install -r requirements.txt + - run: pytest \ No newline at end of file From 4a037b9935bd04e5c175c1f7e01eca14cdc7b9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 2 Apr 2024 17:59:52 +0200 Subject: [PATCH 09/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index b7312fc8c9..09e79ee9f0 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -6,5 +6,5 @@ jobs: runs-on: ubuntu-latest steps: - run: sudo apt-get update; sudo apt-get upgrade; sudo apt install python3-pip; - - run: pip3 install -r requirements.txt + - run: pip3 install -r ../../requirements.txt - run: pytest \ No newline at end of file From 505cbe24725d69c524f6e399b9fc17eb8197cc47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 2 Apr 2024 18:08:24 +0200 Subject: [PATCH 10/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 09e79ee9f0..f8961a690e 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -5,6 +5,7 @@ jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest steps: + - run: ls - run: sudo apt-get update; sudo apt-get upgrade; sudo apt install python3-pip; - run: pip3 install -r ../../requirements.txt - run: pytest \ No newline at end of file From 70e327a95a4896a40d31271b36b92fc647a6b48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 2 Apr 2024 18:13:10 +0200 Subject: [PATCH 11/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index f8961a690e..083143c112 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -5,7 +5,6 @@ jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest steps: - - run: ls - - run: sudo apt-get update; sudo apt-get upgrade; sudo apt install python3-pip; - - run: pip3 install -r ../../requirements.txt + - run: sudo apt install python3-pip; + - run: pip3 install -r requirements.txt - run: pytest \ No newline at end of file From 5e9cbafb749da140596801ad66d0ec6073a8cbcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 2 Apr 2024 18:14:51 +0200 Subject: [PATCH 12/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 083143c112..8c69002e19 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,10 +1,27 @@ -name: GitHub Actions Demo -run-name: Pipeline is testing out GitHub Actions -on: [push] +name: Django CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + jobs: - Explore-GitHub-Actions: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.6, 3.7, 3.8] + steps: - - run: sudo apt install python3-pip; - - run: pip3 install -r requirements.txt - - run: pytest \ No newline at end of file + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt \ No newline at end of file From 1f389f3527c47866536ffc02ebba1ae22d682441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 2 Apr 2024 18:16:43 +0200 Subject: [PATCH 13/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 8c69002e19..75c3764a7f 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -24,4 +24,4 @@ jobs: - name: Install Dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt \ No newline at end of file + pip install -r requirements.txt From e77203f90c1f8d4688dc816d541b0f536f997554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 2 Apr 2024 18:19:35 +0200 Subject: [PATCH 14/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 75c3764a7f..083143c112 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,27 +1,10 @@ -name: Django CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - +name: GitHub Actions Demo +run-name: Pipeline is testing out GitHub Actions +on: [push] jobs: - build: - + Explore-GitHub-Actions: runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python-version: [3.6, 3.7, 3.8] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + - run: sudo apt install python3-pip; + - run: pip3 install -r requirements.txt + - run: pytest \ No newline at end of file From 65310b78a74c8b4cb43470b33a1a7e4100ea1c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Wed, 3 Apr 2024 09:57:44 +0200 Subject: [PATCH 15/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 083143c112..b03e9507a0 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -6,5 +6,5 @@ jobs: runs-on: ubuntu-latest steps: - run: sudo apt install python3-pip; - - run: pip3 install -r requirements.txt + - run: pip install -r requirements.txt - run: pytest \ No newline at end of file From 8e1665fd1ba6d0a6932b474b14eca48a5aed051a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Wed, 3 Apr 2024 09:58:57 +0200 Subject: [PATCH 16/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index b03e9507a0..4be401eada 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -6,5 +6,5 @@ jobs: runs-on: ubuntu-latest steps: - run: sudo apt install python3-pip; - - run: pip install -r requirements.txt + - run: pip freeze > requirements.txt - run: pytest \ No newline at end of file From 1c05b21e017221fad57dc721b74fb1cb42c2b77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 09:52:52 +0200 Subject: [PATCH 17/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 4be401eada..819a7ad89f 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,10 +1,22 @@ name: GitHub Actions Demo -run-name: Pipeline is testing out GitHub Actions -on: [push] + +on: + push: + branches: + - main + jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest steps: - - run: sudo apt install python3-pip; - - run: pip freeze > requirements.txt - - run: pytest \ No newline at end of file + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Python and dependencies + run: | + sudo apt update + sudo apt install python3-pip + pip3 install -r requirements.txt + + - name: Run Pytest + run: pytest From 2e35285b452f778a1561b1f37683d8c78026f0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 09:56:09 +0200 Subject: [PATCH 18/91] adjust pipeline --- .github/workflows/oc_lettings.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 819a7ad89f..3de9b8c360 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,9 +1,6 @@ name: GitHub Actions Demo -on: - push: - branches: - - main +on: [push] jobs: Explore-GitHub-Actions: From d45623eeb27e3ad46b2ea648f1f3dbb91b402a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 12:00:15 +0200 Subject: [PATCH 19/91] add SAST to pipeline --- .github/workflows/oc_lettings.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 3de9b8c360..64453dc204 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,4 +1,4 @@ -name: GitHub Actions Demo +name: GitHub Actions Integration on: [push] @@ -17,3 +17,8 @@ jobs: - name: Run Pytest run: pytest + + - name: Static Application Security Testing (SAST) + run: | + pip3 install bandit + bandit -r . From beaf73d9615bf14d45e83e6b3234b81355fc9f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 12:07:38 +0200 Subject: [PATCH 20/91] adjust bandit config --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index 9cc23d548f..f4e7d48dd6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,3 +21,6 @@ omit = */settings.py */wsgi.py */asgi.py + +[bandit] +pytest_filter: test_* From 88f4012be078b6ab01365b3e08979c0741a77021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 12:11:26 +0200 Subject: [PATCH 21/91] adjust bandit config --- setup.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f4e7d48dd6..623ce26689 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,4 +23,6 @@ omit = */asgi.py [bandit] -pytest_filter: test_* +omit: + */tests/* + */tests.py From 7e6ed9b6e5706ca0221ae4903e42caa125542971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 12:13:06 +0200 Subject: [PATCH 22/91] adjust bandit config --- setup.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 623ce26689..431458e191 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,6 +23,6 @@ omit = */asgi.py [bandit] -omit: - */tests/* - */tests.py +exclude: ./tests/* +pytest_filter: test_* + From 6210c64792b65f65a6bdc65e66c40c84ffc57a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 12:15:10 +0200 Subject: [PATCH 23/91] adjust bandit config --- setup.cfg | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 431458e191..fc0c7db820 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,7 +22,6 @@ omit = */wsgi.py */asgi.py -[bandit] -exclude: ./tests/* -pytest_filter: test_* +[tool.bandit.assert_used] +skips = ['*_test.py', '*/test_*.py'] From 6f5198853aeb71eb645397f07d24a407a43d501a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 12:33:45 +0200 Subject: [PATCH 24/91] remouve SAST + add docker_image --- .github/workflows/docker-image.yml | 14 ++++++++++++++ .github/workflows/oc_lettings.yml | 5 ----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000000..b942614782 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,14 @@ +name: Docker Image CI + +on: [push] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile \ No newline at end of file diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 64453dc204..216a34ae3c 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -17,8 +17,3 @@ jobs: - name: Run Pytest run: pytest - - - name: Static Application Security Testing (SAST) - run: | - pip3 install bandit - bandit -r . From cdfcc04c9ff825a1af3708d2016912951004ca13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 12:46:16 +0200 Subject: [PATCH 25/91] add deployment in pipeline --- .github/workflows/docker-image.yml | 14 -------------- .github/workflows/oc_lettings.yml | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index b942614782..0000000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Docker Image CI - -on: [push] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile \ No newline at end of file diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 216a34ae3c..ef46f4517b 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -2,8 +2,13 @@ name: GitHub Actions Integration on: [push] +permissions: + contents: read + pages: write + id-token: write + jobs: - Explore-GitHub-Actions: + build_and_tests: runs-on: ubuntu-latest steps: - name: Checkout code @@ -17,3 +22,14 @@ jobs: - name: Run Pytest run: pytest + + deploy: + needs: build_and_tests + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 From b0b323ce3f807b1036bd55755e79237d2da6229a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Fri, 5 Apr 2024 14:46:44 +0200 Subject: [PATCH 26/91] final pipeline and adjustments --- .github/workflows/oc_lettings.yml | 16 ---------------- setup.cfg | 5 ----- 2 files changed, 21 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index ef46f4517b..aac5c1303c 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -2,11 +2,6 @@ name: GitHub Actions Integration on: [push] -permissions: - contents: read - pages: write - id-token: write - jobs: build_and_tests: runs-on: ubuntu-latest @@ -22,14 +17,3 @@ jobs: - name: Run Pytest run: pytest - - deploy: - needs: build_and_tests - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 diff --git a/setup.cfg b/setup.cfg index fc0c7db820..f8df4dd073 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,6 @@ max-line-length = 99 exclude = **/migrations/*,venv - [tool:pytest] DJANGO_SETTINGS_MODULE = oc_lettings_site.settings python_files = test_*.py @@ -21,7 +20,3 @@ omit = */settings.py */wsgi.py */asgi.py - -[tool.bandit.assert_used] -skips = ['*_test.py', '*/test_*.py'] - From 04507cd0ecddb25617e7bf7facf7379fdb9d8af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 15:00:32 +0200 Subject: [PATCH 27/91] test new pipeline CI --- .github/workflows/oc_lettings.yml | 46 +++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index aac5c1303c..90de9ea547 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,10 +1,18 @@ name: GitHub Actions Integration -on: [push] +on: + push: + branches: + - '*' + pull_request: + branches: + - master jobs: build_and_tests: runs-on: ubuntu-latest + if: github.event_name in ['push', 'pull_request'] + steps: - name: Checkout code uses: actions/checkout@v2 @@ -15,5 +23,37 @@ jobs: sudo apt install python3-pip pip3 install -r requirements.txt - - name: Run Pytest - run: pytest + - name: Run Tests whit Coverage + run: pytest --cov=. --cov-fail-under=80 + + - name: Run Linting + run: flake8 + + compilation_and_deployment: + runs-on: ubuntu-latest + needs: build_and_tests + if: github.event_name == 'pull_request' && success() + + env: + CUSTOM_TAG: 'your_custom_tag' + + steps: + - name: Set up AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-3 + + - name: Build and push Docker image to ECR + run: | + docker build -t python-oc-lettings-fr:${{ env.CUSTOM_TAG }} . + aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:${{ env.CUSTOM_TAG }} + + - name: Update ECS Task Definition + run: | + task_definition=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --query 'taskDefinition' --output json) + echo $task_definition > task_definition.json + sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$CUSTOM_TAG\"|" task_definition.json + new_task_definition=$(aws ecs register-task-definition --cli-input-json file://task_definition.json --query 'taskDefinition.taskDefinitionArn' --output json) From 9cf5ff871883b6b6eef8b959d861687b7f1043b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 15:06:10 +0200 Subject: [PATCH 28/91] adjust test new pipeline CI --- .github/workflows/oc_lettings.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 90de9ea547..a36b71282f 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,12 +1,6 @@ name: GitHub Actions Integration -on: - push: - branches: - - '*' - pull_request: - branches: - - master +on: [push] jobs: build_and_tests: From 466fc17e4b99d0edc6aa912a9446aefdd9bb0a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 15:07:14 +0200 Subject: [PATCH 29/91] adjust test new pipeline CI --- .github/workflows/oc_lettings.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index a36b71282f..258bf757ba 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -5,7 +5,6 @@ on: [push] jobs: build_and_tests: runs-on: ubuntu-latest - if: github.event_name in ['push', 'pull_request'] steps: - name: Checkout code @@ -26,7 +25,6 @@ jobs: compilation_and_deployment: runs-on: ubuntu-latest needs: build_and_tests - if: github.event_name == 'pull_request' && success() env: CUSTOM_TAG: 'your_custom_tag' From ea447b8e5d6108a627277ef843a834f0491690d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 15:20:23 +0200 Subject: [PATCH 30/91] adjust test new pipeline CI --- .github/workflows/oc_lettings.yml | 2 +- requirements.txt | 7 ++++--- setup.cfg | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 258bf757ba..127eb81d70 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -17,7 +17,7 @@ jobs: pip3 install -r requirements.txt - name: Run Tests whit Coverage - run: pytest --cov=. --cov-fail-under=80 + run: pytest - name: Run Linting run: flake8 diff --git a/requirements.txt b/requirements.txt index 368d7d9b96..37a8737139 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ django==3.0 -flake8==3.7.0 -pytest-django==3.9.0 -pytest~=8.1.1 \ No newline at end of file +flake8==7.0.0 +pytest-django==4.8.0 +pytest~=8.1.1 +pytest-xdist \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index f8df4dd073..3d17f4b503 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,6 +7,8 @@ DJANGO_SETTINGS_MODULE = oc_lettings_site.settings python_files = test_*.py python_functions = test_* addopts = -v --nomigrations + --cov=. + --cov-fail-under=80 [coverage:run] omit = From dd06489c73ece5f550f1b0c019a7403de0b44539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 15:26:30 +0200 Subject: [PATCH 31/91] adjust test new pipeline CI --- .github/workflows/oc_lettings.yml | 1 + requirements.txt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 127eb81d70..94dff5dd75 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -15,6 +15,7 @@ jobs: sudo apt update sudo apt install python3-pip pip3 install -r requirements.txt + pip3 install pytest pytest-cov - name: Run Tests whit Coverage run: pytest diff --git a/requirements.txt b/requirements.txt index 37a8737139..663dd67eed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,3 @@ django==3.0 flake8==7.0.0 pytest-django==4.8.0 pytest~=8.1.1 -pytest-xdist \ No newline at end of file From f3d1604d28a09b11bf9ec533c6cfb11debdd5b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 15:54:51 +0200 Subject: [PATCH 32/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 94dff5dd75..4a8eb87d83 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -28,7 +28,7 @@ jobs: needs: build_and_tests env: - CUSTOM_TAG: 'your_custom_tag' + CUSTOM_TAG: ${{ shell 'git log -1 --format="%H"' }} steps: - name: Set up AWS credentials @@ -40,7 +40,7 @@ jobs: - name: Build and push Docker image to ECR run: | - docker build -t python-oc-lettings-fr:${{ env.CUSTOM_TAG }} . + docker build -t python-oc-lettings-fr:${{ env.CUSTOM_TAG }} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:${{ env.CUSTOM_TAG }} From 12a80af56fecb6ba72f3ab84c629bcec38490080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 15:58:35 +0200 Subject: [PATCH 33/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 4a8eb87d83..731ddc5731 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -28,7 +28,7 @@ jobs: needs: build_and_tests env: - CUSTOM_TAG: ${{ shell 'git log -1 --format="%H"' }} + CUSTOM_TAG: ${{ 'git log -1 --format="%H"' }} steps: - name: Set up AWS credentials From a864f9f010a525b623ac5b13beb9682d998fbf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:01:15 +0200 Subject: [PATCH 34/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 731ddc5731..038b16cc03 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -17,6 +17,15 @@ jobs: pip3 install -r requirements.txt pip3 install pytest pytest-cov + - name: Get latest commit hash + id: git_hash + run: | + echo "::set-output name=hash::$(git log -1 --format='%H')" + + - name: Set CUSTOM_TAG + run: | + echo "CUSTOM_TAG=$(echo ${{ steps.git_hash.outputs.hash }})" >> $GITHUB_ENV + - name: Run Tests whit Coverage run: pytest @@ -28,7 +37,7 @@ jobs: needs: build_and_tests env: - CUSTOM_TAG: ${{ 'git log -1 --format="%H"' }} + CUSTOM_TAG: ${{ env.CUSTOM_TAG }} steps: - name: Set up AWS credentials From 6a8efba66380f23d1bffce642f1dc28198e713a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:04:07 +0200 Subject: [PATCH 35/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 038b16cc03..8fd4f58f56 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -36,9 +36,6 @@ jobs: runs-on: ubuntu-latest needs: build_and_tests - env: - CUSTOM_TAG: ${{ env.CUSTOM_TAG }} - steps: - name: Set up AWS credentials uses: aws-actions/configure-aws-credentials@v2 @@ -49,13 +46,14 @@ jobs: - name: Build and push Docker image to ECR run: | - docker build -t python-oc-lettings-fr:${{ env.CUSTOM_TAG }} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . + tag=$(echo $CUSTOM_TAG) + docker build -t python-oc-lettings-fr:$tag -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:${{ env.CUSTOM_TAG }} + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$tag - name: Update ECS Task Definition run: | task_definition=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --query 'taskDefinition' --output json) echo $task_definition > task_definition.json - sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$CUSTOM_TAG\"|" task_definition.json + sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$tag\"|" task_definition.json new_task_definition=$(aws ecs register-task-definition --cli-input-json file://task_definition.json --query 'taskDefinition.taskDefinitionArn' --output json) From 160b55b502a0d88ee767569e313388d8aaf31215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:08:28 +0200 Subject: [PATCH 36/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 8fd4f58f56..038b16cc03 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -36,6 +36,9 @@ jobs: runs-on: ubuntu-latest needs: build_and_tests + env: + CUSTOM_TAG: ${{ env.CUSTOM_TAG }} + steps: - name: Set up AWS credentials uses: aws-actions/configure-aws-credentials@v2 @@ -46,14 +49,13 @@ jobs: - name: Build and push Docker image to ECR run: | - tag=$(echo $CUSTOM_TAG) - docker build -t python-oc-lettings-fr:$tag -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . + docker build -t python-oc-lettings-fr:${{ env.CUSTOM_TAG }} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$tag + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:${{ env.CUSTOM_TAG }} - name: Update ECS Task Definition run: | task_definition=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --query 'taskDefinition' --output json) echo $task_definition > task_definition.json - sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$tag\"|" task_definition.json + sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$CUSTOM_TAG\"|" task_definition.json new_task_definition=$(aws ecs register-task-definition --cli-input-json file://task_definition.json --query 'taskDefinition.taskDefinitionArn' --output json) From 34a54ebd95ffc29958d77e818d2f543538ffdca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:12:43 +0200 Subject: [PATCH 37/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 038b16cc03..f96a976ff8 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -36,8 +36,6 @@ jobs: runs-on: ubuntu-latest needs: build_and_tests - env: - CUSTOM_TAG: ${{ env.CUSTOM_TAG }} steps: - name: Set up AWS credentials From a5dbc3962b15dd3de1ee13557bd9c86ae7c5e2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:16:31 +0200 Subject: [PATCH 38/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index f96a976ff8..72a840ddae 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -17,14 +17,12 @@ jobs: pip3 install -r requirements.txt pip3 install pytest pytest-cov - - name: Get latest commit hash - id: git_hash - run: | - echo "::set-output name=hash::$(git log -1 --format='%H')" + - name: Get commit hash + id: commit_hash + run: echo "::set-output name=hash::$(git rev-parse HEAD)" - name: Set CUSTOM_TAG - run: | - echo "CUSTOM_TAG=$(echo ${{ steps.git_hash.outputs.hash }})" >> $GITHUB_ENV + run: echo "CUSTOM_TAG=${{ steps.commit_hash.outputs.hash }}" >> $GITHUB_ENV - name: Run Tests whit Coverage run: pytest From 9be7a1ee16ae6d37991d8d821b2f690c6fdf480f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:18:27 +0200 Subject: [PATCH 39/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 72a840ddae..5cff0f29e7 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -19,7 +19,7 @@ jobs: - name: Get commit hash id: commit_hash - run: echo "::set-output name=hash::$(git rev-parse HEAD)" + run: git rev-parse --short HEAD - name: Set CUSTOM_TAG run: echo "CUSTOM_TAG=${{ steps.commit_hash.outputs.hash }}" >> $GITHUB_ENV From a42bcd1d72df866fb83e1e39de3bf18f31a79457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:23:33 +0200 Subject: [PATCH 40/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 5cff0f29e7..70b9a0922e 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -45,7 +45,7 @@ jobs: - name: Build and push Docker image to ECR run: | - docker build -t python-oc-lettings-fr:${{ env.CUSTOM_TAG }} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . + docker build -t python_oc_lettings_fr:${{env.CUSTOM_TAG}} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:${{ env.CUSTOM_TAG }} From 74bff487a6aa047af749aa21ec04ea8e2cf8a789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:26:35 +0200 Subject: [PATCH 41/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 70b9a0922e..e251cd0c34 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -45,7 +45,7 @@ jobs: - name: Build and push Docker image to ECR run: | - docker build -t python_oc_lettings_fr:${{env.CUSTOM_TAG}} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . + docker build -t lettings:${{env.CUSTOM_TAG}} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:${{ env.CUSTOM_TAG }} From bfcde5fff4828607c422b7e9058ae1d964b5c614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:30:43 +0200 Subject: [PATCH 42/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index e251cd0c34..b156089a39 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -17,13 +17,6 @@ jobs: pip3 install -r requirements.txt pip3 install pytest pytest-cov - - name: Get commit hash - id: commit_hash - run: git rev-parse --short HEAD - - - name: Set CUSTOM_TAG - run: echo "CUSTOM_TAG=${{ steps.commit_hash.outputs.hash }}" >> $GITHUB_ENV - - name: Run Tests whit Coverage run: pytest @@ -45,13 +38,14 @@ jobs: - name: Build and push Docker image to ECR run: | - docker build -t lettings:${{env.CUSTOM_TAG}} -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . + COMMIT_HASH=$(git rev-parse HEAD) + docker build -t python-oc-lettings-fr:$COMMIT_HASH -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:${{ env.CUSTOM_TAG }} + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition run: | task_definition=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --query 'taskDefinition' --output json) echo $task_definition > task_definition.json - sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$CUSTOM_TAG\"|" task_definition.json + sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH\"|" task_definition.json new_task_definition=$(aws ecs register-task-definition --cli-input-json file://task_definition.json --query 'taskDefinition.taskDefinitionArn' --output json) From 79ad313fc007214c1b538311451109ac175c703f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:32:50 +0200 Subject: [PATCH 43/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index b156089a39..e51e2f4703 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -38,7 +38,7 @@ jobs: - name: Build and push Docker image to ECR run: | - COMMIT_HASH=$(git rev-parse HEAD) + cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH From e508d19e4cab48c1e81b3bf3502bd9ffbedc0a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:35:50 +0200 Subject: [PATCH 44/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index e51e2f4703..ffb236b580 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -27,8 +27,10 @@ jobs: runs-on: ubuntu-latest needs: build_and_tests - steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up AWS credentials uses: aws-actions/configure-aws-credentials@v2 with: From 5083d9dc98e2a59dc94076968dbe17e00c6c3fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:37:21 +0200 Subject: [PATCH 45/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index ffb236b580..c5dede6574 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -41,7 +41,7 @@ jobs: - name: Build and push Docker image to ECR run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) - docker build -t python-oc-lettings-fr:$COMMIT_HASH -f /home/edward/Documents/Repos/OpenClassRooms/Python-OC-Lettings-FR/Dockerfile . + docker build -t python-oc-lettings-fr:$COMMIT_HASH -f /Python-OC-Lettings-FR/Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH From 224cee8f3a71b7020f92e83c8700e5cc6ca1d464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:39:16 +0200 Subject: [PATCH 46/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index c5dede6574..60ca34eef9 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -41,7 +41,7 @@ jobs: - name: Build and push Docker image to ECR run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) - docker build -t python-oc-lettings-fr:$COMMIT_HASH -f /Python-OC-Lettings-FR/Dockerfile . + docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH From 0fd93e669c966022a0d5d781dc960f7e962ba762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:44:48 +0200 Subject: [PATCH 47/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 60ca34eef9..fb6a83278f 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition run: | From cd065688f5867bb441ff6efb478df9b8fd4c43ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 16:56:57 +0200 Subject: [PATCH 48/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index fb6a83278f..f755288b88 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH + docker push python-oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition run: | From c6edc73f82566692e74a67393eda9c53d6cce633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:03:33 +0200 Subject: [PATCH 49/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index f755288b88..fb6a83278f 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push python-oc-lettings-fr:$COMMIT_HASH + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition run: | From f56894a09252457584548969b71f074a34cb5ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:05:02 +0200 Subject: [PATCH 50/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index fb6a83278f..a4c859c226 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -41,7 +41,7 @@ jobs: - name: Build and push Docker image to ECR run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) - docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . + docker build -t 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH From 7025d3e30ecc8df7b23d5d720ce5bc9cee4baa48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:09:51 +0200 Subject: [PATCH 51/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index a4c859c226..ef6adab89e 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -41,9 +41,9 @@ jobs: - name: Build and push Docker image to ECR run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) - docker build -t 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . + docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:latest - name: Update ECS Task Definition run: | From 884deb85037158f1c503b85a1429eb2dd398276a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:20:32 +0200 Subject: [PATCH 52/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index ef6adab89e..60ca34eef9 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:latest + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition run: | From a7fb52851b80db4e6e3f86fd7d063924a92d8b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:23:42 +0200 Subject: [PATCH 53/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 60ca34eef9..fb6a83278f 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition run: | From e6d860b277633be1569ecb7f001e80da98eb4ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:28:52 +0200 Subject: [PATCH 54/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index fb6a83278f..25903add60 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,6 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com + docker tag 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition From d938d0dabafd8cf6cf55285810f03526017b89cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:32:04 +0200 Subject: [PATCH 55/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 25903add60..e378d18a18 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker tag 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH + docker tag python-oc-lettings-fr:$COMMIT_HASH python-oc-lettings-fr:$COMMIT_HASH docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition From 2cc24d402b42cfdae44f7816cf08caf2b4139dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:43:43 +0200 Subject: [PATCH 56/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index e378d18a18..04083d8395 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker tag python-oc-lettings-fr:$COMMIT_HASH python-oc-lettings-fr:$COMMIT_HASH + docker tag python-oc-lettings-fr:$COMMIT_HASH python-oc-lettings-fr:aws docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition From 587df74644c5786ef0811285bf98c48296f9cd7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:46:37 +0200 Subject: [PATCH 57/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 04083d8395..7529aa40d9 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -44,7 +44,7 @@ jobs: docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com docker tag python-oc-lettings-fr:$COMMIT_HASH python-oc-lettings-fr:aws - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:$COMMIT_HASH + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:aws - name: Update ECS Task Definition run: | From 266afe5cf955ba65a82fd59de9ac7fdaf623c7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 17:57:48 +0200 Subject: [PATCH 58/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 7529aa40d9..3244f1a8f9 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,8 +43,8 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker tag python-oc-lettings-fr:$COMMIT_HASH python-oc-lettings-fr:aws - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/python-oc-lettings-fr:aws + docker image tag python-oc-lettings-fr:$COMMIT_HASH python-oc-lettings-fr:$COMMIT_HASH + docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition run: | From 91f2dac1bb02534ea43fe32bb538f93a05f60947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 18:02:18 +0200 Subject: [PATCH 59/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 3244f1a8f9..ca47510bfa 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,7 +43,7 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker image tag python-oc-lettings-fr:$COMMIT_HASH python-oc-lettings-fr:$COMMIT_HASH + docker image tag python-oc-lettings-fr:$COMMIT_HASH oc-lettings-fr:$COMMIT_HASH docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH - name: Update ECS Task Definition From b896b1b403c6a9a72533d2c8ac23bfdff19849a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 18:16:32 +0200 Subject: [PATCH 60/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index ca47510bfa..081e89e7b8 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -43,8 +43,8 @@ jobs: cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker image tag python-oc-lettings-fr:$COMMIT_HASH oc-lettings-fr:$COMMIT_HASH - docker push 211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH + docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr + docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr - name: Update ECS Task Definition run: | From 47b22a3c13e03553010dee755750e28c963e999e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 18:22:45 +0200 Subject: [PATCH 61/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 081e89e7b8..fa7e8d0745 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -42,8 +42,8 @@ jobs: run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . - aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 211125791987.dkr.ecr.eu-west-3.amazonaws.com - docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr + aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7 + docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr - name: Update ECS Task Definition From b8714d58ebd2e22f4cdb735d8b23601873b10b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 18:27:29 +0200 Subject: [PATCH 62/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index fa7e8d0745..1a1c80ed29 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -42,7 +42,7 @@ jobs: run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . - aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7 + aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7/oc-lettings-fr docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr From d13a74f44116b0b30c28a88b86d87b1168b49c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 18:32:36 +0200 Subject: [PATCH 63/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 1a1c80ed29..080553083e 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -42,9 +42,10 @@ jobs: run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7/oc-lettings-fr + aws ecr-public get-authorization-token --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH - docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr + docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH + - name: Update ECS Task Definition run: | From 0b42989a3978d28a28d83f8ac43aa684b95d3985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Mon, 8 Apr 2024 19:35:04 +0200 Subject: [PATCH 64/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 080553083e..4ce894dc75 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -42,10 +42,9 @@ jobs: run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . - aws ecr-public get-authorization-token --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws + aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7/oc-lettings-fr docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH - - name: Update ECS Task Definition run: | From 9ee434ab5b3324e873277b9fee1a24eb0fb0524f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 09:20:14 +0200 Subject: [PATCH 65/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 4ce894dc75..b441d842a9 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -48,7 +48,8 @@ jobs: - name: Update ECS Task Definition run: | - task_definition=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --query 'taskDefinition' --output json) - echo $task_definition > task_definition.json - sed -i "s|\"image\": \".*\"|\"image\": \"211125791987.dkr.ecr.eu-west-3.amazonaws.com/oc-lettings-fr:$COMMIT_HASH\"|" task_definition.json - new_task_definition=$(aws ecs register-task-definition --cli-input-json file://task_definition.json --query 'taskDefinition.taskDefinitionArn' --output json) + TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) + NEW_TASK_DEFINITION=$(echo lettings-oc-docker | jq --arg IMAGE python-oc-lettings-fr:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json lettings-oc-docker) + NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') + aws ecs update-service --cluster lettings-fr --task-definition lettings-oc-docker:lettings-oc-docker From 55c3ecb92fd44cf5e8afd474f9d6751af031f099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 09:24:21 +0200 Subject: [PATCH 66/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index b441d842a9..71b588169a 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -49,7 +49,9 @@ jobs: - name: Update ECS Task Definition run: | TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo lettings-oc-docker | jq --arg IMAGE python-oc-lettings-fr:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_DEFINITION=$(echo "lettings-oc-docker" | jq --arg IMAGE "python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json lettings-oc-docker) NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') aws ecs update-service --cluster lettings-fr --task-definition lettings-oc-docker:lettings-oc-docker + + lettings-oc-docker From c34a89a1f20593a69ced4f2a286b11f3a3fc261f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 09:29:01 +0200 Subject: [PATCH 67/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 71b588169a..9e1935e159 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -49,9 +49,7 @@ jobs: - name: Update ECS Task Definition run: | TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo "lettings-oc-docker" | jq --arg IMAGE "python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') - NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json lettings-oc-docker) + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') - aws ecs update-service --cluster lettings-fr --task-definition lettings-oc-docker:lettings-oc-docker - - lettings-oc-docker + aws ecs update-service --cluster lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION From fa40eb7f374223332e95147e0c066e3c4b9fdf53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 09:50:27 +0200 Subject: [PATCH 68/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- static/css/styles.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 9e1935e159..e3162186d4 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -52,4 +52,4 @@ jobs: NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') - aws ecs update-service --cluster lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION + aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION diff --git a/static/css/styles.css b/static/css/styles.css index 53c1b18d5f..e63a611324 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -162,7 +162,7 @@ h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1 { margin-bottom: 0.5rem; font-weight: 500; line-height: 1.2; - color: #363d47; + color: #006aff; } h1, .h1 { From 13bce86e88504341cf13c7183c87fac1399cba8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 09:59:01 +0200 Subject: [PATCH 69/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index e3162186d4..9143fd2923 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -49,7 +49,7 @@ jobs: - name: Update ECS Task Definition run: | TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION From 20b7ad785e8a729a2e5255fa5276b2d810f1fa9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:11:44 +0200 Subject: [PATCH 70/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 9143fd2923..5ea3504f84 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -49,7 +49,8 @@ jobs: - name: Update ECS Task Definition run: | TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_IMAGE="public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH" + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg NEW_IMAGE "$NEW_IMAGE" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') - aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION + aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition "lettings-oc-docker:$NEW_REVISION" From da6e3ac636a3110b184943677da98c1811d009a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:14:18 +0200 Subject: [PATCH 71/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 5ea3504f84..e23212a683 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -49,8 +49,7 @@ jobs: - name: Update ECS Task Definition run: | TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_IMAGE="public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH" - NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg NEW_IMAGE "$NEW_IMAGE" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg NEW_IMAGE "public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition "lettings-oc-docker:$NEW_REVISION" From 5d7dc0eff6ca46a6855735bfbdda61fa80c00ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:16:09 +0200 Subject: [PATCH 72/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index e23212a683..db34397954 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -49,7 +49,7 @@ jobs: - name: Update ECS Task Definition run: | TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg NEW_IMAGE "public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition "lettings-oc-docker:$NEW_REVISION" From e282b1bc621ef53d6562abba795db2d3585dbd69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:25:07 +0200 Subject: [PATCH 73/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index db34397954..7a0b574ff2 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -52,4 +52,4 @@ jobs: NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') - aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition "lettings-oc-docker:$NEW_REVISION" + aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition "lettings-oc-docker:$NEW_REVISION" --force-new-deployment --region eu-west-3 From a30142b5796f936c545d42707eef4fe7b2f17854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:28:22 +0200 Subject: [PATCH 74/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 7a0b574ff2..ae569fb820 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -49,7 +49,7 @@ jobs: - name: Update ECS Task Definition run: | TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') - aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition "lettings-oc-docker:$NEW_REVISION" --force-new-deployment --region eu-west-3 + aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION --force-new-deployment --region eu-west-3 From 120372f837d5808b91c1a30b3e7e23507e37ba0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:37:02 +0200 Subject: [PATCH 75/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index ae569fb820..297ff2d3c6 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -40,7 +40,7 @@ jobs: - name: Build and push Docker image to ECR run: | - cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse HEAD) + cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7/oc-lettings-fr docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH From b5b7d7111753199715a231755a5111b3abb0b160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:39:49 +0200 Subject: [PATCH 76/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 297ff2d3c6..6dd8d29e7d 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -48,6 +48,7 @@ jobs: - name: Update ECS Task Definition run: | + cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") From 1c91507d1f6935e96ddb2ca66c78c6fcbbeefb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 10:51:47 +0200 Subject: [PATCH 77/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 6dd8d29e7d..be2ea0af6f 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -50,7 +50,7 @@ jobs: run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE public.ecr.aws/x3w8a6r7/python-oc-lettings-fr:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION --force-new-deployment --region eu-west-3 From 5a3cea60cd397aac610864f781fb55afbb408619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 11:26:50 +0200 Subject: [PATCH 78/91] adjust test new pipeline CI/CD --- static/css/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/css/styles.css b/static/css/styles.css index e63a611324..53c1b18d5f 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -162,7 +162,7 @@ h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1 { margin-bottom: 0.5rem; font-weight: 500; line-height: 1.2; - color: #006aff; + color: #363d47; } h1, .h1 { From c35b8468fba6937827b85fb2d86cb702654ea827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 16:12:26 +0200 Subject: [PATCH 79/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index be2ea0af6f..b52d1d7918 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -3,7 +3,7 @@ name: GitHub Actions Integration on: [push] jobs: - build_and_tests: + compilations_and_tests: runs-on: ubuntu-latest steps: @@ -23,9 +23,9 @@ jobs: - name: Run Linting run: flake8 - compilation_and_deployment: + containerization_and_push: runs-on: ubuntu-latest - needs: build_and_tests + needs: compilations_and_tests steps: - name: Checkout code @@ -36,15 +36,32 @@ jobs: with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-3 + aws-region: eu-west-30 - - name: Build and push Docker image to ECR + - name: Build Docker image to ECR and DockerHub run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . + + - name: Push Docker image to ECR + run: | aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7/oc-lettings-fr docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH + + - name: Push Docker image to DockerHub + run: | + docker login -u loutreceleste -p secret.DOCKERHUB_PASSWORD + docker tag python-oc-lettings-fr:$COMMIT_HASH loutreceleste/python-oc-lettings-fr:$COMMIT_HASH + docker push loutreceleste/python-oc-lettings-fr:$COMMIT_HASH + + build: + runs-on: ubuntu-latest + needs: containerization + + steps: + - name: Checkout code + uses: actions/checkout@v2 - name: Update ECS Task Definition run: | From 89b0046a2f9ee79a5f22b3cdd56dd8fdcc3b7fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 16:13:27 +0200 Subject: [PATCH 80/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index b52d1d7918..449b15da47 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -57,7 +57,7 @@ jobs: build: runs-on: ubuntu-latest - needs: containerization + needs: containerization_and_push steps: - name: Checkout code From 1b4475c55d492ceae684e2bc7ca317039acae479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 16:16:21 +0200 Subject: [PATCH 81/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 449b15da47..0fd6b49340 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -36,7 +36,7 @@ jobs: with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-30 + aws-region: eu-west-3 - name: Build Docker image to ECR and DockerHub run: | From 5de336dc27982e5822a87b24f3a99c4abcdae30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 16:19:13 +0200 Subject: [PATCH 82/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 0fd6b49340..b2db509cc0 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -45,12 +45,14 @@ jobs: - name: Push Docker image to ECR run: | + cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7/oc-lettings-fr docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH - name: Push Docker image to DockerHub run: | + cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) docker login -u loutreceleste -p secret.DOCKERHUB_PASSWORD docker tag python-oc-lettings-fr:$COMMIT_HASH loutreceleste/python-oc-lettings-fr:$COMMIT_HASH docker push loutreceleste/python-oc-lettings-fr:$COMMIT_HASH From 56b7219525a74c992f19a0ff0bdaf723a69a7946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 16:29:08 +0200 Subject: [PATCH 83/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index b2db509cc0..43f28aa33d 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -53,9 +53,11 @@ jobs: - name: Push Docker image to DockerHub run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) - docker login -u loutreceleste -p secret.DOCKERHUB_PASSWORD + echo "$DOCKERHUB_PASSWORD" | docker login -u loutreceleste --password-stdin docker tag python-oc-lettings-fr:$COMMIT_HASH loutreceleste/python-oc-lettings-fr:$COMMIT_HASH docker push loutreceleste/python-oc-lettings-fr:$COMMIT_HASH + env: + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} build: runs-on: ubuntu-latest From dbff89be1be88964781d20033986c9eda153a544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 16:39:18 +0200 Subject: [PATCH 84/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 43f28aa33d..71766f5bbb 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -66,6 +66,13 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + + - name: Set up AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-3 - name: Update ECS Task Definition run: | From fcc6a02251f0bf593aaf6cf496fd28c663f2bd23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 17:26:54 +0200 Subject: [PATCH 85/91] adjust test new pipeline CI/CD --- .github/workflows/oc_lettings.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 71766f5bbb..ee21991fc3 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -1,6 +1,13 @@ name: GitHub Actions Integration -on: [push] +on: + push: + branches: + - '**' + pull_request: + types: [opened, synchronize, reopened] + branches: + - main jobs: compilations_and_tests: @@ -25,6 +32,7 @@ jobs: containerization_and_push: runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' needs: compilations_and_tests steps: @@ -61,6 +69,7 @@ jobs: build: runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' needs: containerization_and_push steps: From 2331f5c3775f75df90f2edc97de273df4acd0b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 18:25:46 +0200 Subject: [PATCH 86/91] adding if conditions to deployment + create .zshrc file --- .github/workflows/oc_lettings.yml | 3 ++- .zshrc | 10 +++++++++ README.md | 34 +++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .zshrc diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index ee21991fc3..a1173caeec 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -58,12 +58,13 @@ jobs: docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH - - name: Push Docker image to DockerHub + - name: Push Docker image to DockerHub and to local run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) echo "$DOCKERHUB_PASSWORD" | docker login -u loutreceleste --password-stdin docker tag python-oc-lettings-fr:$COMMIT_HASH loutreceleste/python-oc-lettings-fr:$COMMIT_HASH docker push loutreceleste/python-oc-lettings-fr:$COMMIT_HASH + docker pull loutreceleste/python-oc-lettings-fr:$COMMIT_HASH env: DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000000..255d8af8b3 --- /dev/null +++ b/.zshrc @@ -0,0 +1,10 @@ +function deploy_docker { + + cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) + docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . + + echo "$DOCKERHUB_PASSWORD" | docker login -u loutreceleste --password-stdin + docker tag python-oc-lettings-fr:$COMMIT_HASH loutreceleste/python-oc-lettings-fr:$COMMIT_HASH + docker push loutreceleste/python-oc-lettings-fr:$COMMIT_HASH + docker pull loutreceleste/python-oc-lettings-fr:$COMMIT_HASH +} diff --git a/README.md b/README.md index c8547803f7..018da4dabd 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,37 @@ Utilisation de PowerShell, comme ci-dessus sauf : - Pour activer l'environnement virtuel, `.\venv\Scripts\Activate.ps1` - Remplacer `which ` par `(Get-Command ).Path` + +### Déploiement + +Ce projet utilise GitHub Actions pour automatiser le déploiement de l'application sur ECS + +#### Fonctionnement du déploiement + +1. Lorsqu'un push est créé sur n'importe quelle branche, les jobs suivants sont déclenchées : + - compilations_and_tests : compile et teste le code. +2. Lorsqu'une pull request est créée sur la branche master, les jobs suivants sont déclenchés : + - compilations_and_tests : compile et teste le code. + - containerization_and_push : construit une image Docker, puis la pousse vers ECR et DockerHub. + - build : met à jour la tâche ECS avec la nouvelle image Docker et déploie l'application mise à jour. + +#### Configuration requise + +Pour que le déploiement fonctionne correctement, vous devez disposer des éléments suivants : + +1. Un compte AWS avec les autorisations pour Amazon ECS et Amazon ECR. +2. Un compte Docker Hub pour stocker les images Docker. +3. Les secrets GitHub : +- AWS_ACCESS_KEY_ID : votre clé d'accès AWS. +- AWS_SECRET_ACCESS_KEY : votre clé secrète AWS. +- DOCKERHUB_PASSWORD : le mot de passe de votre compte Docker Hub. +4. Un cluster Amazon ECS avec un service comprenant la définition de tâche lettings-oc-docker. + +#### Étapes de déploiement + +1. Assurez-vous davoir la configuration requise. +2. Créez une nouvelle branche à partir de la branche main. +3. Apportez les modifications souhaitées au code et validez-les dans votre nouvelle branche. +4. Créez une pull request à partir de votre branche vers la branche main. +5. Attendez que les GitHub Actions se terminent et vérifiez que le déploiement a réussi. +6. Une fois le déploiement réussi, vous pouvez fusionner la pull request dans la branche main. \ No newline at end of file From 5ef47c8b07ac2ccf3fe9173110fa2583663651f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Tue, 9 Apr 2024 18:51:55 +0200 Subject: [PATCH 87/91] add unique command --- .zshrc | 10 ---------- deploy.sh | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) delete mode 100644 .zshrc create mode 100755 deploy.sh diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 255d8af8b3..0000000000 --- a/.zshrc +++ /dev/null @@ -1,10 +0,0 @@ -function deploy_docker { - - cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) - docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . - - echo "$DOCKERHUB_PASSWORD" | docker login -u loutreceleste --password-stdin - docker tag python-oc-lettings-fr:$COMMIT_HASH loutreceleste/python-oc-lettings-fr:$COMMIT_HASH - docker push loutreceleste/python-oc-lettings-fr:$COMMIT_HASH - docker pull loutreceleste/python-oc-lettings-fr:$COMMIT_HASH -} diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000000..5ef9dd9ff7 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +deploy_docker() { + cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) + export DOCKER_USERNAME="$1" + export DOCKER_PASSWORD="$2" + docker build -t python-oc-lettings-fr:$COMMIT_HASH -f Dockerfile . + docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" + docker push $DOCKER_USERNAME/python-oc-lettings-fr:$COMMIT_HASH + docker pull $DOCKER_USERNAME/python-oc-lettings-fr:$COMMIT_HASH +} + +echo "Entrez votre nom d'utilisateur Docker : " +read DOCKER_USERNAME +echo "Entrez votre mot de passe Docker : " +read -s DOCKER_PASSWORD + +deploy_docker "$DOCKER_USERNAME" "$DOCKER_PASSWORD" + From 1dacfbab39d49588d73355f6effd2fd48fd409d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Thu, 11 Apr 2024 16:09:30 +0200 Subject: [PATCH 88/91] add more environment variables + add unique command to README --- .github/workflows/oc_lettings.yml | 41 +++++++++++++++++++------------ README.md | 20 ++++++++++++--- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index a1173caeec..4dd331960a 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -7,11 +7,12 @@ on: pull_request: types: [opened, synchronize, reopened] branches: - - main + - master jobs: compilations_and_tests: runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' || github.event_name == 'push' steps: - name: Checkout code @@ -32,7 +33,7 @@ jobs: containerization_and_push: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' needs: compilations_and_tests steps: @@ -44,7 +45,7 @@ jobs: with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-3 + aws-region: ${{ secrets.AWS_REGION }} - name: Build Docker image to ECR and DockerHub run: | @@ -54,23 +55,28 @@ jobs: - name: Push Docker image to ECR run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/x3w8a6r7/oc-lettings-fr - docker tag python-oc-lettings-fr:$COMMIT_HASH public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH - docker push public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH + aws ecr-public get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $ECR_URL_REPOSITORY + docker tag python-oc-lettings-fr:$COMMIT_HASH $ECR_URL_REPOSITORY:$COMMIT_HASH + docker push $ECR_URL_REPOSITORY:$COMMIT_HASH + env: + ECR_URL_REPOSITORY: ${{ secrets.ECR_URL_REPOSITORY }} + AWS_REGION: ${{ secrets.AWS_REGION }} - name: Push Docker image to DockerHub and to local run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) - echo "$DOCKERHUB_PASSWORD" | docker login -u loutreceleste --password-stdin - docker tag python-oc-lettings-fr:$COMMIT_HASH loutreceleste/python-oc-lettings-fr:$COMMIT_HASH - docker push loutreceleste/python-oc-lettings-fr:$COMMIT_HASH - docker pull loutreceleste/python-oc-lettings-fr:$COMMIT_HASH + echo "$DOCKERHUB_PASSWORD" | docker login -u $DOCKERHUB_USERNAME --password-stdin + docker tag python-oc-lettings-fr:$COMMIT_HASH $DOCKERHUB_USERNAME/python-oc-lettings-fr:$COMMIT_HASH + docker push $DOCKERHUB_USERNAME/python-oc-lettings-fr:$COMMIT_HASH + docker pull $DOCKERHUB_USERNAME/python-oc-lettings-fr:$COMMIT_HASH env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + build: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' needs: containerization_and_push steps: @@ -82,13 +88,16 @@ jobs: with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-3 + aws-region: ${{ secrets.AWS_REGION }} - name: Update ECS Task Definition run: | cd $(git rev-parse --show-toplevel) && COMMIT_HASH=$(git rev-parse --short HEAD) - TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region eu-west-3) - NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE public.ecr.aws/x3w8a6r7/oc-lettings-fr:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') - NEW_TASK_INFO=$(aws ecs register-task-definition --region eu-west-3 --cli-input-json "$NEW_TASK_DEFINITION") + TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition lettings-oc-docker --region $AWS_REGION) + NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE $ECR_URL_REPOSITORY:$COMMIT_HASH '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities) | del(.registeredAt) | del(.registeredBy)') + NEW_TASK_INFO=$(aws ecs register-task-definition --region $AWS_REGION --cli-input-json "$NEW_TASK_DEFINITION") NEW_REVISION=$(echo $NEW_TASK_INFO | jq '.taskDefinition.revision') - aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION --force-new-deployment --region eu-west-3 + aws ecs update-service --cluster lettings-fr --service python-oc-lettings-fr --task-definition lettings-oc-docker:$NEW_REVISION --force-new-deployment --region $AWS_REGION + env: + ECR_URL_REPOSITORY: ${{ secrets.ECR_URL_REPOSITORY }} + AWS_REGION: ${{ secrets.AWS_REGION }} diff --git a/README.md b/README.md index 018da4dabd..da89ca4c08 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,11 @@ Pour que le déploiement fonctionne correctement, vous devez disposer des élém 2. Un compte Docker Hub pour stocker les images Docker. 3. Les secrets GitHub : - AWS_ACCESS_KEY_ID : votre clé d'accès AWS. -- AWS_SECRET_ACCESS_KEY : votre clé secrète AWS. +- AWS_SECRET_ACCESS_KEY : votre clé secrète AWS. +- ECR_URL_REPOSITORY: l'url' de votre repository sur ECR. +- AWS_REGION: la region associé a votre compte AWS. - DOCKERHUB_PASSWORD : le mot de passe de votre compte Docker Hub. +- DOCKERHUB_USERNAME : l'identifiant de votre compte Docker Hub. 4. Un cluster Amazon ECS avec un service comprenant la définition de tâche lettings-oc-docker. #### Étapes de déploiement @@ -106,6 +109,17 @@ Pour que le déploiement fonctionne correctement, vous devez disposer des élém 1. Assurez-vous davoir la configuration requise. 2. Créez une nouvelle branche à partir de la branche main. 3. Apportez les modifications souhaitées au code et validez-les dans votre nouvelle branche. -4. Créez une pull request à partir de votre branche vers la branche main. +4. Créez une pull request à partir de votre branche vers la branche master. 5. Attendez que les GitHub Actions se terminent et vérifiez que le déploiement a réussi. -6. Une fois le déploiement réussi, vous pouvez fusionner la pull request dans la branche main. \ No newline at end of file +6. Une fois le déploiement réussi, vous pouvez fusionner la pull request dans la branche main. + +#### Commande unique de déploiement +Pour déployer votre site en une seule commande, suivez les étapes suivantes : + +1. Assurez-vous de vous trouver dans le dossier racine du projet. +2. Assurez-vous de posséder un compte Docker Hub. +3. Tapez la commande suivante dans le terminal : `./deploy.sh` + +Cette commande construira une image Docker de votre site avec le tag du hash du commit actuel, la poussera vers votre compte Docker Hub et la tirera localement pour que vous puissiez exécuter le site en utilisant l'image Docker. + +Vous disposez maintenant dans votre Docker Hub et localement de l'image de votre site actuel. \ No newline at end of file From 70b0e1f1d759d0d1dc7ea922780cfd4a1be7a726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Thu, 11 Apr 2024 16:44:09 +0200 Subject: [PATCH 89/91] adapt if conditions --- .github/workflows/oc_lettings.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 4dd331960a..0fd6ad7088 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -5,14 +5,14 @@ on: branches: - '**' pull_request: - types: [opened, synchronize, reopened] + types: [closed] branches: - master jobs: compilations_and_tests: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' || github.event_name == 'push' + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) steps: - name: Checkout code @@ -33,7 +33,7 @@ jobs: containerization_and_push: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' + if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' needs: compilations_and_tests steps: @@ -76,7 +76,7 @@ jobs: build: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' + if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' needs: containerization_and_push steps: From 32563d499b968962a12ba7f0ae61801cba7b84c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Thu, 11 Apr 2024 16:49:39 +0200 Subject: [PATCH 90/91] adapt if conditions --- .github/workflows/oc_lettings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 0fd6ad7088..624a135183 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -33,7 +33,7 @@ jobs: containerization_and_push: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' + if: github.event_name == 'pull_request' && github.event.pull_request.merged == true needs: compilations_and_tests steps: @@ -76,7 +76,7 @@ jobs: build: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' + if: github.event_name == 'pull_request' && github.event.pull_request.merged == true needs: containerization_and_push steps: From 087eb66058f77cb7c0553a9bff01b8b5ba438ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sKe=C3=BCnK?= Date: Thu, 11 Apr 2024 16:58:51 +0200 Subject: [PATCH 91/91] adapt if conditions --- .github/workflows/oc_lettings.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/oc_lettings.yml b/.github/workflows/oc_lettings.yml index 624a135183..f07c0629c8 100644 --- a/.github/workflows/oc_lettings.yml +++ b/.github/workflows/oc_lettings.yml @@ -4,15 +4,11 @@ on: push: branches: - '**' - pull_request: - types: [closed] - branches: - - master jobs: compilations_and_tests: runs-on: ubuntu-latest - if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) + if: github.event_name == 'push' steps: - name: Checkout code @@ -33,7 +29,7 @@ jobs: containerization_and_push: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true + if: github.event_name == 'push' && github.ref == 'refs/heads/master' needs: compilations_and_tests steps: @@ -76,7 +72,7 @@ jobs: build: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true + if: github.event_name == 'push' && github.ref == 'refs/heads/master' needs: containerization_and_push steps: