Repository navigation
Deploying from Git uses the branch's latest commit unless you give one - #59
Conversation
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.
liamdevss
left a comment
There was a problem hiding this comment.
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}/deploythat 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,69resolves the ref beforeassertWildcard,assertComposeFromRepoandassertDocker. 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 aRequestException, not aConnectionException, so it escapes the catch and 500s. Unlikely, but cheap to catch.
|
Thanks for the review 🙂 All done in 5315472 and 5e3ad5d:
|
# Conflicts: # app/Http/Controllers/MachineDeployController.php
liamdevss
left a comment
There was a problem hiding this comment.
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.
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