Changed repo directories, installation boilerplate and models
This commit is contained in:
@ -6,7 +6,7 @@ from wrenn._git import GitCommandError
|
||||
|
||||
GO_VERSION = os.getenv("GO_VERSION", "1.25.8")
|
||||
REPO_URL = "https://git.omukk.dev/wrenn/wrenn.git"
|
||||
REPO_DIR = "/opt/wrenn"
|
||||
REPO_DIR = "~/wrenn"
|
||||
BUILDS_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "builds")
|
||||
|
||||
|
||||
@ -119,10 +119,8 @@ def download_artifacts(capsule: Capsule) -> bool:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with Capsule(wait=True, vcpus=4, memory_mb=4096) as capsule:
|
||||
with Capsule(template="go-1.25.8", wait=True, vcpus=4, memory_mb=4096) as capsule:
|
||||
print(f"Capsule: {capsule.capsule_id}")
|
||||
if not install_go(capsule):
|
||||
sys.exit(1)
|
||||
if not clone_repo(capsule):
|
||||
sys.exit(1)
|
||||
if not build_go(capsule):
|
||||
|
||||
@ -6,11 +6,8 @@ from wrenn._git import GitCommandError
|
||||
|
||||
RUST_VERSION = os.getenv("RUST_VERSION", "1.95.0")
|
||||
REPO_URL = "https://git.omukk.dev/wrenn/wrenn.git"
|
||||
REPO_DIR = "/opt/wrenn"
|
||||
REPO_DIR = "~/wrenn"
|
||||
BUILDS_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "builds")
|
||||
RUST_PATH = (
|
||||
"/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
)
|
||||
|
||||
|
||||
def read_envd_version(capsule: Capsule) -> str:
|
||||
@ -34,40 +31,40 @@ def run(capsule: Capsule, cmd: str, timeout: int = 30, envs={}) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def install_rust(capsule: Capsule) -> bool:
|
||||
if run(capsule, "apt update", timeout=120) != 0:
|
||||
return False
|
||||
if (
|
||||
run(
|
||||
capsule,
|
||||
"apt install -y make build-essential file curl musl-tools protobuf-compiler",
|
||||
timeout=300,
|
||||
)
|
||||
!= 0
|
||||
):
|
||||
return False
|
||||
if (
|
||||
run(
|
||||
capsule,
|
||||
f"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain {RUST_VERSION}",
|
||||
timeout=300,
|
||||
)
|
||||
!= 0
|
||||
):
|
||||
return False
|
||||
if (
|
||||
run(
|
||||
capsule,
|
||||
"/root/.cargo/bin/rustup target add x86_64-unknown-linux-musl",
|
||||
timeout=120,
|
||||
)
|
||||
!= 0
|
||||
):
|
||||
return False
|
||||
# def install_rust(capsule: Capsule) -> bool:
|
||||
# if run(capsule, "apt update", timeout=120) != 0:
|
||||
# return False
|
||||
# if (
|
||||
# run(
|
||||
# capsule,
|
||||
# "apt install -y make build-essential file curl musl-tools protobuf-compiler",
|
||||
# timeout=300,
|
||||
# )
|
||||
# != 0
|
||||
# ):
|
||||
# return False
|
||||
# if (
|
||||
# run(
|
||||
# capsule,
|
||||
# f"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain {RUST_VERSION}",
|
||||
# timeout=300,
|
||||
# )
|
||||
# != 0
|
||||
# ):
|
||||
# return False
|
||||
# if (
|
||||
# run(
|
||||
# capsule,
|
||||
# "/root/.cargo/bin/rustup target add x86_64-unknown-linux-musl",
|
||||
# timeout=120,
|
||||
# )
|
||||
# != 0
|
||||
# ):
|
||||
# return False
|
||||
|
||||
result = capsule.commands.run("/root/.cargo/bin/rustc --version")
|
||||
print(result.stdout.strip())
|
||||
return result.exit_code == 0
|
||||
# result = capsule.commands.run("/root/.cargo/bin/rustc --version")
|
||||
# print(result.stdout.strip())
|
||||
# return result.exit_code == 0
|
||||
|
||||
|
||||
def clone_repo(capsule: Capsule) -> bool:
|
||||
@ -88,7 +85,6 @@ def build_rust(capsule: Capsule) -> bool:
|
||||
"make build-envd",
|
||||
background=True,
|
||||
cwd=REPO_DIR,
|
||||
envs={"PATH": RUST_PATH},
|
||||
)
|
||||
print(f"rust build started (pid={handle.pid}), streaming output...")
|
||||
|
||||
@ -127,10 +123,8 @@ def download_artifacts(capsule: Capsule) -> bool:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with Capsule(wait=True, vcpus=4, memory_mb=4096) as capsule:
|
||||
with Capsule(template="rust-1.95", wait=True, vcpus=4, memory_mb=4096) as capsule:
|
||||
print(f"Capsule: {capsule.capsule_id}")
|
||||
if not install_rust(capsule):
|
||||
sys.exit(1)
|
||||
if not clone_repo(capsule):
|
||||
sys.exit(1)
|
||||
if not build_rust(capsule):
|
||||
|
||||
@ -9,12 +9,7 @@ REPO_DIR = "wrenn-releases"
|
||||
CAPSULE_OUTPUT = "/tmp/release_notes.md"
|
||||
LOCAL_OUTPUT = os.path.join(os.path.dirname(__file__), "..", "release_notes.md")
|
||||
|
||||
# Default starting configuration
|
||||
ZHIPU_API_KEY = os.environ.get("ZHIPU_API_KEY", "")
|
||||
if ZHIPU_API_KEY:
|
||||
DEFAULT_MODEL = "zhipuai-coding-plan/glm-5.1"
|
||||
else:
|
||||
DEFAULT_MODEL = "opencode/minimax-m2.5-free"
|
||||
DEFAULT_MODEL = "opencode/deepseek-v4-flash-free"
|
||||
|
||||
RELEASE_NOTES_EXAMPLE = """
|
||||
## What's new
|
||||
@ -52,57 +47,6 @@ def run(capsule: Capsule, cmd: str, cwd: str | None = None, timeout: int = 30) -
|
||||
return 0
|
||||
|
||||
|
||||
def get_tags(capsule: Capsule) -> tuple[str, str | None]:
|
||||
result = capsule.commands.run(
|
||||
f"cd {REPO_DIR} && git tag --sort=-version:refname",
|
||||
cwd=REPO_DIR,
|
||||
timeout=30,
|
||||
)
|
||||
if result.exit_code != 0:
|
||||
print(f"FAIL [git tag]: {result.stderr}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
tags = [t for t in result.stdout.strip().split("\n") if t]
|
||||
if not tags:
|
||||
print("No tags found", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
current_tag = tags[0]
|
||||
previous_tag = tags[1] if len(tags) > 1 else None
|
||||
print(f"Current tag: {current_tag}")
|
||||
print(f"Previous tag: {previous_tag}")
|
||||
return current_tag, previous_tag
|
||||
|
||||
|
||||
def get_git_context(
|
||||
capsule: Capsule, current_tag: str, previous_tag: str | None
|
||||
) -> tuple[str, str]:
|
||||
if previous_tag:
|
||||
# FIX: Removed '-n 2' to ensure we grab ALL commits between the two tags
|
||||
log_cmd = f"cd {REPO_DIR} && git log {previous_tag}..{current_tag} --pretty=format:'%s (%h)'"
|
||||
else:
|
||||
# Fallback to limit log size if this is the very first tag in the repo
|
||||
log_cmd = (
|
||||
f"cd {REPO_DIR} && git log {current_tag} --pretty=format:'%s (%h)' -n 50"
|
||||
)
|
||||
|
||||
log_result = capsule.commands.run(log_cmd, cwd=REPO_DIR, timeout=30)
|
||||
if log_result.exit_code != 0:
|
||||
print(f"FAIL [git log]: {log_result.stderr}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# git diff natively compares the entire tree state between tags
|
||||
if previous_tag:
|
||||
diff_cmd = f"cd {REPO_DIR} && git diff {previous_tag}..{current_tag} --stat"
|
||||
else:
|
||||
diff_cmd = f"cd {REPO_DIR} && git show {current_tag} --stat"
|
||||
|
||||
diff_result = capsule.commands.run(diff_cmd, cwd=REPO_DIR, timeout=30)
|
||||
if diff_result.exit_code != 0:
|
||||
print(f"FAIL [git diff]: {diff_result.stderr}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
return log_result.stdout.strip(), diff_result.stdout.strip()
|
||||
|
||||
|
||||
def generate_release_notes(
|
||||
capsule: Capsule,
|
||||
output_path: str,
|
||||
@ -236,17 +180,15 @@ def generate_release_notes(
|
||||
|
||||
return cmd_result.exit_code
|
||||
|
||||
# First attempt with the target model
|
||||
exit_status = run_opencode_with_model(model)
|
||||
|
||||
# FIX: Catch failures (like Zhipu rate limits) and fallback to MiniMax
|
||||
if exit_status != 0:
|
||||
if "zhipu" in model.lower():
|
||||
fallback_model = "opencode/big-pickle"
|
||||
if model != fallback_model:
|
||||
print(
|
||||
"\n[!] Zhipu AI failed (likely rate-limited). Falling back to MiniMax...",
|
||||
f"\n[!] Model {model} failed. Falling back to {fallback_model}...",
|
||||
file=sys.stderr,
|
||||
)
|
||||
fallback_model = "opencode/minimax-m2.5-free"
|
||||
exit_status = run_opencode_with_model(fallback_model)
|
||||
if exit_status != 0:
|
||||
print("FAIL: Fallback model also failed. Exiting.", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user