Skip to content

Commit

Permalink
Merge pull request #212 from rkoumis/197-bump-version
Browse files Browse the repository at this point in the history
Use bump-my-version tool to help with versioning
  • Loading branch information
rkoumis authored Nov 12, 2024
2 parents dc2d1e3 + adf82a1 commit a259d7e
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 6 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,12 @@ Zeek Enhancements (#177)

Author: Nikhileswar Reddy <[email protected]>

4.0.0
3.4.0 (2024-11-12)
##################

Version 3.4.x is available initially on the pilot branch,
in a sort of pre-release mode.

* Use pyproject.toml (#184) (#189)
* Use ruff format to format the code (#183) (#190)
* Use ruff check --fix to make style changes (#183) (#192)
Expand All @@ -163,3 +166,6 @@ Author: Nikhileswar Reddy <[email protected]>
* Use ruff to sort and format imports (#207)
* Use ruff to detect flake8 bugbears (B) (#209)
* Use pre-built zeek images (#181)
* Use bump-my-version to update the version and tag (#197)
* Also, use bump-my-version to update the dalton-agent version
* Also, show the dalton controller version on the About page
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ PYTEST=$(VENV)/bin/pytest
COVERAGE=$(VENV)/bin/coverage
RUFF=$(VENV)/bin/ruff
ACTIVATE=$(VENV)/bin/activate

BUMPVERSION=$(VENV)/bin/bump-my-version
BUMPPART ?= patch

venv $(VENV):
python3 -m venv $(VENV)
Expand All @@ -30,3 +31,9 @@ fix: $(VENV)

hadolint: Dockerfile-dalton Dockerfile-nginx dalton-agent/Dockerfiles/Dockerfile_*
docker run -t --rm -v `pwd`:/app -w /app hadolint/hadolint /bin/hadolint $^

bumpversion: $(VENV) pyproject.toml
$(BUMPVERSION) bump $(BUMPPART)

bumpagent: $(VENV) pyproject.toml
$(BUMPVERSION) bump --config-file dalton-agent/.bumpversion.toml $(BUMPPART)
2 changes: 2 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from app.dalton import dalton_blueprint, ensure_rulesets_exist, setup_dalton_logging
from app.flowsynth import flowsynth_blueprint, setup_flowsynth_logging

__version__ = "3.4.0"


def create_app(test_config=None):
"""Create the flask app."""
Expand Down
5 changes: 4 additions & 1 deletion app/dalton.py
Original file line number Diff line number Diff line change
Expand Up @@ -3071,7 +3071,10 @@ def page_queue_default():
# @login_required()
def page_about_default():
"""the about/help page"""
return render_template("/dalton/about.html", page="")
# Need to `import app` here, not at the top of the file.
import app

return render_template("dalton/about.html", version=app.__version__)


#########################################
Expand Down
1 change: 1 addition & 0 deletions app/templates/dalton/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<h1>About Dalton</h1>
<p>Dalton allows pcaps to be run against sundry IDS sensors (e.g. Suricata, Snort) and sensor versions using a defined ruleset and/or bespoke rules.</p>
<p>Official repository and documentation can be found at <a href="https://github.com/secureworks/dalton">https://github.com/secureworks/dalton</a></p>
<p>This is Dalton version {{ version }}</p>
{% endblock %}
21 changes: 21 additions & 0 deletions dalton-agent/.bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.bumpversion]
current_version = "3.1.2"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = false
sign_tags = false
allow_dirty = false
commit = true
message = "Bump dalton-agent version: {current_version} → {new_version}"
commit_args = "--no-verify"
setup_hooks = []
pre_commit_hooks = []
post_commit_hooks = []

[[tool.bumpversion.files]]
filename = "dalton-agent/dalton-agent.py"
2 changes: 1 addition & 1 deletion dalton-agent/dalton-agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def hash_file(filenames):
# *** Constant Variables ***
# **************************

AGENT_VERSION = "3.1.1"
AGENT_VERSION = "3.1.2"
HTTP_HEADERS = {"User-Agent": f"Dalton Agent/{AGENT_VERSION}"}

# check options from config file
Expand Down
21 changes: 19 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"

[project]
name = "dalton"
version = "4.0.0"
description = "Run pcaps against an IDS"
dynamic = ["version"]
requires-python = ">=3.10"
dependencies = [
"Jinja2==3.0.3",
Expand Down Expand Up @@ -43,8 +43,9 @@ testing = [
"pytest",
]
devtools = [
"ruff",
"bump-my-version",
"coverage",
"ruff",
]

[tool.pytest.ini_options]
Expand Down Expand Up @@ -75,3 +76,19 @@ ignore = ["E501"]
[tool.ruff.lint.per-file-ignores]
# Defer these fixes to dalton-agent until we have some unit tests
"dalton-agent/dalton-agent.py" = ["B"]

[tool.bumpversion]
current_version = "3.4.0"

commit = true
allow_dirty = false
message = "Bump version: {current_version} → {new_version}"
commit_args = "--no-verify"

tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"

[[tool.bumpversion.files]]
filename = "app/__init__.py"

0 comments on commit a259d7e

Please sign in to comment.