Skip to content

Deploying from Git uses the branch's latest commit unless you give one - #59

Merged
liamdevss merged 6 commits into
serveroshq:mainfrom
wrrfsub:issue-56
Nov 16, 2026
Merged

liamdevss merged 6 commits into
serveroshq:mainfrom
wrrfsub:issue-56

Conversation

@wrrfsub

@wrrfsub wrrfsub commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

The deploy dialog's commit field takes a branch, a tag or a commit, and left empty it deploys the default branch's latest commit, resolved to an exact commit the way the MCP deploy tools already do. Refs on Git hosts other than GitHub resolve again too: Guzzle 8 turned down CURLOPT_MAXFILESIZE, so the 8 MB cap on the ref list is checked as it downloads instead.

Fixes #56

The deploy dialog's commit field takes a branch, a tag or a commit, and
left empty it's the default branch's latest commit, resolved to an exact
commit the way the MCP deploy tools already do. Refs on Git hosts other
than GitHub resolve again too: Guzzle 8 turned down CURLOPT_MAXFILESIZE,
so the 8 MB cap is checked as the ref list downloads instead.
@wrrfsub
wrrfsub requested a review from a team as a code owner November 13, 2026 11:13

@liamdevss liamdevss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a really good change. Not having to paste a SHA is a big deal, and swapping out the CURLOPT_MAXFILESIZE cap also fixes branch and tag lookups for non-GitHub hosts, which currently throw on main (MCP included). I checked that the job still always carries an exact 40-char commit, so rollback, redeploy and what-was-checked-is-what's-deployed all still hold, and that private repos still get the installation token.

One thing before it goes in:

  • A test for the new behaviour. The test changes only adjust failure cases. Please add one through /machines/{id}/deploy that fakes GitHub and checks an empty commit (and a branch name) resolves to the exact commit, for both the git path and a template. One for the download cap would be nice too.

Smaller things, fine as follow-ups:

  • MachineDeployController.php:41,69 resolves the ref before assertWildcard, assertComposeFromRepo and assertDocker. A deploy that's going to be refused anyway still makes up to two GitHub calls first, and a rate-limit error from GitHub can hide the real reason. Worth moving the resolve after the cheap checks.
  • The template deploy response doesn't say which commit was picked (MCP returns it). Handy to show.
  • RefResolver.php:180-197: if the size cap trips on a 4xx/5xx over 8 MB, that's a RequestException, not a ConnectionException, so it escapes the catch and 500s. Unlikely, but cheap to catch.

@wrrfsub

wrrfsub commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the review 🙂 All done in 5315472 and 5e3ad5d:

  • Added tests through /deploy that fake GitHub and check an empty commit and a branch name resolve to the exact commit, for both the git path and a template, plus one for the 8 MB cap (200 and 404).
  • The ref is now resolved after the wildcard, compose and Docker checks, so a refused deploy doesn't call GitHub.
  • Both deploy responses now include the commit that was picked, and the dialog shows it ("Deploying shop at 68c1b9f").
  • An error status cut off by the cap now gives the size message instead of a 500.

@wrrfsub
wrrfsub requested a review from liamdevss November 15, 2026 00:45

@liamdevss liamdevss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, this covers everything: the tests through /deploy, resolving after the cheap checks, the commit in both responses, and the RequestException catch. Main moved under you (#94 added a reverse proxy choice), so I merged it in and fixed the conflict in MachineDeployController.php: both paths keep #94's DeployRequest::proxy(...) check and withProxy(...) wrapping, with the proxy check before resolveCommit so a refused deploy still doesn't call GitHub. Full suite passes on the merge. Merging once CI is green.

@liamdevss
liamdevss merged commit bbeee78 into serveroshq:main Nov 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default to the latest commit when deploying from Git

2 participants