You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by gj...@apache.org on 2022/12/20 13:51:34 UTC

[bloodhound-core] branch main updated (a3c95e3 -> 3e8288f)

This is an automated email from the ASF dual-hosted git repository.

gjm pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/bloodhound-core.git


    from a3c95e3  Update to Django 4 and minimum python 3.8
     new 8ba4dfd  Introduce Makefile for common operations
     new 3e8288f  Add show-urls make command to help with discovery

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Makefile            | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 bh_core/settings.py |  1 +
 pyproject.toml      | 12 +++----
 trackers/models.py  | 24 ++++++++++++--
 4 files changed, 120 insertions(+), 8 deletions(-)
 create mode 100644 Makefile


[bloodhound-core] 02/02: Add show-urls make command to help with discovery

Posted by gj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gjm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bloodhound-core.git

commit 3e8288f60a341dab1e997d6fd732525ba26c120d
Author: Gary Martin <ga...@physics.org>
AuthorDate: Sat Dec 17 15:09:33 2022 +0000

    Add show-urls make command to help with discovery
---
 Makefile            |  5 ++++-
 bh_core/settings.py |  1 +
 trackers/models.py  | 24 ++++++++++++++++++++++--
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 1d80d0e..c446a69 100644
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,7 @@ endif
 .PHONY: selenium-clean
 
 functional-test: selenium-start
-	poetry run python functional_tests.py
+	$(PYTHON) functional_tests.py
 .PHONY: functional-test
 
 clean-deplock:
@@ -86,3 +86,6 @@ endif
 
 full-clean: clean-deplock clean-venv clean-db selenium-clean
 .PHONY: full-clean
+
+show-urls: manage-show_urls
+.PHONY: show-urls
diff --git a/bh_core/settings.py b/bh_core/settings.py
index 37ac64b..a6de119 100644
--- a/bh_core/settings.py
+++ b/bh_core/settings.py
@@ -60,6 +60,7 @@ INSTALLED_APPS = [
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'rest_framework',
+    'django_extensions',
     'drf_yasg',
 ]
 
diff --git a/trackers/models.py b/trackers/models.py
index 373235a..443e92c 100644
--- a/trackers/models.py
+++ b/trackers/models.py
@@ -15,6 +15,8 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
+"""Main DB models for Apache Bloodhound."""
+
 import logging
 
 from django.db import models
@@ -23,6 +25,8 @@ logger = logging.getLogger(__name__)
 
 
 class Product(models.Model):
+    """Product table."""
+
     prefix = models.TextField(primary_key=True)
     name = models.TextField()
     description = models.TextField(blank=True, null=True)
@@ -33,7 +37,7 @@ class Product(models.Model):
 
 
 class ProductConfig(models.Model):
-    """Possibly legacy table - keeping for now"""
+    """Possibly legacy table - keeping for now."""
 
     product = models.ForeignKey(Product, on_delete=models.CASCADE)
     section = models.TextField()
@@ -46,7 +50,7 @@ class ProductConfig(models.Model):
 
 
 class ProductResourceMap(models.Model):
-    """Possibly legacy model - keeping for now"""
+    """Possibly legacy model - keeping for now."""
 
     product_id = models.ForeignKey(Product, on_delete=models.CASCADE)
     resource_type = models.TextField(blank=True, null=True)
@@ -57,6 +61,8 @@ class ProductResourceMap(models.Model):
 
 
 class Component(models.Model):
+    """Component table."""
+
     name = models.TextField(primary_key=True)
     owner = models.TextField(blank=True, null=True)
     description = models.TextField(blank=True, null=True)
@@ -72,6 +78,8 @@ class Component(models.Model):
 
 
 class Enum(models.Model):
+    """Enum table."""
+
     type = models.TextField(primary_key=True)
     name = models.TextField()
     value = models.TextField(blank=True, null=True)
@@ -83,6 +91,8 @@ class Enum(models.Model):
 
 
 class Milestone(models.Model):
+    """Milestone table."""
+
     name = models.TextField(primary_key=True)
     due = models.BigIntegerField(blank=True, null=True)
     completed = models.BigIntegerField(blank=True, null=True)
@@ -99,6 +109,8 @@ class Milestone(models.Model):
 
 
 class Version(models.Model):
+    """Version table."""
+
     name = models.TextField(primary_key=True)
     time = models.BigIntegerField(blank=True, null=True)
     description = models.TextField(blank=True, null=True)
@@ -114,6 +126,8 @@ class Version(models.Model):
 
 
 class Ticket(models.Model):
+    """Ticket table."""
+
     uid = models.AutoField(primary_key=True)
     type = models.ForeignKey(
         Enum,
@@ -188,6 +202,8 @@ class Ticket(models.Model):
 
 
 class TicketChange(models.Model):
+    """TicketChange table."""
+
     ticket = models.ForeignKey(
         Ticket,
         on_delete=models.PROTECT,
@@ -211,6 +227,8 @@ class TicketChange(models.Model):
 
 
 class TicketCustom(models.Model):
+    """TicketCustom table."""
+
     ticket = models.ForeignKey(Ticket, on_delete=models.PROTECT)
     name = models.TextField()
     value = models.TextField(blank=True, null=True)
@@ -222,6 +240,8 @@ class TicketCustom(models.Model):
 
 
 class Report(models.Model):
+    """Report table - potentially legacy."""
+
     author = models.TextField(blank=True, null=True)
     title = models.TextField(blank=True, null=True)
     query = models.TextField(blank=True, null=True)


[bloodhound-core] 01/02: Introduce Makefile for common operations

Posted by gj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gjm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bloodhound-core.git

commit 8ba4dfd7ecc55ce80cbe93039fa7a0df6ecff8d2
Author: Gary Martin <ga...@physics.org>
AuthorDate: Sat Nov 5 01:14:44 2022 +0000

    Introduce Makefile for common operations
    
     * Add targets for various django commands to reduce need for running
       through `poetry run`
     * Adds targets to help with running selenium for testing via docker;
       expected to be particularly useful for someone running their
       development environment from a podman based "toolbox"
---
 Makefile       | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 pyproject.toml | 12 ++++----
 2 files changed, 94 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1d80d0e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,88 @@
+DOCKER_BIN := $(shell command -v docker || command -v podman)
+SELENIUM_CONTAINER ?= selenium-server
+
+ifneq (,$(wildcard /run/.containerenv))
+	DOCKER_HOST := unix:///run/user/$(UID)/podman/podman.sock
+	DOCKER_CMD := flatpak-spawn --host podman
+else
+	DOCKER_CMD := $(DOCKER_BIN)
+endif
+
+PYTHON = poetry run python
+MANAGE = $(PYTHON) manage.py
+
+install:
+	poetry install
+.PHONY: install
+
+manage-%:
+	$(MANAGE) $*
+.PHONY: manage-%
+
+makemigrations: manage-makemigrations
+	$(MANAGE) makemigrations trackers
+.PHONY: makemigrations
+
+migrate: makemigrations manage-migrate
+createsuperuser: manage-createsuperuser
+shell: manage-shell
+runserver: manage-runserver
+test: manage-test
+
+CONTAINER_FILTER = -f name=$(SELENIUM_CONTAINER)
+EXITED_CONTAINER_FILTER = -f status=exited $(CONTAINER_FILTER)
+
+selenium-start:
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(EXITED_CONTAINER_FILTER)))
+	$(DOCKER_CMD) start $(SELENIUM_CONTAINER)
+else ifneq (,$(shell $(DOCKER_CMD) ps -q $(CONTAINER_FILTER)))
+else
+	$(DOCKER_CMD) run -d --network host --privileged --name $(SELENIUM_CONTAINER) \
+		docker.io/selenium/standalone-firefox
+endif
+	$(DOCKER_CMD) ps $(CONTAINER_FILTER)
+	sleep 10
+.PHONY: selenium-start
+
+selenium-stop:
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(CONTAINER_FILTER)))
+	$(DOCKER_CMD) stop $(SELENIUM_CONTAINER)
+	$(DOCKER_CMD) ps $(EXITED_CONTAINER_FILTER)
+endif
+.PHONY: selenium-stop
+
+selenium-clean:
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(CONTAINER_FILTER)))
+	$(DOCKER_CMD) stop $(SELENIUM_CONTAINER)
+	sleep 1
+endif
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(EXITED_CONTAINER_FILTER)))
+	$(DOCKER_CMD) container rm $(SELENIUM_CONTAINER)
+	@echo $(SELENIUM_CONTAINER) Removed
+endif
+.PHONY: selenium-clean
+
+functional-test: selenium-start
+	poetry run python functional_tests.py
+.PHONY: functional-test
+
+clean-deplock:
+ifeq (haslock,$(shell [ -f poetry.lock ] && echo haslock ))
+	rm poetry.lock
+endif
+.PHONY: clean-deplock
+
+clean-venv:
+ifeq (hasvenv,$(shell [ -d .venv ] && echo hasvenv ))
+	rm -r .venv
+endif
+.PHONY: clean-venv
+
+clean-db:
+ifeq (hasdb,$(shell [ -f db.sqlite3 ] && echo hasdb ))
+	rm db.sqlite3
+endif
+.PHONY: clean-db
+
+full-clean: clean-deplock clean-venv clean-db selenium-clean
+.PHONY: full-clean
diff --git a/pyproject.toml b/pyproject.toml
index 94367d4..83135ca 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,10 +7,10 @@ license = "Apache-2.0"
 
 [tool.poetry.dependencies]
 python = "^3.8"
-Django = "^4.0.3"
-djangorestframework = "^3.13.1"
-Markdown = "^3.3.6"
-drf-yasg = "^1.20.0"
+Django = "^4.1.2"
+djangorestframework = "^3.14.0"
+Markdown = "^3.4.1"
+drf-yasg = "^1.21.4"
 drf-nested-routers = "^0.93.4"
 PyYAML = "^6.0"
 psycopg2 = { version = "^2.9", optional = true }
@@ -18,8 +18,8 @@ psycopg2-binary = { version = "^2.9", optional = true }
 
 [tool.poetry.dev-dependencies]
 selenium = "^3.141.0"
-django-extensions = "^3.1.3"
-hypothesis = "^6.21.0"
+django-extensions = "^3.2.1"
+hypothesis = "^6.56.4"
 
 [tool.poetry.extras]
 postgres = ["psycopg2"]