Compare commits
3
Commits
6314b6a6f6
...
3a7f4283c3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a7f4283c3 | ||
|
|
78d7d12b9f | ||
|
|
13b74ba8a7 |
No files matched your search
@@ -16,6 +16,10 @@ http {
|
|||||||
uwsgi_temp_path /run/framebridge-publisher/uwsgi;
|
uwsgi_temp_path /run/framebridge-publisher/uwsgi;
|
||||||
scgi_temp_path /run/framebridge-publisher/scgi;
|
scgi_temp_path /run/framebridge-publisher/scgi;
|
||||||
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
|
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
|
||||||
|
map "$host|$http_x_forwarded_proto" $framebridge_https_redirect {
|
||||||
|
default 0;
|
||||||
|
"framebridge.betancourt.one|http" 1;
|
||||||
|
}
|
||||||
server {
|
server {
|
||||||
listen 127.0.0.1:8088;
|
listen 127.0.0.1:8088;
|
||||||
listen @GERANAS_LAN_IP@:8088;
|
listen @GERANAS_LAN_IP@:8088;
|
||||||
@@ -23,6 +27,7 @@ http {
|
|||||||
allow @CLOUD_LAN_IP@;
|
allow @CLOUD_LAN_IP@;
|
||||||
deny all;
|
deny all;
|
||||||
server_name framebridge.betancourt.one;
|
server_name framebridge.betancourt.one;
|
||||||
|
if ($framebridge_https_redirect) { return 301 https://framebridge.betancourt.one$request_uri; }
|
||||||
root /run/framebridge-publisher/site;
|
root /run/framebridge-publisher/site;
|
||||||
index index.html;
|
index index.html;
|
||||||
autoindex off;
|
autoindex off;
|
||||||
@@ -46,6 +51,7 @@ http {
|
|||||||
proxy_set_header X-Forwarded-Proto https;
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
proxy_read_timeout 120s;
|
proxy_read_timeout 120s;
|
||||||
proxy_request_buffering off;
|
proxy_request_buffering off;
|
||||||
|
proxy_buffering off;
|
||||||
add_header X-Content-Type-Options nosniff always;
|
add_header X-Content-Type-Options nosniff always;
|
||||||
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-5
@@ -50,11 +50,19 @@ def check_bundle(args, source):
|
|||||||
resolved = run(["git", "--git-dir", source, "rev-parse", args.tag + "^{}"]).stdout.decode().strip()
|
resolved = run(["git", "--git-dir", source, "rev-parse", args.tag + "^{}"]).stdout.decode().strip()
|
||||||
require(resolved == args.commit, "Release tag does not point to reviewed commit")
|
require(resolved == args.commit, "Release tag does not point to reviewed commit")
|
||||||
refs = remote_refs()
|
refs = remote_refs()
|
||||||
require(refs.get("refs/heads/main") == args.old_commit, "Canonical main changed; review before publishing")
|
if args.ops_update_from:
|
||||||
require("refs/tags/" + args.tag not in refs, "Release tag already exists; never overwrite")
|
require(args.ops_branch and re.fullmatch(r"[a-f0-9]{40}", args.ops_update_from), "Explicit operations update guard required")
|
||||||
|
require(refs.get("refs/heads/main") == args.commit, "Published release main changed")
|
||||||
|
require(refs.get("refs/tags/" + args.tag + "^{}") == args.commit, "Published signed tag changed")
|
||||||
|
require(refs.get("refs/heads/" + args.ops_branch) == args.ops_update_from, "Operations branch changed")
|
||||||
|
run(["git", "--git-dir", source, "merge-base", "--is-ancestor", args.ops_update_from, "refs/heads/" + args.ops_branch])
|
||||||
|
else:
|
||||||
|
require(refs.get("refs/heads/main") == args.old_commit, "Canonical main changed; review before publishing")
|
||||||
|
require("refs/tags/" + args.tag not in refs, "Release tag already exists; never overwrite")
|
||||||
if args.ops_branch:
|
if args.ops_branch:
|
||||||
require(re.fullmatch(r"ops/[a-z0-9][a-z0-9/-]*", args.ops_branch), "Invalid operations branch")
|
require(re.fullmatch(r"ops/[a-z0-9][a-z0-9/-]*", args.ops_branch), "Invalid operations branch")
|
||||||
require("refs/heads/" + args.ops_branch not in refs, "Operations branch already exists; do not overwrite")
|
if not args.ops_update_from:
|
||||||
|
require("refs/heads/" + args.ops_branch not in refs, "Operations branch already exists; do not overwrite")
|
||||||
run(["git", "--git-dir", source, "merge-base", "--is-ancestor", args.commit, "refs/heads/" + args.ops_branch])
|
run(["git", "--git-dir", source, "merge-base", "--is-ancestor", args.commit, "refs/heads/" + args.ops_branch])
|
||||||
return refs
|
return refs
|
||||||
|
|
||||||
@@ -132,7 +140,8 @@ def publish(args):
|
|||||||
before = check_bundle(args, source)
|
before = check_bundle(args, source)
|
||||||
state = {"schema": 1, "repository": "gerardo/framebridge", "old_commit": args.old_commit,
|
state = {"schema": 1, "repository": "gerardo/framebridge", "old_commit": args.old_commit,
|
||||||
"commit": args.commit, "tag": args.tag, "bundle_sha256": args.bundle_sha256,
|
"commit": args.commit, "tag": args.tag, "bundle_sha256": args.bundle_sha256,
|
||||||
"phase": "CHECKED", "push_performed": False, "token_revoked": False}
|
"phase": "CHECKED", "push_performed": False, "token_revoked": False,
|
||||||
|
"ops_update_from": args.ops_update_from}
|
||||||
if not args.apply:
|
if not args.apply:
|
||||||
print(json.dumps(state, sort_keys=True))
|
print(json.dumps(state, sort_keys=True))
|
||||||
return
|
return
|
||||||
@@ -169,7 +178,7 @@ def publish(args):
|
|||||||
server, stop, thread, client = askpass_server(directory, token)
|
server, stop, thread, client = askpass_server(directory, token)
|
||||||
env = dict(os.environ, GIT_ASKPASS=str(client), GIT_TERMINAL_PROMPT="0", LC_ALL="C")
|
env = dict(os.environ, GIT_ASKPASS=str(client), GIT_TERMINAL_PROMPT="0", LC_ALL="C")
|
||||||
# No force flag. The normal receive-pack checks and Gitea hooks run.
|
# No force flag. The normal receive-pack checks and Gitea hooks run.
|
||||||
refspecs = [args.commit + ":refs/heads/main", "refs/tags/" + args.tag]
|
refspecs = [] if args.ops_update_from else [args.commit + ":refs/heads/main", "refs/tags/" + args.tag]
|
||||||
if args.ops_branch:
|
if args.ops_branch:
|
||||||
refspecs.append("refs/heads/" + args.ops_branch + ":refs/heads/" + args.ops_branch)
|
refspecs.append("refs/heads/" + args.ops_branch + ":refs/heads/" + args.ops_branch)
|
||||||
run(["git", "--git-dir", source, "-c", "credential.helper=", "push", "--atomic",
|
run(["git", "--git-dir", source, "-c", "credential.helper=", "push", "--atomic",
|
||||||
@@ -232,6 +241,7 @@ def main():
|
|||||||
parser.add_argument("--old-commit", required=True)
|
parser.add_argument("--old-commit", required=True)
|
||||||
parser.add_argument("--tag", required=True)
|
parser.add_argument("--tag", required=True)
|
||||||
parser.add_argument("--ops-branch", help="Publish one new operations branch atomically with the release")
|
parser.add_argument("--ops-branch", help="Publish one new operations branch atomically with the release")
|
||||||
|
parser.add_argument("--ops-update-from", help="Fast-forward only operations from this exact old commit; preserve published main and tag")
|
||||||
parser.add_argument("--journal", type=Path)
|
parser.add_argument("--journal", type=Path)
|
||||||
parser.add_argument("--apply", action="store_true")
|
parser.add_argument("--apply", action="store_true")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|||||||
Reference in new issue
Block a user