Skip to content

Commit

Permalink
chore: CI:Stable/1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ricolin committed Dec 17, 2024
1 parent 02d8a91 commit e71e83d
Show file tree
Hide file tree
Showing 36 changed files with 99 additions and 42 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 120
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
15 changes: 0 additions & 15 deletions .github/workflows/linters.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ releasenotes/build
*.log

# envvar openrc file
*openrc.sh
*openrc.sh
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.0.0
hooks:
- id: conventional-pre-commit
stages:
- commit-msg

- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: end-of-file-fixer
- id: trailing-whitespace
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Project Description

This solution is a volume-level scheduled backup to implement a non-intrusive automatic backup for Openstack VMs.
This solution is a volume-level scheduled backup to implement a non-intrusive automatic backup for Openstack VMs.

All volumes attached to the specified VMs are backed up periodically.

Expand Down
2 changes: 1 addition & 1 deletion etc/staffeln/staffeln.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ mysql_engine = InnoDB
[notification]
# receiver = [email protected]
# sender_email = [email protected]
# smtp_server_domain = localhost
# smtp_server_domain = localhost
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ oslo_versionedobjects
openstacksdk>0.28.0
pymysql
parse
# email
# smtplib
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ classifier =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython

Expand All @@ -35,4 +37,4 @@ console_scripts =
wsgi_scripts =
staffeln-api-wsgi = staffeln.api:app
staffeln.database.migration_backend =
sqlalchemy = staffeln.db.sqlalchemy.migration
sqlalchemy = staffeln.db.sqlalchemy.migration
1 change: 1 addition & 0 deletions staffeln/api/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from flask import Flask, Response, request
from oslo_log import log

from staffeln import objects
from staffeln.common import context

Expand Down
1 change: 1 addition & 0 deletions staffeln/api/middleware/parsable_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""

from oslo_serialization import jsonutils

from staffeln.i18n import _


Expand Down
4 changes: 3 additions & 1 deletion staffeln/cmd/api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Starter script for Staffeln API service"""

import os
import sys

import staffeln.conf
from oslo_log import log as logging

import staffeln.conf
from staffeln.api import app as api_app
from staffeln.common import service
from staffeln.i18n import _
Expand Down
3 changes: 2 additions & 1 deletion staffeln/cmd/conductor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Starter script for the staffeln conductor service."""

import cotyledon
import staffeln.conf
from cotyledon import oslo_config_glue

import staffeln.conf
from staffeln.common import service
from staffeln.conductor import manager

Expand Down
1 change: 1 addition & 0 deletions staffeln/cmd/dbmanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys

from oslo_config import cfg

from staffeln import conf
from staffeln.common import service
from staffeln.db import migration
Expand Down
1 change: 1 addition & 0 deletions staffeln/common/openstack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from openstack import exceptions, proxy
from oslo_log import log

from staffeln.common import auth
from staffeln.i18n import _

Expand Down
3 changes: 2 additions & 1 deletion staffeln/common/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import staffeln.conf
from oslo_log import log as logging

import staffeln.conf
from staffeln import objects
from staffeln.common import config

Expand Down
1 change: 1 addition & 0 deletions staffeln/common/short_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import uuid

import six

from staffeln.i18n import _


Expand Down
3 changes: 2 additions & 1 deletion staffeln/conductor/backup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import collections

import parse
import staffeln.conf
from openstack.exceptions import HttpException as OpenstackHttpException
from openstack.exceptions import ResourceNotFound as OpenstackResourceNotFound
from openstack.exceptions import SDKException as OpenstackSDKException
from oslo_log import log

import staffeln.conf
from staffeln import objects
from staffeln.common import constants, context, openstack
from staffeln.conductor import result
Expand Down
3 changes: 2 additions & 1 deletion staffeln/conductor/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import time

import cotyledon
import staffeln.conf
from futurist import periodics
from oslo_log import log

import staffeln.conf
from staffeln.common import constants, context
from staffeln.common import time as xtime
from staffeln.conductor import backup
Expand Down
3 changes: 2 additions & 1 deletion staffeln/conductor/result.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Email notification package
# This should be upgraded by integrating with mail server to send batch
import staffeln.conf
from oslo_log import log

import staffeln.conf
from staffeln.common import email
from staffeln.common import time as xtime
from staffeln.conductor import backup
Expand Down
1 change: 1 addition & 0 deletions staffeln/conf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from oslo_config import cfg

from staffeln.conf import api, conductor, database, notify, paths

CONF = cfg.CONF
Expand Down
1 change: 1 addition & 0 deletions staffeln/conf/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from oslo_config import cfg

from staffeln.i18n import _

api_group = cfg.OptGroup(
Expand Down
1 change: 1 addition & 0 deletions staffeln/conf/conductor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from oslo_config import cfg

from staffeln.common import constants
from staffeln.i18n import _

Expand Down
1 change: 1 addition & 0 deletions staffeln/conf/database.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from oslo_config import cfg
from oslo_db import options as oslo_db_options

from staffeln.conf import paths
from staffeln.i18n import _

Expand Down
1 change: 1 addition & 0 deletions staffeln/conf/notify.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from oslo_config import cfg

from staffeln.i18n import _

notify_group = cfg.OptGroup(
Expand Down
1 change: 1 addition & 0 deletions staffeln/conf/paths.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from oslo_config import cfg

from staffeln.i18n import _

PATH_OPTS = [
Expand Down
1 change: 1 addition & 0 deletions staffeln/db/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base classes for storage engines"""

from oslo_config import cfg
from oslo_db import api as db_api

Expand Down
4 changes: 3 additions & 1 deletion staffeln/db/migration.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Database setup command"""
import staffeln.conf

from stevedore import driver

import staffeln.conf

CONF = staffeln.conf.CONF

_IMPL = None
Expand Down
1 change: 1 addition & 0 deletions staffeln/db/sqlalchemy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from oslo_utils import strutils, timeutils, uuidutils
from sqlalchemy.inspection import inspect
from sqlalchemy.orm import exc

from staffeln.common import short_id
from staffeln.db.sqlalchemy import models

Expand Down
2 changes: 2 additions & 0 deletions staffeln/db/sqlalchemy/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""
SQLAlchemy models for staffeln service
"""

import urllib.parse as urlparse

from oslo_db.sqlalchemy import models
from sqlalchemy import Column, Integer, String, UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base

from staffeln import conf

CONF = conf.CONF
Expand Down
1 change: 1 addition & 0 deletions staffeln/objects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from oslo_utils import versionutils
from oslo_versionedobjects import base as ovoo_base
from oslo_versionedobjects import fields as ovoo_fields

from staffeln import objects

remotable_classmethod = ovoo_base.remotable_classmethod
Expand Down
1 change: 1 addition & 0 deletions staffeln/objects/fields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility method for objects"""

from oslo_serialization import jsonutils
from oslo_versionedobjects import fields

Expand Down
1 change: 0 additions & 1 deletion staffeln/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@


class TestCase(base.BaseTestCase):

"""Test case base class for all unit tests."""
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ python-subunit>=0.0.18 # Apache-2.0/BSD
oslotest>=1.10.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
testtools>=1.4.0 # MIT
pre-commit
21 changes: 8 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37,pep8
envlist = py3,py37,py38,py39,py310,linters
skipsdist = True
sitepackages = False
skip_missing_interpreters = True
Expand All @@ -21,14 +21,17 @@ install_commands =
pip install {opts} {packages}


[testenv:py3]
[testenv:{py3,py37,py38,py39,py310}]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}

[testenv:pep8]
commands =
flake8
[testenv:linters]
skipsdist = True
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure

[testenv:cover]
basepython = python3
Expand All @@ -48,11 +51,3 @@ commands =

[testenv:venv]
commands = {posargs}

[flake8]
# E123, E125 skipped as they are invalid PEP-8.

show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
9 changes: 9 additions & 0 deletions zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- job:
name: staffeln-linters
parent: tox-linters

- job:
name: staffeln-unit
parent: tox
vars:
tox_envlist: py3
9 changes: 9 additions & 0 deletions zuul.d/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- project:
check:
jobs:
- staffeln-linters
- staffeln-unit
gate:
jobs:
- staffeln-linters
- staffeln-unit

0 comments on commit e71e83d

Please sign in to comment.