1
1
mirror of https://github.com/MarginaliaSearch/MarginaliaSearch.git synced 2025-10-06 07:32:38 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Viktor Lofgren
b66879ccb1 (feed) Add support for date discovery through atom:issued and atom:created
This is specifically to help parse monadnock.net's Atom feed.
2024-12-23 20:05:58 +01:00
Viktor Lofgren
f1b7157ca2 (deploy) Add basic linting ability to deployment script. 2024-12-23 16:21:29 +01:00
2 changed files with 34 additions and 5 deletions

View File

@@ -73,6 +73,17 @@ public class FeedFetcherService {
this.nodeConfigurationService = nodeConfigurationService;
this.serviceHeartbeat = serviceHeartbeat;
this.executorClient = executorClient;
// Add support for some alternate date tags for atom
rssReader.addItemExtension("issued", this::setDateFallback);
rssReader.addItemExtension("created", this::setDateFallback);
}
private void setDateFallback(Item item, String value) {
if (item.getPubDate().isEmpty()) {
item.setPubDate(value);
}
}
public enum UpdateMode {
@@ -366,7 +377,7 @@ public class FeedFetcherService {
return seenFragments.size() > 1;
}
private static class IsFeedItemDateValid implements Predicate<FeedItem> {
static class IsFeedItemDateValid implements Predicate<FeedItem> {
private final String today = ZonedDateTime.now().format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
public boolean test(FeedItem item) {

View File

@@ -1,6 +1,7 @@
from dataclasses import dataclass
import subprocess, os
from typing import List, Set, Dict, Optional
import argparse
build_dir = "/app/search.marginalia.nu/build"
docker_dir = "/app/search.marginalia.nu/docker"
@@ -82,9 +83,17 @@ def parse_deployment_tags(
if part == 'all':
services_to_build.update(available_services)
elif part.startswith('-'):
services_to_exclude.add(part[1:])
service = part[1:]
if not service in available_services:
raise ValueError(f"Unknown service {service}")
services_to_exclude.add(service)
elif part.startswith('+'):
services_to_build.add(part[1:])
service = part[1:]
if not service in available_services:
raise ValueError(f"Unknown service {service}")
services_to_build.add(service)
elif tag.startswith('hold:'):
instances = tag[5:].strip().split(',')
@@ -257,17 +266,26 @@ if __name__ == '__main__':
try:
tags = get_deployment_tag()
parser = argparse.ArgumentParser(
prog='deployment.py',
description='Continuous Deployment helper')
parser.add_argument('-v', '--verify', help='Verify the tags are valid, if present', action='store_true')
args = parser.parse_args()
if tags != None:
print("Found deployment tags:", tags)
plan = parse_deployment_tags(tags, SERVICE_CONFIG)
print("\nDeployment Plan:")
print("Services to build:", plan.services_to_build)
print("Instances to hold:", plan.instances_to_hold)
print("\nExecution Plan:")
if not args.verify:
print("\nExecution Plan:")
build_and_deploy(plan, SERVICE_CONFIG)
build_and_deploy(plan, SERVICE_CONFIG)
else:
print("No tags found")