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
2 changes: 1 addition & 1 deletion src/cmlxc/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def setup_repo(self, dest, out, source):
name = dest.rsplit("/", 1)[-1]
self.bash(f"rm -rf {dest}")
out.print(f" Initial clone of {name} ...")
self.bash(f"git clone {source.url} {dest}")
self.bash(f"git clone --branch {source.ref} {source.url} {dest}")
Copy link
Copy Markdown

@link2xt link2xt May 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the line I pushed. Not great that --branch does not work with hashes, for hashes need to use --revision= but then it does not work for tags. --branch at least works for tags and branch names.


def get_repo_status(self, repo_path):
"""Return a one-line string describing the git repo at repo_path."""
Expand Down
7 changes: 4 additions & 3 deletions src/cmlxc/driver_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class Driver:
DEFAULT_SOURCE_URL: str
REPO_NAME: str
REQUIRED_SOURCE_PATHS: list[str] = []
DEFAULT_REF: str = "main"
type: str = "dns"

def __init__(self, ct, out):
Expand Down Expand Up @@ -143,9 +144,9 @@ def add_cli_options(cls, parser, completer=None):
"""Register ``deploy-*`` CLI options on *parser*."""
parser.add_argument(
"--source",
default="@main",
default=f"@{cls.DEFAULT_REF}",
metavar="SOURCE",
help="Driver source: @ref, /path, ./path, or URL@ref (default: @main).",
help=f"Driver source: @ref, /path, ./path, or URL@ref (default: @{cls.DEFAULT_REF}).",
)
action = parser.add_argument(
"name",
Expand Down Expand Up @@ -220,7 +221,7 @@ def prep_builder(cls, ix, out, bld_ct):

tmp_dest = f"/root/{cls.REPO_NAME}-git-main"
if bld_ct.bash(f"test -d {tmp_dest}", check=False) is None:
source = parse_source("@main", cls.DEFAULT_SOURCE_URL)
source = parse_source(f"@{cls.DEFAULT_REF}", cls.DEFAULT_SOURCE_URL)
bld_ct.setup_repo(tmp_dest, out, source)
else:
out.print(f" Fetching {cls.REPO_NAME}-git-main from upstream ...")
Expand Down
1 change: 1 addition & 0 deletions src/cmlxc/driver_madmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class MadmailDriver(Driver):
DEFAULT_SOURCE_URL = "https://github.com/themadorg/madmail.git"
REPO_NAME = MADMAIL
REQUIRED_SOURCE_PATHS = ["go.mod", "Makefile"]
DEFAULT_REF = "v0.47.1"
type = "ipv4"

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/fullrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_cm_ipv4_test():


def test_mad_deploy():
cmlxc("deploy-madmail", "--source", "@main", CT_MAD)
cmlxc("deploy-madmail", CT_MAD)


def test_mad_deploy_type():
Expand Down