Skip to content

Commit

Permalink
Merge pull request #341 from CSCfi/devel
Browse files Browse the repository at this point in the history
Merge v1.1.0b6
  • Loading branch information
blankdots authored Oct 6, 2021
2 parents 2fa4693 + 08ad96e commit ac2de58
Show file tree
Hide file tree
Showing 29 changed files with 1,991 additions and 5,785 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ updates:
target-branch: "devel"
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
directory: "/dockerfiles"
schedule:
interval: "weekly"
day: "monday"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2etests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Build Frontend
run: |
pushd swift_browser_ui_frontend
sudo npm install -g npm@7.20.5
sudo npm install -g npm@7.24.1
npm install
npm run build
- name: Setup and Run backend
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: |
pushd swift_browser_ui_frontend
npm install
sudo npm install -g [email protected]
npm ci
- name: Run eslint
run: |
pushd swift_browser_ui_frontend
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8]
python-version: [3.8, 3.9]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v2
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8]
python-version: [3.8, 3.9]
node: ['14']

runs-on: ${{ matrix.os }}
Expand All @@ -22,13 +22,19 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install tox tox-gh-actions coveragepy-lcov
- name: Install frontend
run: |
pushd swift_browser_ui_frontend
sudo npm install -g [email protected]
npm install
npm run build
- name: Run unit tests
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: tox -e pytest
run: |
tox -e pytest
coveragepy-lcov --output_file_path lcov.info
- name: Send coverage to coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: lcov.info
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ better upload and download functionality are in their separate files.

### Requirements

Python 3.6+ required (recommended 3.7+)
Python 3.6+ required (recommended 3.8+)

The dependencies mentioned in `requirements.txt` and a suitable storage backend
supporting usage via Openstack Object Storage API. (e.g. Ceph RGW, Openstack Swift)
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile-ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --update \
COPY swift_browser_ui_frontend /root/swift_ui/swift_browser_ui_frontend

RUN cd /root/swift_ui/swift_browser_ui_frontend \
&& npm install -g npm@7.20.5 \
&& npm install -g npm@7.24.1 \
&& npm install \
&& npm run build

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile-ui-devel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --update \
COPY swift_browser_ui_frontend /root/swift_ui/swift_browser_ui_frontend

RUN cd /root/swift_ui/swift_browser_ui_frontend \
&& npm install -g npm@7.20.5 \
&& npm install -g npm@7.24.1 \
&& npm install \
&& npm run build-devel

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
author = "CSC Developers"

# The full version, including alpha/beta/rc tags
version = release = "1.1.0b5"
version = release = "1.1.0b6"


# -- General configuration ---------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
aiohttp==3.7.4.post0
python-swiftclient==3.12.0
cryptography==3.4.8
keystoneauth1==4.3.1
cryptography==35.0.0
keystoneauth1==4.4.0
click==8.0.1
sphinx==4.1.2
sphinx_rtd_theme==0.5.2
sphinx==4.2.0
sphinx_rtd_theme==1.0.0
uvloop==0.16.0
gunicorn>=20.0.1
certifi==2021.5.30
Expand Down
24 changes: 14 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
install_requires=[
"aiohttp==3.7.4.post0",
"python-swiftclient==3.12.0",
"cryptography==3.4.8",
"keystoneauth1==4.3.1",
"cryptography==35.0.0",
"keystoneauth1==4.4.0",
"click==8.0.1",
"gunicorn>=20.0.1",
"uvloop==0.16.0",
Expand All @@ -24,23 +24,27 @@
],
extras_require={
"test": [
"tox==3.24.3",
"tox==3.24.4",
"pytest==6.2.5",
"pytest-cov==2.12.1",
"coverage==5.5",
"coveralls==3.2.0",
"pytest-cov==3.0.0",
"coverage==6.0",
"flake8==3.9.2",
"flake8-docstrings==1.6.0",
"pytest-xdist==2.3.0",
"pytest-xdist==2.4.0",
"asynctest==0.13.0",
"black==21.8b0",
"black==21.9b0",
],
"docs": ["sphinx==4.1.2", "sphinx_rtd_theme==0.5.2"],
"docs": ["sphinx==4.2.0", "sphinx_rtd_theme==1.0.0"],
"ui_test": ["pytest==6.2.5", "pytest-timeout==1.4.2"],
},
packages=setuptools.find_packages(),
package_data={
__name__: ["ui/static/*", "ui/static/js/*", "ui/static/css/*", "ui/static/img/*"]
__name__: [
"ui/static/*",
"ui/static/js/*",
"ui/static/css/*",
"ui/static/img/*",
]
},
include_package_data=True,
platforms="any",
Expand Down
2 changes: 1 addition & 1 deletion swift_browser_ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"""

__name__ = "swift_browser_ui"
__version__ = "1.1.0b5"
__version__ = "1.1.0b6"
__author__ = "CSC Developers"
__license__ = "MIT License"
3 changes: 3 additions & 0 deletions swift_browser_ui/common/common_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ async def handle_validate_authentication(
handler: swift_browser_ui.common.types.AiohttpHandler,
) -> aiohttp.web.Response:
"""Handle the authentication of a response as a middleware function."""
if request.path == "/health":
return await handler(request)

try:
signature = request.query["signature"]
validity = request.query["valid"]
Expand Down
6 changes: 3 additions & 3 deletions swift_browser_ui/request/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ async def handle_health_check(request: aiohttp.web.Request) -> aiohttp.web.Respo
"""Answer a service health check."""
# Case degraded
try:
if request.app["db_conn"].conn.is_closed():
MODULE_LOGGER.log(logging.DEBUG, "Database closed")
if request.app["db_conn"].pool is None:
MODULE_LOGGER.log(logging.ERROR, "No database connection available")
return aiohttp.web.json_response(
{"status": "Degraded", "degraded": ["database"]}
)
except AttributeError:
except (KeyError, AttributeError):
MODULE_LOGGER.log(logging.ERROR, "Degraded Database")
return aiohttp.web.json_response({"status": "Degraded", "degraded": ["database"]})

Expand Down
6 changes: 3 additions & 3 deletions swift_browser_ui/sharing/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ async def handle_health_check(request: aiohttp.web.Request) -> aiohttp.web.Respo
"""Answer a service health check."""
# Case degraded
try:
if request.app["db_conn"].conn.is_closed():
MODULE_LOGGER.log(logging.DEBUG, "Database closed")
if request.app["db_conn"].pool is None:
MODULE_LOGGER.log(logging.ERROR, "No database connection available")
return aiohttp.web.json_response(
{"status": "Degraded", "degraded": ["database"]}
)
except AttributeError:
except (KeyError, AttributeError):
MODULE_LOGGER.log(logging.ERROR, "Degraded Database")
return aiohttp.web.json_response({"status": "Degraded", "degraded": ["database"]})

Expand Down
3 changes: 3 additions & 0 deletions swift_browser_ui/upload/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ async def handle_validate_authentication(
handler: swift_browser_ui.common.types.AiohttpHandler,
) -> aiohttp.web.Response:
"""Handle the authentication of a response as a middleware function."""
if request.path == "/health":
return await handler(request)

try:
signature = request.query["signature"]
validity = request.query["valid"]
Expand Down
4 changes: 2 additions & 2 deletions swift_browser_ui/upload/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ async def servinit() -> aiohttp.web.Application:
# Add auth related routes
# Can use direct project post for creating a session, as it's intuitive
# and POST upload against an account doesn't exist
app.add_routes([aiohttp.web.post("/{project}", handle_login)])

app.add_routes([aiohttp.web.get("/health", handle_health_check)])

app.add_routes([aiohttp.web.post("/{project}", handle_login)])

# Add api routes
app.add_routes(
[
Expand Down
Loading

0 comments on commit ac2de58

Please sign in to comment.