Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 63 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
default: true
required: true
type: boolean
legacySandbox:
description: 'Deploy to Legacy Sandbox'
default: false
required: false
type: boolean
skiptests:
description: 'Skip Tests'
default: false
Expand Down Expand Up @@ -258,7 +263,7 @@ jobs:
# -----------------------------------------------------------------
release:
name: Make Release
if: ${{ success() }}
if: ${{ !failure() && !cancelled() }}
needs: [tests-python, tests-playwright, tests-playwright-legacy, prepare]
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -442,7 +447,7 @@ jobs:
# -----------------------------------------------------------------
sandbox:
name: Deploy to Sandbox
if: ${{ success() && github.event.inputs.sandbox == 'true' }}
if: ${{ !failure() && !cancelled() && github.event.inputs.sandbox == 'true' }}
needs: [prepare, release]
runs-on: [self-hosted, dev-server]
env:
Expand Down Expand Up @@ -474,3 +479,59 @@ jobs:
DEBIAN_FRONTEND: noninteractive
run: |
docker image prune -a -f

legacySandbox:
name: Deploy to Legacy Sandbox
if: ${{ !failure() && !cancelled() && github.event.inputs.legacySandbox == 'true' }}
needs: [prepare, release]
runs-on: [self-hosted, legacy-sandbox-server]
env:
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}}

steps:
- name: Download a Release Artifact
uses: actions/download-artifact@v3.0.2
with:
name: release-${{ env.PKG_VERSION }}
path: /a/www/ietf-datatracker/main.dev.${{ github.run_number }}

- name: Extract Release
env:
DEBIAN_FRONTEND: noninteractive
working-directory: /a/www/ietf-datatracker/main.dev.${{ github.run_number }}
run: |
echo "Extracting release tarball..."
tar xzf release.tar.gz
echo "Deleting release tarball..."
rm -rf release.tar.gz

- name: Setup Environment
env:
DEBIAN_FRONTEND: noninteractive
working-directory: /a/www/ietf-datatracker/main.dev.${{ github.run_number }}
run: |
echo "Copying settings from previous deploy..."
cp ../web/ietf/settings_local.py ietf/
rsync -a ../web/test/ test/
echo "Installing Python dependencies..."
python3.9 -mvenv env
source env/bin/activate
pip install -r requirements.txt
pip freeze > frozen-requirements.txt
echo "Collecting static..."
ietf/manage.py collectstatic
echo "Running checks..."
ietf/manage.py check

- name: Update Docker Containers
env:
DEBIAN_FRONTEND: noninteractive
working-directory: /a/docker/datatracker
run: |
echo "Pulling latest docker images..."
docker image tag ghcr.io/ietf-tools/datatracker-celery:latest datatracker-celery-fallback
docker image tag ghcr.io/ietf-tools/datatracker-mq:latest datatracker-mq-fallback
docker-compose pull
# echo "Shutting down containers..."
# docker-compose down -t 300

5 changes: 4 additions & 1 deletion ietf/doc/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,9 @@ def setUp(self):
f.write(self.draft_text)

def test_document_draft(self):
draft = WgDraftFactory(name='draft-ietf-mars-test',rev='01')
draft = WgDraftFactory(name='draft-ietf-mars-test',rev='01', create_revisions=range(0,2))


HolderIprDisclosureFactory(docs=[draft])

# Docs for testing relationships. Does not test 'possibly-replaces'. The 'replaced_by' direction
Expand Down Expand Up @@ -785,6 +787,7 @@ def test_document_draft(self):
self.assertEqual(len(q('#sidebar option[value="draft-ietf-mars-test-00"][selected="selected"]')), 1)

rfc = WgRfcFactory()
rfc.save_with_history([DocEventFactory(doc=rfc)])
(Path(settings.RFC_PATH) / rfc.get_base_name()).touch()
r = self.client.get(urlreverse("ietf.doc.views_doc.document_html", kwargs=dict(name=rfc.canonical_name())))
self.assertEqual(r.status_code, 200)
Expand Down
34 changes: 23 additions & 11 deletions ietf/doc/views_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def document_main(request, name, rev=None, document_html=False):
is_author = request.user.is_authenticated and doc.documentauthor_set.filter(person__user=request.user).exists()
can_view_possibly_replaces = can_edit_replaces or is_author

rfc_number = name[3:] if name.startswith("") else None
rfc_number = name[3:] if name.startswith("rfc") else None
draft_name = None
for a in aliases:
if a.startswith("draft"):
Expand Down Expand Up @@ -487,13 +487,25 @@ def document_main(request, name, rev=None, document_html=False):
html = None
js = None
css = None
diff_revisions = None
simple_diff_revisions = None
if document_html:
html = doc.html_body()
if request.COOKIES.get("pagedeps") == "inline":
js = Path(finders.find("ietf/js/document_html.js")).read_text()
css = Path(finders.find("ietf/css/document_html_inline.css")).read_text()
if html:
css += Path(finders.find("ietf/css/document_html_txt.css")).read_text()
diff_revisions=get_diff_revisions(request, name, doc if isinstance(doc,Document) else doc.doc)
simple_diff_revisions = [t[1] for t in diff_revisions]
simple_diff_revisions.reverse()
if not doc.is_rfc() and rev != doc.rev:
# No DocHistory was found matching rev - snapshot will be false
# and doc will be a Document object, not a DocHistory
snapshot = True
doc = doc.fake_history_obj(rev)
else:
html = doc.html_body()
if request.COOKIES.get("pagedeps") == "inline":
js = Path(finders.find("ietf/js/document_html.js")).read_text()
css = Path(finders.find("ietf/css/document_html_inline.css")).read_text()
if html:
css += Path(finders.find("ietf/css/document_html_txt.css")).read_text()

return render(request, "doc/document_draft.html" if document_html is False else "doc/document_html.html",
dict(doc=doc,
document_html=document_html,
Expand All @@ -505,7 +517,7 @@ def document_main(request, name, rev=None, document_html=False):
name=name,
content=content,
split_content=split_content,
revisions=revisions,
revisions=simple_diff_revisions if document_html else revisions,
snapshot=snapshot,
stream_desc=stream_desc,
latest_revision=latest_revision,
Expand Down Expand Up @@ -544,7 +556,7 @@ def document_main(request, name, rev=None, document_html=False):
status_changes=status_changes,
proposed_status_changes=proposed_status_changes,
rfc_aliases=rfc_aliases,
has_errata=doc.tags.filter(slug="errata"),
has_errata=doc.pk and doc.tags.filter(slug="errata"), # doc.pk == None if using a fake_history_obj
published=published,
file_urls=file_urls,
additional_urls=additional_urls,
Expand All @@ -569,7 +581,7 @@ def document_main(request, name, rev=None, document_html=False):
review_assignments=review_assignments,
no_review_from_teams=no_review_from_teams,
due_date=due_date,
diff_revisions=get_diff_revisions(request, name, doc if isinstance(doc,Document) else doc.doc) if document_html else None
diff_revisions=diff_revisions
))

if doc.type_id == "charter":
Expand Down Expand Up @@ -859,7 +871,7 @@ def document_html(request, name, rev=None):
if not os.path.exists(doc.get_file_name()):
raise Http404("File not found: %s" % doc.get_file_name())

return document_main(request, name=doc.name, rev=doc.rev if not doc.is_rfc() else None, document_html=True)
return document_main(request, name=doc.canonical_name(), rev=doc.rev if not doc.is_rfc() else None, document_html=True)

def document_pdfized(request, name, rev=None, ext=None):

Expand Down
3 changes: 1 addition & 2 deletions ietf/meeting/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,7 @@ def test_meeting_agenda(self):
# iCal, no session filtering
ical_url = urlreverse("ietf.meeting.views.agenda_ical", kwargs=dict(num=meeting.number))
r = self.client.get(ical_url)
with open('./ical-output.ics', 'w') as f:
f.write(r.content.decode())

assert_ical_response_is_valid(self, r)
self.assertContains(r, "BEGIN:VTIMEZONE")
self.assertContains(r, "END:VTIMEZONE")
Expand Down
2 changes: 1 addition & 1 deletion ietf/secr/sreq/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def test_submit_request(self):
list(session.constraints().get(name='timerange').timeranges.all().values('name')),
list(TimerangeName.objects.filter(name__in=['thursday-afternoon-early', 'thursday-afternoon-late']).values('name'))
)
self.assertEqual(list(session.joint_with_groups.all()), [group3, group4])
self.assertEqual(set(list(session.joint_with_groups.all())), set([group3, group4]))

def test_submit_request_invalid(self):
MeetingFactory(type_id='ietf', date=date_today())
Expand Down