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
5 changes: 5 additions & 0 deletions cgit_repos/cgitrepos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enable-index-owner=0

repo.url=Singularity
repo.path=/var/git/singularity
repo.desc=Repository containing all KDLP content and infrastructure.
1 change: 1 addition & 0 deletions container-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ services:
additional_contexts:
- orbit_singularity_git_dir=./.git
- orbit_docs_source=./kdlp.underground.software
- orbit_repos_source=./cgit_repos
target: orbit
args:
orbit_version_info: "singularity ${SINGULARITY_VERSION} ${SINGULARITY_DEPLOYMENT_STATUS} https://github.com/underground-software/singularity"
Expand Down
4 changes: 4 additions & 0 deletions kdlp.underground.software/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,7 @@ li {
#cgit ul.pager li::marker {
content: none;
}

#cgit .content > a {
display: none;
}
3 changes: 3 additions & 0 deletions orbit/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ RUN test -n "$orbit_version_info" || (echo 'version info is not set' && false) &
RUN mkdir \
/var/git \
/orbit/docs \
/etc/cgit \
;

COPY --from=orbit_singularity_git_dir . /var/git/singularity
COPY --from=orbit_docs_source . /orbit/docs
COPY --from=orbit_repos_source . /etc/cgit

FROM alpine:3.19 AS orbit

Expand All @@ -48,6 +50,7 @@ COPY --from=build /orbit /orbit
COPY --from=build /radius-venv /radius-venv
COPY --from=build /var/orbit /var/orbit
COPY --from=build /var/git /var/git
COPY --from=build /etc/cgit /etc/cgit

COPY cgitrc /etc/cgitrc

Expand Down
4 changes: 2 additions & 2 deletions orbit/cgitrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
css=/style.css

# Allow http transport git clone
enable-http-clone=1
enable-http-clone=0

# Enable caching of up to 1000 output entries
cache-size=0
Expand Down Expand Up @@ -36,4 +36,4 @@ mimetype.svg=image/svg+xml

virtual-root=/cgit

scan-path=/var/git
include=/etc/cgit/cgitrepos
18 changes: 15 additions & 3 deletions orbit/radius.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import re
import subprocess
import sys
from http import HTTPStatus, cookies
from datetime import datetime, timedelta
from urllib.parse import parse_qs, urlparse
Expand Down Expand Up @@ -476,14 +477,25 @@ def handle_cgit(rocket):
cgit_env = os.environ.copy()
cgit_env['PATH_INFO'] = rocket.path_info.removeprefix('/cgit')
cgit_env['QUERY_STRING'] = rocket.env.get('QUERY_STRING', '')

path_array = cgit_env['PATH_INFO'].split('/')
if len(path_array) > 2 and path_array[2] == 'plain':
return rocket.raw_respond(HTTPStatus.NOT_FOUND)

proc = subprocess.Popen(['/usr/share/webapps/cgit/cgit'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=cgit_env)
so, se = proc.communicate()
outstring = str(so, 'UTF-8')
begin = outstring.index('\n\n')
return rocket.respond(outstring[begin+2:])
try:
outstring = str(so, 'UTF-8')
begin = outstring.index('\n\n')
return rocket.respond(outstring[begin+2:])
except (UnicodeDecodeError, ValueError) as ex:
print(f'cgit: Error {type(ex)} at path_info "{cgit_env["PATH_INFO"]}"'
f' and query string "{cgit_env["QUERY_STRING"]}"',
file=sys.stderr)
return rocket.raw_respond(HTTPStatus.INTERNAL_SERVER_ERROR)


def handle_md(rocket, md_path):
Expand Down