Skip to content

Commit

Permalink
CONCD-660 Merge Main into Feature branch (#2237)
Browse files Browse the repository at this point in the history
* Removed first/last name fields from admin user list display (#2234)

* Added /healthz and /metrics to URLs ignored in maintenance mode (#2236)

* Added toggle for allowing staff to use the front-end during maintenance mode (#2238)

* Added control of access to the frontend during maintenance mode via the cache

* Implementation of views to turn the front-end on and off for staff during maintenance

* Implement updates to checkout that allow fetching git tags needed for setuptools_scm semver tagging (#2239)

* a few more small repairs (#2240)

* Implement updates to checkout that allow fetching git tags needed for setuptools_scm semver tagging

* remove ref on checkout step for dev deploy

* implement update for checkoutv4 for tags needed for setuptools - feature

* Update feature cluster (#2241)

* Implement updates to checkout that allow fetching git tags needed for setuptools_scm semver tagging

* remove ref on checkout step for dev deploy

* implement update for checkoutv4 for tags needed for setuptools - feature

* Map feature deployment to its own environment

* Updating stylelint and related libraries (#2244)

* Updated stylelint versions

* Updated precommit hook config to use new versions of stylelint and related libraries. Updated base.css for updated version of stylelint

* Reverted global function and color function changes since gulp doesn't recognize them

---------

Co-authored-by: Josh Stegmaier <104993387+joshuastegmaier@users.noreply.github.com>
Co-authored-by: Jennifer Kuenning <72825410+jkueloc@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 25, 2024
1 parent faf21a6 commit 0acf647
Show file tree
Hide file tree
Showing 16 changed files with 1,147 additions and 1,674 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/dev-main-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4

- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git describe --tags
with:
fetch-depth: 0
fetch-tags: 'true'

- name: Set up Python 3.10
uses: actions/setup-python@v4
Expand Down Expand Up @@ -93,8 +90,6 @@ jobs:
CLUSTER: ${{ secrets.CLUSTER }}
TARGET_SERVICE: ${{ secrets.TARGET_SERVICE }}
run: |
echo "version number: $version_number"
docker build -t concordia .
docker tag concordia:latest $REGISTRY/concordia:$version_number
docker tag concordia:latest $REGISTRY/concordia:$IMAGE_TAG
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/feature-branch-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ vars.FEATURE_BRANCH }}

- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git describe --tags
fetch-depth: 0
fetch-tags: 'true'

- name: Set up Python 3.10
uses: actions/setup-python@v4
Expand Down Expand Up @@ -91,11 +87,9 @@ jobs:
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ secrets.IMAGE_TAG }}
CLUSTER: ${{ secrets.CLUSTER_TEST }}
CLUSTER: ${{ secrets.CLUSTER }}
TARGET_SERVICE: ${{ secrets.TARGET_SERVICE }}
run: |
echo "version number: $version_number"
docker build -t concordia .
docker tag concordia:latest $REGISTRY/concordia:$version_number
docker tag concordia:latest $REGISTRY/concordia:$IMAGE_TAG
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/stage-release-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ jobs:
uses: actions/checkout@v4
with:
ref: release

- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git describe --tags
fetch-depth: 0
fetch-tags: 'true'

- name: Set up Python 3.10
uses: actions/setup-python@v4
Expand Down Expand Up @@ -95,8 +91,6 @@ jobs:
CLUSTER: ${{ secrets.CLUSTER }}
TARGET_SERVICE: ${{ secrets.TARGET_SERVICE }}
run: |
echo "version number: $version_number"
docker build -t concordia .
docker tag concordia:latest $REGISTRY/concordia:$version_number
docker tag concordia:latest $REGISTRY/concordia:$IMAGE_TAG
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ repos:
hooks:
- id: stylelint
additional_dependencies:
- 'stylelint@^13.8.0'
- 'stylelint-config-prettier@^8.0.2'
- 'stylelint-config-recommended@^3.0.0'
- 'stylelint-value-no-unknown-custom-properties@^4.0.0'
- 'stylelint@^16.2.0'
- 'stylelint-config-recommended@^14.0.0'
- 'stylelint-value-no-unknown-custom-properties@^6.0.1'
- 'stylelint-config-standard-scss@^13.0.0'
- repo: https://github.com/aws-cloudformation/cfn-python-lint
rev: v0.82.2
hooks:
Expand Down
3 changes: 3 additions & 0 deletions .stylelintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
extends:
- stylelint-config-recommended
- stylelint-config-standard-scss

plugins:
- stylelint-value-no-unknown-custom-properties
Expand All @@ -8,3 +9,5 @@ rules:
no-descending-specificity: null
at-rule-no-unknown: null
csstools/value-no-unknown-custom-properties: true
scss/dollar-variable-empty-line-before: null
property-no-vendor-prefix: null
8 changes: 7 additions & 1 deletion concordia/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ class ItemProjectListFilter(ProjectListFilter):


class ConcordiaUserAdmin(UserAdmin):
list_display = UserAdmin.list_display + ("date_joined", "transcription_count")
list_display = (
"username",
"email",
"is_staff",
"date_joined",
"transcription_count",
)

def get_queryset(self, request):
qs = super().get_queryset(request)
Expand Down
6 changes: 6 additions & 0 deletions concordia/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings
from django.core.cache import cache


def system_configuration(request):
Expand Down Expand Up @@ -26,3 +27,8 @@ def site_navigation(request):
data["PATH_LEVEL_%d" % i] = component

return data


def maintenance_mode_frontend_available(request):
value = cache.get("maintenance_mode_frontend_available", False)
return {"maintenance_mode_frontend_available": value}
24 changes: 24 additions & 0 deletions concordia/maintenance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.core.cache import cache
from maintenance_mode.http import (
need_maintenance_response as base_need_maintenance_response,
)


def _need_maintenence_frontend(request):
if not hasattr(request, "user"):
return

user = request.user

frontend_available = cache.get("maintenance_mode_frontend_available", False)
if frontend_available and (user.is_staff or user.is_superuser):
return False


def need_maintenance_response(request):
value = base_need_maintenance_response(request)
if value is True:
value = _need_maintenence_frontend(request)
if isinstance(value, bool):
return value
return True
13 changes: 13 additions & 0 deletions concordia/middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from maintenance_mode.http import get_maintenance_response
from maintenance_mode.middleware import (
MaintenanceModeMiddleware as BaseMaintenanceModeMiddleware,
)

from .maintenance import need_maintenance_response


class MaintenanceModeMiddleware(BaseMaintenanceModeMiddleware):
def process_request(self, request):
if need_maintenance_response(request):
return get_maintenance_response(request)
return None
6 changes: 3 additions & 3 deletions concordia/settings_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django_ratelimit.middleware.RatelimitMiddleware",
"maintenance_mode.middleware.MaintenanceModeMiddleware",
"concordia.middleware.MaintenanceModeMiddleware",
]

RATELIMIT_VIEW = "concordia.views.ratelimit_view"
Expand All @@ -162,6 +162,7 @@
# Concordia
"concordia.context_processors.system_configuration",
"concordia.context_processors.site_navigation",
"concordia.context_processors.maintenance_mode_frontend_available",
],
"libraries": {
"staticfiles": "django.templatetags.static",
Expand Down Expand Up @@ -407,5 +408,4 @@

MAINTENANCE_MODE_STATE_BACKEND = "maintenance_mode.backends.CacheBackend"
MAINTENANCE_MODE_IGNORE_ADMIN_SITE = True
MAINTENANCE_MODE_IGNORE_STAFF = True
MAINTENANCE_MODE_IGNORE_SUPERUSER = True
MAINTENANCE_MODE_IGNORE_URLS = ("/healthz*", "/metrics*", "/maintenance-mode*")
Loading

0 comments on commit 0acf647

Please sign in to comment.