Compare commits

..

32 Commits

Author SHA1 Message Date
47d2c94b79 Specify license for .python-version
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-28 12:57:31 +02:00
b0dcfacd25 Add .python-version file
Some checks failed
continuous-integration/drone/pr Build is failing
2024-08-27 19:08:52 +02:00
86edb246bf Merge pull request 'revert f02efab07aeabe02a94efd62fbe498659297b36f' (!102) from revert-python-3.11 into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #102
2024-08-23 15:59:55 +02:00
9424e21edc revert f02efab07a
All checks were successful
continuous-integration/drone/pr Build is passing
revert Merge pull request 'Update python Docker tag to v3.11.9' (!97) from renovate/minor-3.11-python into main

Reviewed-on: #97
2024-08-23 15:50:30 +02:00
f02efab07a Merge pull request 'Update python Docker tag to v3.11.9' (!97) from renovate/minor-3.11-python into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #97
2024-08-23 15:33:32 +02:00
08f1104942 Merge branch 'main' into renovate/minor-3.11-python
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-23 15:30:29 +02:00
8dde142f38 Try and use Python 3.11
Some checks failed
continuous-integration/drone/pr Build is failing
2024-08-23 15:26:39 +02:00
d1b1636aa2 Merge pull request 'Update dependency waitress to v2.1.2' (!93) from renovate/waitress-2.x into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #93
2024-08-23 12:01:59 +02:00
3fcd1fa20e Update python Docker tag to v3.11.9
Some checks failed
continuous-integration/drone/pr Build is failing
2024-08-22 18:37:13 +00:00
8394400e96 Update dependency waitress to v2.1.2
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-22 18:36:55 +00:00
843050f923 Merge pull request 'Update plugins/docker Docker tag to v20.18.4' (!95) from renovate/plugins-docker-20.x into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #95
2024-08-22 19:53:59 +02:00
812913ffe2 Merge pull request 'Update dependency reuse to v0.14.0' (!92) from renovate/reuse-0.x into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #92
2024-08-22 19:52:24 +02:00
dee80c7e14 Update plugins/docker Docker tag to v20.18.4
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-22 15:35:49 +00:00
de60ec0d46 Update dependency reuse to v0.14.0
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-22 14:35:41 +00:00
6c6fcea81c Merge pull request 'Update python Docker tag to v3.8.19' (!85) from renovate/patch-python into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #85
2024-08-22 13:17:55 +02:00
166e0d40c6 Merge pull request 'Update dependency werkzeug to v2.3.8' (!84) from renovate/werkzeug-2.x into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #84
2024-08-22 12:39:36 +02:00
c9b5ab62ed Update python Docker tag to v3.8.19
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-22 10:35:35 +00:00
c0005100b4 Update dependency werkzeug to v2.3.8
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-22 10:35:34 +00:00
d614039cdd Merge pull request 'Pin python Docker tag to 0ef73cd' (!83) from renovate/python into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #83
2024-08-22 11:52:25 +02:00
316236a7e5 Merge pull request 'Pin dependencies' (!82) from renovate/pin-dependencies into main
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #82
2024-08-22 11:51:54 +02:00
c15faabd6d Pinning werkzeug to v2
All checks were successful
continuous-integration/drone/pr Build is passing
Thanks for the hint in #78
2024-08-22 11:46:27 +02:00
53eab74e60 Pin python Docker tag to 0ef73cd
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-22 09:35:43 +00:00
82d908193c Pin dependencies
Some checks failed
continuous-integration/drone/pr Build is failing
2024-08-22 09:35:42 +00:00
6620a6819a Merge pull request 'Configure Renovate' (!81) from renovate/configure into main
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Reviewed-on: #81
2024-08-22 11:25:28 +02:00
be6fec18ab Update Renovate config
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-21 22:12:27 +02:00
9ebae03550 Add renovate.json
Some checks failed
continuous-integration/drone/pr Build is failing
2024-08-21 19:34:54 +00:00
763a6efc9f Merge pull request 'Improve Docker usage' (!80) from docker-improvements into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #80
2024-08-21 21:22:40 +02:00
6f04d23e6c Add license information to .dockerignore file
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-21 21:17:33 +02:00
155ddc556c Add .dockerignore file
Some checks failed
continuous-integration/drone/pr Build is failing
2024-08-21 21:09:12 +02:00
a5a85e6032 Fix Dockerfile warnings 2024-08-21 21:08:52 +02:00
6a3458a596 Pin Docker images in CI 2024-08-21 20:53:59 +02:00
97be8f4667 Ditch builder and base Docker images
This should make dependency upgrades easier and bring more clarity to the CI pipelines
2024-08-21 20:49:47 +02:00
9 changed files with 597 additions and 542 deletions

13
.dockerignore Normal file
View File

@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
*
!Pipfile
!Pipfile.lock
!data/
!ki/
!LICENSES/
!migrations/
!app.py
!run_prod.py

View File

@ -15,16 +15,18 @@ trigger:
steps:
- name: install-lint-test
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
image: python:3.8.19-alpine@sha256:3bd7ea88cb637e09d6c7de24c5394657163a85c2be82bfebe0305cf07f8de1ea
env:
PYROOT: '/pyroot'
PYTHONUSERBASE: '/pyroot'
commands:
- apk add --no-cache gcc g++ musl-dev python3-dev
- pip3 install pipenv
- pipenv install --dev
- pipenv run flake8
- pipenv run reuse lint
- pipenv run python -m unittest discover ki
image_pull_secrets:
- dockerconfig
---
kind: pipeline
type: docker
@ -41,7 +43,7 @@ depends_on:
steps:
- name: docker-publish
image: plugins/docker
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
settings:
registry: git.wtf-eg.de
repo: git.wtf-eg.de/kompetenzinventar/backend
@ -68,7 +70,7 @@ depends_on:
steps:
- name: deploy-dev
image: appleboy/drone-ssh
image: appleboy/drone-ssh:1.7.5@sha256:995677e073454912f26d4c0fdd2f9df2e1f5a30d6603d3f2ece667311b6babb3
settings:
host:
- dev01.wtf-eg.net
@ -91,14 +93,19 @@ trigger:
steps:
- name: install-lint-test
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
image: python:3.8.19-alpine@sha256:3bd7ea88cb637e09d6c7de24c5394657163a85c2be82bfebe0305cf07f8de1ea
env:
PYROOT: '/pyroot'
PYTHONUSERBASE: '/pyroot'
commands:
- apk add --no-cache gcc g++ musl-dev python3-dev
- pip3 install pipenv
- pipenv install --dev
- pipenv run flake8
- pipenv run reuse lint
- pipenv run python -m unittest discover ki
- name: docker-publish
image: plugins/docker
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
settings:
registry: git.wtf-eg.de
repo: git.wtf-eg.de/kompetenzinventar/backend

1
.python-version Normal file
View File

@ -0,0 +1 @@
3.8.19

View File

@ -10,3 +10,7 @@ License: MIT
Files: Pipfile.lock migrations/*
Copyright: WTF Kooperative eG <https://wtf-eg.de/>
License: AGPL-3.0-or-later
Files: renovate.json .python-version
Copyright: WTF Kooperative eG <https://wtf-eg.de/>
License: AGPL-3.0-or-later

View File

@ -2,7 +2,17 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later
FROM git.wtf-eg.de/kompetenzinventar/builder:1.0.2 as builder
FROM python:3.8.19-alpine@sha256:3bd7ea88cb637e09d6c7de24c5394657163a85c2be82bfebe0305cf07f8de1ea AS builder
ENV PYROOT=/pyroot
ENV PYTHONUSERBASE=$PYROOT
RUN apk add --no-cache \
gcc \
g++ \
musl-dev \
python3-dev && \
pip3 install pipenv
COPY Pipfile* ./
@ -10,7 +20,10 @@ RUN PIP_USER=1 PIP_IGNORE_INSTALLED=1 pipenv install --system --deploy --ignore-
RUN pip3 uninstall --yes pipenv
FROM git.wtf-eg.de/kompetenzinventar/base:1.0.2 as ki-backend
FROM python:3.8.19-alpine@sha256:3bd7ea88cb637e09d6c7de24c5394657163a85c2be82bfebe0305cf07f8de1ea AS ki-backend
ENV PYROOT=/pyroot
ENV PYTHONUSERBASE=$PYROOT
# Install six explicitly. Otherwise Python complains about it missing.
RUN pip3 install six

29
Pipfile
View File

@ -8,22 +8,23 @@ verify_ssl = true
name = "pypi"
[packages]
flask = "~=2.0.1"
python-dotenv = "~=0.17.1"
flask-migrate = "~=3.0.1"
flask-sqlalchemy = "~=2.5.1"
sqlalchemy = "~=1.4.18"
waitress = "~=2.0.0"
pyyaml = "~=6.0.1"
flask-cors = "~=3.0.10"
ldap3 = "~=2.9"
pymysql = "~=1.0.2"
flask = "==2.0.3"
python-dotenv = "==0.17.1"
flask-migrate = "==3.0.1"
flask-sqlalchemy = "==2.5.1"
sqlalchemy = "==1.4.53"
waitress = "==2.1.2"
pyyaml = "==6.0.2"
flask-cors = "==3.0.10"
ldap3 = "==2.9.1"
pymysql = "==1.0.3"
werkzeug = "==2.3.8"
[dev-packages]
flake8 = "~=3.9.2"
yapf = "~=0.31.0"
pre-commit = "~=2.13.0"
reuse = "~=0.13.0"
flake8 = "==3.9.2"
yapf = "==0.31.0"
pre-commit = "==2.13.0"
reuse = "==0.14.0"
[requires]
python_version = "3.8"

965
Pipfile.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,6 @@ class User(db.Model):
tokens = relationship("Token", back_populates="user")
profile = relationship("Profile", back_populates="user")
jobs = relationship("Job", back_populates="owner")
job_responses = relationship("JobResponse",back_populates="user")
def to_dict(self):
return {"id": self.id}
@ -148,7 +146,6 @@ class Skill(db.Model):
profiles = relationship("ProfileSkill", back_populates="skill")
searchtopics = relationship("ProfileSearchtopic", back_populates="skill")
jobs = relationship("JobSkill", back_populates="skill")
def to_dict(self):
return {"id": self.id, "name": self.name, "icon_url": "/skills/{}/icon".format(self.id)}
@ -231,69 +228,3 @@ class ProfileLanguage(db.Model):
def to_dict(self):
return {"profile_id": self.profile_id, "language": self.language.to_dict(), "level": self.level}
class Job(db.Model):
__tablename__ = "job"
id = Column(Integer, primary_key=True)
owner_id = Column(Integer, ForeignKey("user.id"), nullable=False)
description = Column(String(5000))
amount_of_people_needed = Column(Integer, nullable=False)
amount_of_weekhours_needed = Column(Integer)
amount_of_payment_hour = Column(Integer)
timeframeImprecise = Column(String(120))
remotePercent = Column(Integer)
location = Column(String(50))
beginDate = Column(DateTime)
endDate = Column(DateTime)
link = Column(String(500))
aidsLevel = Column(Integer) ## Stupid Shit one has to deal with like Teams or weird Apps, Datathrower Webportals...
created = Column(DateTime, nullable=False, default=datetime.now)
updated = Column(DateTime, onupdate=datetime.now, nullable=False, default=datetime.now)
withdrawn = Column(DateTime, nullable=True)
owner = relationship("User", back_populates="jobs")
responses = relationship("JobResponse", back_populates="jobs")
skills = relationship("JobSkill", back_populates="job")
def to_dict(self):
return {"job_id": self.id, "owner_id": self.owner_id, "description": self.description,
"amount_of_people_needed": self.amount_of_people_needed, "amount_of_weekhours_needed": self.amount_of_weekhours_needed,
"amount_of_payment_hour": self.amount_of_payment_hour, "timeframeImprecise": self.timeframeImprecise,
"remotePercent": self.timeframeImprecise, "location": self.location, "beginDate": self.beginDate,
"endDate": self.endDate, "link": self.link, "aidsLevel": self.aidsLevel, "created": self.created,
"updated": self.updated, "withdrawn": self.withdrawn
}
class JobSkill(db.Model):
__tablename__ = "job_skill"
job_id = Column(Integer, ForeignKey("job.id"), primary_key=True)
skill_id = Column(Integer, ForeignKey("skill.id"), primary_key=True)
level = Column(SmallInteger, nullable=False)
job = relationship("Job", back_populates="skills")
skill = relationship("Skill", back_populates="jobs")
def to_dict(self):
return {"job_id": self.job_id, "skill": self.skill.to_dict(), "level": self.level}
class JobResponse(db.Model):
__tablename__ = "job_response"
job_id = Column(Integer, ForeignKey("job.id"), primary_key=True)
user_id = Column(Integer, ForeignKey("user.id"), primary_key=True)
created = Column(DateTime, nullable=False, default=datetime.now)
withdrawn = Column(DateTime, nullable=True) # no longer interested/available
job = relationship("Job", back_populates="responses")
user = relationship("User", back_populates="job_responses")
def to_dict(self):
return {
"job": self.job.to_dict(),
"user": self.user.to_dict(),
"created": self.created,
"withdrawn": self.withdrawn
}

18
renovate.json Normal file
View File

@ -0,0 +1,18 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:best-practices",
":disableDependencyDashboard",
":maintainLockFilesMonthly",
":pinVersions",
":separateMultipleMajorReleases"
],
"packageRules": [
{
"matchDepNames": ["python"],
"groupName": "Python",
"separateMinorPatch": true,
"separateMultipleMinor": true
}
]
}