Skip to content

Commit

Permalink
chore(ci): Merging 'development'
Browse files Browse the repository at this point in the history
* 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
  ...
  • Loading branch information
b32147 committed Aug 1, 2024
2 parents fa2f135 + a634ec1 commit 53f4b19
Show file tree
Hide file tree
Showing 23 changed files with 6,801 additions and 240 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release Build

on:
push:
branches: [ master, development ]
workflow_dispatch:
inputs:
force:
type: boolean
default: false

jobs:
test-image:
uses: hms-dbmi/actions/.github/workflows/test-image-build.yml@main
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.BLHMSDBMI_DOCKERHUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.BLHMSDBMI_DOCKERHUB_PASSWORD }}
with:
repository: ${{ github.repository }}
commit: ${{ github.sha }}

scan-image:
uses: hms-dbmi/actions/.github/workflows/scan.yml@main
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.BLHMSDBMI_DOCKERHUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.BLHMSDBMI_DOCKERHUB_PASSWORD }}
with:
repository: ${{ github.repository }}
commit: ${{ github.sha }}

metadata:
runs-on: "ubuntu-latest"
outputs:
branch: ${{ steps.set_branch.outputs.branch }}
force: ${{ steps.force.outputs.force }}
steps:
- name: Set the current branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: set_branch
- name: Manage force input
id: force
env:
FORCE_INPUT: ${{ inputs.force }}
run: echo "force=${FORCE_INPUT:=false}" >> $GITHUB_OUTPUT

deploy:
uses: hms-dbmi/actions/.github/workflows/dbmisvc-app-deploy.yml@main
needs:
- "test-image"
- "metadata"
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: "${{ github.event.repository.name }}-${{ needs.metadata.outputs.branch }}.zip"
app: ${{ github.event.repository.name }}
role: ${{ vars[ format('BLHMSDBMI_DBMISVC_DEPLOYMENT_{0}_ROLE_ARN', needs.metadata.outputs.branch) ] }}
bucket: ${{ vars[ format('BLHMSDBMI_DBMISVC_DEPLOYMENT_{0}_BUCKET', needs.metadata.outputs.branch) ] }}
force: ${{ fromJson(needs.metadata.outputs.force) }}
backmerge: development
2 changes: 0 additions & 2 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Scan

on:
push:
branches: [ master, development ]
pull_request:
branches: [ master, development ]
schedule:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Test Image Build

on:
push:
branches: [ master, development ]
pull_request:
branches: [ master, development ]
workflow_dispatch:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ app/db.sqlite3
app/hypatio/local_settings.py
.vscode/settings.json
backup
node_modules
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-merge-conflict
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- repo: https://github.com/jazzband/pip-tools
rev: 7.4.1
hooks:
- id: pip-compile
name: pip-compile test-requirements.in
args: [test-requirements.in, --upgrade, --generate-hashes, --allow-unsafe, --output-file, test-requirements.txt]
files: ^test-requirements\.(in|txt)$
- id: pip-compile
name: pip-compile dev-requirements.in
args: [dev-requirements.in, --upgrade, --generate-hashes, --allow-unsafe, --output-file, dev-requirements.txt]
Expand Down
29 changes: 29 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"branches": [
"master",
"main",
"+([0-9])?(.{+([0-9]),x}).x",
{"name": "development", "channel": "pre/rc", "prerelease": "rc"},
{"name": "beta", "prerelease": true},
{"name": "alpha", "prerelease": true}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
["@semantic-release/exec", {
"prepareCmd": "sed -ie \"s/^version.*/version = \\x22${nextRelease.version}\\x22/g\" pyproject.toml"
}],
["@semantic-release/git", {
"assets": ["pyproject.toml", "CHANGELOG.md"]
}],
["@semantic-release/github", {
"successComment": false,
"failComment": false,
"failTitle": false
}]
],
"preset": "angular"
}
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 1.0.0-rc.1 (2024-07-31)


### Bug Fixes

* **reporting:** Updated Sentry reporting; implemented automated versioning for CI routines ([3449c4d](https://github.com/hms-dbmi/hypatio-app/commit/3449c4d6f8f38520542c757070a45ba2781d80da))
* **requirements:** Updated Python requirements ([b7c16fc](https://github.com/hms-dbmi/hypatio-app/commit/b7c16fc9241f46062f6a5ef20b884f73b2188a9c))
* **requirements:** Updated Python requirements ([d5fac44](https://github.com/hms-dbmi/hypatio-app/commit/d5fac449348b4cb924001fae58e71b13a70fd91d))
* **requirements:** Updated Python requirements ([8cd71f6](https://github.com/hms-dbmi/hypatio-app/commit/8cd71f6c090157b927ed3cd6d4b31ffa14958fbc))
* **requirements:** Updated Python requirements ([479f562](https://github.com/hms-dbmi/hypatio-app/commit/479f562976aacbc36b1da18c7d008df9c2a4777f))
* **requirements:** Updated Python requirements ([6186407](https://github.com/hms-dbmi/hypatio-app/commit/6186407200178a3d7699a57e31330707f379159f))
* **requirements:** Updated Python requirements ([0876e7a](https://github.com/hms-dbmi/hypatio-app/commit/0876e7a2edde9cb84d7f3438f913f5a068a02a86))
* **requirements:** Updated Python requirements ([ea0367a](https://github.com/hms-dbmi/hypatio-app/commit/ea0367a90f2ce284846c0debc76860b4b031449e))
* **requirements:** Updated Python requirements ([4f76a09](https://github.com/hms-dbmi/hypatio-app/commit/4f76a097b923f04f9ba612f359f5189e4227e32e))
* **requirements:** Updated Python requirements ([ad7054b](https://github.com/hms-dbmi/hypatio-app/commit/ad7054b8660cb5f6df44e253c88c3986b1bb9550))
* **requirements:** Updated Python requirements ([acde20f](https://github.com/hms-dbmi/hypatio-app/commit/acde20ffd6bca00c1903ee97abcbbc6351b02f01))
* **requirements:** Updated Python requirements ([b47cce0](https://github.com/hms-dbmi/hypatio-app/commit/b47cce003cabfd38f87d6a6d51b6549d3cbd7004))
* **requirements:** Updated Python requirements ([14cfb90](https://github.com/hms-dbmi/hypatio-app/commit/14cfb90f5b94ff7c051a69de6611d837db693df4))
* **requirements:** Updated Python requirements ([219f75b](https://github.com/hms-dbmi/hypatio-app/commit/219f75b57a21505b8a873f6e12163ba30ddf065f))
* **requirements:** Updated Python requirements ([8186602](https://github.com/hms-dbmi/hypatio-app/commit/8186602cdbfab9ea7e6219396fa27beb69c8ab0d))
* **requirements:** Updated Python requirements ([c6f0f5b](https://github.com/hms-dbmi/hypatio-app/commit/c6f0f5b66be7d0107945f969517b5c7077a80809))
* **requirements:** Updated Python requirements ([4f578f6](https://github.com/hms-dbmi/hypatio-app/commit/4f578f6d8ab1f138e3c841bac1430119ee77b882))
* **requirements:** Updated Python requirements ([398e025](https://github.com/hms-dbmi/hypatio-app/commit/398e02523fe629e5fc3f0548bdfe03f2b5564867))
* **requirements:** Updated Python requirements ([9c4c16f](https://github.com/hms-dbmi/hypatio-app/commit/9c4c16f80fd0b2e74fe840762ab19bbaf9aab2d6))
* **requirements:** Updated Python requirements ([9d40b7b](https://github.com/hms-dbmi/hypatio-app/commit/9d40b7b08aead1d7273da1a891e15dd3c7f51f6d))
* **requirements:** Updated Python requirements ([385ae17](https://github.com/hms-dbmi/hypatio-app/commit/385ae177d171a5e8d2159f94623cceb2157aa089))
* **requirements:** Updated Python requirements ([0403b2b](https://github.com/hms-dbmi/hypatio-app/commit/0403b2b2224c873a1d4c0a03dc49e91362401dd1))
* **requirements:** Updated Python requirements ([8e5c26d](https://github.com/hms-dbmi/hypatio-app/commit/8e5c26d606765c565c012a94c7d47b8d1dd17404))
* **requirements:** Updated Python requirements ([1917c7f](https://github.com/hms-dbmi/hypatio-app/commit/1917c7fea19bf16a38017214e8a22d94f718040f))
* **requirements:** Updated Python requirements ([35139f3](https://github.com/hms-dbmi/hypatio-app/commit/35139f317a607f94baca9b3654af397566d884bd))
* **requirements:** Updated Python requirements ([0646eaf](https://github.com/hms-dbmi/hypatio-app/commit/0646eafd196de443ca9933c59ec5f7ee1dc6b031))
* **requirements:** Updated Python requirements ([13296d0](https://github.com/hms-dbmi/hypatio-app/commit/13296d0f4546536c343e69f5b387b265232b3845))
* **requirements:** Updated Python requirements ([e5beb03](https://github.com/hms-dbmi/hypatio-app/commit/e5beb037968ce8e824723ef406116cfe6795f273))
* **requirements:** Updated Python requirements ([7427625](https://github.com/hms-dbmi/hypatio-app/commit/7427625cd1d181781195735428b8388834c2488d))
24 changes: 22 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.1 AS builder
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.2 AS builder

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

FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.1
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.2

ARG APP_NAME="dbmi-data-portal"
ARG APP_CODENAME="hypatio"
ARG VERSION
ARG COMMIT
ARG DATE

LABEL org.label-schema.schema-version=1.0 \
org.label-schema.vendor="HMS-DBMI" \
org.label-schema.version=${VERSION} \
org.label-schema.name=${APP_NAME} \
org.label-schema.build-date=${DATE} \
org.label-schema.description="DBMI Data Portal" \
org.label-schema.url="https://github.com/hms-dbmi/hypatio-app" \
org.label-schema.vcs-url="https://github.com/hms-dbmi/hypatio-app" \
org.label-schema.vcf-ref=${COMMIT}

# Copy Python wheels from builder
COPY --from=builder /root/wheels /root/wheels
Expand Down Expand Up @@ -59,6 +75,10 @@ ENV DBMI_PARAMETER_STORE_PRIORITY=true
ENV DBMI_AWS_REGION=us-east-1

# App config
ENV DBMI_APP_NAME=${APP_NAME}
ENV DBMI_APP_CODENAME=${APP_CODENAME}
ENV DBMI_APP_VERSION=${VERSION}
ENV DBMI_APP_COMMIT=${COMMIT}
ENV DBMI_APP_WSGI=hypatio
ENV DBMI_APP_ROOT=/app
ENV DBMI_APP_DB=true
Expand Down
103 changes: 43 additions & 60 deletions app/hypatio/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

from os.path import normpath, join, dirname, abspath
from dbmi_client import environment
from dbmi_client import reporting
from dbmi_client.logging import config

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

#####################################################################################

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'console': {
'format': '[HYPATIO] - [%(asctime)s][%(levelname)s][%(name)s.%(funcName)s:%(lineno)d] - %(message)s',
},
#####################################################################################
# Logging settings
#####################################################################################

# Configure Sentry
reporting.sentry(
sentry_dsn=environment.get_str("SENTRY_DSN", required=True),
release=f'{environment.get_str("DBMI_APP_NAME")}@{environment.get_str("DBMI_APP_VERSION")}',
environment=environment.get_str("DBMI_ENV", "prod"),
sentry_trace_rate=environment.get_float("SENTRY_TRACES_RATE", default=0.0),
sentry_profile_rate=environment.get_float("SENTRY_PROFILES_RATE", default=0.0),
)

# Output the standard logging configuration
LOGGING = config('HYPATIO', root_level=logging.DEBUG)

# Disable warning level for 4xx request logging
LOGGING['loggers'].update({
'django.request': {
'handlers': ['console'],
'level': 'ERROR',
'propagate': True,
},
'handlers': {
'sentry': {
'level': 'ERROR',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'console',
'stream': sys.stdout,
},
'boto3': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
},
'root': {
'handlers': ['console', ],
'level': 'DEBUG'
'botocore': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
},
'loggers': {
'django': {
'handlers': ['console', ],
'level': 'INFO',
'propagate': True,
},
'raven': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': False,
},
'sentry.errors': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': False,
},
'botocore': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': True,
},
'boto3': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': True,
},
's3transfer': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': True,
},
's3transfer': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
},
}
'urllib3': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
},
})

RAVEN_CONFIG = {
'dsn': environment.get_str("RAVEN_URL", required=True),
# If you are using git, you can also automatically configure the
# release based on the git info.
'release': '1',
'site': 'HYPATIO'
}
#####################################################################################
8 changes: 8 additions & 0 deletions app/hypatio/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ def group_context():
# Check for group
active_group = next((g for g in groups if project in g.dataproject_set.all()), None)

# Pull out top-level groups
parent_groups_keys = groups.filter(parent__isnull=False).values_list('parent', flat=True)
parent_groups = Group.objects.filter(id__in=parent_groups_keys)

# Remove groups that will be placed under a parent group
groups = groups.filter(parent__isnull=True)

return {
"parent_groups": parent_groups,
"groups": groups,
"active_group": active_group,
}
Expand Down
19 changes: 19 additions & 0 deletions app/projects/migrations/0104_group_parent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.11 on 2024-04-25 13:33

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('projects', '0103_dataproject_commercial_only'),
]

operations = [
migrations.AddField(
model_name='group',
name='parent',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='projects.group'),
),
]
3 changes: 3 additions & 0 deletions app/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ class Group(models.Model):
title = models.CharField(max_length=255, blank=False, null=False)
description = models.TextField(blank=True)
navigation_title = models.CharField(max_length=20, blank=True, null=True)
parent = models.ForeignKey("Group", on_delete=models.PROTECT, blank=True, null=True)

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

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

################################################################################
# Deprecated models
Expand Down
Loading

0 comments on commit 53f4b19

Please sign in to comment.