fix: make branches available as recipe source #453
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "branch-recipes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Oh this is really cool @stevensting! Thanks for working on this!
A few minor comments below.
I'd be quite nervous to merge this without a test. Got any ideas? If it's really too awkward, lemme know how you manually tested it and I can also try.
@ -95,6 +95,7 @@ func (r Recipe) GetVersionLabelLocal() (string, error) {
for _, service := range config.Services {
for label, value := range service.Deploy.Labels {
log.Debugf("checking deploy label '%s'", label)
Could we make this message more specific, e.g. what are we checking for?
Also, you don't log the
value
, is that by choice?@ -68,6 +68,7 @@ func (r Recipe) EnsureExists() error {
// EnsureVersion checks whether a specific version exists for a recipe.
func (r Recipe) EnsureVersion(version string) (bool, error) {
isChaosCommit := false
log.Debugf("Ensuring version '%s'", version)
%s/Ensuring/ensuring
(lowercase convention everywhere else in the codebase).Also, can you make this more specific, e.g. using the
r.Name
there too?@stevensting FYI there is some prior art in unit testing this stuff below, thanks to @ammaratef45 🎉 Let me know if you have spoons / cycles to finish this up in the next days, we can try to coordinate to get this change into the new release? Thanks!
74108b0dd9/pkg/git/init_test.go (L11-L35)
(Copying over from chats FYI)
decentral1se referenced this pull request from toolshed/organising2025-01-03 19:31:43 +00:00
Make branches available as recipe sourceto fix: make branches available as recipe sourceAnother terrifying reference: https://github.com/go-git/go-git/issues/363#issuecomment-943534705 Even Git itself has no idea how to figure this out 😱
There's an implementation of "if transport supports directly peeking where HEAD points to, use that" here which I also tested but
refs["HEADS"].Target()
returnsnil
and it explodes for the Collabora recipe (usesmain
).We're definitely not doing "if the git_default_branch_name (from the git configuration: key init.defaultbranch) exists at remote, use it" either.
We could try to implement all that?
@stevensting maybe you can explain what others branches you're using that are not
master
/main
and how you've configured your Git setup? Then we can know how to "guess" this correctly in our implementation.🤔🤔🤔
Due to this being a hornest nest, we're gonna abandon it (just chatted on Matrix). I'm gonna try fix #464 which I hope is unrelated. If that works out, then I guess we will have to say "this is an upstream limitation and please use main for branches". Updates coming soon hopefully.
The goal of this PR was to make
RECIPE=backupbot-two:mycoolbranch
work. This should be possible right?#468
Pull request closed