Skip to content

Commit 53f4b19

Browse files
committed
chore(ci): Merging 'development'
* development: (618 commits) chore(release): 1.0.0-rc.1 [skip ci] fix(reporting): Updated Sentry reporting; implemented automated versioning for CI routines HYP-HOTFIX-061224 - Examples fix(requirements): Updated Python requirements HYP-302 - Filter out child groups with no active projects HYP-302 - Added top-level navigation functionality develop(actions): Removed Snyk secret develop(requirements): Updated dev requirements fix(requirements): Updated Python requirements develop(actions): Configured Actions to use Organization secrets develop(dependencies): Reverted to Python 3.11 due to AWS CLIv2 incompatibility; updated Python dependencies develop(dependencies): Updated pre-commit develop(dependencies): Updated Python version, Docker image and Python dependencies HYP-301 - Hides 'Already Completed' button on signed agreement forms when a user starts filling out form PPM-HOTFIX-112823 - Updated language about N2C2 and LLM usage fix(requirements): Updated Python requirements fix(requirements): Updated Python requirements HYP-297 - Added fixture for DataProject model change HYP-297 - Added badge for commercial only projects HYP-HOTFIX-091323 - Set uploads to use S3v4 signatures ...
2 parents fa2f135 + a634ec1 commit 53f4b19

23 files changed

+6801
-240
lines changed

.github/workflows/release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release Build
2+
3+
on:
4+
push:
5+
branches: [ master, development ]
6+
workflow_dispatch:
7+
inputs:
8+
force:
9+
type: boolean
10+
default: false
11+
12+
jobs:
13+
test-image:
14+
uses: hms-dbmi/actions/.github/workflows/test-image-build.yml@main
15+
secrets:
16+
DOCKER_HUB_USERNAME: ${{ secrets.BLHMSDBMI_DOCKERHUB_USERNAME }}
17+
DOCKER_HUB_PASSWORD: ${{ secrets.BLHMSDBMI_DOCKERHUB_PASSWORD }}
18+
with:
19+
repository: ${{ github.repository }}
20+
commit: ${{ github.sha }}
21+
22+
scan-image:
23+
uses: hms-dbmi/actions/.github/workflows/scan.yml@main
24+
secrets:
25+
DOCKER_HUB_USERNAME: ${{ secrets.BLHMSDBMI_DOCKERHUB_USERNAME }}
26+
DOCKER_HUB_PASSWORD: ${{ secrets.BLHMSDBMI_DOCKERHUB_PASSWORD }}
27+
with:
28+
repository: ${{ github.repository }}
29+
commit: ${{ github.sha }}
30+
31+
metadata:
32+
runs-on: "ubuntu-latest"
33+
outputs:
34+
branch: ${{ steps.set_branch.outputs.branch }}
35+
force: ${{ steps.force.outputs.force }}
36+
steps:
37+
- name: Set the current branch name
38+
shell: bash
39+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
40+
id: set_branch
41+
- name: Manage force input
42+
id: force
43+
env:
44+
FORCE_INPUT: ${{ inputs.force }}
45+
run: echo "force=${FORCE_INPUT:=false}" >> $GITHUB_OUTPUT
46+
47+
deploy:
48+
uses: hms-dbmi/actions/.github/workflows/dbmisvc-app-deploy.yml@main
49+
needs:
50+
- "test-image"
51+
- "metadata"
52+
secrets:
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
filename: "${{ github.event.repository.name }}-${{ needs.metadata.outputs.branch }}.zip"
56+
app: ${{ github.event.repository.name }}
57+
role: ${{ vars[ format('BLHMSDBMI_DBMISVC_DEPLOYMENT_{0}_ROLE_ARN', needs.metadata.outputs.branch) ] }}
58+
bucket: ${{ vars[ format('BLHMSDBMI_DBMISVC_DEPLOYMENT_{0}_BUCKET', needs.metadata.outputs.branch) ] }}
59+
force: ${{ fromJson(needs.metadata.outputs.force) }}
60+
backmerge: development

.github/workflows/scan.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Scan
22

33
on:
4-
push:
5-
branches: [ master, development ]
64
pull_request:
75
branches: [ master, development ]
86
schedule:

.github/workflows/test.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Test Image Build
22

33
on:
4-
push:
5-
branches: [ master, development ]
64
pull_request:
75
branches: [ master, development ]
86
workflow_dispatch:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ app/db.sqlite3
77
app/hypatio/local_settings.py
88
.vscode/settings.json
99
backup
10+
node_modules

.pre-commit-config.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks.git
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: trailing-whitespace
66
- id: mixed-line-ending
77
- id: check-byte-order-marker
88
- id: check-merge-conflict
99
- id: detect-aws-credentials
10+
args: [--allow-missing-credentials]
1011
- repo: https://github.com/jazzband/pip-tools
1112
rev: 7.4.1
1213
hooks:
14+
- id: pip-compile
15+
name: pip-compile test-requirements.in
16+
args: [test-requirements.in, --upgrade, --generate-hashes, --allow-unsafe, --output-file, test-requirements.txt]
17+
files: ^test-requirements\.(in|txt)$
1318
- id: pip-compile
1419
name: pip-compile dev-requirements.in
1520
args: [dev-requirements.in, --upgrade, --generate-hashes, --allow-unsafe, --output-file, dev-requirements.txt]

.releaserc

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"branches": [
3+
"master",
4+
"main",
5+
"+([0-9])?(.{+([0-9]),x}).x",
6+
{"name": "development", "channel": "pre/rc", "prerelease": "rc"},
7+
{"name": "beta", "prerelease": true},
8+
{"name": "alpha", "prerelease": true}
9+
],
10+
"plugins": [
11+
"@semantic-release/commit-analyzer",
12+
"@semantic-release/release-notes-generator",
13+
["@semantic-release/changelog", {
14+
"changelogFile": "CHANGELOG.md"
15+
}],
16+
["@semantic-release/exec", {
17+
"prepareCmd": "sed -ie \"s/^version.*/version = \\x22${nextRelease.version}\\x22/g\" pyproject.toml"
18+
}],
19+
["@semantic-release/git", {
20+
"assets": ["pyproject.toml", "CHANGELOG.md"]
21+
}],
22+
["@semantic-release/github", {
23+
"successComment": false,
24+
"failComment": false,
25+
"failTitle": false
26+
}]
27+
],
28+
"preset": "angular"
29+
}

CHANGELOG.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# 1.0.0-rc.1 (2024-07-31)
2+
3+
4+
### Bug Fixes
5+
6+
* **reporting:** Updated Sentry reporting; implemented automated versioning for CI routines ([3449c4d](https://github.com/hms-dbmi/hypatio-app/commit/3449c4d6f8f38520542c757070a45ba2781d80da))
7+
* **requirements:** Updated Python requirements ([b7c16fc](https://github.com/hms-dbmi/hypatio-app/commit/b7c16fc9241f46062f6a5ef20b884f73b2188a9c))
8+
* **requirements:** Updated Python requirements ([d5fac44](https://github.com/hms-dbmi/hypatio-app/commit/d5fac449348b4cb924001fae58e71b13a70fd91d))
9+
* **requirements:** Updated Python requirements ([8cd71f6](https://github.com/hms-dbmi/hypatio-app/commit/8cd71f6c090157b927ed3cd6d4b31ffa14958fbc))
10+
* **requirements:** Updated Python requirements ([479f562](https://github.com/hms-dbmi/hypatio-app/commit/479f562976aacbc36b1da18c7d008df9c2a4777f))
11+
* **requirements:** Updated Python requirements ([6186407](https://github.com/hms-dbmi/hypatio-app/commit/6186407200178a3d7699a57e31330707f379159f))
12+
* **requirements:** Updated Python requirements ([0876e7a](https://github.com/hms-dbmi/hypatio-app/commit/0876e7a2edde9cb84d7f3438f913f5a068a02a86))
13+
* **requirements:** Updated Python requirements ([ea0367a](https://github.com/hms-dbmi/hypatio-app/commit/ea0367a90f2ce284846c0debc76860b4b031449e))
14+
* **requirements:** Updated Python requirements ([4f76a09](https://github.com/hms-dbmi/hypatio-app/commit/4f76a097b923f04f9ba612f359f5189e4227e32e))
15+
* **requirements:** Updated Python requirements ([ad7054b](https://github.com/hms-dbmi/hypatio-app/commit/ad7054b8660cb5f6df44e253c88c3986b1bb9550))
16+
* **requirements:** Updated Python requirements ([acde20f](https://github.com/hms-dbmi/hypatio-app/commit/acde20ffd6bca00c1903ee97abcbbc6351b02f01))
17+
* **requirements:** Updated Python requirements ([b47cce0](https://github.com/hms-dbmi/hypatio-app/commit/b47cce003cabfd38f87d6a6d51b6549d3cbd7004))
18+
* **requirements:** Updated Python requirements ([14cfb90](https://github.com/hms-dbmi/hypatio-app/commit/14cfb90f5b94ff7c051a69de6611d837db693df4))
19+
* **requirements:** Updated Python requirements ([219f75b](https://github.com/hms-dbmi/hypatio-app/commit/219f75b57a21505b8a873f6e12163ba30ddf065f))
20+
* **requirements:** Updated Python requirements ([8186602](https://github.com/hms-dbmi/hypatio-app/commit/8186602cdbfab9ea7e6219396fa27beb69c8ab0d))
21+
* **requirements:** Updated Python requirements ([c6f0f5b](https://github.com/hms-dbmi/hypatio-app/commit/c6f0f5b66be7d0107945f969517b5c7077a80809))
22+
* **requirements:** Updated Python requirements ([4f578f6](https://github.com/hms-dbmi/hypatio-app/commit/4f578f6d8ab1f138e3c841bac1430119ee77b882))
23+
* **requirements:** Updated Python requirements ([398e025](https://github.com/hms-dbmi/hypatio-app/commit/398e02523fe629e5fc3f0548bdfe03f2b5564867))
24+
* **requirements:** Updated Python requirements ([9c4c16f](https://github.com/hms-dbmi/hypatio-app/commit/9c4c16f80fd0b2e74fe840762ab19bbaf9aab2d6))
25+
* **requirements:** Updated Python requirements ([9d40b7b](https://github.com/hms-dbmi/hypatio-app/commit/9d40b7b08aead1d7273da1a891e15dd3c7f51f6d))
26+
* **requirements:** Updated Python requirements ([385ae17](https://github.com/hms-dbmi/hypatio-app/commit/385ae177d171a5e8d2159f94623cceb2157aa089))
27+
* **requirements:** Updated Python requirements ([0403b2b](https://github.com/hms-dbmi/hypatio-app/commit/0403b2b2224c873a1d4c0a03dc49e91362401dd1))
28+
* **requirements:** Updated Python requirements ([8e5c26d](https://github.com/hms-dbmi/hypatio-app/commit/8e5c26d606765c565c012a94c7d47b8d1dd17404))
29+
* **requirements:** Updated Python requirements ([1917c7f](https://github.com/hms-dbmi/hypatio-app/commit/1917c7fea19bf16a38017214e8a22d94f718040f))
30+
* **requirements:** Updated Python requirements ([35139f3](https://github.com/hms-dbmi/hypatio-app/commit/35139f317a607f94baca9b3654af397566d884bd))
31+
* **requirements:** Updated Python requirements ([0646eaf](https://github.com/hms-dbmi/hypatio-app/commit/0646eafd196de443ca9933c59ec5f7ee1dc6b031))
32+
* **requirements:** Updated Python requirements ([13296d0](https://github.com/hms-dbmi/hypatio-app/commit/13296d0f4546536c343e69f5b387b265232b3845))
33+
* **requirements:** Updated Python requirements ([e5beb03](https://github.com/hms-dbmi/hypatio-app/commit/e5beb037968ce8e824723ef406116cfe6795f273))
34+
* **requirements:** Updated Python requirements ([7427625](https://github.com/hms-dbmi/hypatio-app/commit/7427625cd1d181781195735428b8388834c2488d))

Dockerfile

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.1 AS builder
1+
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.2 AS builder
22

33
# Install requirements
44
RUN apt-get update \
@@ -20,7 +20,23 @@ RUN pip install -U wheel \
2020
&& pip wheel -r /requirements.txt \
2121
--wheel-dir=/root/wheels
2222

23-
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.1
23+
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.2
24+
25+
ARG APP_NAME="dbmi-data-portal"
26+
ARG APP_CODENAME="hypatio"
27+
ARG VERSION
28+
ARG COMMIT
29+
ARG DATE
30+
31+
LABEL org.label-schema.schema-version=1.0 \
32+
org.label-schema.vendor="HMS-DBMI" \
33+
org.label-schema.version=${VERSION} \
34+
org.label-schema.name=${APP_NAME} \
35+
org.label-schema.build-date=${DATE} \
36+
org.label-schema.description="DBMI Data Portal" \
37+
org.label-schema.url="https://github.com/hms-dbmi/hypatio-app" \
38+
org.label-schema.vcs-url="https://github.com/hms-dbmi/hypatio-app" \
39+
org.label-schema.vcf-ref=${COMMIT}
2440

2541
# Copy Python wheels from builder
2642
COPY --from=builder /root/wheels /root/wheels
@@ -59,6 +75,10 @@ ENV DBMI_PARAMETER_STORE_PRIORITY=true
5975
ENV DBMI_AWS_REGION=us-east-1
6076

6177
# App config
78+
ENV DBMI_APP_NAME=${APP_NAME}
79+
ENV DBMI_APP_CODENAME=${APP_CODENAME}
80+
ENV DBMI_APP_VERSION=${VERSION}
81+
ENV DBMI_APP_COMMIT=${COMMIT}
6282
ENV DBMI_APP_WSGI=hypatio
6383
ENV DBMI_APP_ROOT=/app
6484
ENV DBMI_APP_DB=true

app/hypatio/settings.py

+43-60
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
from os.path import normpath, join, dirname, abspath
1818
from dbmi_client import environment
19+
from dbmi_client import reporting
20+
from dbmi_client.logging import config
1921

2022
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
2123
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -301,68 +303,49 @@
301303

302304
#####################################################################################
303305

304-
LOGGING = {
305-
'version': 1,
306-
'disable_existing_loggers': False,
307-
'formatters': {
308-
'console': {
309-
'format': '[HYPATIO] - [%(asctime)s][%(levelname)s][%(name)s.%(funcName)s:%(lineno)d] - %(message)s',
310-
},
306+
#####################################################################################
307+
# Logging settings
308+
#####################################################################################
309+
310+
# Configure Sentry
311+
reporting.sentry(
312+
sentry_dsn=environment.get_str("SENTRY_DSN", required=True),
313+
release=f'{environment.get_str("DBMI_APP_NAME")}@{environment.get_str("DBMI_APP_VERSION")}',
314+
environment=environment.get_str("DBMI_ENV", "prod"),
315+
sentry_trace_rate=environment.get_float("SENTRY_TRACES_RATE", default=0.0),
316+
sentry_profile_rate=environment.get_float("SENTRY_PROFILES_RATE", default=0.0),
317+
)
318+
319+
# Output the standard logging configuration
320+
LOGGING = config('HYPATIO', root_level=logging.DEBUG)
321+
322+
# Disable warning level for 4xx request logging
323+
LOGGING['loggers'].update({
324+
'django.request': {
325+
'handlers': ['console'],
326+
'level': 'ERROR',
327+
'propagate': True,
311328
},
312-
'handlers': {
313-
'sentry': {
314-
'level': 'ERROR',
315-
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
316-
},
317-
'console': {
318-
'level': 'DEBUG',
319-
'class': 'logging.StreamHandler',
320-
'formatter': 'console',
321-
'stream': sys.stdout,
322-
},
329+
'boto3': {
330+
'handlers': ['console'],
331+
'level': 'INFO',
332+
'propagate': True,
323333
},
324-
'root': {
325-
'handlers': ['console', ],
326-
'level': 'DEBUG'
334+
'botocore': {
335+
'handlers': ['console'],
336+
'level': 'INFO',
337+
'propagate': True,
327338
},
328-
'loggers': {
329-
'django': {
330-
'handlers': ['console', ],
331-
'level': 'INFO',
332-
'propagate': True,
333-
},
334-
'raven': {
335-
'level': 'WARNING',
336-
'handlers': ['console'],
337-
'propagate': False,
338-
},
339-
'sentry.errors': {
340-
'level': 'WARNING',
341-
'handlers': ['console'],
342-
'propagate': False,
343-
},
344-
'botocore': {
345-
'level': 'WARNING',
346-
'handlers': ['console'],
347-
'propagate': True,
348-
},
349-
'boto3': {
350-
'level': 'WARNING',
351-
'handlers': ['console'],
352-
'propagate': True,
353-
},
354-
's3transfer': {
355-
'level': 'WARNING',
356-
'handlers': ['console'],
357-
'propagate': True,
358-
},
339+
's3transfer': {
340+
'handlers': ['console'],
341+
'level': 'INFO',
342+
'propagate': True,
359343
},
360-
}
344+
'urllib3': {
345+
'handlers': ['console'],
346+
'level': 'INFO',
347+
'propagate': True,
348+
},
349+
})
361350

362-
RAVEN_CONFIG = {
363-
'dsn': environment.get_str("RAVEN_URL", required=True),
364-
# If you are using git, you can also automatically configure the
365-
# release based on the git info.
366-
'release': '1',
367-
'site': 'HYPATIO'
368-
}
351+
#####################################################################################

app/hypatio/views.py

+8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ def group_context():
3838
# Check for group
3939
active_group = next((g for g in groups if project in g.dataproject_set.all()), None)
4040

41+
# Pull out top-level groups
42+
parent_groups_keys = groups.filter(parent__isnull=False).values_list('parent', flat=True)
43+
parent_groups = Group.objects.filter(id__in=parent_groups_keys)
44+
45+
# Remove groups that will be placed under a parent group
46+
groups = groups.filter(parent__isnull=True)
47+
4148
return {
49+
"parent_groups": parent_groups,
4250
"groups": groups,
4351
"active_group": active_group,
4452
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 4.2.11 on 2024-04-25 13:33
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('projects', '0103_dataproject_commercial_only'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='group',
16+
name='parent',
17+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='projects.group'),
18+
),
19+
]

app/projects/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ class Group(models.Model):
694694
title = models.CharField(max_length=255, blank=False, null=False)
695695
description = models.TextField(blank=True)
696696
navigation_title = models.CharField(max_length=20, blank=True, null=True)
697+
parent = models.ForeignKey("Group", on_delete=models.PROTECT, blank=True, null=True)
697698

698699
# Meta
699700
created = models.DateTimeField(auto_now_add=True)
@@ -702,6 +703,8 @@ class Group(models.Model):
702703
def __str__(self):
703704
return self.title
704705

706+
def active_project_child_groups(self):
707+
return self.group_set.filter(dataproject__isnull=False, dataproject__visible=True).distinct()
705708

706709
################################################################################
707710
# Deprecated models

0 commit comments

Comments
 (0)