Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to prod #858

Merged
merged 76 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
bda2416
Map authenticated users to a Django group
amstilp Sep 4, 2024
0c8e129
Switch UploadCycleDetail to be visible by View users
amstilp Sep 4, 2024
8ae5e00
Make the upload cycle detail page a bit prettier
amstilp Sep 4, 2024
8ed852f
Show an alert indicating if the upload cycle is current, past, or future
amstilp Sep 4, 2024
772b209
Switch icon for combined workspace
amstilp Sep 4, 2024
552f332
Only show upload cycle notes to staff users
amstilp Sep 4, 2024
b33c940
Only UploadWorkspaceDetail links to users with access
amstilp Sep 4, 2024
8d60961
Allow view users to see UploadCycleList
amstilp Sep 4, 2024
70c1912
Add content to the home page
amstilp Sep 4, 2024
b7fc012
Add description and links to home page
amstilp Sep 5, 2024
68fb593
Wording modifications
amstilp Sep 5, 2024
33bc3bb
Show combined workspace before upload workspaces
amstilp Sep 5, 2024
839f004
Show accordions uncollapsed by default
amstilp Sep 5, 2024
bd85e08
Only show combined and upload workspaces to view users
amstilp Sep 5, 2024
9cd4d00
Merge branch 'main' into feature/open-views-to-investigators
amstilp Oct 23, 2024
17d0935
Update workspace detail pages for view users
amstilp Oct 23, 2024
dc6df37
Improve tests checking for main ACM index link
amstilp Oct 23, 2024
173831c
Run ruff format
amstilp Oct 23, 2024
6a3698b
Bump werkzeug from 3.1.2 to 3.1.3
dependabot[bot] Nov 8, 2024
51b5723
Switch ACM to v0.26 in requirements file
amstilp Nov 12, 2024
8c4c6ab
Compile requirements files
amstilp Nov 12, 2024
3d16ae3
Merge pull request #832 from UW-GAC/pip-tools/update-requirements-fil…
amstilp Nov 12, 2024
5fcdcf8
Move account related settings into adapter
amstilp Nov 12, 2024
2bc9f01
Uncomment lines in account adapter
amstilp Nov 12, 2024
522554d
Merge pull request #831 from UW-GAC/maint/acm-v0.26
amstilp Nov 12, 2024
b07e1fb
Bump django-allauth from 65.1.0 to 65.2.0
dependabot[bot] Nov 12, 2024
203ff2d
Merge branch 'main' into feature/open-views-to-investigators
amstilp Nov 12, 2024
aeda042
Update text on home page
amstilp Nov 12, 2024
54de6ef
Add custom text to UploadWorkspace list page
amstilp Nov 12, 2024
38bfe8a
Add custom text to combined workspace page
amstilp Nov 12, 2024
fe2536e
Add custom text to exchange workspace template
amstilp Nov 12, 2024
0fb96c6
Bump mysqlclient from 2.2.5 to 2.2.6
dependabot[bot] Nov 13, 2024
37d365c
Reorder registered workspace types
amstilp Nov 14, 2024
8522653
Allow only 4 maximum processes for pytest
amstilp Nov 14, 2024
ab6dcf2
Bump ruff from 0.7.2 to 0.7.4
dependabot[bot] Nov 15, 2024
62ae5db
Bump codecov/codecov-action from 4.6.0 to 5.0.7
dependabot[bot] Nov 21, 2024
777a730
Add redirectview for favicon.ico to our custom favicon. Make redirect…
jmcarson Nov 21, 2024
a381456
Minor linting changes
jmcarson Nov 21, 2024
a320f5f
Merge pull request #840 from UW-GAC/maint/favicon-notfound
jmcarson Nov 21, 2024
30c4b2b
Merge dependabot/github_actions/codecov/codecov-action-5.0.7 into com…
github-actions[bot] Nov 21, 2024
67782e7
Merge dependabot/pip/ruff-0.7.4 into combined-prs-branch
github-actions[bot] Nov 21, 2024
5f87362
Merge dependabot/pip/mysqlclient-2.2.6 into combined-prs-branch
github-actions[bot] Nov 21, 2024
1efb532
Merge dependabot/pip/werkzeug-3.1.3 into combined-prs-branch
github-actions[bot] Nov 21, 2024
ea71046
Merge dependabot/pip/django-allauth-65.2.0 into combined-prs-branch
github-actions[bot] Nov 21, 2024
4388e8b
Merge branch 'main' into combined-prs-branch
github-actions[bot] Nov 21, 2024
200e982
Merge pull request #841 from UW-GAC/combined-prs-branch
amstilp Nov 22, 2024
9e0958e
Bump pyjwt from 2.9.0 to 2.10.0
dependabot[bot] Nov 22, 2024
c25a2a6
Fix breaking change in 2.10 - sub must be a string - to align with JW…
jmcarson Nov 22, 2024
e5bf0bd
Merge pull request #837 from UW-GAC/dependabot/pip/pyjwt-2.10.0
jmcarson Nov 22, 2024
fd36515
Bump cryptography from 43.0.3 to 44.0.0
dependabot[bot] Nov 27, 2024
0f2db28
Bump pyjwt from 2.10.0 to 2.10.1
dependabot[bot] Nov 28, 2024
90c51da
Bump ruff from 0.7.4 to 0.8.1
dependabot[bot] Nov 29, 2024
7bfad31
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Dec 2, 2024
1bb1130
Bump pyjwt from 2.10.0 to 2.10.1 in /requirements
dependabot[bot] Dec 2, 2024
5f2fc74
Compile requirements files
dependabot[bot] Dec 2, 2024
cbaa696
Bump django-allauth from 65.2.0 to 65.3.0
dependabot[bot] Dec 2, 2024
2a62ad6
Bump pytest from 8.3.3 to 8.3.4
dependabot[bot] Dec 2, 2024
53af7c3
Merge pull request #847 from UW-GAC/pip-tools/update-requirements-fil…
amstilp Dec 2, 2024
77370ea
Merge dependabot/pip/pytest-8.3.4 into combined-prs-branch
github-actions[bot] Dec 2, 2024
88bfda1
Merge dependabot/pip/django-allauth-65.3.0 into combined-prs-branch
github-actions[bot] Dec 2, 2024
ea6729d
Merge dependabot/pip/requirements/pyjwt-2.10.1 into combined-prs-branch
github-actions[bot] Dec 2, 2024
2a16ff8
Merge dependabot/pip/ruff-0.8.1 into combined-prs-branch
github-actions[bot] Dec 2, 2024
bcae859
Merge dependabot/pip/pyjwt-2.10.1 into combined-prs-branch
github-actions[bot] Dec 2, 2024
b4ebc46
Merge dependabot/pip/cryptography-44.0.0 into combined-prs-branch
github-actions[bot] Dec 2, 2024
ab7d878
Merge pull request #850 from UW-GAC/combined-prs-branch
amstilp Dec 2, 2024
896adb7
Merge pull request #798 from UW-GAC/pre-commit-ci-update-config
amstilp Dec 2, 2024
0891a0f
Split some tables into staff vs. regular user tables
amstilp Dec 2, 2024
5397ce4
Clean up coverage and add more tests for links in detail views
amstilp Dec 3, 2024
1587f3b
Merge pull request #789 from UW-GAC/feature/open-views-to-investigators
amstilp Dec 3, 2024
7e42195
Update ACM version in requirements.in file
amstilp Dec 3, 2024
0e87cc3
Compile requirements files
amstilp Dec 3, 2024
fa23196
Merge pull request #852 from UW-GAC/pip-tools/update-requirements-fil…
amstilp Dec 3, 2024
73a8286
Merge pull request #851 from UW-GAC/maint/acm-v0.26.1
amstilp Dec 3, 2024
7a095a0
Use release-drafter action draft releases and notes
amstilp Dec 6, 2024
436098b
Merge pull request #856 from UW-GAC/maint/release-drafter
amstilp Dec 6, 2024
e1c5a46
Merge pull request #857 from UW-GAC/main
amstilp Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sort-direction: ascending

categories:
- title: "⬆️ Dependencies"
labels:
- "dependencies"
- "update-requirements-files"
- "combined-pr"

template: |
## What’s Changed

$CHANGES
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,6 @@ jobs:
python -m coverage report

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.6.0
uses: codecov/codecov-action@v5.0.7
with:
token: ${{ secrets.CODECOV_TOKEN }}
114 changes: 114 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- deploy/production

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: read
runs-on: ubuntu-latest
steps:

- name: Get current date
id: get-date
run: |
export CURRENT_DATE=$(TZ=":America/Los_Angeles" date "+%Y-%m-%d")
echo "current_date=${CURRENT_DATE}" >> $GITHUB_OUTPUT
echo "Current date set to ${CURRENT_DATE}"

- name: Get number of releases for the current date
id: get-release-count
run: |
export RELEASE_COUNT=$(gh release list \
--repo ${{ github.repository }} \
--json tagName \
--exclude-drafts \
--jq "map(select(.tagName | startswith(\"${CURRENT_DATE}\")))|length" \
)
echo "release_count=${RELEASE_COUNT}" >> $GITHUB_OUTPUT
echo "Found ${RELEASE_COUNT} releases"
env:
CURRENT_DATE: ${{ steps.get-date.outputs.current_date }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare release version
id: get-version
run: |
export VERSION="${CURRENT_DATE}"

if [ $RELEASE_COUNT -gt 0 ]; then
echo "Release already exists for version ${VERSION}"
echo "Appending release count to version"
export VERSION="${CURRENT_DATE}-${RELEASE_COUNT}"
fi

echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version set to ${VERSION}"
env:
CURRENT_DATE: ${{ steps.get-date.outputs.current_date }}
RELEASE_COUNT: ${{ steps.get-release-count.outputs.release_count }}


- name: Check that version doesn't exist
id: check-release
run: |
echo "Checking version ${VERSION}"

export CHECK=$(gh release list \
--repo ${{ github.repository }} \
--json tagName \
--exclude-drafts \
--jq "map(select(.tagName == \"${VERSION}\"))|length" \
)
echo "Found ${CHECK} releases"

if [ $CHECK -gt 0 ]; then
echo "Release already exists for version ${VERSION}"
exit 1
fi
env:
VERSION: ${{ steps.get-version.outputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check that tag doesn't exist
id: check-tag
run: |
echo "Checking tag for version ${VERSION}"

# Query the API for this tag.
export CHECK=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/tags \
--jq "map(select(.name == \"${VERSION}\"))|length" \
)
echo "Found ${CHECK} tags"

if [ $CHECK -gt 0 ]; then
echo "Tag already exists for version ${VERSION}"
exit 1
fi
env:
VERSION: ${{ steps.get-version.outputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- uses: release-drafter/release-drafter@v6
with:
commitish: deploy/production
tag: ${{ steps.get-version.outputs.version }}
name: ${{ steps.get-version.outputs.version }}
version: ${{ steps.get-version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.0
rev: v0.8.1
hooks:
# Run the linter.
- id: ruff
Expand All @@ -21,7 +21,7 @@ repos:
- id: ruff-format

- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.1
rev: v8.21.2
hooks:
- id: gitleaks

Expand Down
22 changes: 11 additions & 11 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
"socialaccount_signup",
"admin:index",
"admin:login",
"favicon",
]

# django-dbbackup
Expand Down Expand Up @@ -345,6 +346,11 @@
"request_scope": True,
"django_group_name": "Approved by PI for AnVIL access",
},
{
"drupal_machine_name": "authenticated",
"request_scope": True,
"django_group_name": "Authenticated",
},
],
}
}
Expand Down Expand Up @@ -375,25 +381,19 @@
# django-anvil-consortium-manager
# ------------------------------------------------------------------------------
ANVIL_WORKSPACE_ADAPTERS = [
"gregor_django.gregor_anvil.adapters.ResourceWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.TemplateWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.CombinedConsortiumDataWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.UploadWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.ResourceWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.ExchangeWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.PartnerUploadWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.CombinedConsortiumDataWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.ReleaseWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.DCCProcessingWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.DCCProcessedDataWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.ExchangeWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.ReleaseWorkspaceAdapter",
"gregor_django.gregor_anvil.adapters.TemplateWorkspaceAdapter",
]
ANVIL_ACCOUNT_ADAPTER = "gregor_django.gregor_anvil.adapters.AccountAdapter"
ANVIL_MANAGED_GROUP_ADAPTER = "gregor_django.gregor_anvil.adapters.ManagedGroupAdapter"

# Specify the URL name that AccountLink and AccountLinkVerify redirect to.
ANVIL_ACCOUNT_LINK_REDIRECT = "users:redirect"
# Specify the subject for AnVIL account verification emails.
ANVIL_ACCOUNT_LINK_EMAIL_SUBJECT = "Verify your AnVIL account email"
ANVIL_ACCOUNT_VERIFY_NOTIFICATION_EMAIL = "[email protected]"

DRUPAL_API_CLIENT_ID = env("DRUPAL_API_CLIENT_ID", default="")
DRUPAL_API_CLIENT_SECRET = env("DRUPAL_API_CLIENT_SECRET", default="")
DRUPAL_API_REL_PATH = env("DRUPAL_API_REL_PATH", default="mockapi")
Expand Down
7 changes: 7 additions & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.templatetags.static import static as static_url_tag
from django.urls import include, path
from django.views import defaults as default_views
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView

urlpatterns = [
path("", TemplateView.as_view(template_name="pages/home.html"), name="home"),
Expand All @@ -22,6 +24,11 @@
"gregor_anvil/",
include("gregor_django.gregor_anvil.urls", namespace="gregor_anvil"),
),
path(
"favicon.ico",
RedirectView.as_view(url=static_url_tag("images/favicons/favicon_1.jpg"), permanent=True),
name="favicon",
),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


Expand Down
4 changes: 2 additions & 2 deletions gregor_django/drupal_oauth_provider/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_mocked_response(self):
"name": "testmaster",
"email": "[email protected]",
"email_verified": "True",
"sub": 20122
"sub": "20122"
}""",
),
]
Expand Down Expand Up @@ -184,7 +184,7 @@ def get_id_token(self):
"iat": self.setup_time,
"aud": allowed_audience,
"scope": ["authenticated", "oauth_client_user"],
"sub": 20122,
"sub": "20122",
}
)

Expand Down
12 changes: 9 additions & 3 deletions gregor_django/gregor_anvil/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class AccountAdapter(BaseAccountAdapter):

list_table_class = tables.AccountTable
list_filterset_class = filters.AccountListFilter
account_link_verify_redirect = "users:redirect"
account_link_email_subject = "Verify your AnVIL account email"
account_verify_notification_email = "[email protected]"

def get_autocomplete_queryset(self, queryset, q):
"""Filter to Accounts where the email or the associated user name matches the query `q`."""
Expand Down Expand Up @@ -115,6 +118,7 @@ class UploadWorkspaceAdapter(WorkspaceAdminSharingAdapterMixin, BaseWorkspaceAda
workspace_data_form_class = forms.UploadWorkspaceForm
workspace_form_class = WorkspaceForm
workspace_detail_template_name = "gregor_anvil/uploadworkspace_detail.html"
workspace_list_template_name = "gregor_anvil/uploadworkspace_list.html"

def get_autocomplete_queryset(self, queryset, q, forwarded={}):
"""Filter to Accounts where the email or the associated user name matches the query `q`."""
Expand All @@ -139,7 +143,7 @@ class PartnerUploadWorkspaceAdapter(WorkspaceAdminSharingAdapterMixin, BaseWorks
name = "Partner upload workspace"
description = "Workspaces that contain data uploaded by a Partner Group "
list_table_class_view = tables.PartnerUploadWorkspaceTable
list_table_class_staff_view = tables.PartnerUploadWorkspaceTable
list_table_class_staff_view = tables.PartnerUploadWorkspaceStaffTable

workspace_data_model = models.PartnerUploadWorkspace
workspace_data_form_class = forms.PartnerUploadWorkspaceForm
Expand All @@ -156,7 +160,7 @@ class ResourceWorkspaceAdapter(WorkspaceAdminSharingAdapterMixin, BaseWorkspaceA
"Workspaces that contain general Consortium resources (e.g., examples of using AnVIL, working with data, etc.)" # noqa: E501
)
list_table_class_view = tables.DefaultWorkspaceTable
list_table_class_staff_view = tables.DefaultWorkspaceTable
list_table_class_staff_view = tables.DefaultWorkspaceStaffTable
workspace_data_model = models.ResourceWorkspace
workspace_data_form_class = forms.ResourceWorkspaceForm
workspace_detail_template_name = "gregor_anvil/resourceworkspace_detail.html"
Expand Down Expand Up @@ -189,6 +193,7 @@ class CombinedConsortiumDataWorkspaceAdapter(WorkspaceAdminSharingAdapterMixin,
workspace_data_form_class = forms.CombinedConsortiumDataWorkspaceForm
workspace_detail_template_name = "gregor_anvil/combinedconsortiumdataworkspace_detail.html"
workspace_form_class = WorkspaceForm
workspace_list_template_name = "gregor_anvil/combinedconsortiumdataworkspace_list.html"


class ReleaseWorkspaceAdapter(WorkspaceAdminSharingAdapterMixin, BaseWorkspaceAdapter):
Expand Down Expand Up @@ -240,8 +245,9 @@ class ExchangeWorkspaceAdapter(WorkspaceAdminSharingAdapterMixin, BaseWorkspaceA
name = "Exchange workspace"
description = "Workspaces for exchanging data with a Research Center outside of an upload cycle"
list_table_class_view = tables.ExchangeWorkspaceTable
list_table_class_staff_view = tables.ExchangeWorkspaceTable
list_table_class_staff_view = tables.ExchangeWorkspaceStaffTable
workspace_data_model = models.ExchangeWorkspace
workspace_data_form_class = forms.ExchangeWorkspaceForm
workspace_form_class = WorkspaceForm
workspace_detail_template_name = "gregor_anvil/exchangeworkspace_detail.html"
workspace_list_template_name = "gregor_anvil/exchangeworkspace_list.html"
Loading
Loading