Skip to content

Commit

Permalink
Get bugbug package version outside setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-c committed Sep 19, 2024
1 parent 235ebfe commit 3600106
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ tasks:
cp infra/hgrc /etc/mercurial/hgrc.d/bugbug.rc &&
pip install --disable-pip-version-check --no-cache-dir --progress-bar off . &&
pip install --disable-pip-version-check --no-cache-dir --progress-bar off -r test-requirements.txt &&
cp VERSION http_service/VERSION &&
pip install --disable-pip-version-check --no-cache-dir --progress-bar off ./http_service &&
hg clone -r 90302f015ac8dd8877ef3ee24b5a62541142378b https://hg.mozilla.org/hgcustom/version-control-tools /version-control-tools/ &&
pytest --cov=http_service http_service/tests/ -vvv &&
Expand Down
4 changes: 3 additions & 1 deletion http_service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ RUN pip install --disable-pip-version-check --quiet --no-cache-dir -r /requireme

# Setup http service as package
COPY . /code/http_service
RUN pip install --disable-pip-version-check --quiet --no-cache-dir /code/http_service
# Use same version as bugbug
RUN python -c "import importlib.metadata; print(importlib.metadata.version('bugbug'))" > /code/http_service/VERSION
RUN pip install --disable-pip-version-check --no-cache-dir /code/http_service

# Run the Pulse listener in the background
CMD (bugbug-http-pulse-listener &) && gunicorn -b 0.0.0.0:$PORT bugbug_http.app --preload --timeout 30 -w 3
2 changes: 2 additions & 0 deletions http_service/Dockerfile.bg_worker
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RUN pip install --disable-pip-version-check --quiet --no-cache-dir -r /requireme

# Setup http service as package
COPY . /code/http_service
# Use same version as bugbug
RUN python -c "import importlib.metadata; print(importlib.metadata.version('bugbug'))" > /code/http_service/VERSION
RUN pip install --disable-pip-version-check --quiet --no-cache-dir /code/http_service

# Load the models
Expand Down
5 changes: 2 additions & 3 deletions http_service/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import importlib.metadata
import os

from setuptools import find_packages, setup
Expand All @@ -18,8 +17,8 @@ def read_requirements(file_):

install_requires = read_requirements("requirements.txt")

# Use same version as bugbug
version = importlib.metadata.version("bugbug")
with open(os.path.join(here, "VERSION")) as f:
version = f.read().strip()

setup(
name="bugbug-http-service",
Expand Down

0 comments on commit 3600106

Please sign in to comment.