weblink github fetching snapcraft.yaml fails if branch 'HEAD' exists

Bug #1920026 reported by A333
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

I was trying to automatically build and publish the freeorion snap (using a weblink to repositoy agrrr3/freeorion).

That worked a while and suddenly failed, using an old snapcraft.yaml file. I opened a ticket against snapcraft.io
https://github.com/canonical-web-and-design/snapcraft.io/issues/3443

And they figured out that launchpad tries to fetch the snapcraft.yaml from
https://raw.githubusercontent.com/agrrr3/freeorion/HEAD/snap/snapcraft.yaml

But that did not return the contents from the default branch
https://raw.githubusercontent.com/agrrr3/freeorion/master/snap/snapcraft.yaml

On snapcraft.io people were guessing that maybe launchpad should use the API or retrieve the correct revision in a different way.
They told me to open this ticket against launchpad.

I opened a support ticket against github and they told me that I have a branch named 'HEAD' and that was the reason I got the contents from that branch instead of the default branch.

TLDR;
By mistake I had created a branch named HEAD (push origin master:HEAD) and that broke the automatic snapcraft build. Deleting that branch (push origin :HEAD) solved that for me. But this may bite other people as well - the behavior is pretty opaque/surprising.

Revision history for this message
Colin Watson (cjwatson) wrote :

Ah! Mystery solved, thanks. As far as I can see the effect is the same as my original guess though: we'll have to use the API (https://docs.github.com/en/rest/reference/repos#contents or similar) so that it can tell us what the default branch is, rather than relying on the behaviour where raw.githubusercontent.com returns the blob from the default branch if no branch called HEAD exists.

tags: added: git lp-code lp-snappy
Changed in launchpad:
status: New → Triaged
importance: Undecided → Low
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.