Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from setup.py to pyproject, use poetry and refactor Dockerfile #30

Merged
merged 14 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/in-solidarity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
rules:
master:
level: failure # default rules are set to warning
slave:
level: failure
blacklist:
level: failure
whitelist:
level: failure
ignore:
- ".github/in-solidarity.yml" # default
- ".github/workflows/*.yml"
- "**/*.yml"
- "app/manifests/install-config-template.j2"
40 changes: 0 additions & 40 deletions .github/workflows/pr-verification.yml

This file was deleted.

31 changes: 13 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
FROM docker.io/library/python:3.11

# Copy firewatch package into /firewatch folder
RUN mkdir /firewatch
COPY . /firewatch/
COPY pyproject.toml poetry.lock README.md /firewatch/
COPY cli /firewatch/cli/

# Install firewatch
RUN pip install --upgrade pip
RUN pip install /firewatch tox
WORKDIR /firewatch

# Copy the Jira config template to /templates
RUN mkdir /templates
COPY cli/templates/* /templates/
ENV POETRY_HOME=/firewatch
ENV PATH="/firewatch/bin:$PATH"

# Add permissions
RUN chgrp -R 0 /tmp && \
chmod -R g=u /tmp
RUN python3 -m pip install pip poetry --upgrade \
&& poetry config cache-dir /openshift-cli-installer \
&& poetry config virtualenvs.in-project true \
&& poetry config installer.max-workers 10 \
&& poetry install \
&& printf '#!/bin/bash \n poetry run firewatch $@' > /usr/bin/firewatch \
&& chmod +x /usr/bin/firewatch

RUN chgrp -R 0 /firewatch && \
chmod -R g=u /firewatch

RUN chgrp -R 0 /templates && \
chmod -R g=u /templates

CMD ["/bin/bash"]
ENTRYPOINT ["firewatch"]
2 changes: 1 addition & 1 deletion OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ reviewers:
- liswang89
- Sau1506mya
- amp-rh
- macharya0907
- macharya0907
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
3 changes: 2 additions & 1 deletion cli/jira_config_gen/jira_config_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import logging
import os

from jinja2 import Environment
from jinja2 import FileSystemLoader
Expand All @@ -26,7 +27,7 @@ def __init__(
server_url: str,
token_path: str,
output_file: str,
template_dir: str = "/templates",
template_dir: str = os.path.join("/", "firewatch", "cli", "templates"),
template_filename: str = "jira.config.j2",
) -> None:
"""
Expand Down
665 changes: 665 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[tool.black]
line-length = 88
target_version = ['py39', 'py310', "py311"]
exclude = '''
(
/(
| \.git
| \.venv
| \.mypy_cache
| \.tox
)/
)
'''

[tool.mypy]
check_untyped_defs = "true"
disallow_any_generics = "true"
disallow_incomplete_defs = "true"
disallow_untyped_defs = "true"
no_implicit_optional = "true"
ignore_missing_imports = "true"

[tool.isort]
line_length = 88
profile = "black"

[tool.poetry]
name = "firewatch"
version = "0.0.0"
calebevans marked this conversation as resolved.
Show resolved Hide resolved
description = "A tool to monitor results in OpenShift CI and report pod or test failures to Jira."
authors = ["CSPI QE <[email protected]>"]
readme = "README.md"
license = "GPLv3"
homepage = "https://github.com/CSPI-QE/firewatch"
repository = "https://github.com/CSPI-QE/firewatch"
packages = [{include = "cli"}]
classifiers = [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"License :: OSI Approved :: GPLv3 License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
]

[tool.poetry.urls]
Download = "https://github.com/CSPI-QE/firewatch"
"Bug Tracker" = "https://github.com/CSPI-QE/firewatch/issues"

[tool.poetry.dependencies]
python = "^3.9"
click = "^8.1.7"
google-cloud-storage = "^2.10.0"
jinja2 = "^3.1.2"
jira = "^3.5.2"
junitparser = "^3.1.0"

[tool.poetry.scripts]
firewatch = "cli:cli"

[tool.poetry-dynamic-versioning]
enable = true
pattern = "((?P<epoch>\\d+)!)?(?P<base>\\d+(\\.\\d+)*)"

[tool.poetry-dynamic-versioning.substitution]
files = ["VERSION"]

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.ruff]
line-length = 120
53 changes: 0 additions & 53 deletions setup.cfg

This file was deleted.

20 changes: 0 additions & 20 deletions setup.py

This file was deleted.