Allow building snap from current default branch of repository

Bug #1688224 reported by Colin Watson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Colin Watson
launchpad-buildd
Fix Released
High
Colin Watson

Bug Description

Launchpad allows building a snap from any branch in a Git repository, if named explicitly. However, it would be useful to be able to have a way to represent the notion of building from whatever the current default branch is: for instance, I think this would be a clean way to fix https://github.com/canonical-ols/build.snapcraft.io/issues/497.

We generally prefer to pass IGitRef-providing objects around internally rather than explicit repository/path combinations (see e.g. GitRefRemote), and I don't want to unwind that. However, the repository scanner doesn't and probably shouldn't create GitRef rows for HEAD, instead just setting GitRepository.default_branch.

I think the most elegant way to handle this would be as follows:

 * Allow launchpad-buildd to accept a snap build without git_path, turning that into a simple 'git clone' rather than 'git clone -b <git_path>'.
 * Extend GitRepository.getRefByPath so that if path is HEAD then it returns a new flavour of IGitRef which refers to whatever the current default branch is.
 * Adjust SnapBuildBehaviour to omit git_path if one of these "use the default branch" GitRef objects is passed.

Related branches

Colin Watson (cjwatson)
Changed in launchpad-buildd:
status: New → In Progress
importance: Undecided → High
Changed in launchpad:
assignee: nobody → Colin Watson (cjwatson)
Changed in launchpad-buildd:
assignee: nobody → Colin Watson (cjwatson)
Colin Watson (cjwatson)
Changed in launchpad-buildd:
status: In Progress → Fix Committed
Revision history for this message
Colin Watson (cjwatson) wrote :

Fixed in launchpad-buildd 143 (but there's still a branch to land on the Launchpad side).

Changed in launchpad-buildd:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
Colin Watson (cjwatson)
tags: added: qa-ok
removed: qa-needstesting
Colin Watson (cjwatson)
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.